Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#1791)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Apr 24, 2024
1 parent 6815cb2 commit 169d844
Show file tree
Hide file tree
Showing 17 changed files with 108 additions and 135 deletions.
3 changes: 1 addition & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4102,12 +4102,11 @@ Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream">stream</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#Caption">Caption</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream">stream</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionUpdateResponseUnion">CaptionUpdateResponseUnion</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream">stream</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionDeleteResponseUnion">CaptionDeleteResponseUnion</a>

Methods:

- <code title="put /accounts/{account_id}/stream/{identifier}/captions/{language}">client.Stream.Captions.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionService.Update">Update</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, identifier <a href="https://pkg.go.dev/builtin#string">string</a>, language <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream">stream</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionUpdateParams">CaptionUpdateParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream">stream</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionUpdateResponseUnion">CaptionUpdateResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="delete /accounts/{account_id}/stream/{identifier}/captions/{language}">client.Stream.Captions.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, identifier <a href="https://pkg.go.dev/builtin#string">string</a>, language <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream">stream</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionDeleteParams">CaptionDeleteParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream">stream</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionDeleteResponseUnion">CaptionDeleteResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="delete /accounts/{account_id}/stream/{identifier}/captions/{language}">client.Stream.Captions.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, identifier <a href="https://pkg.go.dev/builtin#string">string</a>, language <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream">stream</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionDeleteParams">CaptionDeleteParams</a>) (<a href="https://pkg.go.dev/builtin#string">string</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_id}/stream/{identifier}/captions">client.Stream.Captions.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, identifier <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream">stream</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionGetParams">CaptionGetParams</a>) ([]<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream">stream</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#Caption">Caption</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

## Downloads
Expand Down
16 changes: 8 additions & 8 deletions calls/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ func (r CallNewParams) MarshalJSON() (data []byte, err error) {
type CallNewResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result CallsAppWithSecret `json:"result,required"`
// Whether the API call was successful
Success CallNewResponseEnvelopeSuccess `json:"success,required"`
Result CallsAppWithSecret `json:"result"`
JSON callNewResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -198,8 +198,8 @@ type CallNewResponseEnvelope struct {
type callNewResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down Expand Up @@ -241,9 +241,9 @@ func (r CallUpdateParams) MarshalJSON() (data []byte, err error) {
type CallUpdateResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result CallsApp `json:"result,required"`
// Whether the API call was successful
Success CallUpdateResponseEnvelopeSuccess `json:"success,required"`
Result CallsApp `json:"result"`
JSON callUpdateResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -252,8 +252,8 @@ type CallUpdateResponseEnvelope struct {
type callUpdateResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down Expand Up @@ -294,9 +294,9 @@ type CallDeleteParams struct {
type CallDeleteResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result CallsApp `json:"result,required"`
// Whether the API call was successful
Success CallDeleteResponseEnvelopeSuccess `json:"success,required"`
Result CallsApp `json:"result"`
JSON callDeleteResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -305,8 +305,8 @@ type CallDeleteResponseEnvelope struct {
type callDeleteResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down Expand Up @@ -342,9 +342,9 @@ type CallGetParams struct {
type CallGetResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result CallsApp `json:"result,required"`
// Whether the API call was successful
Success CallGetResponseEnvelopeSuccess `json:"success,required"`
Result CallsApp `json:"result"`
JSON callGetResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -353,8 +353,8 @@ type CallGetResponseEnvelope struct {
type callGetResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down
1 change: 0 additions & 1 deletion internal/shared/union.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ func (UnionString) ImplementsStreamWebhookUpdateResponseUnion()
func (UnionString) ImplementsStreamWebhookDeleteResponseUnion() {}
func (UnionString) ImplementsStreamWebhookGetResponseUnion() {}
func (UnionString) ImplementsStreamCaptionUpdateResponseUnion() {}
func (UnionString) ImplementsStreamCaptionDeleteResponseUnion() {}
func (UnionString) ImplementsStreamDownloadNewResponseUnion() {}
func (UnionString) ImplementsStreamDownloadDeleteResponseUnion() {}
func (UnionString) ImplementsStreamDownloadGetResponseUnion() {}
Expand Down
20 changes: 10 additions & 10 deletions stream/audiotrack.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ type AudioTrackDeleteParams struct {
}

type AudioTrackDeleteResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result AudioTrackDeleteResponseUnion `json:"result,required"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
// Whether the API call was successful
Success AudioTrackDeleteResponseEnvelopeSuccess `json:"success,required"`
Result AudioTrackDeleteResponseUnion `json:"result"`
JSON audioTrackDeleteResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -173,8 +173,8 @@ type AudioTrackDeleteResponseEnvelope struct {
type audioTrackDeleteResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down Expand Up @@ -221,9 +221,9 @@ func (r AudioTrackCopyParams) MarshalJSON() (data []byte, err error) {
type AudioTrackCopyResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result Audio `json:"result,required"`
// Whether the API call was successful
Success AudioTrackCopyResponseEnvelopeSuccess `json:"success,required"`
Result Audio `json:"result"`
JSON audioTrackCopyResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -232,8 +232,8 @@ type AudioTrackCopyResponseEnvelope struct {
type audioTrackCopyResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down Expand Up @@ -278,9 +278,9 @@ func (r AudioTrackEditParams) MarshalJSON() (data []byte, err error) {
type AudioTrackEditResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result Audio `json:"result,required"`
// Whether the API call was successful
Success AudioTrackEditResponseEnvelopeSuccess `json:"success,required"`
Result Audio `json:"result"`
JSON audioTrackEditResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -289,8 +289,8 @@ type AudioTrackEditResponseEnvelope struct {
type audioTrackEditResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down Expand Up @@ -326,9 +326,9 @@ type AudioTrackGetParams struct {
type AudioTrackGetResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result []Audio `json:"result,required"`
// Whether the API call was successful
Success AudioTrackGetResponseEnvelopeSuccess `json:"success,required"`
Result []Audio `json:"result"`
JSON audioTrackGetResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -337,8 +337,8 @@ type AudioTrackGetResponseEnvelope struct {
type audioTrackGetResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down
47 changes: 11 additions & 36 deletions stream/caption.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (r *CaptionService) Update(ctx context.Context, identifier string, language
}

// Removes the captions or subtitles from a video.
func (r *CaptionService) Delete(ctx context.Context, identifier string, language string, params CaptionDeleteParams, opts ...option.RequestOption) (res *CaptionDeleteResponseUnion, err error) {
func (r *CaptionService) Delete(ctx context.Context, identifier string, language string, params CaptionDeleteParams, opts ...option.RequestOption) (res *string, err error) {
opts = append(r.Options[:], opts...)
var env CaptionDeleteResponseEnvelope
path := fmt.Sprintf("accounts/%s/stream/%s/captions/%s", params.AccountID, identifier, language)
Expand Down Expand Up @@ -114,31 +114,6 @@ func init() {
)
}

// Union satisfied by [stream.CaptionDeleteResponseUnknown],
// [stream.CaptionDeleteResponseArray] or [shared.UnionString].
type CaptionDeleteResponseUnion interface {
ImplementsStreamCaptionDeleteResponseUnion()
}

func init() {
apijson.RegisterUnion(
reflect.TypeOf((*CaptionDeleteResponseUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(CaptionDeleteResponseArray{}),
},
apijson.UnionVariant{
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
)
}

type CaptionDeleteResponseArray []interface{}

func (r CaptionDeleteResponseArray) ImplementsStreamCaptionDeleteResponseUnion() {}

type CaptionUpdateParams struct {
// Identifier
AccountID param.Field[string] `path:"account_id,required"`
Expand All @@ -151,11 +126,11 @@ func (r CaptionUpdateParams) MarshalJSON() (data []byte, err error) {
}

type CaptionUpdateResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result CaptionUpdateResponseUnion `json:"result,required"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
// Whether the API call was successful
Success CaptionUpdateResponseEnvelopeSuccess `json:"success,required"`
Result CaptionUpdateResponseUnion `json:"result"`
JSON captionUpdateResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -164,8 +139,8 @@ type CaptionUpdateResponseEnvelope struct {
type captionUpdateResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down Expand Up @@ -204,11 +179,11 @@ func (r CaptionDeleteParams) MarshalJSON() (data []byte, err error) {
}

type CaptionDeleteResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result CaptionDeleteResponseUnion `json:"result,required"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
// Whether the API call was successful
Success CaptionDeleteResponseEnvelopeSuccess `json:"success,required"`
Result string `json:"result"`
JSON captionDeleteResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -217,8 +192,8 @@ type CaptionDeleteResponseEnvelope struct {
type captionDeleteResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down Expand Up @@ -254,9 +229,9 @@ type CaptionGetParams struct {
type CaptionGetResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result []Caption `json:"result,required"`
// Whether the API call was successful
Success CaptionGetResponseEnvelopeSuccess `json:"success,required"`
Result []Caption `json:"result"`
JSON captionGetResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -265,8 +240,8 @@ type CaptionGetResponseEnvelope struct {
type captionGetResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down
4 changes: 2 additions & 2 deletions stream/clip.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ func (r ClipNewParamsWatermark) MarshalJSON() (data []byte, err error) {
type ClipNewResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result Clip `json:"result,required"`
// Whether the API call was successful
Success ClipNewResponseEnvelopeSuccess `json:"success,required"`
Result Clip `json:"result"`
JSON clipNewResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -239,8 +239,8 @@ type ClipNewResponseEnvelope struct {
type clipNewResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down
4 changes: 2 additions & 2 deletions stream/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ func (r CopyNewParamsWatermark) MarshalJSON() (data []byte, err error) {
type CopyNewResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result Video `json:"result,required"`
// Whether the API call was successful
Success CopyNewResponseEnvelopeSuccess `json:"success,required"`
Result Video `json:"result"`
JSON copyNewResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -109,8 +109,8 @@ type CopyNewResponseEnvelope struct {
type copyNewResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down
8 changes: 4 additions & 4 deletions stream/directupload.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ func (r DirectUploadNewParamsWatermark) MarshalJSON() (data []byte, err error) {
}

type DirectUploadNewResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result DirectUploadNewResponse `json:"result,required"`
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
// Whether the API call was successful
Success DirectUploadNewResponseEnvelopeSuccess `json:"success,required"`
Result DirectUploadNewResponse `json:"result"`
JSON directUploadNewResponseEnvelopeJSON `json:"-"`
}

Expand All @@ -142,8 +142,8 @@ type DirectUploadNewResponseEnvelope struct {
type directUploadNewResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down
Loading

0 comments on commit 169d844

Please sign in to comment.