Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#1822)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 19, 2024
1 parent a035789 commit b0878be
Show file tree
Hide file tree
Showing 16 changed files with 1,570 additions and 202 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1259
configured_endpoints: 1266
50 changes: 48 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4105,10 +4105,22 @@ Response Types:

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#Caption">Caption</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>

### Language

Methods:

- <code title="put /accounts/{account_id}/stream/{identifier}/captions/{language}">client.Stream.Captions.Language.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionLanguageService.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#CaptionLanguageUpdateParams">CaptionLanguageUpdateParams</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>
- <code title="delete /accounts/{account_id}/stream/{identifier}/captions/{language}">client.Stream.Captions.Language.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionLanguageService.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#CaptionLanguageDeleteParams">CaptionLanguageDeleteParams</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/{language}">client.Stream.Captions.Language.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionLanguageService.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>, language <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#CaptionLanguageGetParams">CaptionLanguageGetParams</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>

#### Vtt

Methods:

- <code title="get /accounts/{account_id}/stream/{identifier}/captions/{language}/vtt">client.Stream.Captions.Language.Vtt.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/stream#CaptionLanguageVttService.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>, 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#CaptionLanguageVttGetParams">CaptionLanguageVttGetParams</a>) (<a href="https://pkg.go.dev/builtin#string">string</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

## Downloads

Response Types:
Expand Down Expand Up @@ -5537,6 +5549,40 @@ Methods:
- <code title="delete /accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}">client.ZeroTrust.Networks.VirtualNetworks.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#NetworkVirtualNetworkService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, virtualNetworkID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#NetworkVirtualNetworkDeleteParams">NetworkVirtualNetworkDeleteParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#NetworkVirtualNetworkDeleteResponseUnion">NetworkVirtualNetworkDeleteResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="patch /accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}">client.ZeroTrust.Networks.VirtualNetworks.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#NetworkVirtualNetworkService.Edit">Edit</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, virtualNetworkID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#NetworkVirtualNetworkEditParams">NetworkVirtualNetworkEditParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#NetworkVirtualNetworkEditResponseUnion">NetworkVirtualNetworkEditResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

## RiskScoring

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringGetResponse">RiskScoringGetResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringResetResponseUnion">RiskScoringResetResponseUnion</a>

Methods:

- <code title="get /accounts/{account_identifier}/zt_risk_scoring/{user_id}">client.ZeroTrust.RiskScoring.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, accountIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>, userID <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringGetParams">RiskScoringGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringGetResponse">RiskScoringGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /accounts/{account_identifier}/zt_risk_scoring/{user_id}/reset">client.ZeroTrust.RiskScoring.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringService.Reset">Reset</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, accountIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>, userID <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringResetResponseUnion">RiskScoringResetResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

### Behaviours

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringBehaviourUpdateResponse">RiskScoringBehaviourUpdateResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringBehaviourGetResponse">RiskScoringBehaviourGetResponse</a>

Methods:

- <code title="put /accounts/{account_identifier}/zt_risk_scoring/behaviors">client.ZeroTrust.RiskScoring.Behaviours.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringBehaviourService.Update">Update</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, accountIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringBehaviourUpdateParams">RiskScoringBehaviourUpdateParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringBehaviourUpdateResponse">RiskScoringBehaviourUpdateResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_identifier}/zt_risk_scoring/behaviors">client.ZeroTrust.RiskScoring.Behaviours.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringBehaviourService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, accountIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringBehaviourGetResponse">RiskScoringBehaviourGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

### Summary

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringSummaryGetResponse">RiskScoringSummaryGetResponse</a>

Methods:

- <code title="get /accounts/{account_identifier}/zt_risk_scoring/summary">client.ZeroTrust.RiskScoring.Summary.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringSummaryService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, accountIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringSummaryGetParams">RiskScoringSummaryGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#RiskScoringSummaryGetResponse">RiskScoringSummaryGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# Challenges

## Widgets
Expand Down
1 change: 1 addition & 0 deletions internal/shared/union.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func (UnionString) ImplementsZeroTrustGatewayRuleDeleteResponseUnion()
func (UnionString) ImplementsZeroTrustNetworkVirtualNetworkNewResponseUnion() {}
func (UnionString) ImplementsZeroTrustNetworkVirtualNetworkDeleteResponseUnion() {}
func (UnionString) ImplementsZeroTrustNetworkVirtualNetworkEditResponseUnion() {}
func (UnionString) ImplementsZeroTrustRiskScoringResetResponseUnion() {}
func (UnionString) ImplementsHyperdriveConfigDeleteResponseUnion() {}
func (UnionString) ImplementsVectorizeIndexDeleteResponseUnion() {}
func (UnionString) ImplementsRadarRankingTimeseriesGroupsResponseSerie0Union() {}
Expand Down
138 changes: 3 additions & 135 deletions stream/caption.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import (
// variables from the environment automatically. You should not instantiate this
// service directly, and instead use the [NewCaptionService] method instead.
type CaptionService struct {
Options []option.RequestOption
Options []option.RequestOption
Language *CaptionLanguageService
}

// NewCaptionService generates a new service that applies the given options to each
Expand All @@ -28,33 +29,7 @@ type CaptionService struct {
func NewCaptionService(opts ...option.RequestOption) (r *CaptionService) {
r = &CaptionService{}
r.Options = opts
return
}

// Uploads the caption or subtitle file to the endpoint for a specific BCP47
// language. One caption or subtitle file per language is allowed.
func (r *CaptionService) Update(ctx context.Context, identifier string, language string, params CaptionUpdateParams, opts ...option.RequestOption) (res *Caption, err error) {
opts = append(r.Options[:], opts...)
var env CaptionUpdateResponseEnvelope
path := fmt.Sprintf("accounts/%s/stream/%s/captions/%s", params.AccountID, identifier, language)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}

// 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 *string, err error) {
opts = append(r.Options[:], opts...)
var env CaptionDeleteResponseEnvelope
path := fmt.Sprintf("accounts/%s/stream/%s/captions/%s", params.AccountID, identifier, language)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...)
if err != nil {
return
}
res = &env.Result
r.Language = NewCaptionLanguageService(opts...)
return
}

Expand Down Expand Up @@ -95,113 +70,6 @@ func (r captionJSON) RawJSON() string {
return r.raw
}

type CaptionUpdateParams struct {
// Identifier
AccountID param.Field[string] `path:"account_id,required"`
// The WebVTT file containing the caption or subtitle content.
File param.Field[string] `json:"file,required"`
}

func (r CaptionUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

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

// captionUpdateResponseEnvelopeJSON contains the JSON metadata for the struct
// [CaptionUpdateResponseEnvelope]
type captionUpdateResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *CaptionUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r captionUpdateResponseEnvelopeJSON) RawJSON() string {
return r.raw
}

// Whether the API call was successful
type CaptionUpdateResponseEnvelopeSuccess bool

const (
CaptionUpdateResponseEnvelopeSuccessTrue CaptionUpdateResponseEnvelopeSuccess = true
)

func (r CaptionUpdateResponseEnvelopeSuccess) IsKnown() bool {
switch r {
case CaptionUpdateResponseEnvelopeSuccessTrue:
return true
}
return false
}

type CaptionDeleteParams struct {
// Identifier
AccountID param.Field[string] `path:"account_id,required"`
Body interface{} `json:"body,required"`
}

func (r CaptionDeleteParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r.Body)
}

type CaptionDeleteResponseEnvelope struct {
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:"-"`
}

// captionDeleteResponseEnvelopeJSON contains the JSON metadata for the struct
// [CaptionDeleteResponseEnvelope]
type captionDeleteResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *CaptionDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r captionDeleteResponseEnvelopeJSON) RawJSON() string {
return r.raw
}

// Whether the API call was successful
type CaptionDeleteResponseEnvelopeSuccess bool

const (
CaptionDeleteResponseEnvelopeSuccessTrue CaptionDeleteResponseEnvelopeSuccess = true
)

func (r CaptionDeleteResponseEnvelopeSuccess) IsKnown() bool {
switch r {
case CaptionDeleteResponseEnvelopeSuccessTrue:
return true
}
return false
}

type CaptionGetParams struct {
// Identifier
AccountID param.Field[string] `path:"account_id,required"`
Expand Down
Loading

0 comments on commit b0878be

Please sign in to comment.