Skip to content

Commit

Permalink
feat(internal): update path placeholders (#3683)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Nov 28, 2024
1 parent e4b651b commit 4af2958
Show file tree
Hide file tree
Showing 13 changed files with 2,441 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1436
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-8c1088ba96368f5f19f6d33654ae76942cfd4f0e3b7f418add2c67b01a6085dc.yml
configured_endpoints: 1451
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-c5682a28c312411d32f5a8447e4c50880eabf7d71415128758e7924dc434c4da.yml
2 changes: 0 additions & 2 deletions ai_gateway/aigateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,6 @@ type AIGatewayListParams struct {
OrderByDirection param.Field[AIGatewayListParamsOrderByDirection] `query:"order_by_direction"`
Page param.Field[int64] `query:"page"`
PerPage param.Field[int64] `query:"per_page"`
// Search by id
Search param.Field[string] `query:"search"`
}

// URLQuery serializes [AIGatewayListParams]'s query parameters as `url.Values`.
Expand Down
1 change: 0 additions & 1 deletion ai_gateway/aigateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ func TestAIGatewayListWithOptionalParams(t *testing.T) {
OrderByDirection: cloudflare.F(ai_gateway.AIGatewayListParamsOrderByDirectionAsc),
Page: cloudflare.F(int64(1)),
PerPage: cloudflare.F(int64(1)),
Search: cloudflare.F("search"),
})
if err != nil {
var apierr *cloudflare.Error
Expand Down
44 changes: 43 additions & 1 deletion api.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dnssec/dnssec.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewDNSSECService(opts ...option.RequestOption) (r *DNSSECService) {
}

// Delete DNSSEC.
func (r *DNSSECService) Delete(ctx context.Context, body DNSSECDeleteParams, opts ...option.RequestOption) (res *string, err error) {
func (r *DNSSECService) Delete(ctx context.Context, body DNSSECDeleteParams, opts ...option.RequestOption) (res *interface{}, err error) {
var env DNSSECDeleteResponseEnvelope
opts = append(r.Options[:], opts...)
if body.ZoneID.Value == "" {
Expand Down Expand Up @@ -185,7 +185,7 @@ type DNSSECDeleteResponseEnvelope struct {
Messages []shared.ResponseInfo `json:"messages,required"`
// Whether the API call was successful
Success DNSSECDeleteResponseEnvelopeSuccess `json:"success,required"`
Result string `json:"result"`
Result interface{} `json:"result"`
JSON dnssecDeleteResponseEnvelopeJSON `json:"-"`
}

Expand Down
262 changes: 262 additions & 0 deletions email_security/settingtrusteddomain.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,57 @@ func (r *SettingTrustedDomainService) ListAutoPaging(ctx context.Context, params
return pagination.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...))
}

// Delete a trusted email domain
func (r *SettingTrustedDomainService) Delete(ctx context.Context, trustedDomainID int64, body SettingTrustedDomainDeleteParams, opts ...option.RequestOption) (res *SettingTrustedDomainDeleteResponse, err error) {
var env SettingTrustedDomainDeleteResponseEnvelope
opts = append(r.Options[:], opts...)
if body.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
}
path := fmt.Sprintf("accounts/%s/email-security/settings/trusted_domains/%v", body.AccountID, trustedDomainID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}

// Update a trusted email domain
func (r *SettingTrustedDomainService) Edit(ctx context.Context, trustedDomainID int64, params SettingTrustedDomainEditParams, opts ...option.RequestOption) (res *SettingTrustedDomainEditResponse, err error) {
var env SettingTrustedDomainEditResponseEnvelope
opts = append(r.Options[:], opts...)
if params.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
}
path := fmt.Sprintf("accounts/%s/email-security/settings/trusted_domains/%v", params.AccountID, trustedDomainID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}

// Get a trusted email domain
func (r *SettingTrustedDomainService) Get(ctx context.Context, trustedDomainID int64, query SettingTrustedDomainGetParams, opts ...option.RequestOption) (res *SettingTrustedDomainGetResponse, err error) {
var env SettingTrustedDomainGetResponseEnvelope
opts = append(r.Options[:], opts...)
if query.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
}
path := fmt.Sprintf("accounts/%s/email-security/settings/trusted_domains/%v", query.AccountID, trustedDomainID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}

// Union satisfied by
// [email_security.SettingTrustedDomainNewResponseEmailSecurityTrustedDomain] or
// [email_security.SettingTrustedDomainNewResponseArray].
Expand Down Expand Up @@ -235,6 +286,108 @@ func (r settingTrustedDomainListResponseJSON) RawJSON() string {
return r.raw
}

type SettingTrustedDomainDeleteResponse struct {
// The unique identifier for the trusted domain.
ID int64 `json:"id,required"`
JSON settingTrustedDomainDeleteResponseJSON `json:"-"`
}

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

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

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

type SettingTrustedDomainEditResponse struct {
// The unique identifier for the trusted domain.
ID int64 `json:"id,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Select to prevent recently registered domains from triggering a Suspicious or
// Malicious disposition.
IsRecent bool `json:"is_recent,required"`
IsRegex bool `json:"is_regex,required"`
// Select for partner or other approved domains that have similar spelling to your
// connected domains. Prevents listed domains from triggering a Spoof disposition.
IsSimilarity bool `json:"is_similarity,required"`
LastModified time.Time `json:"last_modified,required" format:"date-time"`
Pattern string `json:"pattern,required"`
Comments string `json:"comments,nullable"`
JSON settingTrustedDomainEditResponseJSON `json:"-"`
}

// settingTrustedDomainEditResponseJSON contains the JSON metadata for the struct
// [SettingTrustedDomainEditResponse]
type settingTrustedDomainEditResponseJSON struct {
ID apijson.Field
CreatedAt apijson.Field
IsRecent apijson.Field
IsRegex apijson.Field
IsSimilarity apijson.Field
LastModified apijson.Field
Pattern apijson.Field
Comments apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type SettingTrustedDomainGetResponse struct {
// The unique identifier for the trusted domain.
ID int64 `json:"id,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Select to prevent recently registered domains from triggering a Suspicious or
// Malicious disposition.
IsRecent bool `json:"is_recent,required"`
IsRegex bool `json:"is_regex,required"`
// Select for partner or other approved domains that have similar spelling to your
// connected domains. Prevents listed domains from triggering a Spoof disposition.
IsSimilarity bool `json:"is_similarity,required"`
LastModified time.Time `json:"last_modified,required" format:"date-time"`
Pattern string `json:"pattern,required"`
Comments string `json:"comments,nullable"`
JSON settingTrustedDomainGetResponseJSON `json:"-"`
}

// settingTrustedDomainGetResponseJSON contains the JSON metadata for the struct
// [SettingTrustedDomainGetResponse]
type settingTrustedDomainGetResponseJSON struct {
ID apijson.Field
CreatedAt apijson.Field
IsRecent apijson.Field
IsRegex apijson.Field
IsSimilarity apijson.Field
LastModified apijson.Field
Pattern apijson.Field
Comments apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type SettingTrustedDomainNewParams struct {
// Account Identifier
AccountID param.Field[string] `path:"account_id,required"`
Expand Down Expand Up @@ -378,3 +531,112 @@ func (r SettingTrustedDomainListParamsOrder) IsKnown() bool {
}
return false
}

type SettingTrustedDomainDeleteParams struct {
// Account Identifier
AccountID param.Field[string] `path:"account_id,required"`
}

type SettingTrustedDomainDeleteResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result SettingTrustedDomainDeleteResponse `json:"result,required"`
Success bool `json:"success,required"`
JSON settingTrustedDomainDeleteResponseEnvelopeJSON `json:"-"`
}

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

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

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

type SettingTrustedDomainEditParams struct {
// Account Identifier
AccountID param.Field[string] `path:"account_id,required"`
Comments param.Field[string] `json:"comments"`
// Select to prevent recently registered domains from triggering a Suspicious or
// Malicious disposition.
IsRecent param.Field[bool] `json:"is_recent"`
IsRegex param.Field[bool] `json:"is_regex"`
// Select for partner or other approved domains that have similar spelling to your
// connected domains. Prevents listed domains from triggering a Spoof disposition.
IsSimilarity param.Field[bool] `json:"is_similarity"`
Pattern param.Field[string] `json:"pattern"`
}

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

type SettingTrustedDomainEditResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result SettingTrustedDomainEditResponse `json:"result,required"`
Success bool `json:"success,required"`
JSON settingTrustedDomainEditResponseEnvelopeJSON `json:"-"`
}

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

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

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

type SettingTrustedDomainGetParams struct {
// Account Identifier
AccountID param.Field[string] `path:"account_id,required"`
}

type SettingTrustedDomainGetResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result SettingTrustedDomainGetResponse `json:"result,required"`
Success bool `json:"success,required"`
JSON settingTrustedDomainGetResponseEnvelopeJSON `json:"-"`
}

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

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

func (r settingTrustedDomainGetResponseEnvelopeJSON) RawJSON() string {
return r.raw
}
Loading

0 comments on commit 4af2958

Please sign in to comment.