Skip to content

Commit

Permalink
feat: update via SDK Studio (#1552)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Mar 13, 2024
1 parent 6f7d4ef commit 1281506
Show file tree
Hide file tree
Showing 9 changed files with 1,336 additions and 631 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1282
configured_endpoints: 1288
53 changes: 26 additions & 27 deletions alerting/v3destinationpagerduty.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (r *V3DestinationPagerdutyService) Delete(ctx context.Context, body V3Desti
}

// Get a list of all configured PagerDuty services.
func (r *V3DestinationPagerdutyService) Get(ctx context.Context, query V3DestinationPagerdutyGetParams, opts ...option.RequestOption) (res *[]V3DestinationPagerdutyGetResponse, err error) {
func (r *V3DestinationPagerdutyService) Get(ctx context.Context, query V3DestinationPagerdutyGetParams, opts ...option.RequestOption) (res *[]AaaPagerduty, err error) {
opts = append(r.Options[:], opts...)
var env V3DestinationPagerdutyGetResponseEnvelope
path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/pagerduty", query.AccountID)
Expand All @@ -86,6 +86,30 @@ func (r *V3DestinationPagerdutyService) Link(ctx context.Context, tokenID string
return
}

type AaaPagerduty struct {
// UUID
ID string `json:"id"`
// The name of the pagerduty service.
Name string `json:"name"`
JSON aaaPagerdutyJSON `json:"-"`
}

// aaaPagerdutyJSON contains the JSON metadata for the struct [AaaPagerduty]
type aaaPagerdutyJSON struct {
ID apijson.Field
Name apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type V3DestinationPagerdutyNewResponse struct {
// token in form of UUID
ID string `json:"id"`
Expand Down Expand Up @@ -134,31 +158,6 @@ type V3DestinationPagerdutyDeleteResponseArray []interface{}
func (r V3DestinationPagerdutyDeleteResponseArray) ImplementsAlertingV3DestinationPagerdutyDeleteResponse() {
}

type V3DestinationPagerdutyGetResponse struct {
// UUID
ID string `json:"id"`
// The name of the pagerduty service.
Name string `json:"name"`
JSON v3DestinationPagerdutyGetResponseJSON `json:"-"`
}

// v3DestinationPagerdutyGetResponseJSON contains the JSON metadata for the struct
// [V3DestinationPagerdutyGetResponse]
type v3DestinationPagerdutyGetResponseJSON struct {
ID apijson.Field
Name apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type V3DestinationPagerdutyLinkResponse struct {
// UUID
ID string `json:"id"`
Expand Down Expand Up @@ -394,7 +393,7 @@ type V3DestinationPagerdutyGetParams struct {
type V3DestinationPagerdutyGetResponseEnvelope struct {
Errors []V3DestinationPagerdutyGetResponseEnvelopeErrors `json:"errors,required"`
Messages []V3DestinationPagerdutyGetResponseEnvelopeMessages `json:"messages,required"`
Result []V3DestinationPagerdutyGetResponse `json:"result,required,nullable"`
Result []AaaPagerduty `json:"result,required,nullable"`
// Whether the API call was successful
Success V3DestinationPagerdutyGetResponseEnvelopeSuccess `json:"success,required"`
ResultInfo V3DestinationPagerdutyGetResponseEnvelopeResultInfo `json:"result_info"`
Expand Down
178 changes: 60 additions & 118 deletions alerting/v3destinationwebhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (r *V3DestinationWebhookService) Update(ctx context.Context, webhookID stri
}

// Gets a list of all configured webhook destinations.
func (r *V3DestinationWebhookService) List(ctx context.Context, query V3DestinationWebhookListParams, opts ...option.RequestOption) (res *[]V3DestinationWebhookListResponse, err error) {
func (r *V3DestinationWebhookService) List(ctx context.Context, query V3DestinationWebhookListParams, opts ...option.RequestOption) (res *[]AaaWebhooks, err error) {
opts = append(r.Options[:], opts...)
var env V3DestinationWebhookListResponseEnvelope
path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks", query.AccountID)
Expand All @@ -88,7 +88,7 @@ func (r *V3DestinationWebhookService) Delete(ctx context.Context, webhookID stri
}

// Get details for a single webhooks destination.
func (r *V3DestinationWebhookService) Get(ctx context.Context, webhookID string, query V3DestinationWebhookGetParams, opts ...option.RequestOption) (res *V3DestinationWebhookGetResponse, err error) {
func (r *V3DestinationWebhookService) Get(ctx context.Context, webhookID string, query V3DestinationWebhookGetParams, opts ...option.RequestOption) (res *AaaWebhooks, err error) {
opts = append(r.Options[:], opts...)
var env V3DestinationWebhookGetResponseEnvelope
path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks/%s", query.AccountID, webhookID)
Expand All @@ -100,51 +100,7 @@ func (r *V3DestinationWebhookService) Get(ctx context.Context, webhookID string,
return
}

type V3DestinationWebhookNewResponse struct {
// UUID
ID string `json:"id"`
JSON v3DestinationWebhookNewResponseJSON `json:"-"`
}

// v3DestinationWebhookNewResponseJSON contains the JSON metadata for the struct
// [V3DestinationWebhookNewResponse]
type v3DestinationWebhookNewResponseJSON struct {
ID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type V3DestinationWebhookUpdateResponse struct {
// UUID
ID string `json:"id"`
JSON v3DestinationWebhookUpdateResponseJSON `json:"-"`
}

// v3DestinationWebhookUpdateResponseJSON contains the JSON metadata for the struct
// [V3DestinationWebhookUpdateResponse]
type v3DestinationWebhookUpdateResponseJSON struct {
ID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type V3DestinationWebhookListResponse struct {
type AaaWebhooks struct {
// The unique identifier of a webhook
ID string `json:"id"`
// Timestamp of when the webhook destination was created.
Expand All @@ -163,15 +119,14 @@ type V3DestinationWebhookListResponse struct {
// destinations. Secrets are not returned in any API response body.
Secret string `json:"secret"`
// Type of webhook endpoint.
Type V3DestinationWebhookListResponseType `json:"type"`
Type AaaWebhooksType `json:"type"`
// The POST endpoint to call when dispatching a notification.
URL string `json:"url"`
JSON v3DestinationWebhookListResponseJSON `json:"-"`
URL string `json:"url"`
JSON aaaWebhooksJSON `json:"-"`
}

// v3DestinationWebhookListResponseJSON contains the JSON metadata for the struct
// [V3DestinationWebhookListResponse]
type v3DestinationWebhookListResponseJSON struct {
// aaaWebhooksJSON contains the JSON metadata for the struct [AaaWebhooks]
type aaaWebhooksJSON struct {
ID apijson.Field
CreatedAt apijson.Field
LastFailure apijson.Field
Expand All @@ -184,23 +139,67 @@ type v3DestinationWebhookListResponseJSON struct {
ExtraFields map[string]apijson.Field
}

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

func (r v3DestinationWebhookListResponseJSON) RawJSON() string {
func (r aaaWebhooksJSON) RawJSON() string {
return r.raw
}

// Type of webhook endpoint.
type V3DestinationWebhookListResponseType string
type AaaWebhooksType string

const (
V3DestinationWebhookListResponseTypeSlack V3DestinationWebhookListResponseType = "slack"
V3DestinationWebhookListResponseTypeGeneric V3DestinationWebhookListResponseType = "generic"
V3DestinationWebhookListResponseTypeGchat V3DestinationWebhookListResponseType = "gchat"
AaaWebhooksTypeSlack AaaWebhooksType = "slack"
AaaWebhooksTypeGeneric AaaWebhooksType = "generic"
AaaWebhooksTypeGchat AaaWebhooksType = "gchat"
)

type V3DestinationWebhookNewResponse struct {
// UUID
ID string `json:"id"`
JSON v3DestinationWebhookNewResponseJSON `json:"-"`
}

// v3DestinationWebhookNewResponseJSON contains the JSON metadata for the struct
// [V3DestinationWebhookNewResponse]
type v3DestinationWebhookNewResponseJSON struct {
ID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type V3DestinationWebhookUpdateResponse struct {
// UUID
ID string `json:"id"`
JSON v3DestinationWebhookUpdateResponseJSON `json:"-"`
}

// v3DestinationWebhookUpdateResponseJSON contains the JSON metadata for the struct
// [V3DestinationWebhookUpdateResponse]
type v3DestinationWebhookUpdateResponseJSON struct {
ID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

// Union satisfied by [alerting.V3DestinationWebhookDeleteResponseUnknown],
// [alerting.V3DestinationWebhookDeleteResponseArray] or [shared.UnionString].
type V3DestinationWebhookDeleteResponse interface {
Expand All @@ -227,63 +226,6 @@ type V3DestinationWebhookDeleteResponseArray []interface{}
func (r V3DestinationWebhookDeleteResponseArray) ImplementsAlertingV3DestinationWebhookDeleteResponse() {
}

type V3DestinationWebhookGetResponse struct {
// The unique identifier of a webhook
ID string `json:"id"`
// Timestamp of when the webhook destination was created.
CreatedAt time.Time `json:"created_at" format:"date-time"`
// Timestamp of the last time an attempt to dispatch a notification to this webhook
// failed.
LastFailure time.Time `json:"last_failure" format:"date-time"`
// Timestamp of the last time Cloudflare was able to successfully dispatch a
// notification using this webhook.
LastSuccess time.Time `json:"last_success" format:"date-time"`
// The name of the webhook destination. This will be included in the request body
// when you receive a webhook notification.
Name string `json:"name"`
// Optional secret that will be passed in the `cf-webhook-auth` header when
// dispatching generic webhook notifications or formatted for supported
// destinations. Secrets are not returned in any API response body.
Secret string `json:"secret"`
// Type of webhook endpoint.
Type V3DestinationWebhookGetResponseType `json:"type"`
// The POST endpoint to call when dispatching a notification.
URL string `json:"url"`
JSON v3DestinationWebhookGetResponseJSON `json:"-"`
}

// v3DestinationWebhookGetResponseJSON contains the JSON metadata for the struct
// [V3DestinationWebhookGetResponse]
type v3DestinationWebhookGetResponseJSON struct {
ID apijson.Field
CreatedAt apijson.Field
LastFailure apijson.Field
LastSuccess apijson.Field
Name apijson.Field
Secret apijson.Field
Type apijson.Field
URL apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

// Type of webhook endpoint.
type V3DestinationWebhookGetResponseType string

const (
V3DestinationWebhookGetResponseTypeSlack V3DestinationWebhookGetResponseType = "slack"
V3DestinationWebhookGetResponseTypeGeneric V3DestinationWebhookGetResponseType = "generic"
V3DestinationWebhookGetResponseTypeGchat V3DestinationWebhookGetResponseType = "gchat"
)

type V3DestinationWebhookNewParams struct {
// The account id
AccountID param.Field[string] `path:"account_id,required"`
Expand Down Expand Up @@ -490,7 +432,7 @@ type V3DestinationWebhookListParams struct {
type V3DestinationWebhookListResponseEnvelope struct {
Errors []V3DestinationWebhookListResponseEnvelopeErrors `json:"errors,required"`
Messages []V3DestinationWebhookListResponseEnvelopeMessages `json:"messages,required"`
Result []V3DestinationWebhookListResponse `json:"result,required,nullable"`
Result []AaaWebhooks `json:"result,required,nullable"`
// Whether the API call was successful
Success V3DestinationWebhookListResponseEnvelopeSuccess `json:"success,required"`
ResultInfo V3DestinationWebhookListResponseEnvelopeResultInfo `json:"result_info"`
Expand Down Expand Up @@ -728,7 +670,7 @@ type V3DestinationWebhookGetParams struct {
type V3DestinationWebhookGetResponseEnvelope struct {
Errors []V3DestinationWebhookGetResponseEnvelopeErrors `json:"errors,required"`
Messages []V3DestinationWebhookGetResponseEnvelopeMessages `json:"messages,required"`
Result V3DestinationWebhookGetResponse `json:"result,required"`
Result AaaWebhooks `json:"result,required"`
// Whether the API call was successful
Success V3DestinationWebhookGetResponseEnvelopeSuccess `json:"success,required"`
JSON v3DestinationWebhookGetResponseEnvelopeJSON `json:"-"`
Expand Down
Loading

0 comments on commit 1281506

Please sign in to comment.