Skip to content

Commit

Permalink
feat(api): api update (#3632)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 20, 2024
1 parent 7a327f0 commit f3ff236
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1449
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-829ade7062fed63a30accc2a5e1a14c6c26fd4dc003d300d1b25a5416b8b8727.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-47eb882cbdc1acad6371a1827ff0a63b642a7b9a7a61049445cc4c2c4e7b9397.yml
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7487,7 +7487,7 @@ Response Types:

Methods:

- <code title="get /accounts/{account_id}/workflows/{workflow_name}/versions">client.Workflows.Versions.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows#VersionService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, workflowName <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows">workflows</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows#VersionListParams">VersionListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/packages/pagination#V4PagePagination">V4PagePagination</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows">workflows</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows#VersionListResponse">VersionListResponse</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_id}/workflows/{workflow_name}/versions">client.Workflows.Versions.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows#VersionService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, workflowName <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows">workflows</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows#VersionListParams">VersionListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/packages/pagination#V4PagePaginationArray">V4PagePaginationArray</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows">workflows</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows#VersionListResponse">VersionListResponse</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_id}/workflows/{workflow_name}/versions/{version_id}">client.Workflows.Versions.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows#VersionService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, workflowName <a href="https://pkg.go.dev/builtin#string">string</a>, versionID <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows">workflows</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows#VersionGetParams">VersionGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows">workflows</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/workflows#VersionGetResponse">VersionGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# ResourceSharing
Expand Down
138 changes: 11 additions & 127 deletions workflows/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewVersionService(opts ...option.RequestOption) (r *VersionService) {
}

// List deployed Workflow versions
func (r *VersionService) List(ctx context.Context, workflowName string, params VersionListParams, opts ...option.RequestOption) (res *pagination.V4PagePagination[VersionListResponse], err error) {
func (r *VersionService) List(ctx context.Context, workflowName string, params VersionListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[VersionListResponse], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
Expand All @@ -64,8 +64,8 @@ func (r *VersionService) List(ctx context.Context, workflowName string, params V
}

// List deployed Workflow versions
func (r *VersionService) ListAutoPaging(ctx context.Context, workflowName string, params VersionListParams, opts ...option.RequestOption) *pagination.V4PagePaginationAutoPager[VersionListResponse] {
return pagination.NewV4PagePaginationAutoPager(r.List(ctx, workflowName, params, opts...))
func (r *VersionService) ListAutoPaging(ctx context.Context, workflowName string, params VersionListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[VersionListResponse] {
return pagination.NewV4PagePaginationArrayAutoPager(r.List(ctx, workflowName, params, opts...))
}

// Get Workflow version details
Expand Down Expand Up @@ -94,92 +94,17 @@ func (r *VersionService) Get(ctx context.Context, workflowName string, versionID
}

type VersionListResponse struct {
Errors []VersionListResponseError `json:"errors,required"`
Messages []VersionListResponseMessage `json:"messages,required"`
Result VersionListResponseResult `json:"result,required"`
Success VersionListResponseSuccess `json:"success,required"`
ResultInfo VersionListResponseResultInfo `json:"result_info"`
JSON versionListResponseJSON `json:"-"`
ID string `json:"id,required" format:"uuid"`
ClassName string `json:"class_name,required"`
CreatedOn time.Time `json:"created_on,required" format:"date-time"`
ModifiedOn time.Time `json:"modified_on,required" format:"date-time"`
WorkflowID string `json:"workflow_id,required" format:"uuid"`
JSON versionListResponseJSON `json:"-"`
}

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

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

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

type VersionListResponseError struct {
Code float64 `json:"code,required"`
Message string `json:"message,required"`
JSON versionListResponseErrorJSON `json:"-"`
}

// versionListResponseErrorJSON contains the JSON metadata for the struct
// [VersionListResponseError]
type versionListResponseErrorJSON struct {
Code apijson.Field
Message apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type VersionListResponseMessage struct {
Code float64 `json:"code,required"`
Message string `json:"message,required"`
JSON versionListResponseMessageJSON `json:"-"`
}

// versionListResponseMessageJSON contains the JSON metadata for the struct
// [VersionListResponseMessage]
type versionListResponseMessageJSON struct {
Code apijson.Field
Message apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type VersionListResponseResult struct {
ID string `json:"id,required" format:"uuid"`
ClassName string `json:"class_name,required"`
CreatedOn time.Time `json:"created_on,required" format:"date-time"`
ModifiedOn time.Time `json:"modified_on,required" format:"date-time"`
WorkflowID string `json:"workflow_id,required" format:"uuid"`
JSON versionListResponseResultJSON `json:"-"`
}

// versionListResponseResultJSON contains the JSON metadata for the struct
// [VersionListResponseResult]
type versionListResponseResultJSON struct {
ID apijson.Field
ClassName apijson.Field
CreatedOn apijson.Field
Expand All @@ -189,52 +114,11 @@ type versionListResponseResultJSON struct {
ExtraFields map[string]apijson.Field
}

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

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

type VersionListResponseSuccess bool

const (
VersionListResponseSuccessTrue VersionListResponseSuccess = true
)

func (r VersionListResponseSuccess) IsKnown() bool {
switch r {
case VersionListResponseSuccessTrue:
return true
}
return false
}

type VersionListResponseResultInfo struct {
Count float64 `json:"count,required"`
Page float64 `json:"page,required"`
PerPage float64 `json:"per_page,required"`
TotalCount float64 `json:"total_count,required"`
JSON versionListResponseResultInfoJSON `json:"-"`
}

// versionListResponseResultInfoJSON contains the JSON metadata for the struct
// [VersionListResponseResultInfo]
type versionListResponseResultInfoJSON struct {
Count apijson.Field
Page apijson.Field
PerPage apijson.Field
TotalCount apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

func (r versionListResponseResultInfoJSON) RawJSON() string {
func (r versionListResponseJSON) RawJSON() string {
return r.raw
}

Expand Down

0 comments on commit f3ff236

Please sign in to comment.