@@ -12,7 +12,6 @@ import (
1212 "net/http"
1313 "net/url"
1414 "slices"
15- "time"
1615
1716 "github.com/cloudflare/cloudflare-go/v6/internal/apiform"
1817 "github.com/cloudflare/cloudflare-go/v6/internal/apijson"
@@ -21,6 +20,7 @@ import (
2120 "github.com/cloudflare/cloudflare-go/v6/internal/requestconfig"
2221 "github.com/cloudflare/cloudflare-go/v6/option"
2322 "github.com/cloudflare/cloudflare-go/v6/packages/pagination"
23+ "github.com/cloudflare/cloudflare-go/v6/schema_validation"
2424)
2525
2626// UserSchemaService contains methods and other services that help with interacting
@@ -72,7 +72,7 @@ func (r *UserSchemaService) New(ctx context.Context, params UserSchemaNewParams,
7272// Deprecated: Use
7373// [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/)
7474// instead.
75- func (r * UserSchemaService ) List (ctx context.Context , params UserSchemaListParams , opts ... option.RequestOption ) (res * pagination.V4PagePaginationArray [PublicSchema ], err error ) {
75+ func (r * UserSchemaService ) List (ctx context.Context , params UserSchemaListParams , opts ... option.RequestOption ) (res * pagination.V4PagePaginationArray [schema_validation. PublicSchema ], err error ) {
7676 var raw * http.Response
7777 opts = slices .Concat (r .Options , opts )
7878 opts = append ([]option.RequestOption {option .WithResponseInto (& raw )}, opts ... )
@@ -98,7 +98,7 @@ func (r *UserSchemaService) List(ctx context.Context, params UserSchemaListParam
9898// Deprecated: Use
9999// [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/)
100100// instead.
101- func (r * UserSchemaService ) ListAutoPaging (ctx context.Context , params UserSchemaListParams , opts ... option.RequestOption ) * pagination.V4PagePaginationArrayAutoPager [PublicSchema ] {
101+ func (r * UserSchemaService ) ListAutoPaging (ctx context.Context , params UserSchemaListParams , opts ... option.RequestOption ) * pagination.V4PagePaginationArrayAutoPager [schema_validation. PublicSchema ] {
102102 return pagination .NewV4PagePaginationArrayAutoPager (r .List (ctx , params , opts ... ))
103103}
104104
@@ -127,7 +127,7 @@ func (r *UserSchemaService) Delete(ctx context.Context, schemaID string, body Us
127127// Deprecated: Use
128128// [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/)
129129// instead.
130- func (r * UserSchemaService ) Edit (ctx context.Context , schemaID string , params UserSchemaEditParams , opts ... option.RequestOption ) (res * PublicSchema , err error ) {
130+ func (r * UserSchemaService ) Edit (ctx context.Context , schemaID string , params UserSchemaEditParams , opts ... option.RequestOption ) (res * schema_validation. PublicSchema , err error ) {
131131 var env UserSchemaEditResponseEnvelope
132132 opts = slices .Concat (r .Options , opts )
133133 if params .ZoneID .Value == "" {
@@ -152,7 +152,7 @@ func (r *UserSchemaService) Edit(ctx context.Context, schemaID string, params Us
152152// Deprecated: Use
153153// [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/)
154154// instead.
155- func (r * UserSchemaService ) Get (ctx context.Context , schemaID string , params UserSchemaGetParams , opts ... option.RequestOption ) (res * PublicSchema , err error ) {
155+ func (r * UserSchemaService ) Get (ctx context.Context , schemaID string , params UserSchemaGetParams , opts ... option.RequestOption ) (res * schema_validation. PublicSchema , err error ) {
156156 var env UserSchemaGetResponseEnvelope
157157 opts = slices .Concat (r .Options , opts )
158158 if params .ZoneID .Value == "" {
@@ -221,60 +221,10 @@ func (r messageItemSourceJSON) RawJSON() string {
221221 return r .raw
222222}
223223
224- type PublicSchema struct {
225- CreatedAt time.Time `json:"created_at,required" format:"date-time"`
226- // Kind of schema
227- Kind PublicSchemaKind `json:"kind,required"`
228- // Name of the schema
229- Name string `json:"name,required"`
230- // UUID.
231- SchemaID string `json:"schema_id,required"`
232- // Source of the schema
233- Source string `json:"source"`
234- // Flag whether schema is enabled for validation.
235- ValidationEnabled bool `json:"validation_enabled"`
236- JSON publicSchemaJSON `json:"-"`
237- }
238-
239- // publicSchemaJSON contains the JSON metadata for the struct [PublicSchema]
240- type publicSchemaJSON struct {
241- CreatedAt apijson.Field
242- Kind apijson.Field
243- Name apijson.Field
244- SchemaID apijson.Field
245- Source apijson.Field
246- ValidationEnabled apijson.Field
247- raw string
248- ExtraFields map [string ]apijson.Field
249- }
250-
251- func (r * PublicSchema ) UnmarshalJSON (data []byte ) (err error ) {
252- return apijson .UnmarshalRoot (data , r )
253- }
254-
255- func (r publicSchemaJSON ) RawJSON () string {
256- return r .raw
257- }
258-
259- // Kind of schema
260- type PublicSchemaKind string
261-
262- const (
263- PublicSchemaKindOpenAPIV3 PublicSchemaKind = "openapi_v3"
264- )
265-
266- func (r PublicSchemaKind ) IsKnown () bool {
267- switch r {
268- case PublicSchemaKindOpenAPIV3 :
269- return true
270- }
271- return false
272- }
273-
274224type SchemaUpload struct {
275- Schema PublicSchema `json:"schema,required"`
276- UploadDetails SchemaUploadUploadDetails `json:"upload_details"`
277- JSON schemaUploadJSON `json:"-"`
225+ Schema schema_validation. PublicSchema `json:"schema,required"`
226+ UploadDetails SchemaUploadUploadDetails `json:"upload_details"`
227+ JSON schemaUploadJSON `json:"-"`
278228}
279229
280230// schemaUploadJSON contains the JSON metadata for the struct [SchemaUpload]
@@ -542,9 +492,9 @@ func (r UserSchemaEditParamsValidationEnabled) IsKnown() bool {
542492}
543493
544494type UserSchemaEditResponseEnvelope struct {
545- Errors Message `json:"errors,required"`
546- Messages Message `json:"messages,required"`
547- Result PublicSchema `json:"result,required"`
495+ Errors Message `json:"errors,required"`
496+ Messages Message `json:"messages,required"`
497+ Result schema_validation. PublicSchema `json:"result,required"`
548498 // Whether the API call was successful.
549499 Success UserSchemaEditResponseEnvelopeSuccess `json:"success,required"`
550500 JSON userSchemaEditResponseEnvelopeJSON `json:"-"`
@@ -600,9 +550,9 @@ func (r UserSchemaGetParams) URLQuery() (v url.Values) {
600550}
601551
602552type UserSchemaGetResponseEnvelope struct {
603- Errors Message `json:"errors,required"`
604- Messages Message `json:"messages,required"`
605- Result PublicSchema `json:"result,required"`
553+ Errors Message `json:"errors,required"`
554+ Messages Message `json:"messages,required"`
555+ Result schema_validation. PublicSchema `json:"result,required"`
606556 // Whether the API call was successful.
607557 Success UserSchemaGetResponseEnvelopeSuccess `json:"success,required"`
608558 JSON userSchemaGetResponseEnvelopeJSON `json:"-"`
0 commit comments