diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2afb19f0..92f5ba5b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/go { "name": "Go", - "image": "mcr.microsoft.com/devcontainers/go:1-1.20-bullseye", + "image": "mcr.microsoft.com/devcontainers/go:1-1.22-bullseye", // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, // Use 'forwardPorts' to make a list of ports inside the container available locally. diff --git a/.gitignore b/.gitignore index 5f88fc7d..10945094 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.env +.env.local .DS_Store **/.speakeasy/temp/ **/.speakeasy/logs/ diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index b2dc322b..b814f22e 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,10 +3,10 @@ id: 2858c6d9-f946-4185-ae68-3b8e708830fb management: docChecksum: 17226457b23fc2563102eb22d263bc30 docVersion: 0.4.0 - speakeasyVersion: 1.542.3 - generationVersion: 2.597.9 - releaseVersion: 3.26.7 - configChecksum: bfeb51f5ecac40c606ed841c8725ab38 + speakeasyVersion: 1.651.0 + generationVersion: 2.745.2 + releaseVersion: 3.27.0 + configChecksum: feef891542f83b8722e3649645b8ed40 repoURL: https://github.com/speakeasy-api/speakeasy-client-sdk-go.git repoSubDirectory: . installationURL: https://github.com/speakeasy-api/speakeasy-client-sdk-go @@ -15,7 +15,7 @@ features: go: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.12 - core: 3.7.4 + core: 3.13.1 deepObjectParams: 0.1.1 defaultEnabledRetries: 0.2.0 deprecations: 2.81.3 @@ -23,20 +23,20 @@ features: downloadStreams: 0.1.2 envVarSecurityUsage: 0.3.2 getRequestBodies: 2.81.1 - globalSecurity: 2.82.11 + globalSecurity: 2.82.12 globalSecurityCallbacks: 0.1.0 - globalServerURLs: 2.82.2 + globalServerURLs: 2.83.0 globals: 2.82.2 intellisenseMarkdownSupport: 0.1.0 - mockServer: 0.1.0 + mockServer: 0.1.1 nameOverrides: 2.81.2 - nullables: 0.1.1 + nullables: 0.2.1 openEnums: 0.1.0 responseFormat: 0.1.2 - retries: 2.83.2 - sdkHooks: 0.1.0 + retries: 2.84.2 + sdkHooks: 0.2.0 serverIDs: 2.81.1 - tests: 0.15.1 + tests: 0.16.3 uploadStreams: 0.1.0 generatedFiles: - .devcontainer/README.md @@ -454,23 +454,24 @@ generatedFiles: - docs/sdks/reports/README.md - docs/sdks/schemastore/README.md - docs/sdks/shorturls/README.md - - docs/sdks/speakeasy/README.md - docs/sdks/subscriptions/README.md - docs/sdks/suggest/README.md - docs/sdks/workspaces/README.md - events.go - github.go - go.mod + - internal/config/sdkconfiguration.go - internal/globals/globals.go - internal/hooks/hooks.go - organizations.go - pkg/models/operations/options.go - pkg/models/sdkerrors/sdkerror.go + - pkg/optionalnullable/optionalnullable.go + - pkg/optionalnullable/optionalnullable_test.go - pkg/retry/config.go - pkg/types/bigint.go - pkg/types/date.go - pkg/types/datetime.go - - pkg/types/decimal.go - pkg/types/pointers.go - pkg/utils/contenttype.go - pkg/utils/env.go @@ -760,57 +761,11 @@ generatedFiles: - tests/workspaces_test.go - workspaces.go examples: - createPublishingToken: - speakeasy-default-create-publishing-token: - requestBody: - application/json: {"target_id": "", "target_resource": "document", "token_name": "", "valid_until": "2024-06-17T07:14:55.338Z"} - responses: - "200": - application/json: {"created_at": "2023-12-11T20:09:47.767Z", "created_by": "", "id": "", "organization_id": "", "target_id": "", "target_resource": "document", "token": "", "token_name": "", "valid_until": "2024-11-30T17:06:07.804Z", "workspace_id": ""} - 4XX: - application/json: {"message": "", "status_code": 447867} - deletePublishingToken: - speakeasy-default-delete-publishing-token: - parameters: - path: - tokenID: "" - responses: - 4XX: - application/json: {"message": "", "status_code": 227169} - getPublishingTokenByID: - speakeasy-default-get-publishing-token-by-ID: - parameters: - path: - tokenID: "" - responses: - "200": - application/json: {"created_at": "2025-10-20T08:51:57.553Z", "created_by": "", "id": "", "organization_id": "", "target_id": "", "target_resource": "document", "token": "", "token_name": "", "valid_until": "2025-02-06T13:54:48.821Z", "workspace_id": ""} - 4XX: - application/json: {"message": "", "status_code": 82666} - getPublishingTokenTargetByID: - speakeasy-default-get-publishing-token-target-by-ID: - parameters: - path: - tokenID: "" - responses: - "200": - application/json: {} - text/plain: "" - 4XX: - application/json: {"message": "", "status_code": 297644} - updatePublishingTokenExpiration: - speakeasy-default-update-publishing-token-expiration: - parameters: - path: - tokenID: "" - responses: - 4XX: - application/json: {"message": "", "status_code": 784694} createRemoteSource: speakeasy-default-create-remote-source: responses: 4XX: - application/json: {"message": "", "status_code": 580557} + application/json: {"message": "", "status_code": 314779} getBlob: speakeasy-default-get-blob: parameters: @@ -823,7 +778,7 @@ examples: 2XX: application/octet-stream: "x-file: example.file" 4XX: - application/json: {"message": "", "status_code": 115307} + application/json: {"message": "", "status_code": 614230} getManifest: speakeasy-default-get-manifest: parameters: @@ -836,25 +791,24 @@ examples: 2XX: application/vnd.oci.image.manifest.v1+json: {"layers": [{"digest": "sha256:5d20c808ce198565ff70b3ed23a991dd49afac45dece63474b27ce6ed036adc6", "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 2107098}], "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "schemaVersion": 2} 4XX: - application/json: {"message": "", "status_code": 707258} + application/json: {"message": "", "status_code": 951684} getNamespaces: speakeasy-default-get-namespaces: responses: 2XX: - application/json: {"items": [{"created_at": "2025-01-19T10:11:46.428Z", "id": "", "name": "", "updated_at": "2023-01-07T04:43:36.873Z"}, {"created_at": "2024-07-05T07:26:30.970Z", "id": "", "name": "", "updated_at": "2025-01-30T11:34:19.590Z"}, {"created_at": "2023-08-10T13:43:30.983Z", "id": "", "name": "", "updated_at": "2023-07-15T08:41:36.371Z"}]} + application/json: {"items": []} 4XX: - application/json: {"message": "", "status_code": 305198} + application/json: {"message": "", "status_code": 442334} getRevisions: speakeasy-default-get-revisions: parameters: path: namespace_name: "" - query: {} responses: 2XX: - application/json: {"items": [{"created_at": "2025-09-16T19:17:04.361Z", "digest": "sha256:6d1ef012b5674ad8a127ecfa9b5e6f5178d171b90ee462846974177fd9bdd39f", "id": "", "namespace_name": "", "tags": [""], "updated_at": "2024-12-05T05:58:38.953Z"}], "next_page_token": ""} + application/json: {"items": [{"created_at": "2024-04-08T17:06:20.340Z", "digest": "sha256:6d1ef012b5674ad8a127ecfa9b5e6f5178d171b90ee462846974177fd9bdd39f", "id": "", "namespace_name": "", "tags": ["", "", ""], "updated_at": "2025-11-19T01:05:11.002Z"}], "next_page_token": ""} 4XX: - application/json: {"message": "", "status_code": 414389} + application/json: {"message": "", "status_code": 503937} getTags: speakeasy-default-get-tags: parameters: @@ -862,9 +816,9 @@ examples: namespace_name: "" responses: 2XX: - application/json: {"items": []} + application/json: {"items": [{"id": "", "name": "", "namespace_name": "", "revision_digest": ""}]} 4XX: - application/json: {"message": "", "status_code": 50428} + application/json: {"message": "", "status_code": 293534} listRemoteSources: speakeasy-default-list-remote-sources: parameters: @@ -872,9 +826,9 @@ examples: namespace_name: "" responses: 2XX: - application/json: {"inputs": [{"registry_url": "https://well-lit-cap.net"}, {"registry_url": "https://vibrant-labourer.net"}], "output": {"registry_url": "https://unfit-minor.biz"}} + application/json: {"inputs": [], "output": {"registry_url": "https://happy-substitution.com"}} 4XX: - application/json: {"message": "", "status_code": 754391} + application/json: {"message": "", "status_code": 672449} postTags: speakeasy-default-post-tags: parameters: @@ -882,14 +836,14 @@ examples: namespace_name: "" responses: 4XX: - application/json: {"message": "", "status_code": 581484} + application/json: {"message": "", "status_code": 418537} preflight: speakeasy-default-preflight: responses: 2XX: application/json: {} 4XX: - application/json: {"message": "", "status_code": 820828} + application/json: {"message": "", "status_code": 626529} archiveNamespace: speakeasy-default-archive-namespace: parameters: @@ -897,7 +851,7 @@ examples: namespace_name: "" responses: 4XX: - application/json: {"message": "", "status_code": 334009} + application/json: {"message": "", "status_code": 726683} setVisibility: speakeasy-default-set-visibility: parameters: @@ -905,12 +859,12 @@ examples: namespace_name: "" responses: 4XX: - application/json: {"message": "", "status_code": 651364} + application/json: {"message": "", "status_code": 669253} getWorkspaceAccess: speakeasy-default-get-workspace-access: responses: 2XX: - application/json: {"generation_allowed": true, "message": ""} + application/json: {"generation_allowed": false, "message": ""} getAccessToken: speakeasy-default-get-access-token: parameters: @@ -920,41 +874,41 @@ examples: 2XX: application/json: {"access_token": "", "claims": {}, "user": {}} 4XX: - application/json: {"message": "", "status_code": 299050} + application/json: {"message": "", "status_code": 646748} getUser: speakeasy-default-get-user: responses: 2XX: - application/json: {"admin": false, "confirmed": true, "created_at": "2025-09-05T08:59:40.988Z", "display_name": "Tianna_Prohaska", "email": "Morton82@gmail.com", "email_verified": false, "id": "", "updated_at": "2023-08-28T03:26:52.335Z", "whitelisted": true} + application/json: {"admin": true, "confirmed": true, "created_at": "2025-07-25T03:12:15.738Z", "display_name": "Gunnar6", "email": "Ernesto40@gmail.com", "email_verified": false, "id": "", "updated_at": "2025-07-05T00:21:52.607Z", "whitelisted": false} 4XX: - application/json: {"message": "", "status_code": 237845} + application/json: {"message": "", "status_code": 527542} validateApiKey: speakeasy-default-validate-api-key: responses: 2XX: - application/json: {"account_type_v2": "enterprise", "billing_add_ons": ["webhooks", "sdk_testing", "webhooks"], "enabled_features": ["", "", ""], "org_slug": "", "telemetry_disabled": false, "workspace_created_at": "2024-02-23T05:39:14.801Z", "workspace_id": "", "workspace_slug": ""} + application/json: {"account_type_v2": "scale-up", "billing_add_ons": [], "enabled_features": ["", "", ""], "org_slug": "", "telemetry_disabled": true, "workspace_created_at": "2023-12-15T07:11:54.529Z", "workspace_id": "", "workspace_slug": ""} 4XX: - application/json: {"message": "", "status_code": 380984} + application/json: {"message": "", "status_code": 532463} generateCodeSamplePreview: default: requestBody: - multipart/form-data: {"language": "", "schema_file": {"": "example.file"}} + multipart/form-data: {"language": "", "schema_file": "x-file: example.file"} responses: 2XX: application/json: {"snippets": [{"code": "import { Petstore } from \"petstore-sdk\";\n\nconst petstore = new Petstore({\n apiKey: \"\",\n});\n\nasync function run() {\n const result = await petstore.pet.getById({\n id: 137396,\n });\n\n // Handle the result\n console.log(result);\n}\n\nrun();", "language": "typescript", "method": "get", "operationId": "getPetById", "path": "/pet/{id}"}]} generateCodeSamplePreviewAsync: speakeasy-default-generate-code-sample-preview-async: requestBody: - multipart/form-data: {"language": "", "schema_file": {"": "example.file"}} + multipart/form-data: {"language": "", "schema_file": "x-file: example.file"} responses: "202": - application/json: {"job_id": "", "status": "running"} + application/json: {"job_id": "", "status": "pending"} 4XX: - application/json: {"message": "", "status_code": 885038} + application/json: {"message": "", "status_code": 431188} 5XX: - application/json: {"message": "", "status_code": 242219} + application/json: {"message": "", "status_code": 431188} getCodeSamples: - "": + speakeasy-default-get-code-samples: parameters: query: registry_url: "https://spec.speakeasy.com/my-org/my-workspace/my-source" @@ -963,9 +917,9 @@ examples: languages: ["python", "javascript"] responses: 2XX: - application/json: {"snippets": [{"code": "", "language": "", "method": "", "operationId": "", "path": "/sbin"}, {"code": "", "language": "", "method": "", "operationId": "", "path": "/root"}]} + application/json: {"snippets": []} 4XX: - application/json: {"message": "", "status_code": 521235} + application/json: {"message": "", "status_code": 887801} default: parameters: query: @@ -992,7 +946,7 @@ examples: repo: "" responses: 4XX: - application/json: {"message": "", "status_code": 74604} + application/json: {"message": "", "status_code": 292890} githubCheckPublishingPRs: speakeasy-default-github-check-publishing-P-rs: parameters: @@ -1004,7 +958,7 @@ examples: 2XX: application/json: {} 4XX: - application/json: {"message": "", "status_code": 670562} + application/json: {"message": "", "status_code": 64289} githubCheckPublishingSecrets: speakeasy-default-github-check-publishing-secrets: parameters: @@ -1014,30 +968,30 @@ examples: 2XX: application/json: {} 4XX: - application/json: {"message": "", "status_code": 749379} + application/json: {"message": "", "status_code": 929456} githubConfigureCodeSamples: speakeasy-default-github-configure-code-samples: requestBody: application/json: {"org": "", "repo": "", "targetName": ""} responses: 2XX: - application/json: {"codeSampleOverlayRegistryURL": "https://giving-handover.net", "source": {"location": ""}} + application/json: {"codeSampleOverlayRegistryURL": "https://flustered-mountain.net/", "source": {"location": ""}} 4XX: - application/json: {"message": "", "status_code": 628169} + application/json: {"message": "", "status_code": 382989} githubConfigureMintlifyRepo: speakeasy-default-github-configure-mintlify-repo: requestBody: - application/json: {"input": "", "org": "", "overlays": [""], "repo": ""} + application/json: {"input": "", "org": "", "overlays": [""], "repo": ""} responses: 4XX: - application/json: {"message": "", "status_code": 529873} + application/json: {"message": "", "status_code": 685904} githubConfigureTarget: speakeasy-default-github-configure-target: requestBody: application/json: {"org": "", "repo_name": ""} responses: 4XX: - application/json: {"message": "", "status_code": 210299} + application/json: {"message": "", "status_code": 285752} getGitHubAction: speakeasy-default-get-git-hub-action: parameters: @@ -1048,7 +1002,7 @@ examples: 2XX: application/json: {} 4XX: - application/json: {"message": "", "status_code": 252330} + application/json: {"message": "", "status_code": 413434} getGithubSetupState: speakeasy-default-get-github-setup-state: parameters: @@ -1058,59 +1012,59 @@ examples: generate_gen_lock_id: "" responses: 2XX: - application/json: {"actions": {"generation_action_configured": false, "publish_action_configured": false}, "app_installed": false, "secrets": {"api_key_configured": true, "publishing_secrets_configured": true}} + application/json: {"actions": {"generation_action_configured": true, "publish_action_configured": true}, "app_installed": true, "secrets": {"api_key_configured": true, "publishing_secrets_configured": false}} 4XX: - application/json: {"message": "", "status_code": 743106} + application/json: {"message": "", "status_code": 78009} linkGithubAccess: speakeasy-default-link-github-access: responses: 4XX: - application/json: {"message": "", "status_code": 774553} + application/json: {"message": "", "status_code": 829955} githubStorePublishingSecrets: speakeasy-default-github-store-publishing-secrets: requestBody: application/json: {"generate_gen_lock_id": ""} responses: 4XX: - application/json: {"message": "", "status_code": 444361} + application/json: {"message": "", "status_code": 258052} githubTriggerAction: speakeasy-default-github-trigger-action: requestBody: application/json: {"gen_lock_id": "", "org": "", "repo_name": ""} responses: 4XX: - application/json: {"message": "", "status_code": 689611} + application/json: {"message": "", "status_code": 124849} createOrganization: speakeasy-default-create-organization: requestBody: - application/json: {"account_type": "scale-up", "created_at": "2024-11-30T17:06:07.804Z", "id": "", "name": "", "slug": "", "sso_activated": true, "telemetry_disabled": true, "updated_at": "2023-03-17T15:39:20.911Z"} + application/json: {"account_type": "scale-up", "created_at": "2025-10-26T09:05:00.560Z", "id": "", "name": "", "slug": "", "sso_activated": false, "telemetry_disabled": false, "updated_at": "2023-12-23T08:00:51.380Z"} responses: 2XX: - application/json: {"account_type": "enterprise", "created_at": "2025-11-08T08:43:39.394Z", "id": "", "name": "", "slug": "", "sso_activated": true, "telemetry_disabled": true, "updated_at": "2023-04-09T14:25:29.356Z"} + application/json: {"account_type": "free", "created_at": "2025-06-13T19:16:50.186Z", "id": "", "name": "", "slug": "", "sso_activated": false, "telemetry_disabled": true, "updated_at": "2024-03-27T19:13:33.227Z"} 4XX: - application/json: {"message": "", "status_code": 792620} + application/json: {"message": "", "status_code": 634641} createBillingAddOns: speakeasy-default-create-billing-add-ons: requestBody: - application/json: {"add_ons": ["sdk_testing", "sdk_testing", "webhooks"]} + application/json: {"add_ons": ["custom_code_regions"]} responses: "200": - application/json: {"add_ons": ["custom_code_regions", "custom_code_regions", "sdk_testing"]} + application/json: {"add_ons": []} 5XX: - application/json: {"message": "", "status_code": 518517} + application/json: {"message": "", "status_code": 501320} createFreeTrial: speakeasy-default-create-free-trial: responses: 4XX: - application/json: {"message": "", "status_code": 728627} + application/json: {"message": "", "status_code": 822669} deleteBillingAddOn: speakeasy-default-delete-billing-add-on: parameters: path: - add_on: "custom_code_regions" + add_on: "sdk_testing" responses: 5XX: - application/json: {"message": "", "status_code": 783245} + application/json: {"message": "", "status_code": 844353} getOrganization: speakeasy-default-get-organization: parameters: @@ -1118,178 +1072,90 @@ examples: organizationID: "" responses: 2XX: - application/json: {"account_type": "business", "created_at": "2024-09-04T11:33:52.011Z", "id": "", "name": "", "slug": "", "sso_activated": false, "telemetry_disabled": false, "updated_at": "2025-11-29T01:50:48.954Z"} + application/json: {"account_type": "scale-up", "created_at": "2024-10-13T14:22:14.424Z", "id": "", "name": "", "slug": "", "sso_activated": false, "telemetry_disabled": true, "updated_at": "2024-05-28T14:00:19.557Z"} 4XX: - application/json: {"message": "", "status_code": 458049} + application/json: {"message": "", "status_code": 924479} getOrganizations: speakeasy-default-get-organizations: responses: 2XX: - application/json: [{"account_type": "free", "created_at": "2024-10-17T22:25:06.537Z", "id": "", "name": "", "slug": "", "sso_activated": false, "telemetry_disabled": true, "updated_at": "2024-05-22T13:01:16.115Z"}, {"account_type": "business", "created_at": "2023-03-09T16:25:53.264Z", "id": "", "name": "", "slug": "", "sso_activated": false, "telemetry_disabled": false, "updated_at": "2023-06-16T08:07:08.454Z"}] + application/json: [{"account_type": "free", "created_at": "2025-01-26T18:20:48.179Z", "id": "", "name": "", "slug": "", "sso_activated": false, "telemetry_disabled": true, "updated_at": "2025-06-30T11:58:00.293Z"}] 4XX: - application/json: {"message": "", "status_code": 217828} + application/json: {"message": "", "status_code": 367315} getBillingAddOns: speakeasy-default-get-billing-add-ons: responses: "200": - application/json: {"add_ons": []} + application/json: {"add_ons": ["snippet_ai"]} 5XX: - application/json: {"message": "", "status_code": 697034} + application/json: {"message": "", "status_code": 576599} getOrganizationUsage: speakeasy-default-get-organization-usage: responses: 2XX: - application/json: {"allowed_languages": [], "total_allowed_languages": 863126, "usage": [{"accessible": false, "accessible_features": [""], "gen_lock_ids": ["", "", ""], "language": "", "max_operations": 939867, "number_of_operations": 881790, "used_features": [""], "workspaces": ["", ""]}, {"accessible": true, "accessible_features": ["", "", ""], "gen_lock_ids": [""], "language": "", "max_operations": 593645, "number_of_operations": 369818, "used_features": [""], "workspaces": []}]} + application/json: {"allowed_languages": ["", ""], "total_allowed_languages": 68444, "usage": []} 4XX: - application/json: {"message": "", "status_code": 804495} - createWorkspace: - speakeasy-default-create-workspace: - requestBody: - application/json: {"created_at": "2024-06-17T07:14:55.338Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2024-11-30T17:06:07.804Z", "verified": true} - responses: - 2XX: - application/json: {"created_at": "2023-05-28T06:20:22.766Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2023-03-17T15:39:20.911Z", "verified": false} - 4XX: - application/json: {"message": "", "status_code": 951062} - createWorkspaceToken: - speakeasy-default-create-workspace-token: - parameters: - path: - workspace_id: "" - requestBody: - application/json: {"alg": "", "created_at": "2023-08-16T02:33:00.784Z", "id": "", "key": "", "name": "", "workspace_id": ""} + application/json: {"message": "", "status_code": 577242} + createPublishingToken: + speakeasy-default-create-publishing-token: responses: + "200": + application/json: {"created_at": "2023-03-05T16:00:09.135Z", "created_by": "", "id": "", "organization_id": "", "target_id": "", "target_resource": "document", "token": "", "token_name": "", "valid_until": "2023-04-09T03:55:02.077Z", "workspace_id": ""} 4XX: - application/json: {"message": "", "status_code": 966454} - deleteWorkspaceToken: - speakeasy-default-delete-workspace-token: + application/json: {"message": "", "status_code": 956440} + deletePublishingToken: + speakeasy-default-delete-publishing-token: parameters: path: - workspace_id: "" tokenID: "" responses: 4XX: - application/json: {"message": "", "status_code": 120260} - getWorkspaceByContext: - speakeasy-default-get-workspace-by-context: - responses: - 2XX: - application/json: {"organization": {"account_type": "business", "created_at": "2024-09-04T11:33:52.011Z", "id": "", "name": "", "slug": "", "sso_activated": false, "telemetry_disabled": false, "updated_at": "2025-11-29T01:50:48.954Z"}, "workspace": {"created_at": "2024-05-17T00:32:02.244Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2024-05-09T02:28:23.533Z", "verified": true}} - 4XX: - application/json: {"message": "", "status_code": 213457} - getWorkspaces: - speakeasy-default-get-workspaces: - responses: - 2XX: - application/json: [{"created_at": "2023-03-06T21:36:22.528Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2024-10-17T22:25:06.537Z", "verified": false}, {"created_at": "2023-01-18T20:59:19.735Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2024-05-22T13:01:16.115Z", "verified": false}] - 4XX: - application/json: {"message": "", "status_code": 61756} - getWorkspace: - speakeasy-default-get-workspace: - parameters: - path: - workspace_id: "" - responses: - 2XX: - application/json: {"created_at": "2025-11-17T10:14:22.985Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2025-07-28T15:04:25.117Z", "verified": false} - 4XX: - application/json: {"message": "", "status_code": 868924} - getWorkspaceFeatureFlags: - speakeasy-default-get-workspace-feature-flags: + application/json: {"message": "", "status_code": 411698} + getPublishingTokenByID: + speakeasy-default-get-publishing-token-by-ID: parameters: path: - workspace_id: "" + tokenID: "" responses: "200": - application/json: {} - 5XX: - application/json: {"message": "", "status_code": 104495} + application/json: {"created_at": "2024-12-02T05:03:56.616Z", "created_by": "", "id": "", "organization_id": "", "target_id": "", "target_resource": "document", "token": "", "token_name": "", "valid_until": "2023-06-04T22:39:04.224Z", "workspace_id": ""} + 4XX: + application/json: {"message": "", "status_code": 560933} getPublishingToken: speakeasy-default-get-publishing-token: responses: "200": - application/json: [{"created_at": "2023-01-18T23:26:03.849Z", "created_by": "", "id": "", "organization_id": "", "target_id": "", "target_resource": "document", "token": "", "token_name": "", "valid_until": "2025-04-22T08:39:55.981Z", "workspace_id": ""}, {"created_at": "2023-08-07T04:00:26.830Z", "created_by": "", "id": "", "organization_id": "", "target_id": "", "target_resource": "document", "token": "", "token_name": "", "valid_until": "2024-08-22T19:26:20.850Z", "workspace_id": ""}, {"created_at": "2024-01-27T14:50:38.288Z", "created_by": "", "id": "", "organization_id": "", "target_id": "", "target_resource": "document", "token": "", "token_name": "", "valid_until": "2025-01-13T10:26:00.433Z", "workspace_id": ""}] - 4XX: - application/json: {"message": "", "status_code": 136532} - getWorkspaceSettings: - speakeasy-default-get-workspace-settings: - parameters: - path: - workspace_id: "" - responses: - 2XX: - application/json: {"created_at": "2025-05-29T22:34:47.605Z", "updated_at": "2024-02-24T21:50:01.663Z", "webhook_url": "https://different-amendment.com/", "workspace_id": ""} - 4XX: - application/json: {"message": "", "status_code": 864485} - getWorkspaceTeam: - speakeasy-default-get-workspace-team: - parameters: - path: - workspace_id: "" - responses: - 2XX: - application/json: {"users": []} + application/json: [{"created_at": "2024-10-15T09:36:59.033Z", "created_by": "", "id": "", "organization_id": "", "target_id": "", "target_resource": "document", "token": "", "token_name": "", "valid_until": "2025-03-31T17:27:20.802Z", "workspace_id": ""}] 4XX: - application/json: {"message": "", "status_code": 194974} - getWorkspaceTokens: - speakeasy-default-get-workspace-tokens: - parameters: - path: - workspace_id: "" - responses: - 2XX: - application/json: [{"alg": "", "created_at": "2024-06-30T03:05:24.969Z", "id": "", "key": "", "name": "", "workspace_id": ""}, {"alg": "", "created_at": "2024-11-09T11:33:52.654Z", "id": "", "key": "", "name": "", "workspace_id": ""}, {"alg": "", "created_at": "2024-11-05T09:03:46.133Z", "id": "", "key": "", "name": "", "workspace_id": ""}] - 4XX: - application/json: {"message": "", "status_code": 858647} - grantUserAccessToWorkspace: - speakeasy-default-grant-user-access-to-workspace: + application/json: {"message": "", "status_code": 464289} + getPublishingTokenPublicMetadata: + speakeasy-default-get-publishing-token-public-metadata: parameters: path: - workspace_id: "" - email: "Lucinda.Batz8@hotmail.com" + tokenID: "" responses: "200": - application/json: {"relationship": {"user_id": "", "workspace_id": ""}} + application/json: {} 4XX: - application/json: {"message": "", "status_code": 621540} - revokeUserAccessToWorkspace: - speakeasy-default-revoke-user-access-to-workspace: + application/json: {"message": "", "status_code": 833471} + getPublishingTokenTargetByID: + speakeasy-default-get-publishing-token-target-by-ID: parameters: path: - workspace_id: "" - userId: "" - responses: - 4XX: - application/json: {"message": "", "status_code": 243814} - setWorkspaceFeatureFlags: - speakeasy-default-set-workspace-feature-flags: - requestBody: - application/json: {"feature_flags": ["skip_schema_registry", "webhooks"]} + tokenID: "" responses: "200": - application/json: {} - 5XX: - application/json: {"message": "", "status_code": 264889} - updateWorkspaceDetails: - speakeasy-default-update-workspace-details: - parameters: - path: - workspace_id: "" - requestBody: - application/json: {"created_at": "2025-07-28T19:04:48.565Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2024-10-16T10:52:42.015Z", "verified": true} - responses: + text/plain: "" 4XX: - application/json: {"message": "", "status_code": 991464} - updateWorkspaceSettings: - speakeasy-default-update-workspace-settings: + application/json: {"message": "", "status_code": 690090} + updatePublishingTokenExpiration: + speakeasy-default-update-publishing-token-expiration: parameters: path: - workspace_id: "" - requestBody: - application/json: {"created_at": "2023-07-05T11:43:28.305Z", "updated_at": "2024-05-14T05:39:21.874Z", "webhook_url": "https://grown-pharmacopoeia.net", "workspace_id": ""} + tokenID: "" responses: 4XX: - application/json: {"message": "", "status_code": 54657} + application/json: {"message": "", "status_code": 324979} getChangesReportSignedUrl: speakeasy-default-get-changes-report-signed-url: parameters: @@ -1297,7 +1163,7 @@ examples: documentChecksum: "" responses: 2XX: - application/json: {"url": "https://rosy-masterpiece.biz/"} + application/json: {"url": "https://babyish-foodstuffs.info/"} getLintingReportSignedUrl: speakeasy-default-get-linting-report-signed-url: parameters: @@ -1305,37 +1171,37 @@ examples: documentChecksum: "" responses: 2XX: - application/json: {"url": "https://negligible-merit.info"} + application/json: {"url": "https://somber-lashes.org/"} uploadReport: speakeasy-default-upload-report: requestBody: - multipart/form-data: {"data": {}, "file": {"": "example.file"}} + multipart/form-data: {"data": {}, "file": "x-file: example.file"} responses: 2XX: - application/json: {"url": "https://cluttered-stall.info"} + application/json: {"url": "https://aged-armoire.info"} createSchemaStoreItem: speakeasy-default-create-schema-store-item: requestBody: application/json: {"format": "yaml", "packageName": "", "sdkClassname": "", "spec": ""} responses: 2XX: - application/json: {"created_at": "2024-08-06T03:45:46.936Z", "format": "json", "id": "", "packageName": "", "sdkClassname": "", "spec": ""} + application/json: {"created_at": "2023-06-13T18:33:55.488Z", "format": "json", "id": "", "packageName": "", "sdkClassname": "", "spec": ""} 4XX: - application/json: {"message": "", "status_code": 769739} + application/json: {"message": "", "status_code": 865252} getSchemaStoreItem: speakeasy-default-get-schema-store-item: responses: 2XX: - application/json: {"created_at": "2023-02-14T01:44:55.437Z", "format": "yaml", "id": "", "packageName": "", "sdkClassname": "", "spec": ""} + application/json: {"created_at": "2024-08-18T15:04:44.601Z", "format": "yaml", "id": "", "packageName": "", "sdkClassname": "", "spec": ""} 4XX: - application/json: {"message": "", "status_code": 168509} + application/json: {"message": "", "status_code": 59948} create: speakeasy-default-create: requestBody: - application/json: {"url": "https://probable-heating.com/"} + application/json: {"url": "https://exalted-heroine.org/"} responses: 2XX: - application/json: {"full_url": "https://standard-utilization.com/", "short_url": "https://brisk-seafood.net/"} + application/json: {"full_url": "https://merry-luck.info", "short_url": "https://stable-tomb.biz/"} activateSubscriptionNamespace: speakeasy-default-activate-subscription-namespace: parameters: @@ -1344,7 +1210,7 @@ examples: namespaceName: "" responses: 4XX: - application/json: {"message": "", "status_code": 566510} + application/json: {"message": "", "status_code": 496630} ignoreSubscriptionNamespace: speakeasy-default-ignore-subscription-namespace: parameters: @@ -1353,31 +1219,31 @@ examples: namespaceName: "" responses: 4XX: - application/json: {"message": "", "status_code": 844164} + application/json: {"message": "", "status_code": 60658} suggest: speakeasy-default-suggest: parameters: header: x-session-id: "" requestBody: - application/json: {"diagnostics": [{"message": "", "path": ["/opt/include", "/opt/share"], "type": ""}, {"message": "", "path": [], "type": ""}], "oas_summary": {"info": {"description": "amid traffic the unfortunately underneath what father lovely out", "license": {}, "summary": "", "title": "", "version": ""}, "operations": [{"description": "times dull than except", "method": "", "operation_id": "", "path": "/mnt", "tags": ["", ""]}]}, "suggestion_type": "diagnostics-only"} + application/json: {"diagnostics": [{"message": "", "path": ["/usr/src"], "type": ""}], "oas_summary": {"info": {"description": "prioritize bell vainly", "license": {}, "summary": "", "title": "", "version": ""}, "operations": [{"description": "though since instead accurate safe unnaturally charming", "method": "", "operation_id": "", "path": "/usr/local/bin", "tags": ["", ""]}]}, "suggestion_type": "method-names"} responses: 2XX: application/json: "x-file: example.file" suggestItems: speakeasy-default-suggest-items: requestBody: - application/json: {"items": [], "prompt": ""} + application/json: {"items": [""], "prompt": ""} responses: 2XX: - application/json: ["", ""] + application/json: ["", ""] suggestOpenAPI: speakeasy-default-suggest-open-API: parameters: header: x-session-id: "" requestBody: - multipart/form-data: {"schema": {"": "example.file"}} + multipart/form-data: {"schema": "x-file: example.file"} responses: 2XX: application/json: "x-file: example.file" @@ -1392,68 +1258,196 @@ examples: responses: 2XX: application/json: "x-file: example.file" + createWorkspace: + speakeasy-default-create-workspace: + requestBody: + application/json: {"created_at": "2023-11-18T13:41:10.525Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2024-11-21T08:36:32.740Z", "verified": true} + responses: + 2XX: + application/json: {"created_at": "2023-04-24T17:11:44.872Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2023-07-24T11:15:07.239Z", "verified": false} + 4XX: + application/json: {"message": "", "status_code": 373179} + createWorkspaceToken: + speakeasy-default-create-workspace-token: + parameters: + path: + workspace_id: "" + requestBody: + application/json: {"alg": "", "created_at": "2024-10-04T10:23:04.522Z", "id": "", "key": "", "name": "", "workspace_id": ""} + responses: + 4XX: + application/json: {"message": "", "status_code": 869423} + deleteWorkspaceToken: + speakeasy-default-delete-workspace-token: + parameters: + path: + workspace_id: "" + tokenID: "" + responses: + 4XX: + application/json: {"message": "", "status_code": 478706} + getWorkspaceByContext: + speakeasy-default-get-workspace-by-context: + responses: + 2XX: + application/json: {"organization": {"account_type": "free", "created_at": "2024-11-04T19:58:57.410Z", "id": "", "name": "", "slug": "", "sso_activated": true, "telemetry_disabled": true, "updated_at": "2023-03-22T01:46:46.818Z"}, "workspace": {"created_at": "2023-06-27T03:14:56.721Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2024-04-17T17:49:11.505Z", "verified": false}} + 4XX: + application/json: {"message": "", "status_code": 305240} + getWorkspaces: + speakeasy-default-get-workspaces: + responses: + 2XX: + application/json: [{"created_at": "2025-04-04T16:14:43.471Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2023-01-19T03:44:32.150Z", "verified": false}] + 4XX: + application/json: {"message": "", "status_code": 660531} + getWorkspace: + speakeasy-default-get-workspace: + parameters: + path: + workspace_id: "" + responses: + 2XX: + application/json: {"created_at": "2024-12-18T07:48:58.821Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2025-06-24T23:43:05.468Z", "verified": true} + 4XX: + application/json: {"message": "", "status_code": 239288} + getWorkspaceFeatureFlags: + speakeasy-default-get-workspace-feature-flags: + parameters: + path: + workspace_id: "" + responses: + "200": + application/json: {} + 5XX: + application/json: {"message": "", "status_code": 689983} + getWorkspaceSettings: + speakeasy-default-get-workspace-settings: + parameters: + path: + workspace_id: "" + responses: + 2XX: + application/json: {"created_at": "2025-01-01T09:37:48.245Z", "updated_at": "2025-10-09T10:59:45.889Z", "webhook_url": "https://dirty-taxicab.name/", "workspace_id": ""} + 4XX: + application/json: {"message": "", "status_code": 88356} + getWorkspaceTeam: + speakeasy-default-get-workspace-team: + parameters: + path: + workspace_id: "" + responses: + 2XX: + application/json: {"users": []} + 4XX: + application/json: {"message": "", "status_code": 227320} + getWorkspaceTokens: + speakeasy-default-get-workspace-tokens: + parameters: + path: + workspace_id: "" + responses: + 2XX: + application/json: [{"alg": "", "created_at": "2024-09-13T14:17:43.018Z", "id": "", "key": "", "name": "", "workspace_id": ""}] + 4XX: + application/json: {"message": "", "status_code": 306057} + grantUserAccessToWorkspace: + speakeasy-default-grant-user-access-to-workspace: + parameters: + path: + workspace_id: "" + email: "Idella24@gmail.com" + responses: + "200": + application/json: {"relationship": {"user_id": "", "workspace_id": ""}} + 4XX: + application/json: {"message": "", "status_code": 146190} + revokeUserAccessToWorkspace: + speakeasy-default-revoke-user-access-to-workspace: + parameters: + path: + workspace_id: "" + userId: "" + responses: + 4XX: + application/json: {"message": "", "status_code": 910892} + setWorkspaceFeatureFlags: + speakeasy-default-set-workspace-feature-flags: + requestBody: + application/json: {"feature_flags": []} + responses: + "200": + application/json: {} + 5XX: + application/json: {"message": "", "status_code": 831800} + updateWorkspaceDetails: + speakeasy-default-update-workspace-details: + parameters: + path: + workspace_id: "" + requestBody: + application/json: {"created_at": "2023-08-02T22:30:24.264Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2025-01-24T03:53:13.581Z", "verified": true} + responses: + 4XX: + application/json: {"message": "", "status_code": 708653} + updateWorkspaceSettings: + speakeasy-default-update-workspace-settings: + parameters: + path: + workspace_id: "" + requestBody: + application/json: {"created_at": "2025-03-09T15:48:09.330Z", "updated_at": "2025-11-24T16:37:53.492Z", "webhook_url": "https://wobbly-lid.org", "workspace_id": ""} + responses: + 4XX: + application/json: {"message": "", "status_code": 911456} getWorkspaceEventsByTarget: speakeasy-default-get-workspace-events-by-target: parameters: path: workspace_id: "" target_id: "" - query: {} responses: "200": - application/json: [{"created_at": "2023-11-22T11:46:52.430Z", "execution_id": "", "id": "", "interaction_type": "QUICKSTART", "local_started_at": "2023-09-25T12:14:43.566Z", "speakeasy_api_key_name": "", "speakeasy_version": "", "success": true, "workspace_id": ""}] + application/json: [{"created_at": "2023-04-02T15:35:18.939Z", "execution_id": "", "id": "", "interaction_type": "TARGET_GENERATE", "local_started_at": "2025-04-06T11:11:25.699Z", "speakeasy_api_key_name": "", "speakeasy_version": "", "success": false, "workspace_id": ""}] 5XX: - application/json: {"message": "", "status_code": 858330} + application/json: {"message": "", "status_code": 224805} getWorkspaceTargets: speakeasy-default-get-workspace-targets: responses: "200": - application/json: [{"generate_gen_lock_id": "", "generate_target": "", "id": "", "last_event_created_at": "2025-12-14T05:15:52.449Z", "last_event_id": "", "last_event_interaction_type": "TARGET_GENERATE"}, {"generate_gen_lock_id": "", "generate_target": "", "id": "", "last_event_created_at": "2023-05-31T08:33:28.499Z", "last_event_id": "", "last_event_interaction_type": "CLI_EXEC"}] + application/json: [{"generate_gen_lock_id": "", "generate_target": "", "id": "", "last_event_created_at": "2025-11-25T04:49:38.730Z", "last_event_id": "", "last_event_interaction_type": "AUTHENTICATE"}] 5XX: - application/json: {"message": "", "status_code": 801192} + application/json: {"message": "", "status_code": 869083} getWorkspaceTargetsDeprecated: speakeasy-default-get-workspace-targets-deprecated: parameters: path: workspace_id: "" - query: {} responses: "200": - application/json: [{"generate_gen_lock_id": "", "generate_target": "", "id": "", "last_event_created_at": "2023-10-08T11:47:38.510Z", "last_event_id": "", "last_event_interaction_type": "TOMBSTONE"}] + application/json: [{"generate_gen_lock_id": "", "generate_target": "", "id": "", "last_event_created_at": "2023-03-04T07:55:39.835Z", "last_event_id": "", "last_event_interaction_type": "QUICKSTART"}] 5XX: - application/json: {"message": "", "status_code": 264673} + application/json: {"message": "", "status_code": 397013} postWorkspaceEvents: speakeasy-default-post-workspace-events: parameters: path: workspace_id: "" requestBody: - application/json: [{"created_at": "2025-03-02T10:07:28.113Z", "execution_id": "", "id": "", "interaction_type": "AUTHENTICATE", "local_started_at": "2025-08-12T17:54:17.538Z", "speakeasy_api_key_name": "", "speakeasy_version": "", "success": true, "workspace_id": ""}] + application/json: [{"created_at": "2023-02-16T09:12:42.397Z", "execution_id": "", "id": "", "interaction_type": "QUICKSTART", "local_started_at": "2024-01-24T01:13:51.002Z", "speakeasy_api_key_name": "", "speakeasy_version": "", "success": true, "workspace_id": ""}] responses: 5XX: - application/json: {"message": "", "status_code": 630719} + application/json: {"message": "", "status_code": 104921} searchWorkspaceEvents: speakeasy-default-search-workspace-events: parameters: path: workspace_id: "" - query: {} responses: "200": - application/json: [{"created_at": "2024-01-24T23:49:11.608Z", "execution_id": "", "id": "", "interaction_type": "LINT", "local_started_at": "2023-03-09T07:00:10.489Z", "speakeasy_api_key_name": "", "speakeasy_version": "", "success": true, "workspace_id": ""}] + application/json: [{"created_at": "2024-08-19T16:09:42.068Z", "execution_id": "", "id": "", "interaction_type": "TEST", "local_started_at": "2024-07-02T15:46:28.663Z", "speakeasy_api_key_name": "", "speakeasy_version": "", "success": false, "workspace_id": ""}] 5XX: - application/json: {"message": "", "status_code": 238575} - getPublishingTokenPublicMetadata: - speakeasy-default-get-publishing-token-public-metadata: - parameters: - path: - tokenID: "" - responses: - "200": - application/json: {} - 4XX: - application/json: {"message": "", "status_code": 25297} -examplesVersion: 1.0.1 + application/json: {"message": "", "status_code": 436496} +examplesVersion: 1.0.2 generatedTests: generateCodeSamplePreview: "2024-12-09T10:07:33-05:00" generateCodeSamplePreviewAsync: "2024-12-09T10:07:33-05:00" @@ -1542,3 +1536,6 @@ generatedTests: updatePublishingTokenExpiration: "2025-04-09T22:02:41Z" getPublishingToken: "2025-04-09T22:02:41Z" getPublishingTokenPublicMetadata: "2025-04-16T22:02:42Z" + generateCodeSamplePreview-default: "2025-11-07T22:07:48Z" + getCodeSamples-default: "2025-11-07T22:07:48Z" + getCodeSamplePreviewAsync-default: "2025-11-07T22:07:48Z" diff --git a/.speakeasy/tests.arazzo.yaml b/.speakeasy/tests.arazzo.yaml index c14b35ea..66541dd8 100644 --- a/.speakeasy/tests.arazzo.yaml +++ b/.speakeasy/tests.arazzo.yaml @@ -1916,3 +1916,99 @@ workflows: {} type: simple x-speakeasy-test-group: PublishingTokens + - workflowId: generateCodeSamplePreview-default + steps: + - stepId: test + operationId: generateCodeSamplePreview + requestBody: + contentType: multipart/form-data + payload: + language: + schema_file: 'x-file: example.file' + successCriteria: + - condition: $statusCode == 2XX + - condition: $response.header.Content-Type == application/json + - context: $response.body + condition: | + { + "snippets": [ + { + "code": "import { Petstore } from \"petstore-sdk\";\n\nconst petstore = new Petstore({\n apiKey: \"\u003cYOUR_API_KEY_HERE\u003e\",\n});\n\nasync function run() {\n const result = await petstore.pet.getById({\n id: 137396,\n });\n\n // Handle the result\n console.log(result);\n}\n\nrun();", + "language": "typescript", + "method": "get", + "operationId": "getPetById", + "path": "/pet/{id}" + } + ] + } + type: simple + x-speakeasy-test-group: CodeSamples + x-speakeasy-test-rebuild: true + - workflowId: getCodeSamples-default + steps: + - stepId: test + operationId: getCodeSamples + parameters: + - name: registry_url + in: query + value: https://spec.speakeasy.com/my-org/my-workspace/my-source + - name: operation_ids + in: query + value: + - getPets + - name: method_paths + in: query + value: + - method: get + path: /pets + - name: languages + in: query + value: + - python + - javascript + successCriteria: + - condition: $statusCode == 2XX + - condition: $response.header.Content-Type == application/json + - context: $response.body + condition: | + { + "snippets": [ + { + "code": "import { Petstore } from \"petstore-sdk\";\n\nconst petstore = new Petstore({\n apiKey: \"\u003cYOUR_API_KEY_HERE\u003e\",\n});\n\nasync function run() {\n const result = await petstore.pet.getById({\n id: 137396,\n });\n\n // Handle the result\n console.log(result);\n}\n\nrun();", + "language": "typescript", + "method": "get", + "operationId": "getPetById", + "path": "/pet/{id}" + } + ] + } + type: simple + x-speakeasy-test-group: CodeSamples + x-speakeasy-test-rebuild: true + - workflowId: getCodeSamplePreviewAsync-default + steps: + - stepId: test + operationId: getCodeSamplePreviewAsync + parameters: + - name: jobID + in: path + value: + successCriteria: + - condition: $statusCode == 2XX + - condition: $response.header.Content-Type == application/json + - context: $response.body + condition: | + { + "snippets": [ + { + "code": "import { Petstore } from \"petstore-sdk\";\n\nconst petstore = new Petstore({\n apiKey: \"\u003cYOUR_API_KEY_HERE\u003e\",\n});\n\nasync function run() {\n const result = await petstore.pet.getById({\n id: 137396,\n });\n\n // Handle the result\n console.log(result);\n}\n\nrun();", + "language": "typescript", + "method": "get", + "operationId": "getPetById", + "path": "/pet/{id}" + } + ] + } + type: simple + x-speakeasy-test-group: CodeSamples + x-speakeasy-test-rebuild: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index fd570b3a..49ab73a9 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.542.3 +speakeasyVersion: 1.651.0 sources: my-source: sourceNamespace: my-source - sourceRevisionDigest: sha256:402d99fabeef032d62c39870ff2b3f9eb8dd356a76a76f07295ac3b4a94af8e0 - sourceBlobDigest: sha256:0442ef7698d8979dd825b3eab0ab868ac86580f4cffcd3e0dff7afdd6191e6d9 + sourceRevisionDigest: sha256:9128c3df436950ca04fec9dfc74e769e8b492d434b115b197d68da656ae17d23 + sourceBlobDigest: sha256:6eb8a6e215c36d3e11d86fc67d5ce7af499bdb934e0f7fbad17efcdde9bffd73 tags: - latest - main @@ -12,10 +12,10 @@ targets: speakeasy-client-sdk-go: source: my-source sourceNamespace: my-source - sourceRevisionDigest: sha256:402d99fabeef032d62c39870ff2b3f9eb8dd356a76a76f07295ac3b4a94af8e0 - sourceBlobDigest: sha256:0442ef7698d8979dd825b3eab0ab868ac86580f4cffcd3e0dff7afdd6191e6d9 + sourceRevisionDigest: sha256:9128c3df436950ca04fec9dfc74e769e8b492d434b115b197d68da656ae17d23 + sourceBlobDigest: sha256:6eb8a6e215c36d3e11d86fc67d5ce7af499bdb934e0f7fbad17efcdde9bffd73 codeSamplesNamespace: code-samples-go-speakeasy-client-sdk-go - codeSamplesRevisionDigest: sha256:367336fdd435084f895195faf801e7618cdb3d206b55fab1b1d220870ad39fd6 + codeSamplesRevisionDigest: sha256:27eccaf3b23754cdf4dde0633f2c49a41daa79c65d40a2801b4d829f9c4bba74 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 36c05714..8540f67c 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ For more information about the API: [The Speakeasy Platform Documentation](/docs To add the SDK as a dependency to your project: ```bash -go get github.com/speakeasy-api/speakeasy-client-sdk-go +go get github.com/speakeasy-api/speakeasy-client-sdk-go/v3 ``` @@ -54,7 +54,7 @@ package main import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -62,9 +62,9 @@ import ( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -172,7 +172,6 @@ func main() { * [Create](docs/sdks/shorturls/README.md#create) - Shorten a URL. - ### [Subscriptions](docs/sdks/subscriptions/README.md) * [ActivateSubscriptionNamespace](docs/sdks/subscriptions/README.md#activatesubscriptionnamespace) - Activate an ignored namespace for a subscription @@ -236,7 +235,7 @@ package main import ( "context" "errors" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" @@ -245,9 +244,9 @@ import ( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -291,7 +290,7 @@ package main import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -299,10 +298,10 @@ import ( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServer("prod"), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServer("prod"), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -325,7 +324,7 @@ package main import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -333,10 +332,10 @@ import ( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL("https://api.prod.speakeasy.com"), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL("https://api.prod.speakeasy.com"), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -371,12 +370,13 @@ The built-in `net/http` client satisfies this interface and a default client bas import ( "net/http" "time" - "github.com/myorg/your-go-sdk" + + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" ) var ( httpClient = &http.Client{Timeout: 30 * time.Second} - sdkClient = sdk.New(sdk.WithClient(httpClient)) + sdkClient = v3.New(v3.WithClient(httpClient)) ) ``` @@ -404,7 +404,7 @@ package main import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -412,9 +412,9 @@ import ( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -453,7 +453,7 @@ package main import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -461,7 +461,9 @@ import ( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New() + s := v3.New( + v3.WithWorkspaceID(""), + ) res, err := s.Auth.GetAccessToken(ctx, operations.GetAccessTokenRequest{ WorkspaceID: "", @@ -488,7 +490,7 @@ package main import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/retry" "log" @@ -498,9 +500,9 @@ import ( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -531,7 +533,7 @@ package main import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/retry" "log" @@ -540,8 +542,8 @@ import ( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithRetryConfig( + s := v3.New( + v3.WithRetryConfig( retry.Config{ Strategy: "backoff", Backoff: &retry.BackoffStrategy{ @@ -552,8 +554,8 @@ func main() { }, RetryConnectionErrors: false, }), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/RELEASES.md b/RELEASES.md index 014a3def..85716856 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1736,4 +1736,14 @@ Based on: ### Generated - [go v3.26.7] . ### Releases -- [Go v3.26.7] https://github.com/speakeasy-api/speakeasy-client-sdk-go/releases/tag/v3.26.7 - . \ No newline at end of file +- [Go v3.26.7] https://github.com/speakeasy-api/speakeasy-client-sdk-go/releases/tag/v3.26.7 - . + +## 2025-11-07 22:07:33 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.651.0 (2.745.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v3.27.0] . +### Releases +- [Go v3.27.0] https://github.com/speakeasy-api/speakeasy-client-sdk-go/releases/tag/v3.27.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 50954e54..bbd6f776 100644 --- a/USAGE.md +++ b/USAGE.md @@ -4,7 +4,7 @@ package main import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -12,9 +12,9 @@ import ( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/artifacts.go b/artifacts.go index cc49a122..7a41bb6a 100644 --- a/artifacts.go +++ b/artifacts.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -18,12 +19,16 @@ import ( // Artifacts - REST APIs for working with Registry artifacts type Artifacts struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newArtifacts(sdkConfig sdkConfiguration) *Artifacts { +func newArtifacts(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Artifacts { return &Artifacts{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -53,11 +58,13 @@ func (s *Artifacts) CreateRemoteSource(ctx context.Context, request *shared.Remo } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "createRemoteSource", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "createRemoteSource", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -113,15 +120,17 @@ func (s *Artifacts) CreateRemoteSource(ctx context.Context, request *shared.Remo "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -138,7 +147,7 @@ func (s *Artifacts) CreateRemoteSource(ctx context.Context, request *shared.Remo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -146,13 +155,13 @@ func (s *Artifacts) CreateRemoteSource(ctx context.Context, request *shared.Remo if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -165,17 +174,17 @@ func (s *Artifacts) CreateRemoteSource(ctx context.Context, request *shared.Remo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -255,11 +264,13 @@ func (s *Artifacts) GetBlob(ctx context.Context, request operations.GetBlobReque } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getBlob", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getBlob", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -308,15 +319,17 @@ func (s *Artifacts) GetBlob(ctx context.Context, request operations.GetBlobReque "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -333,7 +346,7 @@ func (s *Artifacts) GetBlob(ctx context.Context, request operations.GetBlobReque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -341,13 +354,13 @@ func (s *Artifacts) GetBlob(ctx context.Context, request operations.GetBlobReque if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -360,17 +373,17 @@ func (s *Artifacts) GetBlob(ctx context.Context, request operations.GetBlobReque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -462,11 +475,13 @@ func (s *Artifacts) GetManifest(ctx context.Context, request operations.GetManif } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getManifest", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getManifest", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -515,15 +530,17 @@ func (s *Artifacts) GetManifest(ctx context.Context, request operations.GetManif "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -540,7 +557,7 @@ func (s *Artifacts) GetManifest(ctx context.Context, request operations.GetManif err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -548,13 +565,13 @@ func (s *Artifacts) GetManifest(ctx context.Context, request operations.GetManif if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -567,17 +584,17 @@ func (s *Artifacts) GetManifest(ctx context.Context, request operations.GetManif err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -677,11 +694,13 @@ func (s *Artifacts) GetNamespaces(ctx context.Context, opts ...operations.Option } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getNamespaces", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getNamespaces", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -730,15 +749,17 @@ func (s *Artifacts) GetNamespaces(ctx context.Context, opts ...operations.Option "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -755,7 +776,7 @@ func (s *Artifacts) GetNamespaces(ctx context.Context, opts ...operations.Option err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -763,13 +784,13 @@ func (s *Artifacts) GetNamespaces(ctx context.Context, opts ...operations.Option if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -782,17 +803,17 @@ func (s *Artifacts) GetNamespaces(ctx context.Context, opts ...operations.Option err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -891,11 +912,13 @@ func (s *Artifacts) GetRevisions(ctx context.Context, request operations.GetRevi } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getRevisions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getRevisions", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -948,15 +971,17 @@ func (s *Artifacts) GetRevisions(ctx context.Context, request operations.GetRevi "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -973,7 +998,7 @@ func (s *Artifacts) GetRevisions(ctx context.Context, request operations.GetRevi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -981,13 +1006,13 @@ func (s *Artifacts) GetRevisions(ctx context.Context, request operations.GetRevi if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1000,17 +1025,17 @@ func (s *Artifacts) GetRevisions(ctx context.Context, request operations.GetRevi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1109,11 +1134,13 @@ func (s *Artifacts) GetTags(ctx context.Context, request operations.GetTagsReque } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getTags", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getTags", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1162,15 +1189,17 @@ func (s *Artifacts) GetTags(ctx context.Context, request operations.GetTagsReque "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1187,7 +1216,7 @@ func (s *Artifacts) GetTags(ctx context.Context, request operations.GetTagsReque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1195,13 +1224,13 @@ func (s *Artifacts) GetTags(ctx context.Context, request operations.GetTagsReque if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1214,17 +1243,17 @@ func (s *Artifacts) GetTags(ctx context.Context, request operations.GetTagsReque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1324,11 +1353,13 @@ func (s *Artifacts) ListRemoteSources(ctx context.Context, request operations.Li } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "listRemoteSources", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "listRemoteSources", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1381,15 +1412,17 @@ func (s *Artifacts) ListRemoteSources(ctx context.Context, request operations.Li "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1406,7 +1439,7 @@ func (s *Artifacts) ListRemoteSources(ctx context.Context, request operations.Li err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1414,13 +1447,13 @@ func (s *Artifacts) ListRemoteSources(ctx context.Context, request operations.Li if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1433,17 +1466,17 @@ func (s *Artifacts) ListRemoteSources(ctx context.Context, request operations.Li err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1543,11 +1576,13 @@ func (s *Artifacts) PostTags(ctx context.Context, request operations.PostTagsReq } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "postTags", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "postTags", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "AddTags", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1603,15 +1638,17 @@ func (s *Artifacts) PostTags(ctx context.Context, request operations.PostTagsReq "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1628,7 +1665,7 @@ func (s *Artifacts) PostTags(ctx context.Context, request operations.PostTagsReq err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1636,13 +1673,13 @@ func (s *Artifacts) PostTags(ctx context.Context, request operations.PostTagsReq if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1655,17 +1692,17 @@ func (s *Artifacts) PostTags(ctx context.Context, request operations.PostTagsReq err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1745,11 +1782,13 @@ func (s *Artifacts) Preflight(ctx context.Context, request *shared.PreflightRequ } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "preflight", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "preflight", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1805,15 +1844,17 @@ func (s *Artifacts) Preflight(ctx context.Context, request *shared.PreflightRequ "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1830,7 +1871,7 @@ func (s *Artifacts) Preflight(ctx context.Context, request *shared.PreflightRequ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1838,13 +1879,13 @@ func (s *Artifacts) Preflight(ctx context.Context, request *shared.PreflightRequ if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1857,17 +1898,17 @@ func (s *Artifacts) Preflight(ctx context.Context, request *shared.PreflightRequ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1967,11 +2008,13 @@ func (s *Artifacts) SetArchived(ctx context.Context, request operations.ArchiveN } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "archiveNamespace", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "archiveNamespace", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2027,15 +2070,17 @@ func (s *Artifacts) SetArchived(ctx context.Context, request operations.ArchiveN "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2052,7 +2097,7 @@ func (s *Artifacts) SetArchived(ctx context.Context, request operations.ArchiveN err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2060,13 +2105,13 @@ func (s *Artifacts) SetArchived(ctx context.Context, request operations.ArchiveN if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2079,17 +2124,17 @@ func (s *Artifacts) SetArchived(ctx context.Context, request operations.ArchiveN err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2169,11 +2214,13 @@ func (s *Artifacts) SetVisibility(ctx context.Context, request operations.SetVis } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "setVisibility", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "setVisibility", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2229,15 +2276,17 @@ func (s *Artifacts) SetVisibility(ctx context.Context, request operations.SetVis "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2254,7 +2303,7 @@ func (s *Artifacts) SetVisibility(ctx context.Context, request operations.SetVis err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2262,13 +2311,13 @@ func (s *Artifacts) SetVisibility(ctx context.Context, request operations.SetVis if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2281,17 +2330,17 @@ func (s *Artifacts) SetVisibility(ctx context.Context, request operations.SetVis err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/auth.go b/auth.go index af8c4dab..a9768d22 100644 --- a/auth.go +++ b/auth.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -18,12 +19,16 @@ import ( // Auth - REST APIs for managing Authentication type Auth struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newAuth(sdkConfig sdkConfiguration) *Auth { +func newAuth(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Auth { return &Auth{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -54,11 +59,13 @@ func (s *Auth) GetAccess(ctx context.Context, request operations.GetWorkspaceAcc } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getWorkspaceAccess", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getWorkspaceAccess", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -120,15 +127,17 @@ func (s *Auth) GetAccess(ctx context.Context, request operations.GetWorkspaceAcc "503", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -145,7 +154,7 @@ func (s *Auth) GetAccess(ctx context.Context, request operations.GetWorkspaceAcc err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -153,13 +162,13 @@ func (s *Auth) GetAccess(ctx context.Context, request operations.GetWorkspaceAcc if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -172,17 +181,17 @@ func (s *Auth) GetAccess(ctx context.Context, request operations.GetWorkspaceAcc err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -267,11 +276,13 @@ func (s *Auth) GetAccessToken(ctx context.Context, request operations.GetAccessT } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getAccessToken", - OAuth2Scopes: []string{}, - SecuritySource: nil, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getAccessToken", + OAuth2Scopes: nil, + SecuritySource: nil, } timeout := o.Timeout @@ -320,15 +331,17 @@ func (s *Auth) GetAccessToken(ctx context.Context, request operations.GetAccessT "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -345,7 +358,7 @@ func (s *Auth) GetAccessToken(ctx context.Context, request operations.GetAccessT err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -353,13 +366,13 @@ func (s *Auth) GetAccessToken(ctx context.Context, request operations.GetAccessT if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -372,17 +385,17 @@ func (s *Auth) GetAccessToken(ctx context.Context, request operations.GetAccessT err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -482,11 +495,13 @@ func (s *Auth) GetUser(ctx context.Context, opts ...operations.Option) (*operati } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getUser", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getUser", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -535,15 +550,17 @@ func (s *Auth) GetUser(ctx context.Context, opts ...operations.Option) (*operati "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -560,7 +577,7 @@ func (s *Auth) GetUser(ctx context.Context, opts ...operations.Option) (*operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -568,13 +585,13 @@ func (s *Auth) GetUser(ctx context.Context, opts ...operations.Option) (*operati if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -587,17 +604,17 @@ func (s *Auth) GetUser(ctx context.Context, opts ...operations.Option) (*operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -697,11 +714,13 @@ func (s *Auth) ValidateAPIKey(ctx context.Context, opts ...operations.Option) (* } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "validateApiKey", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "validateApiKey", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -750,15 +769,17 @@ func (s *Auth) ValidateAPIKey(ctx context.Context, opts ...operations.Option) (* "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -775,7 +796,7 @@ func (s *Auth) ValidateAPIKey(ctx context.Context, opts ...operations.Option) (* err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -783,13 +804,13 @@ func (s *Auth) ValidateAPIKey(ctx context.Context, opts ...operations.Option) (* if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -802,17 +823,17 @@ func (s *Auth) ValidateAPIKey(ctx context.Context, opts ...operations.Option) (* err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/codeSamples.yaml b/codeSamples.yaml index affef0e8..41584b52 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -13,17 +13,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -45,8 +45,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -54,9 +54,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -80,8 +80,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -89,9 +89,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -115,8 +115,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -124,9 +124,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -150,8 +150,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -159,9 +159,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -185,8 +185,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -194,9 +194,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -220,17 +220,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -252,8 +252,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -261,9 +261,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -287,17 +287,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -319,7 +319,7 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -327,7 +327,7 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New() + s := v3.New() res, err := s.Auth.GetAccessToken(ctx, operations.GetAccessTokenRequest{ WorkspaceID: "", @@ -349,17 +349,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -381,8 +381,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -390,16 +390,22 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.CodeSamples.Get(ctx, operations.GetCodeSamplesRequest{ RegistryURL: "https://spec.speakeasy.com/my-org/my-workspace/my-source", OperationIds: []string{ - "getPets", + "g", + "e", + "t", + "P", + "e", + "t", + "s", }, MethodPaths: []operations.MethodPaths{ operations.MethodPaths{ @@ -429,8 +435,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "os" "log" ) @@ -438,23 +444,22 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - content, fileErr := os.Open("example.file") + example, fileErr := os.Open("example.file") if fileErr != nil { panic(fileErr) } - res, err := s.CodeSamples.GenerateCodeSamplePreview(ctx, shared.CodeSampleSchemaInput{ Language: "", SchemaFile: shared.SchemaFile{ FileName: "example.file", - Content: content, + Content: example, }, }) if err != nil { @@ -474,8 +479,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "os" "log" ) @@ -483,23 +488,22 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - content, fileErr := os.Open("example.file") + example, fileErr := os.Open("example.file") if fileErr != nil { panic(fileErr) } - res, err := s.CodeSamples.GenerateCodeSamplePreviewAsync(ctx, shared.CodeSampleSchemaInput{ Language: "", SchemaFile: shared.SchemaFile{ FileName: "example.file", - Content: content, + Content: example, }, }) if err != nil { @@ -519,8 +523,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -528,9 +532,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -554,8 +558,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -563,9 +567,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -590,8 +594,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -599,9 +603,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -626,17 +630,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -662,17 +666,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -681,7 +685,7 @@ actions: Repo: "", Input: "", Overlays: []string{ - "", + "", }, }) if err != nil { @@ -701,17 +705,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -736,8 +740,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -745,9 +749,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -769,8 +773,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -778,9 +782,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -806,8 +810,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -815,9 +819,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -841,17 +845,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -875,8 +879,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -884,9 +888,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -912,17 +916,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -948,8 +952,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -957,9 +961,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -986,8 +990,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -995,9 +999,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1024,8 +1028,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "log" ) @@ -1033,9 +1037,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1045,8 +1049,8 @@ actions: Slug: "", AccountType: shared.AccountTypeScaleUp, TelemetryDisabled: false, - CreatedAt: types.MustTimeFromString("2024-04-02T12:48:32.253Z"), - UpdatedAt: types.MustTimeFromString("2023-05-28T06:20:22.766Z"), + CreatedAt: types.MustTimeFromString("2025-12-17T21:02:28.497Z"), + UpdatedAt: types.MustTimeFromString("2025-07-22T00:26:10.078Z"), SsoActivated: true, }) if err != nil { @@ -1066,17 +1070,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1098,25 +1102,23 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Organizations.CreateBillingAddOns(ctx, shared.OrganizationBillingAddOnRequest{ AddOns: []shared.BillingAddOn{ shared.BillingAddOnCustomCodeRegions, - shared.BillingAddOnCustomCodeRegions, - shared.BillingAddOnSDKTesting, }, }) if err != nil { @@ -1136,8 +1138,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1145,14 +1147,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Organizations.DeleteBillingAddOn(ctx, operations.DeleteBillingAddOnRequest{ - AddOn: shared.BillingAddOnSnippetAi, + AddOn: shared.BillingAddOnSDKTesting, }) if err != nil { log.Fatal(err) @@ -1171,17 +1173,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1203,17 +1205,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1235,8 +1237,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1244,9 +1246,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1270,17 +1272,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1302,17 +1304,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1334,17 +1336,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1366,8 +1368,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1375,9 +1377,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1401,8 +1403,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1410,9 +1412,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1436,8 +1438,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1445,9 +1447,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1471,8 +1473,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1480,9 +1482,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1506,8 +1508,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1515,9 +1517,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1541,8 +1543,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "os" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -1551,23 +1553,22 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - content, fileErr := os.Open("example.file") + example, fileErr := os.Open("example.file") if fileErr != nil { panic(fileErr) } - res, err := s.Reports.UploadReport(ctx, operations.UploadReportRequestBody{ Data: shared.Report{}, File: operations.File{ FileName: "example.file", - Content: content, + Content: example, }, }) if err != nil { @@ -1587,8 +1588,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1596,9 +1597,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1622,8 +1623,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1631,9 +1632,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1657,17 +1658,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1689,8 +1690,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1698,9 +1699,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1727,8 +1728,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1736,14 +1737,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.ShortURLs.Create(ctx, operations.CreateRequestBody{ - URL: "https://probable-heating.com/", + URL: "https://exalted-heroine.org/", }) if err != nil { log.Fatal(err) @@ -1762,8 +1763,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1771,9 +1772,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1798,8 +1799,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1807,9 +1808,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1834,23 +1835,25 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Suggest.SuggestItems(ctx, shared.SuggestItemsRequestBody{ Prompt: "", - Items: []string{}, + Items: []string{ + "", + }, }) if err != nil { log.Fatal(err) @@ -1869,8 +1872,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "os" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -1879,24 +1882,23 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - content, fileErr := os.Open("example.file") + example, fileErr := os.Open("example.file") if fileErr != nil { panic(fileErr) } - res, err := s.Suggest.SuggestOpenAPI(ctx, operations.SuggestOpenAPIRequest{ XSessionID: "", RequestBody: operations.SuggestOpenAPIRequestBody{ Schema: operations.Schema{ FileName: "example.file", - Content: content, + Content: example, }, }, }) @@ -1917,8 +1919,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1926,9 +1928,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1954,8 +1956,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -1963,9 +1965,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -1976,13 +1978,13 @@ actions: Info: shared.OASInfo{ Title: "", Summary: "", - Description: "ugh which garrote ashamed sarong fiddle really", + Description: "strictly shyly who and than majority unit boohoo", Version: "", License: shared.License{}, }, Operations: []shared.OASOperation{}, }, - SuggestionType: shared.SuggestRequestBodySuggestionTypeDiagnosticsOnly, + SuggestionType: shared.SuggestRequestBodySuggestionTypeMethodNames, Diagnostics: []shared.Diagnostic{}, }, }) @@ -2003,17 +2005,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -2035,17 +2037,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -2067,8 +2069,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "log" ) @@ -2076,19 +2078,19 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.Create(ctx, shared.Workspace{ - CreatedAt: types.MustTimeFromString("2024-06-17T07:14:55.338Z"), + CreatedAt: types.MustTimeFromString("2023-11-18T13:41:10.525Z"), ID: "", Name: "", OrganizationID: "", Slug: "", - UpdatedAt: types.MustTimeFromString("2024-11-30T17:06:07.804Z"), + UpdatedAt: types.MustTimeFromString("2024-11-21T08:36:32.740Z"), Verified: true, }) if err != nil { @@ -2108,8 +2110,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2117,9 +2119,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -2141,8 +2143,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2150,9 +2152,9 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -2174,25 +2176,22 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.SetFeatureFlags(ctx, shared.WorkspaceFeatureFlagRequest{ - FeatureFlags: []shared.WorkspaceFeatureFlag{ - shared.WorkspaceFeatureFlagSkipSchemaRegistry, - shared.WorkspaceFeatureFlagWebhooks, - }, + FeatureFlags: []shared.WorkspaceFeatureFlag{}, }) if err != nil { log.Fatal(err) @@ -2211,8 +2210,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2220,15 +2219,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Workspaces.GetByID(ctx, operations.GetWorkspaceRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Workspaces.GetByID(ctx, operations.GetWorkspaceRequest{}) if err != nil { log.Fatal(err) } @@ -2246,8 +2244,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -2256,21 +2254,21 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.Update(ctx, operations.UpdateWorkspaceDetailsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), Workspace: shared.Workspace{ - CreatedAt: types.MustTimeFromString("2025-07-28T19:04:48.565Z"), + CreatedAt: types.MustTimeFromString("2023-08-02T22:30:24.264Z"), ID: "", Name: "", OrganizationID: "", Slug: "", - UpdatedAt: types.MustTimeFromString("2024-10-16T10:52:42.015Z"), + UpdatedAt: types.MustTimeFromString("2025-01-24T03:53:13.581Z"), Verified: true, }, }) @@ -2291,8 +2289,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2300,15 +2298,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Events.Search(ctx, operations.SearchWorkspaceEventsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Events.Search(ctx, operations.SearchWorkspaceEventsRequest{}) if err != nil { log.Fatal(err) } @@ -2326,8 +2323,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -2336,23 +2333,23 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Events.Post(ctx, operations.PostWorkspaceEventsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), RequestBody: []shared.CliEvent{ shared.CliEvent{ ID: "", ExecutionID: "", WorkspaceID: "", SpeakeasyAPIKeyName: "", - InteractionType: shared.InteractionTypeRun, - LocalStartedAt: types.MustTimeFromString("2024-09-08T05:59:33.876Z"), - CreatedAt: types.MustTimeFromString("2025-08-12T17:54:17.538Z"), + InteractionType: shared.InteractionTypeCiExec, + LocalStartedAt: types.MustTimeFromString("2024-12-22T21:01:06.740Z"), + CreatedAt: types.MustTimeFromString("2024-01-24T01:13:51.002Z"), SpeakeasyVersion: "", Success: true, }, @@ -2375,8 +2372,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2384,15 +2381,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Events.GetTargetsDeprecated(ctx, operations.GetWorkspaceTargetsDeprecatedRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Events.GetTargetsDeprecated(ctx, operations.GetWorkspaceTargetsDeprecatedRequest{}) if err != nil { log.Fatal(err) } @@ -2410,8 +2406,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2419,14 +2415,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Events.GetEventsByTarget(ctx, operations.GetWorkspaceEventsByTargetRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), TargetID: "", }) if err != nil { @@ -2446,8 +2442,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2455,15 +2451,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Workspaces.GetFeatureFlags(ctx, operations.GetWorkspaceFeatureFlagsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Workspaces.GetFeatureFlags(ctx, operations.GetWorkspaceFeatureFlagsRequest{}) if err != nil { log.Fatal(err) } @@ -2481,8 +2476,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2490,15 +2485,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Workspaces.GetSettings(ctx, operations.GetWorkspaceSettingsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Workspaces.GetSettings(ctx, operations.GetWorkspaceSettingsRequest{}) if err != nil { log.Fatal(err) } @@ -2516,8 +2510,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -2526,19 +2520,19 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.UpdateSettings(ctx, operations.UpdateWorkspaceSettingsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), WorkspaceSettings: shared.WorkspaceSettings{ WorkspaceID: "", - WebhookURL: "https://last-suspension.info/", - CreatedAt: types.MustTimeFromString("2024-12-28T06:46:35.807Z"), - UpdatedAt: types.MustTimeFromString("2025-02-03T10:37:56.725Z"), + WebhookURL: "https://wicked-reboot.org", + CreatedAt: types.MustTimeFromString("2024-07-27T10:14:11.397Z"), + UpdatedAt: types.MustTimeFromString("2025-12-12T17:54:28.990Z"), }, }) if err != nil { @@ -2558,8 +2552,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2567,15 +2561,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Workspaces.GetTeam(ctx, operations.GetWorkspaceTeamRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Workspaces.GetTeam(ctx, operations.GetWorkspaceTeamRequest{}) if err != nil { log.Fatal(err) } @@ -2593,8 +2586,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2602,15 +2595,15 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.GrantAccess(ctx, operations.GrantUserAccessToWorkspaceRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - Email: "Lucinda.Batz8@hotmail.com", + Email: "Idella24@gmail.com", }) if err != nil { log.Fatal(err) @@ -2629,8 +2622,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2638,14 +2631,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.RevokeAccess(ctx, operations.RevokeUserAccessToWorkspaceRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), UserID: "", }) if err != nil { @@ -2665,8 +2658,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2674,15 +2667,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Workspaces.GetTokens(ctx, operations.GetWorkspaceTokensRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Workspaces.GetTokens(ctx, operations.GetWorkspaceTokensRequest{}) if err != nil { log.Fatal(err) } @@ -2700,8 +2692,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -2710,21 +2702,21 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.CreateToken(ctx, operations.CreateWorkspaceTokenRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), WorkspaceToken: shared.WorkspaceToken{ ID: "", Name: "", WorkspaceID: "", Alg: "", Key: "", - CreatedAt: types.MustTimeFromString("2023-08-16T02:33:00.784Z"), + CreatedAt: types.MustTimeFromString("2024-10-04T10:23:04.522Z"), }, }) if err != nil { @@ -2744,8 +2736,8 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -2753,14 +2745,14 @@ actions: func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.DeleteToken(ctx, operations.DeleteWorkspaceTokenRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), TokenID: "", }) if err != nil { @@ -2780,17 +2772,17 @@ actions: import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/codesamples.go b/codesamples.go index f7db3483..2d22c9c2 100644 --- a/codesamples.go +++ b/codesamples.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -18,12 +19,16 @@ import ( // CodeSamples - REST APIs for retrieving Code Samples type CodeSamples struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newCodeSamples(sdkConfig sdkConfiguration) *CodeSamples { +func newCodeSamples(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *CodeSamples { return &CodeSamples{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -54,11 +59,13 @@ func (s *CodeSamples) GenerateCodeSamplePreview(ctx context.Context, request sha } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "generateCodeSamplePreview", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "generateCodeSamplePreview", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "multipart", `request:"mediaType=multipart/form-data"`) if err != nil { @@ -114,15 +121,17 @@ func (s *CodeSamples) GenerateCodeSamplePreview(ctx context.Context, request sha "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -139,7 +148,7 @@ func (s *CodeSamples) GenerateCodeSamplePreview(ctx context.Context, request sha err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -147,13 +156,13 @@ func (s *CodeSamples) GenerateCodeSamplePreview(ctx context.Context, request sha if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -166,17 +175,17 @@ func (s *CodeSamples) GenerateCodeSamplePreview(ctx context.Context, request sha err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -292,11 +301,13 @@ func (s *CodeSamples) GenerateCodeSamplePreviewAsync(ctx context.Context, reques } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "generateCodeSamplePreviewAsync", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "generateCodeSamplePreviewAsync", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "multipart", `request:"mediaType=multipart/form-data"`) if err != nil { @@ -352,15 +363,17 @@ func (s *CodeSamples) GenerateCodeSamplePreviewAsync(ctx context.Context, reques "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -377,7 +390,7 @@ func (s *CodeSamples) GenerateCodeSamplePreviewAsync(ctx context.Context, reques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -385,13 +398,13 @@ func (s *CodeSamples) GenerateCodeSamplePreviewAsync(ctx context.Context, reques if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -404,17 +417,17 @@ func (s *CodeSamples) GenerateCodeSamplePreviewAsync(ctx context.Context, reques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -530,11 +543,13 @@ func (s *CodeSamples) Get(ctx context.Context, request operations.GetCodeSamples } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getCodeSamples", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getCodeSamples", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -587,15 +602,17 @@ func (s *CodeSamples) Get(ctx context.Context, request operations.GetCodeSamples "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -612,7 +629,7 @@ func (s *CodeSamples) Get(ctx context.Context, request operations.GetCodeSamples err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -620,13 +637,13 @@ func (s *CodeSamples) Get(ctx context.Context, request operations.GetCodeSamples if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -639,17 +656,17 @@ func (s *CodeSamples) Get(ctx context.Context, request operations.GetCodeSamples err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -750,11 +767,13 @@ func (s *CodeSamples) GetCodeSamplePreviewAsync(ctx context.Context, request ope } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getCodeSamplePreviewAsync", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getCodeSamplePreviewAsync", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -803,15 +822,17 @@ func (s *CodeSamples) GetCodeSamplePreviewAsync(ctx context.Context, request ope "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -828,7 +849,7 @@ func (s *CodeSamples) GetCodeSamplePreviewAsync(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -836,13 +857,13 @@ func (s *CodeSamples) GetCodeSamplePreviewAsync(ctx context.Context, request ope if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -855,17 +876,17 @@ func (s *CodeSamples) GetCodeSamplePreviewAsync(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/docs/sdks/artifacts/README.md b/docs/sdks/artifacts/README.md index 483e6dd5..d892af70 100644 --- a/docs/sdks/artifacts/README.md +++ b/docs/sdks/artifacts/README.md @@ -25,22 +25,23 @@ Configure a new remote source ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -79,13 +80,14 @@ Get blob for a particular digest ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -93,9 +95,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -139,13 +141,14 @@ Get manifest for a particular reference ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -153,9 +156,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -199,22 +202,23 @@ Each namespace contains many revisions. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -250,13 +254,14 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -264,9 +269,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -305,13 +310,14 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -319,9 +325,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -362,13 +368,14 @@ Get remote sources attached to a particular namespace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -376,9 +383,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -419,13 +426,14 @@ Add tags to an existing revision ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -433,9 +441,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -476,22 +484,23 @@ Get access token for communicating with OCI distribution endpoints ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -530,13 +539,14 @@ Set whether a namespace is archived ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -544,9 +554,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -587,13 +597,14 @@ Set visibility of a namespace with an existing metadata entry ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -601,9 +612,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/docs/sdks/auth/README.md b/docs/sdks/auth/README.md index ed038854..abf37a13 100644 --- a/docs/sdks/auth/README.md +++ b/docs/sdks/auth/README.md @@ -18,13 +18,14 @@ Checks if generation is permitted for a particular run of the CLI ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -32,9 +33,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -72,12 +73,13 @@ Get or refresh an access token for the current workspace. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -85,7 +87,7 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New() + s := v3.New() res, err := s.Auth.GetAccessToken(ctx, operations.GetAccessTokenRequest{ WorkspaceID: "", @@ -124,22 +126,23 @@ Get information about the current user. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -177,22 +180,23 @@ Validate the current api key. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/docs/sdks/codesamples/README.md b/docs/sdks/codesamples/README.md index ede62642..4307f888 100644 --- a/docs/sdks/codesamples/README.md +++ b/docs/sdks/codesamples/README.md @@ -18,13 +18,14 @@ This endpoint generates Code Sample previews from a file and configuration param ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "os" "log" ) @@ -32,22 +33,21 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - content, fileErr := os.Open("example.file") + example, fileErr := os.Open("example.file") if fileErr != nil { panic(fileErr) } - res, err := s.CodeSamples.GenerateCodeSamplePreview(ctx, shared.CodeSampleSchemaInput{ Language: "", SchemaFile: shared.SchemaFile{ - Content: content, + Content: example, FileName: "example.file", }, }) @@ -85,13 +85,14 @@ This endpoint generates Code Sample previews from a file and configuration param ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "os" "log" ) @@ -99,22 +100,21 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - content, fileErr := os.Open("example.file") + example, fileErr := os.Open("example.file") if fileErr != nil { panic(fileErr) } - res, err := s.CodeSamples.GenerateCodeSamplePreviewAsync(ctx, shared.CodeSampleSchemaInput{ Language: "", SchemaFile: shared.SchemaFile{ - Content: content, + Content: example, FileName: "example.file", }, }) @@ -152,13 +152,14 @@ Retrieve usage snippets from an OpenAPI document stored in the registry. Support ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -166,9 +167,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -184,7 +185,13 @@ func main() { }, }, OperationIds: []string{ - "getPets", + "g", + "e", + "t", + "P", + "e", + "t", + "s", }, RegistryURL: "https://spec.speakeasy.com/my-org/my-workspace/my-source", }) @@ -222,13 +229,14 @@ Poll for the result of an asynchronous Code Sample preview generation. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -236,9 +244,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/docs/sdks/events/README.md b/docs/sdks/events/README.md index 0164f307..52c172f1 100644 --- a/docs/sdks/events/README.md +++ b/docs/sdks/events/README.md @@ -19,13 +19,14 @@ Load recent events for a particular workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -33,15 +34,15 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Events.GetEventsByTarget(ctx, operations.GetWorkspaceEventsByTargetRequest{ TargetID: "", - WorkspaceID: speakeasyclientsdkgo.String(""), }) if err != nil { log.Fatal(err) @@ -77,13 +78,14 @@ Load targets for a particular workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -91,9 +93,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -132,13 +134,14 @@ Load targets for a particular workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -146,15 +149,14 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Events.GetTargetsDeprecated(ctx, operations.GetWorkspaceTargetsDeprecatedRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Events.GetTargetsDeprecated(ctx, operations.GetWorkspaceTargetsDeprecatedRequest{}) if err != nil { log.Fatal(err) } @@ -189,13 +191,14 @@ Sends an array of events to be stored for a particular workspace. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -204,27 +207,27 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Events.Post(ctx, operations.PostWorkspaceEventsRequest{ RequestBody: []shared.CliEvent{ shared.CliEvent{ - CreatedAt: types.MustTimeFromString("2025-03-02T10:07:28.113Z"), + CreatedAt: types.MustTimeFromString("2023-02-16T09:12:42.397Z"), ExecutionID: "", ID: "", - InteractionType: shared.InteractionTypeAuthenticate, - LocalStartedAt: types.MustTimeFromString("2025-08-12T17:54:17.538Z"), + InteractionType: shared.InteractionTypeQuickstart, + LocalStartedAt: types.MustTimeFromString("2024-01-24T01:13:51.002Z"), SpeakeasyAPIKeyName: "", SpeakeasyVersion: "", Success: true, WorkspaceID: "", }, }, - WorkspaceID: speakeasyclientsdkgo.String(""), }) if err != nil { log.Fatal(err) @@ -260,13 +263,14 @@ Search events for a particular workspace by any field ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -274,15 +278,14 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Events.Search(ctx, operations.SearchWorkspaceEventsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Events.Search(ctx, operations.SearchWorkspaceEventsRequest{}) if err != nil { log.Fatal(err) } diff --git a/docs/sdks/github/README.md b/docs/sdks/github/README.md index ed5ed730..44106406 100644 --- a/docs/sdks/github/README.md +++ b/docs/sdks/github/README.md @@ -23,13 +23,14 @@ REST APIs for managing the github integration ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -37,9 +38,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -79,13 +80,14 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -93,9 +95,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -136,13 +138,14 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -150,9 +153,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -191,22 +194,23 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -247,22 +251,23 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -270,7 +275,7 @@ func main() { Input: "", Org: "", Overlays: []string{ - "", + "", }, Repo: "", }) @@ -306,22 +311,23 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -361,13 +367,14 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -375,9 +382,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -417,13 +424,14 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -431,9 +439,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -474,13 +482,14 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -488,9 +497,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -527,22 +536,23 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -581,22 +591,23 @@ func main() { ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/docs/sdks/organizations/README.md b/docs/sdks/organizations/README.md index 33fa0f9f..cda66be2 100644 --- a/docs/sdks/organizations/README.md +++ b/docs/sdks/organizations/README.md @@ -22,13 +22,14 @@ Creates an organization ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "log" ) @@ -36,21 +37,21 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Organizations.Create(ctx, shared.Organization{ AccountType: shared.AccountTypeScaleUp, - CreatedAt: types.MustTimeFromString("2024-11-30T17:06:07.804Z"), + CreatedAt: types.MustTimeFromString("2025-10-26T09:05:00.560Z"), ID: "", Name: "", Slug: "", - SsoActivated: true, - TelemetryDisabled: true, - UpdatedAt: types.MustTimeFromString("2023-03-17T15:39:20.911Z"), + SsoActivated: false, + TelemetryDisabled: false, + UpdatedAt: types.MustTimeFromString("2023-12-23T08:00:51.380Z"), }) if err != nil { log.Fatal(err) @@ -86,30 +87,29 @@ Create billing add ons ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Organizations.CreateBillingAddOns(ctx, shared.OrganizationBillingAddOnRequest{ AddOns: []shared.BillingAddOn{ - shared.BillingAddOnSDKTesting, - shared.BillingAddOnSDKTesting, - shared.BillingAddOnWebhooks, + shared.BillingAddOnCustomCodeRegions, }, }) if err != nil { @@ -146,22 +146,23 @@ Creates a free trial for an organization ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -199,13 +200,14 @@ Delete billing add ons ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -213,14 +215,14 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Organizations.DeleteBillingAddOn(ctx, operations.DeleteBillingAddOnRequest{ - AddOn: shared.BillingAddOnCustomCodeRegions, + AddOn: shared.BillingAddOnSDKTesting, }) if err != nil { log.Fatal(err) @@ -256,13 +258,14 @@ Get information about a particular organization. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -270,9 +273,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -313,22 +316,23 @@ Returns a list of organizations a user has access too ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -366,22 +370,23 @@ Get billing add ons ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -419,22 +424,23 @@ Returns a billing usage summary by target languages for a particular organizatio ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/docs/sdks/publishingtokens/README.md b/docs/sdks/publishingtokens/README.md index 8486a891..5b16d116 100644 --- a/docs/sdks/publishingtokens/README.md +++ b/docs/sdks/publishingtokens/README.md @@ -19,13 +19,14 @@ Creates a publishing token for the current workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -34,17 +35,17 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.PublishingTokens.Create(ctx, &operations.CreatePublishingTokenRequestBody{ TargetID: "", - TargetResource: "document", + TargetResource: "", TokenName: "", - ValidUntil: types.MustTimeFromString("2024-06-17T07:14:55.338Z"), + ValidUntil: types.MustTimeFromString("2023-03-05T16:00:09.135Z"), }) if err != nil { log.Fatal(err) @@ -80,13 +81,14 @@ Delete a particular publishing token. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -94,9 +96,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -137,13 +139,14 @@ Get information about a particular publishing token. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -151,9 +154,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -194,22 +197,23 @@ Returns a publishing token for the current workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -247,13 +251,14 @@ Get information about a particular publishing token. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -261,9 +266,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -304,13 +309,14 @@ Get information about a particular publishing token target. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -318,9 +324,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -361,13 +367,14 @@ Updates the validity period of a particular publishing token. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -375,9 +382,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/docs/sdks/reports/README.md b/docs/sdks/reports/README.md index c90fa3e9..1bffb985 100644 --- a/docs/sdks/reports/README.md +++ b/docs/sdks/reports/README.md @@ -17,13 +17,14 @@ Get the signed access url for the change reports for a particular document. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -31,9 +32,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -73,13 +74,14 @@ Get the signed access url for the linting reports for a particular document. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -87,9 +89,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -129,13 +131,14 @@ Upload a report. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "os" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -144,22 +147,21 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - content, fileErr := os.Open("example.file") + example, fileErr := os.Open("example.file") if fileErr != nil { panic(fileErr) } - res, err := s.Reports.UploadReport(ctx, operations.UploadReportRequestBody{ Data: shared.Report{}, File: operations.File{ - Content: content, + Content: example, FileName: "example.file", }, }) diff --git a/docs/sdks/schemastore/README.md b/docs/sdks/schemastore/README.md index ae6c925d..255743e9 100644 --- a/docs/sdks/schemastore/README.md +++ b/docs/sdks/schemastore/README.md @@ -14,13 +14,14 @@ Create a schema in the schema store ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -28,9 +29,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -74,22 +75,23 @@ Get a OAS schema from the schema store ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/docs/sdks/shorturls/README.md b/docs/sdks/shorturls/README.md index 7dd181d9..8a3fcd6a 100644 --- a/docs/sdks/shorturls/README.md +++ b/docs/sdks/shorturls/README.md @@ -15,13 +15,14 @@ Shorten a URL. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -29,14 +30,14 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.ShortURLs.Create(ctx, operations.CreateRequestBody{ - URL: "https://probable-heating.com/", + URL: "https://exalted-heroine.org/", }) if err != nil { log.Fatal(err) diff --git a/docs/sdks/speakeasy/README.md b/docs/sdks/speakeasy/README.md deleted file mode 100644 index 2c9348bc..00000000 --- a/docs/sdks/speakeasy/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Speakeasy SDK - -## Overview - -Speakeasy API: The Subscriptions API manages subscriptions for CLI and registry events - -The Speakeasy Platform Documentation - - -### Available Operations diff --git a/docs/sdks/subscriptions/README.md b/docs/sdks/subscriptions/README.md index 4936d968..1ddaaf8d 100644 --- a/docs/sdks/subscriptions/README.md +++ b/docs/sdks/subscriptions/README.md @@ -16,13 +16,14 @@ Activate an ignored namespace for a subscription ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -30,9 +31,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -74,13 +75,14 @@ Ignored a namespace for a subscription ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -88,9 +90,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/docs/sdks/suggest/README.md b/docs/sdks/suggest/README.md index 0f661e51..b5a877d8 100644 --- a/docs/sdks/suggest/README.md +++ b/docs/sdks/suggest/README.md @@ -18,13 +18,14 @@ Get suggestions from an LLM model for improving an OpenAPI document. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -32,9 +33,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -44,20 +45,14 @@ func main() { shared.Diagnostic{ Message: "", Path: []string{ - "/opt/include", - "/opt/share", + "/usr/src", }, Type: "", }, - shared.Diagnostic{ - Message: "", - Path: []string{}, - Type: "", - }, }, OasSummary: shared.OASSummary{ Info: shared.OASInfo{ - Description: "amid traffic the unfortunately underneath what father lovely out", + Description: "prioritize bell vainly", License: shared.License{}, Summary: "", Title: "", @@ -65,18 +60,18 @@ func main() { }, Operations: []shared.OASOperation{ shared.OASOperation{ - Description: "times dull than except", + Description: "though since instead accurate safe unnaturally charming", Method: "", OperationID: "", - Path: "/mnt", + Path: "/usr/local/bin", Tags: []string{ - "", - "", + "", + "", }, }, }, }, - SuggestionType: shared.SuggestRequestBodySuggestionTypeDiagnosticsOnly, + SuggestionType: shared.SuggestRequestBodySuggestionTypeMethodNames, }, XSessionID: "", }) @@ -113,27 +108,30 @@ Generate generic suggestions for a list of items. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Suggest.SuggestItems(ctx, shared.SuggestItemsRequestBody{ - Items: []string{}, + Items: []string{ + "", + }, Prompt: "", }) if err != nil { @@ -169,13 +167,14 @@ Get suggestions from an LLM model for improving an OpenAPI document. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "os" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -184,22 +183,21 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - content, fileErr := os.Open("example.file") + example, fileErr := os.Open("example.file") if fileErr != nil { panic(fileErr) } - res, err := s.Suggest.SuggestOpenAPI(ctx, operations.SuggestOpenAPIRequest{ RequestBody: operations.SuggestOpenAPIRequestBody{ Schema: operations.Schema{ - Content: content, + Content: example, FileName: "example.file", }, }, @@ -238,13 +236,14 @@ Get suggestions from an LLM model for improving an OpenAPI document stored in th ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -252,9 +251,9 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/docs/sdks/workspaces/README.md b/docs/sdks/workspaces/README.md index db36674a..df658a15 100644 --- a/docs/sdks/workspaces/README.md +++ b/docs/sdks/workspaces/README.md @@ -29,13 +29,14 @@ Creates a workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "log" ) @@ -43,19 +44,19 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.Create(ctx, shared.Workspace{ - CreatedAt: types.MustTimeFromString("2024-06-17T07:14:55.338Z"), + CreatedAt: types.MustTimeFromString("2023-11-18T13:41:10.525Z"), ID: "", Name: "", OrganizationID: "", Slug: "", - UpdatedAt: types.MustTimeFromString("2024-11-30T17:06:07.804Z"), + UpdatedAt: types.MustTimeFromString("2024-11-21T08:36:32.740Z"), Verified: true, }) if err != nil { @@ -92,13 +93,14 @@ Create a token for a particular workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -107,22 +109,22 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.CreateToken(ctx, operations.CreateWorkspaceTokenRequest{ WorkspaceToken: shared.WorkspaceToken{ Alg: "", - CreatedAt: types.MustTimeFromString("2023-08-16T02:33:00.784Z"), + CreatedAt: types.MustTimeFromString("2024-10-04T10:23:04.522Z"), ID: "", Key: "", Name: "", WorkspaceID: "", }, - WorkspaceID: speakeasyclientsdkgo.String(""), }) if err != nil { log.Fatal(err) @@ -158,13 +160,14 @@ Delete a token for a particular workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -172,15 +175,15 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.DeleteToken(ctx, operations.DeleteWorkspaceTokenRequest{ TokenID: "", - WorkspaceID: speakeasyclientsdkgo.String(""), }) if err != nil { log.Fatal(err) @@ -216,22 +219,23 @@ Get information about a particular workspace by context. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -269,22 +273,23 @@ Returns a list of workspaces a user has access too ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -322,13 +327,14 @@ Get information about a particular workspace. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -336,15 +342,14 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Workspaces.GetByID(ctx, operations.GetWorkspaceRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Workspaces.GetByID(ctx, operations.GetWorkspaceRequest{}) if err != nil { log.Fatal(err) } @@ -379,13 +384,14 @@ Get workspace feature flags ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -393,15 +399,14 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Workspaces.GetFeatureFlags(ctx, operations.GetWorkspaceFeatureFlagsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Workspaces.GetFeatureFlags(ctx, operations.GetWorkspaceFeatureFlagsRequest{}) if err != nil { log.Fatal(err) } @@ -436,13 +441,14 @@ Get settings about a particular workspace. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -450,15 +456,14 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Workspaces.GetSettings(ctx, operations.GetWorkspaceSettingsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Workspaces.GetSettings(ctx, operations.GetWorkspaceSettingsRequest{}) if err != nil { log.Fatal(err) } @@ -493,13 +498,14 @@ Get team members for a particular workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -507,15 +513,14 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Workspaces.GetTeam(ctx, operations.GetWorkspaceTeamRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Workspaces.GetTeam(ctx, operations.GetWorkspaceTeamRequest{}) if err != nil { log.Fatal(err) } @@ -550,13 +555,14 @@ Get tokens for a particular workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -564,15 +570,14 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - res, err := s.Workspaces.GetTokens(ctx, operations.GetWorkspaceTokensRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), - }) + res, err := s.Workspaces.GetTokens(ctx, operations.GetWorkspaceTokensRequest{}) if err != nil { log.Fatal(err) } @@ -607,13 +612,14 @@ Grant a user access to a particular workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -621,15 +627,15 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.GrantAccess(ctx, operations.GrantUserAccessToWorkspaceRequest{ - Email: "Lucinda.Batz8@hotmail.com", - WorkspaceID: speakeasyclientsdkgo.String(""), + Email: "Idella24@gmail.com", }) if err != nil { log.Fatal(err) @@ -665,13 +671,14 @@ Revoke a user's access to a particular workspace ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" ) @@ -679,15 +686,15 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.RevokeAccess(ctx, operations.RevokeUserAccessToWorkspaceRequest{ UserID: "", - WorkspaceID: speakeasyclientsdkgo.String(""), }) if err != nil { log.Fatal(err) @@ -723,30 +730,28 @@ Set workspace feature flags ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "log" ) func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.SetFeatureFlags(ctx, shared.WorkspaceFeatureFlagRequest{ - FeatureFlags: []shared.WorkspaceFeatureFlag{ - shared.WorkspaceFeatureFlagSkipSchemaRegistry, - shared.WorkspaceFeatureFlagWebhooks, - }, + FeatureFlags: []shared.WorkspaceFeatureFlag{}, }) if err != nil { log.Fatal(err) @@ -782,13 +787,14 @@ Update information about a particular workspace. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -797,23 +803,23 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.Update(ctx, operations.UpdateWorkspaceDetailsRequest{ Workspace: shared.Workspace{ - CreatedAt: types.MustTimeFromString("2025-07-28T19:04:48.565Z"), + CreatedAt: types.MustTimeFromString("2023-08-02T22:30:24.264Z"), ID: "", Name: "", OrganizationID: "", Slug: "", - UpdatedAt: types.MustTimeFromString("2024-10-16T10:52:42.015Z"), + UpdatedAt: types.MustTimeFromString("2025-01-24T03:53:13.581Z"), Verified: true, }, - WorkspaceID: speakeasyclientsdkgo.String(""), }) if err != nil { log.Fatal(err) @@ -849,13 +855,14 @@ Update settings about a particular workspace. ### Example Usage + ```go package main import( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "log" @@ -864,20 +871,20 @@ import( func main() { ctx := context.Background() - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithWorkspaceID(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.UpdateSettings(ctx, operations.UpdateWorkspaceSettingsRequest{ WorkspaceSettings: shared.WorkspaceSettings{ - CreatedAt: types.MustTimeFromString("2023-07-05T11:43:28.305Z"), - UpdatedAt: types.MustTimeFromString("2024-05-14T05:39:21.874Z"), - WebhookURL: "https://grown-pharmacopoeia.net", + CreatedAt: types.MustTimeFromString("2025-03-09T15:48:09.330Z"), + UpdatedAt: types.MustTimeFromString("2025-11-24T16:37:53.492Z"), + WebhookURL: "https://wobbly-lid.org", WorkspaceID: "", }, - WorkspaceID: speakeasyclientsdkgo.String(""), }) if err != nil { log.Fatal(err) diff --git a/events.go b/events.go index e88e2454..cc031e0f 100644 --- a/events.go +++ b/events.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -18,12 +19,16 @@ import ( // Events - REST APIs for managing events captured by a speakeasy binary (CLI, GitHub Action etc) type Events struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newEvents(sdkConfig sdkConfiguration) *Events { +func newEvents(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Events { return &Events{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -57,11 +62,13 @@ func (s *Events) GetEventsByTarget(ctx context.Context, request operations.GetWo } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getWorkspaceEventsByTarget", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getWorkspaceEventsByTarget", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -114,15 +121,17 @@ func (s *Events) GetEventsByTarget(ctx context.Context, request operations.GetWo "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -139,7 +148,7 @@ func (s *Events) GetEventsByTarget(ctx context.Context, request operations.GetWo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -147,13 +156,13 @@ func (s *Events) GetEventsByTarget(ctx context.Context, request operations.GetWo if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -166,17 +175,17 @@ func (s *Events) GetEventsByTarget(ctx context.Context, request operations.GetWo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -276,11 +285,13 @@ func (s *Events) GetTargets(ctx context.Context, request operations.GetWorkspace } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getWorkspaceTargets", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getWorkspaceTargets", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -333,15 +344,17 @@ func (s *Events) GetTargets(ctx context.Context, request operations.GetWorkspace "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -358,7 +371,7 @@ func (s *Events) GetTargets(ctx context.Context, request operations.GetWorkspace err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -366,13 +379,13 @@ func (s *Events) GetTargets(ctx context.Context, request operations.GetWorkspace if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -385,17 +398,17 @@ func (s *Events) GetTargets(ctx context.Context, request operations.GetWorkspace err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -499,11 +512,13 @@ func (s *Events) GetTargetsDeprecated(ctx context.Context, request operations.Ge } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getWorkspaceTargetsDeprecated", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getWorkspaceTargetsDeprecated", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -556,15 +571,17 @@ func (s *Events) GetTargetsDeprecated(ctx context.Context, request operations.Ge "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -581,7 +598,7 @@ func (s *Events) GetTargetsDeprecated(ctx context.Context, request operations.Ge err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -589,13 +606,13 @@ func (s *Events) GetTargetsDeprecated(ctx context.Context, request operations.Ge if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -608,17 +625,17 @@ func (s *Events) GetTargetsDeprecated(ctx context.Context, request operations.Ge err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -723,11 +740,13 @@ func (s *Events) Post(ctx context.Context, request operations.PostWorkspaceEvent } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "postWorkspaceEvents", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "postWorkspaceEvents", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { @@ -792,15 +811,17 @@ func (s *Events) Post(ctx context.Context, request operations.PostWorkspaceEvent "503", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -817,7 +838,7 @@ func (s *Events) Post(ctx context.Context, request operations.PostWorkspaceEvent err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -825,13 +846,13 @@ func (s *Events) Post(ctx context.Context, request operations.PostWorkspaceEvent if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -844,17 +865,17 @@ func (s *Events) Post(ctx context.Context, request operations.PostWorkspaceEvent err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -938,11 +959,13 @@ func (s *Events) Search(ctx context.Context, request operations.SearchWorkspaceE } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "searchWorkspaceEvents", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "searchWorkspaceEvents", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -995,15 +1018,17 @@ func (s *Events) Search(ctx context.Context, request operations.SearchWorkspaceE "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1020,7 +1045,7 @@ func (s *Events) Search(ctx context.Context, request operations.SearchWorkspaceE err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1028,13 +1053,13 @@ func (s *Events) Search(ctx context.Context, request operations.SearchWorkspaceE if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1047,17 +1072,17 @@ func (s *Events) Search(ctx context.Context, request operations.SearchWorkspaceE err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/gen.yaml b/gen.yaml index 896133fb..0e6bd31b 100644 --- a/gen.yaml +++ b/gen.yaml @@ -6,6 +6,7 @@ generation: sdkClassName: speakeasy usageSnippets: optionalPropertyRendering: withExample + sdkInitStyle: constructor fixes: nameResolutionFeb2025: false parameterOrderingFeb2024: false @@ -15,15 +16,21 @@ generation: auth: oAuth2ClientCredentialsEnabled: false oAuth2PasswordEnabled: false + hoistGlobalSecurity: true + schemas: + allOfMergeStrategy: shallowMerge + requestBodyFieldName: "" mockServer: disabled: false tests: + generateTests: true generateNewTests: true skipResponseBodyAssertions: false go: - version: 3.26.7 + version: 3.27.0 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false + baseErrorName: SpeakeasyError clientServerStatusCodesAsErrors: true defaultErrorName: SDKError flattenGlobalSecurity: true @@ -35,9 +42,15 @@ go: operations: pkg/models/operations shared: pkg/models/shared webhooks: pkg/models/webhooks + includeEmptyObjects: false inputModelSuffix: input maxMethodParams: 0 methodArguments: require-security-and-request + modulePath: "" + nullableOptionalWrapper: false outputModelSuffix: output packageName: github.com/speakeasy-api/speakeasy-client-sdk-go + respectRequiredFields: false responseFormat: envelope + sdkPackageName: "" + unionDeserializationStrategy: left-to-right diff --git a/github.go b/github.go index 46b44e3f..adc44b6c 100644 --- a/github.go +++ b/github.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -18,12 +19,16 @@ import ( // Github - REST APIs for managing the github integration type Github struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newGithub(sdkConfig sdkConfiguration) *Github { +func newGithub(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Github { return &Github{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *Github) CheckAccess(ctx context.Context, request operations.CheckGithub } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "checkGithubAccess", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "checkGithubAccess", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *Github) CheckAccess(ctx context.Context, request operations.CheckGithub "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *Github) CheckAccess(ctx context.Context, request operations.CheckGithub err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *Github) CheckAccess(ctx context.Context, request operations.CheckGithub if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *Github) CheckAccess(ctx context.Context, request operations.CheckGithub err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -250,11 +259,13 @@ func (s *Github) CheckPublishingPRs(ctx context.Context, request operations.Gith } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "githubCheckPublishingPRs", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "githubCheckPublishingPRs", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -307,15 +318,17 @@ func (s *Github) CheckPublishingPRs(ctx context.Context, request operations.Gith "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -332,7 +345,7 @@ func (s *Github) CheckPublishingPRs(ctx context.Context, request operations.Gith err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -340,13 +353,13 @@ func (s *Github) CheckPublishingPRs(ctx context.Context, request operations.Gith if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -359,17 +372,17 @@ func (s *Github) CheckPublishingPRs(ctx context.Context, request operations.Gith err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -468,11 +481,13 @@ func (s *Github) CheckPublishingSecrets(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "githubCheckPublishingSecrets", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "githubCheckPublishingSecrets", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -525,15 +540,17 @@ func (s *Github) CheckPublishingSecrets(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -550,7 +567,7 @@ func (s *Github) CheckPublishingSecrets(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -558,13 +575,13 @@ func (s *Github) CheckPublishingSecrets(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -577,17 +594,17 @@ func (s *Github) CheckPublishingSecrets(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -686,11 +703,13 @@ func (s *Github) ConfigureCodeSamples(ctx context.Context, request shared.Github } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "githubConfigureCodeSamples", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "githubConfigureCodeSamples", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -746,15 +765,17 @@ func (s *Github) ConfigureCodeSamples(ctx context.Context, request shared.Github "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -771,7 +792,7 @@ func (s *Github) ConfigureCodeSamples(ctx context.Context, request shared.Github err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -779,13 +800,13 @@ func (s *Github) ConfigureCodeSamples(ctx context.Context, request shared.Github if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -798,17 +819,17 @@ func (s *Github) ConfigureCodeSamples(ctx context.Context, request shared.Github err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -907,11 +928,13 @@ func (s *Github) ConfigureMintlifyRepo(ctx context.Context, request shared.Githu } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "githubConfigureMintlifyRepo", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "githubConfigureMintlifyRepo", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -967,15 +990,17 @@ func (s *Github) ConfigureMintlifyRepo(ctx context.Context, request shared.Githu "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -992,7 +1017,7 @@ func (s *Github) ConfigureMintlifyRepo(ctx context.Context, request shared.Githu err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1000,13 +1025,13 @@ func (s *Github) ConfigureMintlifyRepo(ctx context.Context, request shared.Githu if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1019,17 +1044,17 @@ func (s *Github) ConfigureMintlifyRepo(ctx context.Context, request shared.Githu err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1108,11 +1133,13 @@ func (s *Github) ConfigureTarget(ctx context.Context, request shared.GithubConfi } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "githubConfigureTarget", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "githubConfigureTarget", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1168,15 +1195,17 @@ func (s *Github) ConfigureTarget(ctx context.Context, request shared.GithubConfi "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1193,7 +1222,7 @@ func (s *Github) ConfigureTarget(ctx context.Context, request shared.GithubConfi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1201,13 +1230,13 @@ func (s *Github) ConfigureTarget(ctx context.Context, request shared.GithubConfi if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1220,17 +1249,17 @@ func (s *Github) ConfigureTarget(ctx context.Context, request shared.GithubConfi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1309,11 +1338,13 @@ func (s *Github) GetAction(ctx context.Context, request operations.GetGitHubActi } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getGitHubAction", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getGitHubAction", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1366,15 +1397,17 @@ func (s *Github) GetAction(ctx context.Context, request operations.GetGitHubActi "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1391,7 +1424,7 @@ func (s *Github) GetAction(ctx context.Context, request operations.GetGitHubActi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1399,13 +1432,13 @@ func (s *Github) GetAction(ctx context.Context, request operations.GetGitHubActi if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1418,17 +1451,17 @@ func (s *Github) GetAction(ctx context.Context, request operations.GetGitHubActi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1527,11 +1560,13 @@ func (s *Github) GetSetup(ctx context.Context, request operations.GetGithubSetup } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getGithubSetupState", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getGithubSetupState", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1584,15 +1619,17 @@ func (s *Github) GetSetup(ctx context.Context, request operations.GetGithubSetup "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1609,7 +1646,7 @@ func (s *Github) GetSetup(ctx context.Context, request operations.GetGithubSetup err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1617,13 +1654,13 @@ func (s *Github) GetSetup(ctx context.Context, request operations.GetGithubSetup if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1636,17 +1673,17 @@ func (s *Github) GetSetup(ctx context.Context, request operations.GetGithubSetup err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1745,11 +1782,13 @@ func (s *Github) LinkGithub(ctx context.Context, request operations.LinkGithubAc } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "linkGithubAccess", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "linkGithubAccess", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1802,15 +1841,17 @@ func (s *Github) LinkGithub(ctx context.Context, request operations.LinkGithubAc "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1827,7 +1868,7 @@ func (s *Github) LinkGithub(ctx context.Context, request operations.LinkGithubAc err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1835,13 +1876,13 @@ func (s *Github) LinkGithub(ctx context.Context, request operations.LinkGithubAc if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1854,17 +1895,17 @@ func (s *Github) LinkGithub(ctx context.Context, request operations.LinkGithubAc err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1943,11 +1984,13 @@ func (s *Github) StorePublishingSecrets(ctx context.Context, request shared.Gith } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "githubStorePublishingSecrets", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "githubStorePublishingSecrets", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2003,15 +2046,17 @@ func (s *Github) StorePublishingSecrets(ctx context.Context, request shared.Gith "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2028,7 +2073,7 @@ func (s *Github) StorePublishingSecrets(ctx context.Context, request shared.Gith err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2036,13 +2081,13 @@ func (s *Github) StorePublishingSecrets(ctx context.Context, request shared.Gith if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2055,17 +2100,17 @@ func (s *Github) StorePublishingSecrets(ctx context.Context, request shared.Gith err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2144,11 +2189,13 @@ func (s *Github) TriggerAction(ctx context.Context, request shared.GithubTrigger } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "githubTriggerAction", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "githubTriggerAction", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2204,15 +2251,17 @@ func (s *Github) TriggerAction(ctx context.Context, request shared.GithubTrigger "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2229,7 +2278,7 @@ func (s *Github) TriggerAction(ctx context.Context, request shared.GithubTrigger err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2237,13 +2286,13 @@ func (s *Github) TriggerAction(ctx context.Context, request shared.GithubTrigger if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2256,17 +2305,17 @@ func (s *Github) TriggerAction(ctx context.Context, request shared.GithubTrigger err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index e516a7a9..9880bafc 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,8 @@ module github.com/speakeasy-api/speakeasy-client-sdk-go/v3 -go 1.20 +go 1.22 -require ( - github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 - github.com/stretchr/testify v1.8.4 -) +require github.com/stretchr/testify v1.8.4 require ( github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/go.sum b/go.sum index f3c94ae6..fa4b6e68 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 h1:S92OBrGuLLZsyM5ybUzgc/mPjIYk2AZqufieooe98uw= -github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05/go.mod h1:M9R1FoZ3y//hwwnJtO51ypFGwm8ZfpxPT/ZLtO1mcgQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= diff --git a/internal/config/sdkconfiguration.go b/internal/config/sdkconfiguration.go new file mode 100644 index 00000000..26bafda0 --- /dev/null +++ b/internal/config/sdkconfiguration.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package config + +import ( + "context" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/globals" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/retry" + "net/http" + "time" +) + +type HTTPClient interface { + Do(req *http.Request) (*http.Response, error) +} + +type SDKConfiguration struct { + Client HTTPClient + Security func(context.Context) (interface{}, error) + ServerURL string + Server string + ServerList map[string]string + UserAgent string + Globals globals.Globals + RetryConfig *retry.Config + Timeout *time.Duration +} + +func (c *SDKConfiguration) GetServerDetails() (string, map[string]string) { + if c.ServerURL != "" { + return c.ServerURL, nil + } + + if c.Server == "" { + c.Server = "prod" + } + + return c.ServerList[c.Server], nil +} diff --git a/internal/globals/globals.go b/internal/globals/globals.go index b033951d..22121250 100644 --- a/internal/globals/globals.go +++ b/internal/globals/globals.go @@ -6,9 +6,9 @@ type Globals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *Globals) GetWorkspaceID() *string { - if o == nil { +func (g *Globals) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } diff --git a/internal/hooks/hooks.go b/internal/hooks/hooks.go index a0b49da2..8da3f33c 100644 --- a/internal/hooks/hooks.go +++ b/internal/hooks/hooks.go @@ -5,6 +5,7 @@ package hooks import ( "context" "errors" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "net/http" ) @@ -24,11 +25,13 @@ type HTTPClient interface { } type HookContext struct { - BaseURL string - Context context.Context - OperationID string - OAuth2Scopes []string - SecuritySource func(context.Context) (interface{}, error) + SDK any + SDKConfiguration config.SDKConfiguration + BaseURL string + Context context.Context + OperationID string + OAuth2Scopes []string + SecuritySource func(context.Context) (interface{}, error) } type BeforeRequestContext struct { @@ -71,6 +74,11 @@ type Hooks struct { afterErrorHook []afterErrorHook } +var _ sdkInitHook = (*Hooks)(nil) +var _ beforeRequestHook = (*Hooks)(nil) +var _ afterSuccessHook = (*Hooks)(nil) +var _ afterErrorHook = (*Hooks)(nil) + func New() *Hooks { h := &Hooks{ sdkInitHooks: []sdkInitHook{}, diff --git a/organizations.go b/organizations.go index ba846050..0a7663b3 100644 --- a/organizations.go +++ b/organizations.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -18,12 +19,16 @@ import ( // Organizations - REST APIs for managing Organizations (speakeasy L1 Tenancy construct) type Organizations struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newOrganizations(sdkConfig sdkConfiguration) *Organizations { +func newOrganizations(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Organizations { return &Organizations{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -54,11 +59,13 @@ func (s *Organizations) Create(ctx context.Context, request shared.Organization, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "createOrganization", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "createOrganization", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -114,15 +121,17 @@ func (s *Organizations) Create(ctx context.Context, request shared.Organization, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -139,7 +148,7 @@ func (s *Organizations) Create(ctx context.Context, request shared.Organization, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -147,13 +156,13 @@ func (s *Organizations) Create(ctx context.Context, request shared.Organization, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -166,17 +175,17 @@ func (s *Organizations) Create(ctx context.Context, request shared.Organization, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -276,11 +285,13 @@ func (s *Organizations) CreateBillingAddOns(ctx context.Context, request shared. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "createBillingAddOns", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "createBillingAddOns", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -336,15 +347,17 @@ func (s *Organizations) CreateBillingAddOns(ctx context.Context, request shared. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -361,7 +374,7 @@ func (s *Organizations) CreateBillingAddOns(ctx context.Context, request shared. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -369,13 +382,13 @@ func (s *Organizations) CreateBillingAddOns(ctx context.Context, request shared. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -388,17 +401,17 @@ func (s *Organizations) CreateBillingAddOns(ctx context.Context, request shared. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -499,11 +512,13 @@ func (s *Organizations) CreateFreeTrial(ctx context.Context, opts ...operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "createFreeTrial", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "createFreeTrial", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -552,15 +567,17 @@ func (s *Organizations) CreateFreeTrial(ctx context.Context, opts ...operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -577,7 +594,7 @@ func (s *Organizations) CreateFreeTrial(ctx context.Context, opts ...operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -585,13 +602,13 @@ func (s *Organizations) CreateFreeTrial(ctx context.Context, opts ...operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -604,17 +621,17 @@ func (s *Organizations) CreateFreeTrial(ctx context.Context, opts ...operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -694,11 +711,13 @@ func (s *Organizations) DeleteBillingAddOn(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "deleteBillingAddOn", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "deleteBillingAddOn", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -747,15 +766,17 @@ func (s *Organizations) DeleteBillingAddOn(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -772,7 +793,7 @@ func (s *Organizations) DeleteBillingAddOn(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -780,13 +801,13 @@ func (s *Organizations) DeleteBillingAddOn(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -799,17 +820,17 @@ func (s *Organizations) DeleteBillingAddOn(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -890,11 +911,13 @@ func (s *Organizations) Get(ctx context.Context, request operations.GetOrganizat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getOrganization", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getOrganization", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -943,15 +966,17 @@ func (s *Organizations) Get(ctx context.Context, request operations.GetOrganizat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -968,7 +993,7 @@ func (s *Organizations) Get(ctx context.Context, request operations.GetOrganizat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -976,13 +1001,13 @@ func (s *Organizations) Get(ctx context.Context, request operations.GetOrganizat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -995,17 +1020,17 @@ func (s *Organizations) Get(ctx context.Context, request operations.GetOrganizat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1106,11 +1131,13 @@ func (s *Organizations) GetAll(ctx context.Context, opts ...operations.Option) ( } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getOrganizations", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getOrganizations", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1159,15 +1186,17 @@ func (s *Organizations) GetAll(ctx context.Context, opts ...operations.Option) ( "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1184,7 +1213,7 @@ func (s *Organizations) GetAll(ctx context.Context, opts ...operations.Option) ( err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1192,13 +1221,13 @@ func (s *Organizations) GetAll(ctx context.Context, opts ...operations.Option) ( if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1211,17 +1240,17 @@ func (s *Organizations) GetAll(ctx context.Context, opts ...operations.Option) ( err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1321,11 +1350,13 @@ func (s *Organizations) GetBillingAddOns(ctx context.Context, opts ...operations } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getBillingAddOns", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getBillingAddOns", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1374,15 +1405,17 @@ func (s *Organizations) GetBillingAddOns(ctx context.Context, opts ...operations "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1399,7 +1432,7 @@ func (s *Organizations) GetBillingAddOns(ctx context.Context, opts ...operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1407,13 +1440,13 @@ func (s *Organizations) GetBillingAddOns(ctx context.Context, opts ...operations if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1426,17 +1459,17 @@ func (s *Organizations) GetBillingAddOns(ctx context.Context, opts ...operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1537,11 +1570,13 @@ func (s *Organizations) GetUsage(ctx context.Context, opts ...operations.Option) } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getOrganizationUsage", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getOrganizationUsage", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1590,15 +1625,17 @@ func (s *Organizations) GetUsage(ctx context.Context, opts ...operations.Option) "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1615,7 +1652,7 @@ func (s *Organizations) GetUsage(ctx context.Context, opts ...operations.Option) err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1623,13 +1660,13 @@ func (s *Organizations) GetUsage(ctx context.Context, opts ...operations.Option) if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1642,17 +1679,17 @@ func (s *Organizations) GetUsage(ctx context.Context, opts ...operations.Option) err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/pkg/models/operations/activatesubscriptionnamespace.go b/pkg/models/operations/activatesubscriptionnamespace.go index 4dc37511..faa3d1e4 100644 --- a/pkg/models/operations/activatesubscriptionnamespace.go +++ b/pkg/models/operations/activatesubscriptionnamespace.go @@ -13,18 +13,18 @@ type ActivateSubscriptionNamespaceRequest struct { SubscriptionID string `pathParam:"style=simple,explode=false,name=subscriptionID"` } -func (o *ActivateSubscriptionNamespaceRequest) GetNamespaceName() string { - if o == nil { +func (a *ActivateSubscriptionNamespaceRequest) GetNamespaceName() string { + if a == nil { return "" } - return o.NamespaceName + return a.NamespaceName } -func (o *ActivateSubscriptionNamespaceRequest) GetSubscriptionID() string { - if o == nil { +func (a *ActivateSubscriptionNamespaceRequest) GetSubscriptionID() string { + if a == nil { return "" } - return o.SubscriptionID + return a.SubscriptionID } type ActivateSubscriptionNamespaceResponse struct { @@ -36,23 +36,23 @@ type ActivateSubscriptionNamespaceResponse struct { RawResponse *http.Response } -func (o *ActivateSubscriptionNamespaceResponse) GetContentType() string { - if o == nil { +func (a *ActivateSubscriptionNamespaceResponse) GetContentType() string { + if a == nil { return "" } - return o.ContentType + return a.ContentType } -func (o *ActivateSubscriptionNamespaceResponse) GetStatusCode() int { - if o == nil { +func (a *ActivateSubscriptionNamespaceResponse) GetStatusCode() int { + if a == nil { return 0 } - return o.StatusCode + return a.StatusCode } -func (o *ActivateSubscriptionNamespaceResponse) GetRawResponse() *http.Response { - if o == nil { +func (a *ActivateSubscriptionNamespaceResponse) GetRawResponse() *http.Response { + if a == nil { return nil } - return o.RawResponse + return a.RawResponse } diff --git a/pkg/models/operations/archivenamespace.go b/pkg/models/operations/archivenamespace.go index 24e662b1..4372c0be 100644 --- a/pkg/models/operations/archivenamespace.go +++ b/pkg/models/operations/archivenamespace.go @@ -17,17 +17,17 @@ func (a ArchiveNamespaceRequestBody) MarshalJSON() ([]byte, error) { } func (a *ArchiveNamespaceRequestBody) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &a, "", false, nil); err != nil { return err } return nil } -func (o *ArchiveNamespaceRequestBody) GetArchived() *bool { - if o == nil { +func (a *ArchiveNamespaceRequestBody) GetArchived() *bool { + if a == nil { return nil } - return o.Archived + return a.Archived } type ArchiveNamespaceRequest struct { @@ -36,18 +36,18 @@ type ArchiveNamespaceRequest struct { NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` } -func (o *ArchiveNamespaceRequest) GetRequestBody() *ArchiveNamespaceRequestBody { - if o == nil { +func (a *ArchiveNamespaceRequest) GetRequestBody() *ArchiveNamespaceRequestBody { + if a == nil { return nil } - return o.RequestBody + return a.RequestBody } -func (o *ArchiveNamespaceRequest) GetNamespaceName() string { - if o == nil { +func (a *ArchiveNamespaceRequest) GetNamespaceName() string { + if a == nil { return "" } - return o.NamespaceName + return a.NamespaceName } type ArchiveNamespaceResponse struct { @@ -59,23 +59,23 @@ type ArchiveNamespaceResponse struct { RawResponse *http.Response } -func (o *ArchiveNamespaceResponse) GetContentType() string { - if o == nil { +func (a *ArchiveNamespaceResponse) GetContentType() string { + if a == nil { return "" } - return o.ContentType + return a.ContentType } -func (o *ArchiveNamespaceResponse) GetStatusCode() int { - if o == nil { +func (a *ArchiveNamespaceResponse) GetStatusCode() int { + if a == nil { return 0 } - return o.StatusCode + return a.StatusCode } -func (o *ArchiveNamespaceResponse) GetRawResponse() *http.Response { - if o == nil { +func (a *ArchiveNamespaceResponse) GetRawResponse() *http.Response { + if a == nil { return nil } - return o.RawResponse + return a.RawResponse } diff --git a/pkg/models/operations/checkgithubaccess.go b/pkg/models/operations/checkgithubaccess.go index 9d8a4b2c..c6f950dd 100644 --- a/pkg/models/operations/checkgithubaccess.go +++ b/pkg/models/operations/checkgithubaccess.go @@ -11,18 +11,18 @@ type CheckGithubAccessRequest struct { Repo string `queryParam:"style=form,explode=true,name=repo"` } -func (o *CheckGithubAccessRequest) GetOrg() string { - if o == nil { +func (c *CheckGithubAccessRequest) GetOrg() string { + if c == nil { return "" } - return o.Org + return c.Org } -func (o *CheckGithubAccessRequest) GetRepo() string { - if o == nil { +func (c *CheckGithubAccessRequest) GetRepo() string { + if c == nil { return "" } - return o.Repo + return c.Repo } type CheckGithubAccessResponse struct { @@ -34,23 +34,23 @@ type CheckGithubAccessResponse struct { RawResponse *http.Response } -func (o *CheckGithubAccessResponse) GetContentType() string { - if o == nil { +func (c *CheckGithubAccessResponse) GetContentType() string { + if c == nil { return "" } - return o.ContentType + return c.ContentType } -func (o *CheckGithubAccessResponse) GetStatusCode() int { - if o == nil { +func (c *CheckGithubAccessResponse) GetStatusCode() int { + if c == nil { return 0 } - return o.StatusCode + return c.StatusCode } -func (o *CheckGithubAccessResponse) GetRawResponse() *http.Response { - if o == nil { +func (c *CheckGithubAccessResponse) GetRawResponse() *http.Response { + if c == nil { return nil } - return o.RawResponse + return c.RawResponse } diff --git a/pkg/models/operations/create.go b/pkg/models/operations/create.go index 5c73cf7e..59aed0a9 100644 --- a/pkg/models/operations/create.go +++ b/pkg/models/operations/create.go @@ -12,11 +12,11 @@ type CreateRequestBody struct { URL string `json:"url"` } -func (o *CreateRequestBody) GetURL() string { - if o == nil { +func (c *CreateRequestBody) GetURL() string { + if c == nil { return "" } - return o.URL + return c.URL } type CreateResponse struct { @@ -30,30 +30,30 @@ type CreateResponse struct { RawResponse *http.Response } -func (o *CreateResponse) GetContentType() string { - if o == nil { +func (c *CreateResponse) GetContentType() string { + if c == nil { return "" } - return o.ContentType + return c.ContentType } -func (o *CreateResponse) GetShortURL() *shared.ShortURL { - if o == nil { +func (c *CreateResponse) GetShortURL() *shared.ShortURL { + if c == nil { return nil } - return o.ShortURL + return c.ShortURL } -func (o *CreateResponse) GetStatusCode() int { - if o == nil { +func (c *CreateResponse) GetStatusCode() int { + if c == nil { return 0 } - return o.StatusCode + return c.StatusCode } -func (o *CreateResponse) GetRawResponse() *http.Response { - if o == nil { +func (c *CreateResponse) GetRawResponse() *http.Response { + if c == nil { return nil } - return o.RawResponse + return c.RawResponse } diff --git a/pkg/models/operations/createbillingaddons.go b/pkg/models/operations/createbillingaddons.go index b6e11aa4..20a4db5f 100644 --- a/pkg/models/operations/createbillingaddons.go +++ b/pkg/models/operations/createbillingaddons.go @@ -18,30 +18,30 @@ type CreateBillingAddOnsResponse struct { RawResponse *http.Response } -func (o *CreateBillingAddOnsResponse) GetContentType() string { - if o == nil { +func (c *CreateBillingAddOnsResponse) GetContentType() string { + if c == nil { return "" } - return o.ContentType + return c.ContentType } -func (o *CreateBillingAddOnsResponse) GetOrganizationBillingAddOnResponse() *shared.OrganizationBillingAddOnResponse { - if o == nil { +func (c *CreateBillingAddOnsResponse) GetOrganizationBillingAddOnResponse() *shared.OrganizationBillingAddOnResponse { + if c == nil { return nil } - return o.OrganizationBillingAddOnResponse + return c.OrganizationBillingAddOnResponse } -func (o *CreateBillingAddOnsResponse) GetStatusCode() int { - if o == nil { +func (c *CreateBillingAddOnsResponse) GetStatusCode() int { + if c == nil { return 0 } - return o.StatusCode + return c.StatusCode } -func (o *CreateBillingAddOnsResponse) GetRawResponse() *http.Response { - if o == nil { +func (c *CreateBillingAddOnsResponse) GetRawResponse() *http.Response { + if c == nil { return nil } - return o.RawResponse + return c.RawResponse } diff --git a/pkg/models/operations/createfreetrial.go b/pkg/models/operations/createfreetrial.go index 08c4574a..b5329d46 100644 --- a/pkg/models/operations/createfreetrial.go +++ b/pkg/models/operations/createfreetrial.go @@ -15,23 +15,23 @@ type CreateFreeTrialResponse struct { RawResponse *http.Response } -func (o *CreateFreeTrialResponse) GetContentType() string { - if o == nil { +func (c *CreateFreeTrialResponse) GetContentType() string { + if c == nil { return "" } - return o.ContentType + return c.ContentType } -func (o *CreateFreeTrialResponse) GetStatusCode() int { - if o == nil { +func (c *CreateFreeTrialResponse) GetStatusCode() int { + if c == nil { return 0 } - return o.StatusCode + return c.StatusCode } -func (o *CreateFreeTrialResponse) GetRawResponse() *http.Response { - if o == nil { +func (c *CreateFreeTrialResponse) GetRawResponse() *http.Response { + if c == nil { return nil } - return o.RawResponse + return c.RawResponse } diff --git a/pkg/models/operations/createorganization.go b/pkg/models/operations/createorganization.go index 8907ce20..5536be9d 100644 --- a/pkg/models/operations/createorganization.go +++ b/pkg/models/operations/createorganization.go @@ -18,30 +18,30 @@ type CreateOrganizationResponse struct { RawResponse *http.Response } -func (o *CreateOrganizationResponse) GetContentType() string { - if o == nil { +func (c *CreateOrganizationResponse) GetContentType() string { + if c == nil { return "" } - return o.ContentType + return c.ContentType } -func (o *CreateOrganizationResponse) GetOrganization() *shared.Organization { - if o == nil { +func (c *CreateOrganizationResponse) GetOrganization() *shared.Organization { + if c == nil { return nil } - return o.Organization + return c.Organization } -func (o *CreateOrganizationResponse) GetStatusCode() int { - if o == nil { +func (c *CreateOrganizationResponse) GetStatusCode() int { + if c == nil { return 0 } - return o.StatusCode + return c.StatusCode } -func (o *CreateOrganizationResponse) GetRawResponse() *http.Response { - if o == nil { +func (c *CreateOrganizationResponse) GetRawResponse() *http.Response { + if c == nil { return nil } - return o.RawResponse + return c.RawResponse } diff --git a/pkg/models/operations/createpublishingtoken.go b/pkg/models/operations/createpublishingtoken.go index 8fcdec5d..0806e310 100644 --- a/pkg/models/operations/createpublishingtoken.go +++ b/pkg/models/operations/createpublishingtoken.go @@ -22,38 +22,38 @@ func (c CreatePublishingTokenRequestBody) MarshalJSON() ([]byte, error) { } func (c *CreatePublishingTokenRequestBody) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &c, "", false, []string{"target_id", "target_resource", "token_name", "valid_until"}); err != nil { return err } return nil } -func (o *CreatePublishingTokenRequestBody) GetTargetID() string { - if o == nil { +func (c *CreatePublishingTokenRequestBody) GetTargetID() string { + if c == nil { return "" } - return o.TargetID + return c.TargetID } -func (o *CreatePublishingTokenRequestBody) GetTargetResource() string { - if o == nil { +func (c *CreatePublishingTokenRequestBody) GetTargetResource() string { + if c == nil { return "" } - return o.TargetResource + return c.TargetResource } -func (o *CreatePublishingTokenRequestBody) GetTokenName() string { - if o == nil { +func (c *CreatePublishingTokenRequestBody) GetTokenName() string { + if c == nil { return "" } - return o.TokenName + return c.TokenName } -func (o *CreatePublishingTokenRequestBody) GetValidUntil() time.Time { - if o == nil { +func (c *CreatePublishingTokenRequestBody) GetValidUntil() time.Time { + if c == nil { return time.Time{} } - return o.ValidUntil + return c.ValidUntil } type CreatePublishingTokenResponse struct { @@ -67,30 +67,30 @@ type CreatePublishingTokenResponse struct { RawResponse *http.Response } -func (o *CreatePublishingTokenResponse) GetContentType() string { - if o == nil { +func (c *CreatePublishingTokenResponse) GetContentType() string { + if c == nil { return "" } - return o.ContentType + return c.ContentType } -func (o *CreatePublishingTokenResponse) GetPublishingToken() *shared.PublishingToken { - if o == nil { +func (c *CreatePublishingTokenResponse) GetPublishingToken() *shared.PublishingToken { + if c == nil { return nil } - return o.PublishingToken + return c.PublishingToken } -func (o *CreatePublishingTokenResponse) GetStatusCode() int { - if o == nil { +func (c *CreatePublishingTokenResponse) GetStatusCode() int { + if c == nil { return 0 } - return o.StatusCode + return c.StatusCode } -func (o *CreatePublishingTokenResponse) GetRawResponse() *http.Response { - if o == nil { +func (c *CreatePublishingTokenResponse) GetRawResponse() *http.Response { + if c == nil { return nil } - return o.RawResponse + return c.RawResponse } diff --git a/pkg/models/operations/createremotesource.go b/pkg/models/operations/createremotesource.go index c97cf97b..57524197 100644 --- a/pkg/models/operations/createremotesource.go +++ b/pkg/models/operations/createremotesource.go @@ -15,23 +15,23 @@ type CreateRemoteSourceResponse struct { RawResponse *http.Response } -func (o *CreateRemoteSourceResponse) GetContentType() string { - if o == nil { +func (c *CreateRemoteSourceResponse) GetContentType() string { + if c == nil { return "" } - return o.ContentType + return c.ContentType } -func (o *CreateRemoteSourceResponse) GetStatusCode() int { - if o == nil { +func (c *CreateRemoteSourceResponse) GetStatusCode() int { + if c == nil { return 0 } - return o.StatusCode + return c.StatusCode } -func (o *CreateRemoteSourceResponse) GetRawResponse() *http.Response { - if o == nil { +func (c *CreateRemoteSourceResponse) GetRawResponse() *http.Response { + if c == nil { return nil } - return o.RawResponse + return c.RawResponse } diff --git a/pkg/models/operations/createschemastoreitem.go b/pkg/models/operations/createschemastoreitem.go index 8ca63f02..eeb34f35 100644 --- a/pkg/models/operations/createschemastoreitem.go +++ b/pkg/models/operations/createschemastoreitem.go @@ -47,32 +47,32 @@ type CreateSchemaStoreItemRequestBody struct { Spec string `json:"spec"` } -func (o *CreateSchemaStoreItemRequestBody) GetFormat() Format { - if o == nil { +func (c *CreateSchemaStoreItemRequestBody) GetFormat() Format { + if c == nil { return Format("") } - return o.Format + return c.Format } -func (o *CreateSchemaStoreItemRequestBody) GetPackageName() string { - if o == nil { +func (c *CreateSchemaStoreItemRequestBody) GetPackageName() string { + if c == nil { return "" } - return o.PackageName + return c.PackageName } -func (o *CreateSchemaStoreItemRequestBody) GetSDKClassname() string { - if o == nil { +func (c *CreateSchemaStoreItemRequestBody) GetSDKClassname() string { + if c == nil { return "" } - return o.SDKClassname + return c.SDKClassname } -func (o *CreateSchemaStoreItemRequestBody) GetSpec() string { - if o == nil { +func (c *CreateSchemaStoreItemRequestBody) GetSpec() string { + if c == nil { return "" } - return o.Spec + return c.Spec } type CreateSchemaStoreItemResponse struct { @@ -86,30 +86,30 @@ type CreateSchemaStoreItemResponse struct { RawResponse *http.Response } -func (o *CreateSchemaStoreItemResponse) GetContentType() string { - if o == nil { +func (c *CreateSchemaStoreItemResponse) GetContentType() string { + if c == nil { return "" } - return o.ContentType + return c.ContentType } -func (o *CreateSchemaStoreItemResponse) GetSchemaStoreItem() *shared.SchemaStoreItem { - if o == nil { +func (c *CreateSchemaStoreItemResponse) GetSchemaStoreItem() *shared.SchemaStoreItem { + if c == nil { return nil } - return o.SchemaStoreItem + return c.SchemaStoreItem } -func (o *CreateSchemaStoreItemResponse) GetStatusCode() int { - if o == nil { +func (c *CreateSchemaStoreItemResponse) GetStatusCode() int { + if c == nil { return 0 } - return o.StatusCode + return c.StatusCode } -func (o *CreateSchemaStoreItemResponse) GetRawResponse() *http.Response { - if o == nil { +func (c *CreateSchemaStoreItemResponse) GetRawResponse() *http.Response { + if c == nil { return nil } - return o.RawResponse + return c.RawResponse } diff --git a/pkg/models/operations/createworkspace.go b/pkg/models/operations/createworkspace.go index 9fa38e0a..08381b28 100644 --- a/pkg/models/operations/createworkspace.go +++ b/pkg/models/operations/createworkspace.go @@ -18,30 +18,30 @@ type CreateWorkspaceResponse struct { Workspace *shared.Workspace } -func (o *CreateWorkspaceResponse) GetContentType() string { - if o == nil { +func (c *CreateWorkspaceResponse) GetContentType() string { + if c == nil { return "" } - return o.ContentType + return c.ContentType } -func (o *CreateWorkspaceResponse) GetStatusCode() int { - if o == nil { +func (c *CreateWorkspaceResponse) GetStatusCode() int { + if c == nil { return 0 } - return o.StatusCode + return c.StatusCode } -func (o *CreateWorkspaceResponse) GetRawResponse() *http.Response { - if o == nil { +func (c *CreateWorkspaceResponse) GetRawResponse() *http.Response { + if c == nil { return nil } - return o.RawResponse + return c.RawResponse } -func (o *CreateWorkspaceResponse) GetWorkspace() *shared.Workspace { - if o == nil { +func (c *CreateWorkspaceResponse) GetWorkspace() *shared.Workspace { + if c == nil { return nil } - return o.Workspace + return c.Workspace } diff --git a/pkg/models/operations/createworkspacetoken.go b/pkg/models/operations/createworkspacetoken.go index 73feb3ca..6659945e 100644 --- a/pkg/models/operations/createworkspacetoken.go +++ b/pkg/models/operations/createworkspacetoken.go @@ -11,11 +11,11 @@ type CreateWorkspaceTokenGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *CreateWorkspaceTokenGlobals) GetWorkspaceID() *string { - if o == nil { +func (c *CreateWorkspaceTokenGlobals) GetWorkspaceID() *string { + if c == nil { return nil } - return o.WorkspaceID + return c.WorkspaceID } type CreateWorkspaceTokenRequest struct { @@ -24,18 +24,18 @@ type CreateWorkspaceTokenRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *CreateWorkspaceTokenRequest) GetWorkspaceToken() shared.WorkspaceToken { - if o == nil { +func (c *CreateWorkspaceTokenRequest) GetWorkspaceToken() shared.WorkspaceToken { + if c == nil { return shared.WorkspaceToken{} } - return o.WorkspaceToken + return c.WorkspaceToken } -func (o *CreateWorkspaceTokenRequest) GetWorkspaceID() *string { - if o == nil { +func (c *CreateWorkspaceTokenRequest) GetWorkspaceID() *string { + if c == nil { return nil } - return o.WorkspaceID + return c.WorkspaceID } type CreateWorkspaceTokenResponse struct { @@ -47,23 +47,23 @@ type CreateWorkspaceTokenResponse struct { RawResponse *http.Response } -func (o *CreateWorkspaceTokenResponse) GetContentType() string { - if o == nil { +func (c *CreateWorkspaceTokenResponse) GetContentType() string { + if c == nil { return "" } - return o.ContentType + return c.ContentType } -func (o *CreateWorkspaceTokenResponse) GetStatusCode() int { - if o == nil { +func (c *CreateWorkspaceTokenResponse) GetStatusCode() int { + if c == nil { return 0 } - return o.StatusCode + return c.StatusCode } -func (o *CreateWorkspaceTokenResponse) GetRawResponse() *http.Response { - if o == nil { +func (c *CreateWorkspaceTokenResponse) GetRawResponse() *http.Response { + if c == nil { return nil } - return o.RawResponse + return c.RawResponse } diff --git a/pkg/models/operations/deletebillingaddon.go b/pkg/models/operations/deletebillingaddon.go index 8e67ccf9..3d0dc7bd 100644 --- a/pkg/models/operations/deletebillingaddon.go +++ b/pkg/models/operations/deletebillingaddon.go @@ -12,11 +12,11 @@ type DeleteBillingAddOnRequest struct { AddOn shared.BillingAddOn `pathParam:"style=simple,explode=false,name=add_on"` } -func (o *DeleteBillingAddOnRequest) GetAddOn() shared.BillingAddOn { - if o == nil { +func (d *DeleteBillingAddOnRequest) GetAddOn() shared.BillingAddOn { + if d == nil { return shared.BillingAddOn("") } - return o.AddOn + return d.AddOn } type DeleteBillingAddOnResponse struct { @@ -28,23 +28,23 @@ type DeleteBillingAddOnResponse struct { RawResponse *http.Response } -func (o *DeleteBillingAddOnResponse) GetContentType() string { - if o == nil { +func (d *DeleteBillingAddOnResponse) GetContentType() string { + if d == nil { return "" } - return o.ContentType + return d.ContentType } -func (o *DeleteBillingAddOnResponse) GetStatusCode() int { - if o == nil { +func (d *DeleteBillingAddOnResponse) GetStatusCode() int { + if d == nil { return 0 } - return o.StatusCode + return d.StatusCode } -func (o *DeleteBillingAddOnResponse) GetRawResponse() *http.Response { - if o == nil { +func (d *DeleteBillingAddOnResponse) GetRawResponse() *http.Response { + if d == nil { return nil } - return o.RawResponse + return d.RawResponse } diff --git a/pkg/models/operations/deletepublishingtoken.go b/pkg/models/operations/deletepublishingtoken.go index 1ec20eec..54e5e3a9 100644 --- a/pkg/models/operations/deletepublishingtoken.go +++ b/pkg/models/operations/deletepublishingtoken.go @@ -11,11 +11,11 @@ type DeletePublishingTokenRequest struct { TokenID string `pathParam:"style=simple,explode=false,name=tokenID"` } -func (o *DeletePublishingTokenRequest) GetTokenID() string { - if o == nil { +func (d *DeletePublishingTokenRequest) GetTokenID() string { + if d == nil { return "" } - return o.TokenID + return d.TokenID } type DeletePublishingTokenResponse struct { @@ -27,23 +27,23 @@ type DeletePublishingTokenResponse struct { RawResponse *http.Response } -func (o *DeletePublishingTokenResponse) GetContentType() string { - if o == nil { +func (d *DeletePublishingTokenResponse) GetContentType() string { + if d == nil { return "" } - return o.ContentType + return d.ContentType } -func (o *DeletePublishingTokenResponse) GetStatusCode() int { - if o == nil { +func (d *DeletePublishingTokenResponse) GetStatusCode() int { + if d == nil { return 0 } - return o.StatusCode + return d.StatusCode } -func (o *DeletePublishingTokenResponse) GetRawResponse() *http.Response { - if o == nil { +func (d *DeletePublishingTokenResponse) GetRawResponse() *http.Response { + if d == nil { return nil } - return o.RawResponse + return d.RawResponse } diff --git a/pkg/models/operations/deleteworkspacetoken.go b/pkg/models/operations/deleteworkspacetoken.go index 7b54f3dc..900c8037 100644 --- a/pkg/models/operations/deleteworkspacetoken.go +++ b/pkg/models/operations/deleteworkspacetoken.go @@ -10,11 +10,11 @@ type DeleteWorkspaceTokenGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *DeleteWorkspaceTokenGlobals) GetWorkspaceID() *string { - if o == nil { +func (d *DeleteWorkspaceTokenGlobals) GetWorkspaceID() *string { + if d == nil { return nil } - return o.WorkspaceID + return d.WorkspaceID } type DeleteWorkspaceTokenRequest struct { @@ -24,18 +24,18 @@ type DeleteWorkspaceTokenRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *DeleteWorkspaceTokenRequest) GetTokenID() string { - if o == nil { +func (d *DeleteWorkspaceTokenRequest) GetTokenID() string { + if d == nil { return "" } - return o.TokenID + return d.TokenID } -func (o *DeleteWorkspaceTokenRequest) GetWorkspaceID() *string { - if o == nil { +func (d *DeleteWorkspaceTokenRequest) GetWorkspaceID() *string { + if d == nil { return nil } - return o.WorkspaceID + return d.WorkspaceID } type DeleteWorkspaceTokenResponse struct { @@ -47,23 +47,23 @@ type DeleteWorkspaceTokenResponse struct { RawResponse *http.Response } -func (o *DeleteWorkspaceTokenResponse) GetContentType() string { - if o == nil { +func (d *DeleteWorkspaceTokenResponse) GetContentType() string { + if d == nil { return "" } - return o.ContentType + return d.ContentType } -func (o *DeleteWorkspaceTokenResponse) GetStatusCode() int { - if o == nil { +func (d *DeleteWorkspaceTokenResponse) GetStatusCode() int { + if d == nil { return 0 } - return o.StatusCode + return d.StatusCode } -func (o *DeleteWorkspaceTokenResponse) GetRawResponse() *http.Response { - if o == nil { +func (d *DeleteWorkspaceTokenResponse) GetRawResponse() *http.Response { + if d == nil { return nil } - return o.RawResponse + return d.RawResponse } diff --git a/pkg/models/operations/generatecodesamplepreview.go b/pkg/models/operations/generatecodesamplepreview.go index ad1d8b84..ebaff7de 100644 --- a/pkg/models/operations/generatecodesamplepreview.go +++ b/pkg/models/operations/generatecodesamplepreview.go @@ -18,30 +18,30 @@ type GenerateCodeSamplePreviewResponse struct { UsageSnippets *shared.UsageSnippets } -func (o *GenerateCodeSamplePreviewResponse) GetContentType() string { - if o == nil { +func (g *GenerateCodeSamplePreviewResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GenerateCodeSamplePreviewResponse) GetStatusCode() int { - if o == nil { +func (g *GenerateCodeSamplePreviewResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GenerateCodeSamplePreviewResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GenerateCodeSamplePreviewResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GenerateCodeSamplePreviewResponse) GetUsageSnippets() *shared.UsageSnippets { - if o == nil { +func (g *GenerateCodeSamplePreviewResponse) GetUsageSnippets() *shared.UsageSnippets { + if g == nil { return nil } - return o.UsageSnippets + return g.UsageSnippets } diff --git a/pkg/models/operations/generatecodesamplepreviewasync.go b/pkg/models/operations/generatecodesamplepreviewasync.go index c1c3a93a..11b04d82 100644 --- a/pkg/models/operations/generatecodesamplepreviewasync.go +++ b/pkg/models/operations/generatecodesamplepreviewasync.go @@ -15,18 +15,18 @@ type GenerateCodeSamplePreviewAsyncResponseBody struct { Status shared.CodeSamplesJobStatus `json:"status"` } -func (o *GenerateCodeSamplePreviewAsyncResponseBody) GetJobID() string { - if o == nil { +func (g *GenerateCodeSamplePreviewAsyncResponseBody) GetJobID() string { + if g == nil { return "" } - return o.JobID + return g.JobID } -func (o *GenerateCodeSamplePreviewAsyncResponseBody) GetStatus() shared.CodeSamplesJobStatus { - if o == nil { +func (g *GenerateCodeSamplePreviewAsyncResponseBody) GetStatus() shared.CodeSamplesJobStatus { + if g == nil { return shared.CodeSamplesJobStatus("") } - return o.Status + return g.Status } type GenerateCodeSamplePreviewAsyncResponse struct { @@ -40,30 +40,30 @@ type GenerateCodeSamplePreviewAsyncResponse struct { Object *GenerateCodeSamplePreviewAsyncResponseBody } -func (o *GenerateCodeSamplePreviewAsyncResponse) GetContentType() string { - if o == nil { +func (g *GenerateCodeSamplePreviewAsyncResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GenerateCodeSamplePreviewAsyncResponse) GetStatusCode() int { - if o == nil { +func (g *GenerateCodeSamplePreviewAsyncResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GenerateCodeSamplePreviewAsyncResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GenerateCodeSamplePreviewAsyncResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GenerateCodeSamplePreviewAsyncResponse) GetObject() *GenerateCodeSamplePreviewAsyncResponseBody { - if o == nil { +func (g *GenerateCodeSamplePreviewAsyncResponse) GetObject() *GenerateCodeSamplePreviewAsyncResponseBody { + if g == nil { return nil } - return o.Object + return g.Object } diff --git a/pkg/models/operations/getaccesstoken.go b/pkg/models/operations/getaccesstoken.go index 1d540717..cf57fd46 100644 --- a/pkg/models/operations/getaccesstoken.go +++ b/pkg/models/operations/getaccesstoken.go @@ -12,11 +12,11 @@ type GetAccessTokenRequest struct { WorkspaceID string `queryParam:"style=form,explode=true,name=workspace_id"` } -func (o *GetAccessTokenRequest) GetWorkspaceID() string { - if o == nil { +func (g *GetAccessTokenRequest) GetWorkspaceID() string { + if g == nil { return "" } - return o.WorkspaceID + return g.WorkspaceID } type GetAccessTokenResponse struct { @@ -30,30 +30,30 @@ type GetAccessTokenResponse struct { RawResponse *http.Response } -func (o *GetAccessTokenResponse) GetAccessToken() *shared.AccessToken { - if o == nil { +func (g *GetAccessTokenResponse) GetAccessToken() *shared.AccessToken { + if g == nil { return nil } - return o.AccessToken + return g.AccessToken } -func (o *GetAccessTokenResponse) GetContentType() string { - if o == nil { +func (g *GetAccessTokenResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetAccessTokenResponse) GetStatusCode() int { - if o == nil { +func (g *GetAccessTokenResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetAccessTokenResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetAccessTokenResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getbillingaddons.go b/pkg/models/operations/getbillingaddons.go index ef71aac6..585edb6c 100644 --- a/pkg/models/operations/getbillingaddons.go +++ b/pkg/models/operations/getbillingaddons.go @@ -18,30 +18,30 @@ type GetBillingAddOnsResponse struct { RawResponse *http.Response } -func (o *GetBillingAddOnsResponse) GetContentType() string { - if o == nil { +func (g *GetBillingAddOnsResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetBillingAddOnsResponse) GetOrganizationBillingAddOnResponse() *shared.OrganizationBillingAddOnResponse { - if o == nil { +func (g *GetBillingAddOnsResponse) GetOrganizationBillingAddOnResponse() *shared.OrganizationBillingAddOnResponse { + if g == nil { return nil } - return o.OrganizationBillingAddOnResponse + return g.OrganizationBillingAddOnResponse } -func (o *GetBillingAddOnsResponse) GetStatusCode() int { - if o == nil { +func (g *GetBillingAddOnsResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetBillingAddOnsResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetBillingAddOnsResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getblob.go b/pkg/models/operations/getblob.go index cbfce0f8..695a78ac 100644 --- a/pkg/models/operations/getblob.go +++ b/pkg/models/operations/getblob.go @@ -14,32 +14,32 @@ type GetBlobRequest struct { WorkspaceSlug string `pathParam:"style=simple,explode=false,name=workspace_slug"` } -func (o *GetBlobRequest) GetDigest() string { - if o == nil { +func (g *GetBlobRequest) GetDigest() string { + if g == nil { return "" } - return o.Digest + return g.Digest } -func (o *GetBlobRequest) GetNamespaceName() string { - if o == nil { +func (g *GetBlobRequest) GetNamespaceName() string { + if g == nil { return "" } - return o.NamespaceName + return g.NamespaceName } -func (o *GetBlobRequest) GetOrganizationSlug() string { - if o == nil { +func (g *GetBlobRequest) GetOrganizationSlug() string { + if g == nil { return "" } - return o.OrganizationSlug + return g.OrganizationSlug } -func (o *GetBlobRequest) GetWorkspaceSlug() string { - if o == nil { +func (g *GetBlobRequest) GetWorkspaceSlug() string { + if g == nil { return "" } - return o.WorkspaceSlug + return g.WorkspaceSlug } type GetBlobResponse struct { @@ -54,30 +54,30 @@ type GetBlobResponse struct { RawResponse *http.Response } -func (o *GetBlobResponse) GetBlob() io.ReadCloser { - if o == nil { +func (g *GetBlobResponse) GetBlob() io.ReadCloser { + if g == nil { return nil } - return o.Blob + return g.Blob } -func (o *GetBlobResponse) GetContentType() string { - if o == nil { +func (g *GetBlobResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetBlobResponse) GetStatusCode() int { - if o == nil { +func (g *GetBlobResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetBlobResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetBlobResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getchangesreportsignedurl.go b/pkg/models/operations/getchangesreportsignedurl.go index 2143323f..0c46ba52 100644 --- a/pkg/models/operations/getchangesreportsignedurl.go +++ b/pkg/models/operations/getchangesreportsignedurl.go @@ -11,11 +11,11 @@ type GetChangesReportSignedURLRequest struct { DocumentChecksum string `pathParam:"style=simple,explode=false,name=documentChecksum"` } -func (o *GetChangesReportSignedURLRequest) GetDocumentChecksum() string { - if o == nil { +func (g *GetChangesReportSignedURLRequest) GetDocumentChecksum() string { + if g == nil { return "" } - return o.DocumentChecksum + return g.DocumentChecksum } // GetChangesReportSignedURLSignedAccess - OK @@ -23,11 +23,11 @@ type GetChangesReportSignedURLSignedAccess struct { URL string `json:"url"` } -func (o *GetChangesReportSignedURLSignedAccess) GetURL() string { - if o == nil { +func (g *GetChangesReportSignedURLSignedAccess) GetURL() string { + if g == nil { return "" } - return o.URL + return g.URL } type GetChangesReportSignedURLResponse struct { @@ -41,30 +41,30 @@ type GetChangesReportSignedURLResponse struct { SignedAccess *GetChangesReportSignedURLSignedAccess } -func (o *GetChangesReportSignedURLResponse) GetContentType() string { - if o == nil { +func (g *GetChangesReportSignedURLResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetChangesReportSignedURLResponse) GetStatusCode() int { - if o == nil { +func (g *GetChangesReportSignedURLResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetChangesReportSignedURLResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetChangesReportSignedURLResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetChangesReportSignedURLResponse) GetSignedAccess() *GetChangesReportSignedURLSignedAccess { - if o == nil { +func (g *GetChangesReportSignedURLResponse) GetSignedAccess() *GetChangesReportSignedURLSignedAccess { + if g == nil { return nil } - return o.SignedAccess + return g.SignedAccess } diff --git a/pkg/models/operations/getcodesamplepreviewasync.go b/pkg/models/operations/getcodesamplepreviewasync.go index 2660cb8a..78c2f3fa 100644 --- a/pkg/models/operations/getcodesamplepreviewasync.go +++ b/pkg/models/operations/getcodesamplepreviewasync.go @@ -12,11 +12,11 @@ type GetCodeSamplePreviewAsyncRequest struct { JobID string `pathParam:"style=simple,explode=false,name=jobID"` } -func (o *GetCodeSamplePreviewAsyncRequest) GetJobID() string { - if o == nil { +func (g *GetCodeSamplePreviewAsyncRequest) GetJobID() string { + if g == nil { return "" } - return o.JobID + return g.JobID } // GetCodeSamplePreviewAsyncResponseBody - Job is still in progress @@ -25,11 +25,11 @@ type GetCodeSamplePreviewAsyncResponseBody struct { Status shared.CodeSamplesJobStatus `json:"status"` } -func (o *GetCodeSamplePreviewAsyncResponseBody) GetStatus() shared.CodeSamplesJobStatus { - if o == nil { +func (g *GetCodeSamplePreviewAsyncResponseBody) GetStatus() shared.CodeSamplesJobStatus { + if g == nil { return shared.CodeSamplesJobStatus("") } - return o.Status + return g.Status } type GetCodeSamplePreviewAsyncResponse struct { @@ -45,37 +45,37 @@ type GetCodeSamplePreviewAsyncResponse struct { Object *GetCodeSamplePreviewAsyncResponseBody } -func (o *GetCodeSamplePreviewAsyncResponse) GetContentType() string { - if o == nil { +func (g *GetCodeSamplePreviewAsyncResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetCodeSamplePreviewAsyncResponse) GetStatusCode() int { - if o == nil { +func (g *GetCodeSamplePreviewAsyncResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetCodeSamplePreviewAsyncResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetCodeSamplePreviewAsyncResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetCodeSamplePreviewAsyncResponse) GetUsageSnippets() *shared.UsageSnippets { - if o == nil { +func (g *GetCodeSamplePreviewAsyncResponse) GetUsageSnippets() *shared.UsageSnippets { + if g == nil { return nil } - return o.UsageSnippets + return g.UsageSnippets } -func (o *GetCodeSamplePreviewAsyncResponse) GetObject() *GetCodeSamplePreviewAsyncResponseBody { - if o == nil { +func (g *GetCodeSamplePreviewAsyncResponse) GetObject() *GetCodeSamplePreviewAsyncResponseBody { + if g == nil { return nil } - return o.Object + return g.Object } diff --git a/pkg/models/operations/getcodesamples.go b/pkg/models/operations/getcodesamples.go index 9658b8c5..5adb1a58 100644 --- a/pkg/models/operations/getcodesamples.go +++ b/pkg/models/operations/getcodesamples.go @@ -12,18 +12,18 @@ type MethodPaths struct { Path string `queryParam:"name=path"` } -func (o *MethodPaths) GetMethod() shared.HTTPMethod { - if o == nil { +func (m *MethodPaths) GetMethod() shared.HTTPMethod { + if m == nil { return shared.HTTPMethod("") } - return o.Method + return m.Method } -func (o *MethodPaths) GetPath() string { - if o == nil { +func (m *MethodPaths) GetPath() string { + if m == nil { return "" } - return o.Path + return m.Path } type GetCodeSamplesRequest struct { @@ -37,32 +37,32 @@ type GetCodeSamplesRequest struct { RegistryURL string `queryParam:"style=form,explode=true,name=registry_url"` } -func (o *GetCodeSamplesRequest) GetLanguages() []string { - if o == nil { +func (g *GetCodeSamplesRequest) GetLanguages() []string { + if g == nil { return nil } - return o.Languages + return g.Languages } -func (o *GetCodeSamplesRequest) GetMethodPaths() []MethodPaths { - if o == nil { +func (g *GetCodeSamplesRequest) GetMethodPaths() []MethodPaths { + if g == nil { return nil } - return o.MethodPaths + return g.MethodPaths } -func (o *GetCodeSamplesRequest) GetOperationIds() []string { - if o == nil { +func (g *GetCodeSamplesRequest) GetOperationIds() []string { + if g == nil { return nil } - return o.OperationIds + return g.OperationIds } -func (o *GetCodeSamplesRequest) GetRegistryURL() string { - if o == nil { +func (g *GetCodeSamplesRequest) GetRegistryURL() string { + if g == nil { return "" } - return o.RegistryURL + return g.RegistryURL } type GetCodeSamplesResponse struct { @@ -76,30 +76,30 @@ type GetCodeSamplesResponse struct { UsageSnippets *shared.UsageSnippets } -func (o *GetCodeSamplesResponse) GetContentType() string { - if o == nil { +func (g *GetCodeSamplesResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetCodeSamplesResponse) GetStatusCode() int { - if o == nil { +func (g *GetCodeSamplesResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetCodeSamplesResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetCodeSamplesResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetCodeSamplesResponse) GetUsageSnippets() *shared.UsageSnippets { - if o == nil { +func (g *GetCodeSamplesResponse) GetUsageSnippets() *shared.UsageSnippets { + if g == nil { return nil } - return o.UsageSnippets + return g.UsageSnippets } diff --git a/pkg/models/operations/getgithubaction.go b/pkg/models/operations/getgithubaction.go index 7f8514ec..d25317d9 100644 --- a/pkg/models/operations/getgithubaction.go +++ b/pkg/models/operations/getgithubaction.go @@ -14,25 +14,25 @@ type GetGitHubActionRequest struct { TargetName *string `queryParam:"style=form,explode=true,name=targetName"` } -func (o *GetGitHubActionRequest) GetOrg() string { - if o == nil { +func (g *GetGitHubActionRequest) GetOrg() string { + if g == nil { return "" } - return o.Org + return g.Org } -func (o *GetGitHubActionRequest) GetRepo() string { - if o == nil { +func (g *GetGitHubActionRequest) GetRepo() string { + if g == nil { return "" } - return o.Repo + return g.Repo } -func (o *GetGitHubActionRequest) GetTargetName() *string { - if o == nil { +func (g *GetGitHubActionRequest) GetTargetName() *string { + if g == nil { return nil } - return o.TargetName + return g.TargetName } type GetGitHubActionResponse struct { @@ -46,30 +46,30 @@ type GetGitHubActionResponse struct { RawResponse *http.Response } -func (o *GetGitHubActionResponse) GetContentType() string { - if o == nil { +func (g *GetGitHubActionResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetGitHubActionResponse) GetGithubGetActionResponse() *shared.GithubGetActionResponse { - if o == nil { +func (g *GetGitHubActionResponse) GetGithubGetActionResponse() *shared.GithubGetActionResponse { + if g == nil { return nil } - return o.GithubGetActionResponse + return g.GithubGetActionResponse } -func (o *GetGitHubActionResponse) GetStatusCode() int { - if o == nil { +func (g *GetGitHubActionResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetGitHubActionResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetGitHubActionResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getgithubsetupstate.go b/pkg/models/operations/getgithubsetupstate.go index a351b58e..187ec994 100644 --- a/pkg/models/operations/getgithubsetupstate.go +++ b/pkg/models/operations/getgithubsetupstate.go @@ -13,25 +13,25 @@ type GetGithubSetupStateRequest struct { Repo string `queryParam:"style=form,explode=true,name=repo"` } -func (o *GetGithubSetupStateRequest) GetGenerateGenLockID() string { - if o == nil { +func (g *GetGithubSetupStateRequest) GetGenerateGenLockID() string { + if g == nil { return "" } - return o.GenerateGenLockID + return g.GenerateGenLockID } -func (o *GetGithubSetupStateRequest) GetOrg() string { - if o == nil { +func (g *GetGithubSetupStateRequest) GetOrg() string { + if g == nil { return "" } - return o.Org + return g.Org } -func (o *GetGithubSetupStateRequest) GetRepo() string { - if o == nil { +func (g *GetGithubSetupStateRequest) GetRepo() string { + if g == nil { return "" } - return o.Repo + return g.Repo } type GetGithubSetupStateResponse struct { @@ -45,30 +45,30 @@ type GetGithubSetupStateResponse struct { RawResponse *http.Response } -func (o *GetGithubSetupStateResponse) GetContentType() string { - if o == nil { +func (g *GetGithubSetupStateResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetGithubSetupStateResponse) GetGithubSetupStateResponse() *shared.GithubSetupStateResponse { - if o == nil { +func (g *GetGithubSetupStateResponse) GetGithubSetupStateResponse() *shared.GithubSetupStateResponse { + if g == nil { return nil } - return o.GithubSetupStateResponse + return g.GithubSetupStateResponse } -func (o *GetGithubSetupStateResponse) GetStatusCode() int { - if o == nil { +func (g *GetGithubSetupStateResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetGithubSetupStateResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetGithubSetupStateResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getlintingreportsignedurl.go b/pkg/models/operations/getlintingreportsignedurl.go index 757bf6e5..786ee7ff 100644 --- a/pkg/models/operations/getlintingreportsignedurl.go +++ b/pkg/models/operations/getlintingreportsignedurl.go @@ -11,11 +11,11 @@ type GetLintingReportSignedURLRequest struct { DocumentChecksum string `pathParam:"style=simple,explode=false,name=documentChecksum"` } -func (o *GetLintingReportSignedURLRequest) GetDocumentChecksum() string { - if o == nil { +func (g *GetLintingReportSignedURLRequest) GetDocumentChecksum() string { + if g == nil { return "" } - return o.DocumentChecksum + return g.DocumentChecksum } // GetLintingReportSignedURLSignedAccess - OK @@ -23,11 +23,11 @@ type GetLintingReportSignedURLSignedAccess struct { URL string `json:"url"` } -func (o *GetLintingReportSignedURLSignedAccess) GetURL() string { - if o == nil { +func (g *GetLintingReportSignedURLSignedAccess) GetURL() string { + if g == nil { return "" } - return o.URL + return g.URL } type GetLintingReportSignedURLResponse struct { @@ -41,30 +41,30 @@ type GetLintingReportSignedURLResponse struct { SignedAccess *GetLintingReportSignedURLSignedAccess } -func (o *GetLintingReportSignedURLResponse) GetContentType() string { - if o == nil { +func (g *GetLintingReportSignedURLResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetLintingReportSignedURLResponse) GetStatusCode() int { - if o == nil { +func (g *GetLintingReportSignedURLResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetLintingReportSignedURLResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetLintingReportSignedURLResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetLintingReportSignedURLResponse) GetSignedAccess() *GetLintingReportSignedURLSignedAccess { - if o == nil { +func (g *GetLintingReportSignedURLResponse) GetSignedAccess() *GetLintingReportSignedURLSignedAccess { + if g == nil { return nil } - return o.SignedAccess + return g.SignedAccess } diff --git a/pkg/models/operations/getmanifest.go b/pkg/models/operations/getmanifest.go index 59cca05e..bd6cda37 100644 --- a/pkg/models/operations/getmanifest.go +++ b/pkg/models/operations/getmanifest.go @@ -15,32 +15,32 @@ type GetManifestRequest struct { WorkspaceSlug string `pathParam:"style=simple,explode=false,name=workspace_slug"` } -func (o *GetManifestRequest) GetNamespaceName() string { - if o == nil { +func (g *GetManifestRequest) GetNamespaceName() string { + if g == nil { return "" } - return o.NamespaceName + return g.NamespaceName } -func (o *GetManifestRequest) GetOrganizationSlug() string { - if o == nil { +func (g *GetManifestRequest) GetOrganizationSlug() string { + if g == nil { return "" } - return o.OrganizationSlug + return g.OrganizationSlug } -func (o *GetManifestRequest) GetRevisionReference() string { - if o == nil { +func (g *GetManifestRequest) GetRevisionReference() string { + if g == nil { return "" } - return o.RevisionReference + return g.RevisionReference } -func (o *GetManifestRequest) GetWorkspaceSlug() string { - if o == nil { +func (g *GetManifestRequest) GetWorkspaceSlug() string { + if g == nil { return "" } - return o.WorkspaceSlug + return g.WorkspaceSlug } type GetManifestResponse struct { @@ -54,30 +54,30 @@ type GetManifestResponse struct { RawResponse *http.Response } -func (o *GetManifestResponse) GetContentType() string { - if o == nil { +func (g *GetManifestResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetManifestResponse) GetManifest() *shared.Manifest { - if o == nil { +func (g *GetManifestResponse) GetManifest() *shared.Manifest { + if g == nil { return nil } - return o.Manifest + return g.Manifest } -func (o *GetManifestResponse) GetStatusCode() int { - if o == nil { +func (g *GetManifestResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetManifestResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetManifestResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getnamespaces.go b/pkg/models/operations/getnamespaces.go index 45500fa1..4862ed0f 100644 --- a/pkg/models/operations/getnamespaces.go +++ b/pkg/models/operations/getnamespaces.go @@ -18,30 +18,30 @@ type GetNamespacesResponse struct { RawResponse *http.Response } -func (o *GetNamespacesResponse) GetContentType() string { - if o == nil { +func (g *GetNamespacesResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetNamespacesResponse) GetGetNamespacesResponse() *shared.GetNamespacesResponse { - if o == nil { +func (g *GetNamespacesResponse) GetGetNamespacesResponse() *shared.GetNamespacesResponse { + if g == nil { return nil } - return o.GetNamespacesResponse + return g.GetNamespacesResponse } -func (o *GetNamespacesResponse) GetStatusCode() int { - if o == nil { +func (g *GetNamespacesResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetNamespacesResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetNamespacesResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getorganization.go b/pkg/models/operations/getorganization.go index f69c9e4e..e66d1090 100644 --- a/pkg/models/operations/getorganization.go +++ b/pkg/models/operations/getorganization.go @@ -12,11 +12,11 @@ type GetOrganizationRequest struct { OrganizationID string `pathParam:"style=simple,explode=false,name=organizationID"` } -func (o *GetOrganizationRequest) GetOrganizationID() string { - if o == nil { +func (g *GetOrganizationRequest) GetOrganizationID() string { + if g == nil { return "" } - return o.OrganizationID + return g.OrganizationID } type GetOrganizationResponse struct { @@ -30,30 +30,30 @@ type GetOrganizationResponse struct { RawResponse *http.Response } -func (o *GetOrganizationResponse) GetContentType() string { - if o == nil { +func (g *GetOrganizationResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetOrganizationResponse) GetOrganization() *shared.Organization { - if o == nil { +func (g *GetOrganizationResponse) GetOrganization() *shared.Organization { + if g == nil { return nil } - return o.Organization + return g.Organization } -func (o *GetOrganizationResponse) GetStatusCode() int { - if o == nil { +func (g *GetOrganizationResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetOrganizationResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetOrganizationResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getorganizations.go b/pkg/models/operations/getorganizations.go index f63696e1..74186cf9 100644 --- a/pkg/models/operations/getorganizations.go +++ b/pkg/models/operations/getorganizations.go @@ -18,30 +18,30 @@ type GetOrganizationsResponse struct { RawResponse *http.Response } -func (o *GetOrganizationsResponse) GetContentType() string { - if o == nil { +func (g *GetOrganizationsResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetOrganizationsResponse) GetOrganizations() []shared.Organization { - if o == nil { +func (g *GetOrganizationsResponse) GetOrganizations() []shared.Organization { + if g == nil { return nil } - return o.Organizations + return g.Organizations } -func (o *GetOrganizationsResponse) GetStatusCode() int { - if o == nil { +func (g *GetOrganizationsResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetOrganizationsResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetOrganizationsResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getorganizationusage.go b/pkg/models/operations/getorganizationusage.go index a8a690ce..550caa83 100644 --- a/pkg/models/operations/getorganizationusage.go +++ b/pkg/models/operations/getorganizationusage.go @@ -18,30 +18,30 @@ type GetOrganizationUsageResponse struct { RawResponse *http.Response } -func (o *GetOrganizationUsageResponse) GetContentType() string { - if o == nil { +func (g *GetOrganizationUsageResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetOrganizationUsageResponse) GetOrganizationUsageResponse() *shared.OrganizationUsageResponse { - if o == nil { +func (g *GetOrganizationUsageResponse) GetOrganizationUsageResponse() *shared.OrganizationUsageResponse { + if g == nil { return nil } - return o.OrganizationUsageResponse + return g.OrganizationUsageResponse } -func (o *GetOrganizationUsageResponse) GetStatusCode() int { - if o == nil { +func (g *GetOrganizationUsageResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetOrganizationUsageResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetOrganizationUsageResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getpublishingtoken.go b/pkg/models/operations/getpublishingtoken.go index c00c1476..3970f966 100644 --- a/pkg/models/operations/getpublishingtoken.go +++ b/pkg/models/operations/getpublishingtoken.go @@ -18,30 +18,30 @@ type GetPublishingTokenResponse struct { Classes []shared.PublishingToken } -func (o *GetPublishingTokenResponse) GetContentType() string { - if o == nil { +func (g *GetPublishingTokenResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetPublishingTokenResponse) GetStatusCode() int { - if o == nil { +func (g *GetPublishingTokenResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetPublishingTokenResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetPublishingTokenResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetPublishingTokenResponse) GetClasses() []shared.PublishingToken { - if o == nil { +func (g *GetPublishingTokenResponse) GetClasses() []shared.PublishingToken { + if g == nil { return nil } - return o.Classes + return g.Classes } diff --git a/pkg/models/operations/getpublishingtokenbyid.go b/pkg/models/operations/getpublishingtokenbyid.go index 22e0309e..4f64f0e2 100644 --- a/pkg/models/operations/getpublishingtokenbyid.go +++ b/pkg/models/operations/getpublishingtokenbyid.go @@ -12,11 +12,11 @@ type GetPublishingTokenByIDRequest struct { TokenID string `pathParam:"style=simple,explode=false,name=tokenID"` } -func (o *GetPublishingTokenByIDRequest) GetTokenID() string { - if o == nil { +func (g *GetPublishingTokenByIDRequest) GetTokenID() string { + if g == nil { return "" } - return o.TokenID + return g.TokenID } type GetPublishingTokenByIDResponse struct { @@ -30,30 +30,30 @@ type GetPublishingTokenByIDResponse struct { RawResponse *http.Response } -func (o *GetPublishingTokenByIDResponse) GetContentType() string { - if o == nil { +func (g *GetPublishingTokenByIDResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetPublishingTokenByIDResponse) GetPublishingToken() *shared.PublishingToken { - if o == nil { +func (g *GetPublishingTokenByIDResponse) GetPublishingToken() *shared.PublishingToken { + if g == nil { return nil } - return o.PublishingToken + return g.PublishingToken } -func (o *GetPublishingTokenByIDResponse) GetStatusCode() int { - if o == nil { +func (g *GetPublishingTokenByIDResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetPublishingTokenByIDResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetPublishingTokenByIDResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getpublishingtokenpublicmetadata.go b/pkg/models/operations/getpublishingtokenpublicmetadata.go index f8f7d18b..c41d4578 100644 --- a/pkg/models/operations/getpublishingtokenpublicmetadata.go +++ b/pkg/models/operations/getpublishingtokenpublicmetadata.go @@ -13,11 +13,11 @@ type GetPublishingTokenPublicMetadataRequest struct { TokenID string `pathParam:"style=simple,explode=false,name=tokenID"` } -func (o *GetPublishingTokenPublicMetadataRequest) GetTokenID() string { - if o == nil { +func (g *GetPublishingTokenPublicMetadataRequest) GetTokenID() string { + if g == nil { return "" } - return o.TokenID + return g.TokenID } // GetPublishingTokenPublicMetadataResponseBody - OK @@ -34,45 +34,45 @@ func (g GetPublishingTokenPublicMetadataResponseBody) MarshalJSON() ([]byte, err } func (g *GetPublishingTokenPublicMetadataResponseBody) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { return err } return nil } -func (o *GetPublishingTokenPublicMetadataResponseBody) GetOrganizationID() *string { - if o == nil { +func (g *GetPublishingTokenPublicMetadataResponseBody) GetOrganizationID() *string { + if g == nil { return nil } - return o.OrganizationID + return g.OrganizationID } -func (o *GetPublishingTokenPublicMetadataResponseBody) GetTargetID() *string { - if o == nil { +func (g *GetPublishingTokenPublicMetadataResponseBody) GetTargetID() *string { + if g == nil { return nil } - return o.TargetID + return g.TargetID } -func (o *GetPublishingTokenPublicMetadataResponseBody) GetTargetResource() *string { - if o == nil { +func (g *GetPublishingTokenPublicMetadataResponseBody) GetTargetResource() *string { + if g == nil { return nil } - return o.TargetResource + return g.TargetResource } -func (o *GetPublishingTokenPublicMetadataResponseBody) GetValidUntil() *time.Time { - if o == nil { +func (g *GetPublishingTokenPublicMetadataResponseBody) GetValidUntil() *time.Time { + if g == nil { return nil } - return o.ValidUntil + return g.ValidUntil } -func (o *GetPublishingTokenPublicMetadataResponseBody) GetWorkspaceID() *string { - if o == nil { +func (g *GetPublishingTokenPublicMetadataResponseBody) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetPublishingTokenPublicMetadataResponse struct { @@ -86,30 +86,30 @@ type GetPublishingTokenPublicMetadataResponse struct { Object *GetPublishingTokenPublicMetadataResponseBody } -func (o *GetPublishingTokenPublicMetadataResponse) GetContentType() string { - if o == nil { +func (g *GetPublishingTokenPublicMetadataResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetPublishingTokenPublicMetadataResponse) GetStatusCode() int { - if o == nil { +func (g *GetPublishingTokenPublicMetadataResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetPublishingTokenPublicMetadataResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetPublishingTokenPublicMetadataResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetPublishingTokenPublicMetadataResponse) GetObject() *GetPublishingTokenPublicMetadataResponseBody { - if o == nil { +func (g *GetPublishingTokenPublicMetadataResponse) GetObject() *GetPublishingTokenPublicMetadataResponseBody { + if g == nil { return nil } - return o.Object + return g.Object } diff --git a/pkg/models/operations/getpublishingtokentargetbyid.go b/pkg/models/operations/getpublishingtokentargetbyid.go index 4db61f8c..70fede0a 100644 --- a/pkg/models/operations/getpublishingtokentargetbyid.go +++ b/pkg/models/operations/getpublishingtokentargetbyid.go @@ -11,11 +11,11 @@ type GetPublishingTokenTargetByIDRequest struct { TokenID string `pathParam:"style=simple,explode=false,name=tokenID"` } -func (o *GetPublishingTokenTargetByIDRequest) GetTokenID() string { - if o == nil { +func (g *GetPublishingTokenTargetByIDRequest) GetTokenID() string { + if g == nil { return "" } - return o.TokenID + return g.TokenID } type GetPublishingTokenTargetByIDResponse struct { @@ -29,30 +29,30 @@ type GetPublishingTokenTargetByIDResponse struct { Res *string } -func (o *GetPublishingTokenTargetByIDResponse) GetContentType() string { - if o == nil { +func (g *GetPublishingTokenTargetByIDResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetPublishingTokenTargetByIDResponse) GetStatusCode() int { - if o == nil { +func (g *GetPublishingTokenTargetByIDResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetPublishingTokenTargetByIDResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetPublishingTokenTargetByIDResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetPublishingTokenTargetByIDResponse) GetRes() *string { - if o == nil { +func (g *GetPublishingTokenTargetByIDResponse) GetRes() *string { + if g == nil { return nil } - return o.Res + return g.Res } diff --git a/pkg/models/operations/getrevisions.go b/pkg/models/operations/getrevisions.go index ed3be900..2759c608 100644 --- a/pkg/models/operations/getrevisions.go +++ b/pkg/models/operations/getrevisions.go @@ -13,18 +13,18 @@ type GetRevisionsRequest struct { NextPageToken *string `queryParam:"style=form,explode=true,name=next_page_token"` } -func (o *GetRevisionsRequest) GetNamespaceName() string { - if o == nil { +func (g *GetRevisionsRequest) GetNamespaceName() string { + if g == nil { return "" } - return o.NamespaceName + return g.NamespaceName } -func (o *GetRevisionsRequest) GetNextPageToken() *string { - if o == nil { +func (g *GetRevisionsRequest) GetNextPageToken() *string { + if g == nil { return nil } - return o.NextPageToken + return g.NextPageToken } type GetRevisionsResponse struct { @@ -38,30 +38,30 @@ type GetRevisionsResponse struct { RawResponse *http.Response } -func (o *GetRevisionsResponse) GetContentType() string { - if o == nil { +func (g *GetRevisionsResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetRevisionsResponse) GetGetRevisionsResponse() *shared.GetRevisionsResponse { - if o == nil { +func (g *GetRevisionsResponse) GetGetRevisionsResponse() *shared.GetRevisionsResponse { + if g == nil { return nil } - return o.GetRevisionsResponse + return g.GetRevisionsResponse } -func (o *GetRevisionsResponse) GetStatusCode() int { - if o == nil { +func (g *GetRevisionsResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetRevisionsResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetRevisionsResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getschemastoreitem.go b/pkg/models/operations/getschemastoreitem.go index 3cac7a13..6e7f8246 100644 --- a/pkg/models/operations/getschemastoreitem.go +++ b/pkg/models/operations/getschemastoreitem.go @@ -11,11 +11,11 @@ type GetSchemaStoreItemRequestBody struct { ID *string `json:"id,omitempty"` } -func (o *GetSchemaStoreItemRequestBody) GetID() *string { - if o == nil { +func (g *GetSchemaStoreItemRequestBody) GetID() *string { + if g == nil { return nil } - return o.ID + return g.ID } type GetSchemaStoreItemResponse struct { @@ -29,30 +29,30 @@ type GetSchemaStoreItemResponse struct { RawResponse *http.Response } -func (o *GetSchemaStoreItemResponse) GetContentType() string { - if o == nil { +func (g *GetSchemaStoreItemResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetSchemaStoreItemResponse) GetSchemaStoreItem() *shared.SchemaStoreItem { - if o == nil { +func (g *GetSchemaStoreItemResponse) GetSchemaStoreItem() *shared.SchemaStoreItem { + if g == nil { return nil } - return o.SchemaStoreItem + return g.SchemaStoreItem } -func (o *GetSchemaStoreItemResponse) GetStatusCode() int { - if o == nil { +func (g *GetSchemaStoreItemResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetSchemaStoreItemResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetSchemaStoreItemResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/gettags.go b/pkg/models/operations/gettags.go index 8337cae6..bf36b8cc 100644 --- a/pkg/models/operations/gettags.go +++ b/pkg/models/operations/gettags.go @@ -11,11 +11,11 @@ type GetTagsRequest struct { NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` } -func (o *GetTagsRequest) GetNamespaceName() string { - if o == nil { +func (g *GetTagsRequest) GetNamespaceName() string { + if g == nil { return "" } - return o.NamespaceName + return g.NamespaceName } type GetTagsResponse struct { @@ -29,30 +29,30 @@ type GetTagsResponse struct { RawResponse *http.Response } -func (o *GetTagsResponse) GetContentType() string { - if o == nil { +func (g *GetTagsResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetTagsResponse) GetGetTagsResponse() *shared.GetTagsResponse { - if o == nil { +func (g *GetTagsResponse) GetGetTagsResponse() *shared.GetTagsResponse { + if g == nil { return nil } - return o.GetTagsResponse + return g.GetTagsResponse } -func (o *GetTagsResponse) GetStatusCode() int { - if o == nil { +func (g *GetTagsResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetTagsResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetTagsResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getuser.go b/pkg/models/operations/getuser.go index 96b34f4e..d96d22d6 100644 --- a/pkg/models/operations/getuser.go +++ b/pkg/models/operations/getuser.go @@ -18,30 +18,30 @@ type GetUserResponse struct { User *shared.User } -func (o *GetUserResponse) GetContentType() string { - if o == nil { +func (g *GetUserResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetUserResponse) GetStatusCode() int { - if o == nil { +func (g *GetUserResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetUserResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetUserResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetUserResponse) GetUser() *shared.User { - if o == nil { +func (g *GetUserResponse) GetUser() *shared.User { + if g == nil { return nil } - return o.User + return g.User } diff --git a/pkg/models/operations/getworkspace.go b/pkg/models/operations/getworkspace.go index d0c1682b..ad6b0163 100644 --- a/pkg/models/operations/getworkspace.go +++ b/pkg/models/operations/getworkspace.go @@ -11,11 +11,11 @@ type GetWorkspaceGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceGlobals) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceGlobals) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceRequest struct { @@ -23,11 +23,11 @@ type GetWorkspaceRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceRequest) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceRequest) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceResponse struct { @@ -41,30 +41,30 @@ type GetWorkspaceResponse struct { Workspace *shared.Workspace } -func (o *GetWorkspaceResponse) GetContentType() string { - if o == nil { +func (g *GetWorkspaceResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetWorkspaceResponse) GetStatusCode() int { - if o == nil { +func (g *GetWorkspaceResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetWorkspaceResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetWorkspaceResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetWorkspaceResponse) GetWorkspace() *shared.Workspace { - if o == nil { +func (g *GetWorkspaceResponse) GetWorkspace() *shared.Workspace { + if g == nil { return nil } - return o.Workspace + return g.Workspace } diff --git a/pkg/models/operations/getworkspaceaccess.go b/pkg/models/operations/getworkspaceaccess.go index 13851db0..34a4a626 100644 --- a/pkg/models/operations/getworkspaceaccess.go +++ b/pkg/models/operations/getworkspaceaccess.go @@ -16,25 +16,25 @@ type GetWorkspaceAccessRequest struct { TargetType *string `queryParam:"style=form,explode=true,name=targetType"` } -func (o *GetWorkspaceAccessRequest) GetGenLockID() *string { - if o == nil { +func (g *GetWorkspaceAccessRequest) GetGenLockID() *string { + if g == nil { return nil } - return o.GenLockID + return g.GenLockID } -func (o *GetWorkspaceAccessRequest) GetPassive() *bool { - if o == nil { +func (g *GetWorkspaceAccessRequest) GetPassive() *bool { + if g == nil { return nil } - return o.Passive + return g.Passive } -func (o *GetWorkspaceAccessRequest) GetTargetType() *string { - if o == nil { +func (g *GetWorkspaceAccessRequest) GetTargetType() *string { + if g == nil { return nil } - return o.TargetType + return g.TargetType } type GetWorkspaceAccessResponse struct { @@ -48,30 +48,30 @@ type GetWorkspaceAccessResponse struct { RawResponse *http.Response } -func (o *GetWorkspaceAccessResponse) GetAccessDetails() *shared.AccessDetails { - if o == nil { +func (g *GetWorkspaceAccessResponse) GetAccessDetails() *shared.AccessDetails { + if g == nil { return nil } - return o.AccessDetails + return g.AccessDetails } -func (o *GetWorkspaceAccessResponse) GetContentType() string { - if o == nil { +func (g *GetWorkspaceAccessResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetWorkspaceAccessResponse) GetStatusCode() int { - if o == nil { +func (g *GetWorkspaceAccessResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetWorkspaceAccessResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetWorkspaceAccessResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getworkspacebycontext.go b/pkg/models/operations/getworkspacebycontext.go index fde3c40d..a3f7a2cb 100644 --- a/pkg/models/operations/getworkspacebycontext.go +++ b/pkg/models/operations/getworkspacebycontext.go @@ -18,30 +18,30 @@ type GetWorkspaceByContextResponse struct { WorkspaceAndOrganization *shared.WorkspaceAndOrganization } -func (o *GetWorkspaceByContextResponse) GetContentType() string { - if o == nil { +func (g *GetWorkspaceByContextResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetWorkspaceByContextResponse) GetStatusCode() int { - if o == nil { +func (g *GetWorkspaceByContextResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetWorkspaceByContextResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetWorkspaceByContextResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetWorkspaceByContextResponse) GetWorkspaceAndOrganization() *shared.WorkspaceAndOrganization { - if o == nil { +func (g *GetWorkspaceByContextResponse) GetWorkspaceAndOrganization() *shared.WorkspaceAndOrganization { + if g == nil { return nil } - return o.WorkspaceAndOrganization + return g.WorkspaceAndOrganization } diff --git a/pkg/models/operations/getworkspaceeventsbytarget.go b/pkg/models/operations/getworkspaceeventsbytarget.go index 5c1c4e11..c96011e3 100644 --- a/pkg/models/operations/getworkspaceeventsbytarget.go +++ b/pkg/models/operations/getworkspaceeventsbytarget.go @@ -13,11 +13,11 @@ type GetWorkspaceEventsByTargetGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceEventsByTargetGlobals) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceEventsByTargetGlobals) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceEventsByTargetRequest struct { @@ -34,31 +34,31 @@ func (g GetWorkspaceEventsByTargetRequest) MarshalJSON() ([]byte, error) { } func (g *GetWorkspaceEventsByTargetRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &g, "", false, []string{"target_id"}); err != nil { return err } return nil } -func (o *GetWorkspaceEventsByTargetRequest) GetAfterCreatedAt() *time.Time { - if o == nil { +func (g *GetWorkspaceEventsByTargetRequest) GetAfterCreatedAt() *time.Time { + if g == nil { return nil } - return o.AfterCreatedAt + return g.AfterCreatedAt } -func (o *GetWorkspaceEventsByTargetRequest) GetTargetID() string { - if o == nil { +func (g *GetWorkspaceEventsByTargetRequest) GetTargetID() string { + if g == nil { return "" } - return o.TargetID + return g.TargetID } -func (o *GetWorkspaceEventsByTargetRequest) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceEventsByTargetRequest) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceEventsByTargetResponse struct { @@ -72,30 +72,30 @@ type GetWorkspaceEventsByTargetResponse struct { RawResponse *http.Response } -func (o *GetWorkspaceEventsByTargetResponse) GetCliEventBatch() []shared.CliEvent { - if o == nil { +func (g *GetWorkspaceEventsByTargetResponse) GetCliEventBatch() []shared.CliEvent { + if g == nil { return nil } - return o.CliEventBatch + return g.CliEventBatch } -func (o *GetWorkspaceEventsByTargetResponse) GetContentType() string { - if o == nil { +func (g *GetWorkspaceEventsByTargetResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetWorkspaceEventsByTargetResponse) GetStatusCode() int { - if o == nil { +func (g *GetWorkspaceEventsByTargetResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetWorkspaceEventsByTargetResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetWorkspaceEventsByTargetResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/getworkspacefeatureflags.go b/pkg/models/operations/getworkspacefeatureflags.go index c1b6f289..6a0ea333 100644 --- a/pkg/models/operations/getworkspacefeatureflags.go +++ b/pkg/models/operations/getworkspacefeatureflags.go @@ -11,11 +11,11 @@ type GetWorkspaceFeatureFlagsGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceFeatureFlagsGlobals) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceFeatureFlagsGlobals) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceFeatureFlagsRequest struct { @@ -23,11 +23,11 @@ type GetWorkspaceFeatureFlagsRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceFeatureFlagsRequest) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceFeatureFlagsRequest) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceFeatureFlagsResponse struct { @@ -41,30 +41,30 @@ type GetWorkspaceFeatureFlagsResponse struct { WorkspaceFeatureFlagResponse *shared.WorkspaceFeatureFlagResponse } -func (o *GetWorkspaceFeatureFlagsResponse) GetContentType() string { - if o == nil { +func (g *GetWorkspaceFeatureFlagsResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetWorkspaceFeatureFlagsResponse) GetStatusCode() int { - if o == nil { +func (g *GetWorkspaceFeatureFlagsResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetWorkspaceFeatureFlagsResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetWorkspaceFeatureFlagsResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetWorkspaceFeatureFlagsResponse) GetWorkspaceFeatureFlagResponse() *shared.WorkspaceFeatureFlagResponse { - if o == nil { +func (g *GetWorkspaceFeatureFlagsResponse) GetWorkspaceFeatureFlagResponse() *shared.WorkspaceFeatureFlagResponse { + if g == nil { return nil } - return o.WorkspaceFeatureFlagResponse + return g.WorkspaceFeatureFlagResponse } diff --git a/pkg/models/operations/getworkspaces.go b/pkg/models/operations/getworkspaces.go index 9d4654f4..01dae409 100644 --- a/pkg/models/operations/getworkspaces.go +++ b/pkg/models/operations/getworkspaces.go @@ -18,30 +18,30 @@ type GetWorkspacesResponse struct { Workspaces []shared.Workspace } -func (o *GetWorkspacesResponse) GetContentType() string { - if o == nil { +func (g *GetWorkspacesResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetWorkspacesResponse) GetStatusCode() int { - if o == nil { +func (g *GetWorkspacesResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetWorkspacesResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetWorkspacesResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetWorkspacesResponse) GetWorkspaces() []shared.Workspace { - if o == nil { +func (g *GetWorkspacesResponse) GetWorkspaces() []shared.Workspace { + if g == nil { return nil } - return o.Workspaces + return g.Workspaces } diff --git a/pkg/models/operations/getworkspacesettings.go b/pkg/models/operations/getworkspacesettings.go index 6aa88e49..6679609f 100644 --- a/pkg/models/operations/getworkspacesettings.go +++ b/pkg/models/operations/getworkspacesettings.go @@ -11,11 +11,11 @@ type GetWorkspaceSettingsGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceSettingsGlobals) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceSettingsGlobals) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceSettingsRequest struct { @@ -23,11 +23,11 @@ type GetWorkspaceSettingsRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceSettingsRequest) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceSettingsRequest) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceSettingsResponse struct { @@ -41,30 +41,30 @@ type GetWorkspaceSettingsResponse struct { WorkspaceSettings *shared.WorkspaceSettings } -func (o *GetWorkspaceSettingsResponse) GetContentType() string { - if o == nil { +func (g *GetWorkspaceSettingsResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetWorkspaceSettingsResponse) GetStatusCode() int { - if o == nil { +func (g *GetWorkspaceSettingsResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetWorkspaceSettingsResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetWorkspaceSettingsResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetWorkspaceSettingsResponse) GetWorkspaceSettings() *shared.WorkspaceSettings { - if o == nil { +func (g *GetWorkspaceSettingsResponse) GetWorkspaceSettings() *shared.WorkspaceSettings { + if g == nil { return nil } - return o.WorkspaceSettings + return g.WorkspaceSettings } diff --git a/pkg/models/operations/getworkspacetargets.go b/pkg/models/operations/getworkspacetargets.go index d993d29e..a5b80baa 100644 --- a/pkg/models/operations/getworkspacetargets.go +++ b/pkg/models/operations/getworkspacetargets.go @@ -19,17 +19,17 @@ func (g GetWorkspaceTargetsRequest) MarshalJSON() ([]byte, error) { } func (g *GetWorkspaceTargetsRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { return err } return nil } -func (o *GetWorkspaceTargetsRequest) GetAfterLastEventCreatedAt() *time.Time { - if o == nil { +func (g *GetWorkspaceTargetsRequest) GetAfterLastEventCreatedAt() *time.Time { + if g == nil { return nil } - return o.AfterLastEventCreatedAt + return g.AfterLastEventCreatedAt } type GetWorkspaceTargetsResponse struct { @@ -43,30 +43,30 @@ type GetWorkspaceTargetsResponse struct { TargetSDKList []shared.TargetSDK } -func (o *GetWorkspaceTargetsResponse) GetContentType() string { - if o == nil { +func (g *GetWorkspaceTargetsResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetWorkspaceTargetsResponse) GetStatusCode() int { - if o == nil { +func (g *GetWorkspaceTargetsResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetWorkspaceTargetsResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetWorkspaceTargetsResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetWorkspaceTargetsResponse) GetTargetSDKList() []shared.TargetSDK { - if o == nil { +func (g *GetWorkspaceTargetsResponse) GetTargetSDKList() []shared.TargetSDK { + if g == nil { return nil } - return o.TargetSDKList + return g.TargetSDKList } diff --git a/pkg/models/operations/getworkspacetargetsdeprecated.go b/pkg/models/operations/getworkspacetargetsdeprecated.go index dbd5d742..b1ed3af8 100644 --- a/pkg/models/operations/getworkspacetargetsdeprecated.go +++ b/pkg/models/operations/getworkspacetargetsdeprecated.go @@ -13,11 +13,11 @@ type GetWorkspaceTargetsDeprecatedGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceTargetsDeprecatedGlobals) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceTargetsDeprecatedGlobals) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceTargetsDeprecatedRequest struct { @@ -32,24 +32,24 @@ func (g GetWorkspaceTargetsDeprecatedRequest) MarshalJSON() ([]byte, error) { } func (g *GetWorkspaceTargetsDeprecatedRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { return err } return nil } -func (o *GetWorkspaceTargetsDeprecatedRequest) GetAfterLastEventCreatedAt() *time.Time { - if o == nil { +func (g *GetWorkspaceTargetsDeprecatedRequest) GetAfterLastEventCreatedAt() *time.Time { + if g == nil { return nil } - return o.AfterLastEventCreatedAt + return g.AfterLastEventCreatedAt } -func (o *GetWorkspaceTargetsDeprecatedRequest) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceTargetsDeprecatedRequest) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceTargetsDeprecatedResponse struct { @@ -63,30 +63,30 @@ type GetWorkspaceTargetsDeprecatedResponse struct { TargetSDKList []shared.TargetSDK } -func (o *GetWorkspaceTargetsDeprecatedResponse) GetContentType() string { - if o == nil { +func (g *GetWorkspaceTargetsDeprecatedResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetWorkspaceTargetsDeprecatedResponse) GetStatusCode() int { - if o == nil { +func (g *GetWorkspaceTargetsDeprecatedResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetWorkspaceTargetsDeprecatedResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetWorkspaceTargetsDeprecatedResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetWorkspaceTargetsDeprecatedResponse) GetTargetSDKList() []shared.TargetSDK { - if o == nil { +func (g *GetWorkspaceTargetsDeprecatedResponse) GetTargetSDKList() []shared.TargetSDK { + if g == nil { return nil } - return o.TargetSDKList + return g.TargetSDKList } diff --git a/pkg/models/operations/getworkspaceteam.go b/pkg/models/operations/getworkspaceteam.go index 329a948c..1d7f54b4 100644 --- a/pkg/models/operations/getworkspaceteam.go +++ b/pkg/models/operations/getworkspaceteam.go @@ -11,11 +11,11 @@ type GetWorkspaceTeamGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceTeamGlobals) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceTeamGlobals) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceTeamRequest struct { @@ -23,11 +23,11 @@ type GetWorkspaceTeamRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceTeamRequest) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceTeamRequest) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceTeamResponse struct { @@ -41,30 +41,30 @@ type GetWorkspaceTeamResponse struct { WorkspaceTeamResponse *shared.WorkspaceTeamResponse } -func (o *GetWorkspaceTeamResponse) GetContentType() string { - if o == nil { +func (g *GetWorkspaceTeamResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetWorkspaceTeamResponse) GetStatusCode() int { - if o == nil { +func (g *GetWorkspaceTeamResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetWorkspaceTeamResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetWorkspaceTeamResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetWorkspaceTeamResponse) GetWorkspaceTeamResponse() *shared.WorkspaceTeamResponse { - if o == nil { +func (g *GetWorkspaceTeamResponse) GetWorkspaceTeamResponse() *shared.WorkspaceTeamResponse { + if g == nil { return nil } - return o.WorkspaceTeamResponse + return g.WorkspaceTeamResponse } diff --git a/pkg/models/operations/getworkspacetokens.go b/pkg/models/operations/getworkspacetokens.go index c8fb2233..85b882d4 100644 --- a/pkg/models/operations/getworkspacetokens.go +++ b/pkg/models/operations/getworkspacetokens.go @@ -11,11 +11,11 @@ type GetWorkspaceTokensGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceTokensGlobals) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceTokensGlobals) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceTokensRequest struct { @@ -23,11 +23,11 @@ type GetWorkspaceTokensRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GetWorkspaceTokensRequest) GetWorkspaceID() *string { - if o == nil { +func (g *GetWorkspaceTokensRequest) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GetWorkspaceTokensResponse struct { @@ -41,30 +41,30 @@ type GetWorkspaceTokensResponse struct { Classes []shared.WorkspaceToken } -func (o *GetWorkspaceTokensResponse) GetContentType() string { - if o == nil { +func (g *GetWorkspaceTokensResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GetWorkspaceTokensResponse) GetStatusCode() int { - if o == nil { +func (g *GetWorkspaceTokensResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GetWorkspaceTokensResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GetWorkspaceTokensResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GetWorkspaceTokensResponse) GetClasses() []shared.WorkspaceToken { - if o == nil { +func (g *GetWorkspaceTokensResponse) GetClasses() []shared.WorkspaceToken { + if g == nil { return nil } - return o.Classes + return g.Classes } diff --git a/pkg/models/operations/githubcheckpublishingprs.go b/pkg/models/operations/githubcheckpublishingprs.go index d54a4d8e..46b9eb1e 100644 --- a/pkg/models/operations/githubcheckpublishingprs.go +++ b/pkg/models/operations/githubcheckpublishingprs.go @@ -13,25 +13,25 @@ type GithubCheckPublishingPRsRequest struct { Repo string `queryParam:"style=form,explode=true,name=repo"` } -func (o *GithubCheckPublishingPRsRequest) GetGenerateGenLockID() string { - if o == nil { +func (g *GithubCheckPublishingPRsRequest) GetGenerateGenLockID() string { + if g == nil { return "" } - return o.GenerateGenLockID + return g.GenerateGenLockID } -func (o *GithubCheckPublishingPRsRequest) GetOrg() string { - if o == nil { +func (g *GithubCheckPublishingPRsRequest) GetOrg() string { + if g == nil { return "" } - return o.Org + return g.Org } -func (o *GithubCheckPublishingPRsRequest) GetRepo() string { - if o == nil { +func (g *GithubCheckPublishingPRsRequest) GetRepo() string { + if g == nil { return "" } - return o.Repo + return g.Repo } type GithubCheckPublishingPRsResponse struct { @@ -45,30 +45,30 @@ type GithubCheckPublishingPRsResponse struct { RawResponse *http.Response } -func (o *GithubCheckPublishingPRsResponse) GetContentType() string { - if o == nil { +func (g *GithubCheckPublishingPRsResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GithubCheckPublishingPRsResponse) GetGithubPublishingPRResponse() *shared.GithubPublishingPRResponse { - if o == nil { +func (g *GithubCheckPublishingPRsResponse) GetGithubPublishingPRResponse() *shared.GithubPublishingPRResponse { + if g == nil { return nil } - return o.GithubPublishingPRResponse + return g.GithubPublishingPRResponse } -func (o *GithubCheckPublishingPRsResponse) GetStatusCode() int { - if o == nil { +func (g *GithubCheckPublishingPRsResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GithubCheckPublishingPRsResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GithubCheckPublishingPRsResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/githubcheckpublishingsecrets.go b/pkg/models/operations/githubcheckpublishingsecrets.go index 9bf6d2d7..61875ff5 100644 --- a/pkg/models/operations/githubcheckpublishingsecrets.go +++ b/pkg/models/operations/githubcheckpublishingsecrets.go @@ -11,11 +11,11 @@ type GithubCheckPublishingSecretsRequest struct { GenerateGenLockID string `queryParam:"style=form,explode=true,name=generate_gen_lock_id"` } -func (o *GithubCheckPublishingSecretsRequest) GetGenerateGenLockID() string { - if o == nil { +func (g *GithubCheckPublishingSecretsRequest) GetGenerateGenLockID() string { + if g == nil { return "" } - return o.GenerateGenLockID + return g.GenerateGenLockID } type GithubCheckPublishingSecretsResponse struct { @@ -29,30 +29,30 @@ type GithubCheckPublishingSecretsResponse struct { RawResponse *http.Response } -func (o *GithubCheckPublishingSecretsResponse) GetContentType() string { - if o == nil { +func (g *GithubCheckPublishingSecretsResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GithubCheckPublishingSecretsResponse) GetGithubMissingPublishingSecretsResponse() *shared.GithubMissingPublishingSecretsResponse { - if o == nil { +func (g *GithubCheckPublishingSecretsResponse) GetGithubMissingPublishingSecretsResponse() *shared.GithubMissingPublishingSecretsResponse { + if g == nil { return nil } - return o.GithubMissingPublishingSecretsResponse + return g.GithubMissingPublishingSecretsResponse } -func (o *GithubCheckPublishingSecretsResponse) GetStatusCode() int { - if o == nil { +func (g *GithubCheckPublishingSecretsResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GithubCheckPublishingSecretsResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GithubCheckPublishingSecretsResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/githubconfigurecodesamples.go b/pkg/models/operations/githubconfigurecodesamples.go index 61e0072c..bdc38885 100644 --- a/pkg/models/operations/githubconfigurecodesamples.go +++ b/pkg/models/operations/githubconfigurecodesamples.go @@ -18,30 +18,30 @@ type GithubConfigureCodeSamplesResponse struct { RawResponse *http.Response } -func (o *GithubConfigureCodeSamplesResponse) GetContentType() string { - if o == nil { +func (g *GithubConfigureCodeSamplesResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GithubConfigureCodeSamplesResponse) GetGithubConfigureCodeSamplesResponse() *shared.GithubConfigureCodeSamplesResponse { - if o == nil { +func (g *GithubConfigureCodeSamplesResponse) GetGithubConfigureCodeSamplesResponse() *shared.GithubConfigureCodeSamplesResponse { + if g == nil { return nil } - return o.GithubConfigureCodeSamplesResponse + return g.GithubConfigureCodeSamplesResponse } -func (o *GithubConfigureCodeSamplesResponse) GetStatusCode() int { - if o == nil { +func (g *GithubConfigureCodeSamplesResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GithubConfigureCodeSamplesResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GithubConfigureCodeSamplesResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/githubconfiguremintlifyrepo.go b/pkg/models/operations/githubconfiguremintlifyrepo.go index 83452c0d..b6eaf22b 100644 --- a/pkg/models/operations/githubconfiguremintlifyrepo.go +++ b/pkg/models/operations/githubconfiguremintlifyrepo.go @@ -15,23 +15,23 @@ type GithubConfigureMintlifyRepoResponse struct { RawResponse *http.Response } -func (o *GithubConfigureMintlifyRepoResponse) GetContentType() string { - if o == nil { +func (g *GithubConfigureMintlifyRepoResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GithubConfigureMintlifyRepoResponse) GetStatusCode() int { - if o == nil { +func (g *GithubConfigureMintlifyRepoResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GithubConfigureMintlifyRepoResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GithubConfigureMintlifyRepoResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/githubconfiguretarget.go b/pkg/models/operations/githubconfiguretarget.go index 7122bcdf..4fd620e6 100644 --- a/pkg/models/operations/githubconfiguretarget.go +++ b/pkg/models/operations/githubconfiguretarget.go @@ -15,23 +15,23 @@ type GithubConfigureTargetResponse struct { RawResponse *http.Response } -func (o *GithubConfigureTargetResponse) GetContentType() string { - if o == nil { +func (g *GithubConfigureTargetResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GithubConfigureTargetResponse) GetStatusCode() int { - if o == nil { +func (g *GithubConfigureTargetResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GithubConfigureTargetResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GithubConfigureTargetResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/githubstorepublishingsecrets.go b/pkg/models/operations/githubstorepublishingsecrets.go index 07581a18..04504fa0 100644 --- a/pkg/models/operations/githubstorepublishingsecrets.go +++ b/pkg/models/operations/githubstorepublishingsecrets.go @@ -15,23 +15,23 @@ type GithubStorePublishingSecretsResponse struct { RawResponse *http.Response } -func (o *GithubStorePublishingSecretsResponse) GetContentType() string { - if o == nil { +func (g *GithubStorePublishingSecretsResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GithubStorePublishingSecretsResponse) GetStatusCode() int { - if o == nil { +func (g *GithubStorePublishingSecretsResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GithubStorePublishingSecretsResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GithubStorePublishingSecretsResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/githubtriggeraction.go b/pkg/models/operations/githubtriggeraction.go index e986aa92..7e76988c 100644 --- a/pkg/models/operations/githubtriggeraction.go +++ b/pkg/models/operations/githubtriggeraction.go @@ -15,23 +15,23 @@ type GithubTriggerActionResponse struct { RawResponse *http.Response } -func (o *GithubTriggerActionResponse) GetContentType() string { - if o == nil { +func (g *GithubTriggerActionResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GithubTriggerActionResponse) GetStatusCode() int { - if o == nil { +func (g *GithubTriggerActionResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GithubTriggerActionResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GithubTriggerActionResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } diff --git a/pkg/models/operations/grantuseraccesstoworkspace.go b/pkg/models/operations/grantuseraccesstoworkspace.go index d203d0f9..58921a40 100644 --- a/pkg/models/operations/grantuseraccesstoworkspace.go +++ b/pkg/models/operations/grantuseraccesstoworkspace.go @@ -11,11 +11,11 @@ type GrantUserAccessToWorkspaceGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GrantUserAccessToWorkspaceGlobals) GetWorkspaceID() *string { - if o == nil { +func (g *GrantUserAccessToWorkspaceGlobals) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GrantUserAccessToWorkspaceRequest struct { @@ -25,18 +25,18 @@ type GrantUserAccessToWorkspaceRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *GrantUserAccessToWorkspaceRequest) GetEmail() string { - if o == nil { +func (g *GrantUserAccessToWorkspaceRequest) GetEmail() string { + if g == nil { return "" } - return o.Email + return g.Email } -func (o *GrantUserAccessToWorkspaceRequest) GetWorkspaceID() *string { - if o == nil { +func (g *GrantUserAccessToWorkspaceRequest) GetWorkspaceID() *string { + if g == nil { return nil } - return o.WorkspaceID + return g.WorkspaceID } type GrantUserAccessToWorkspaceResponse struct { @@ -50,30 +50,30 @@ type GrantUserAccessToWorkspaceResponse struct { WorkspaceInviteResponse *shared.WorkspaceInviteResponse } -func (o *GrantUserAccessToWorkspaceResponse) GetContentType() string { - if o == nil { +func (g *GrantUserAccessToWorkspaceResponse) GetContentType() string { + if g == nil { return "" } - return o.ContentType + return g.ContentType } -func (o *GrantUserAccessToWorkspaceResponse) GetStatusCode() int { - if o == nil { +func (g *GrantUserAccessToWorkspaceResponse) GetStatusCode() int { + if g == nil { return 0 } - return o.StatusCode + return g.StatusCode } -func (o *GrantUserAccessToWorkspaceResponse) GetRawResponse() *http.Response { - if o == nil { +func (g *GrantUserAccessToWorkspaceResponse) GetRawResponse() *http.Response { + if g == nil { return nil } - return o.RawResponse + return g.RawResponse } -func (o *GrantUserAccessToWorkspaceResponse) GetWorkspaceInviteResponse() *shared.WorkspaceInviteResponse { - if o == nil { +func (g *GrantUserAccessToWorkspaceResponse) GetWorkspaceInviteResponse() *shared.WorkspaceInviteResponse { + if g == nil { return nil } - return o.WorkspaceInviteResponse + return g.WorkspaceInviteResponse } diff --git a/pkg/models/operations/ignoresubscriptionnamespace.go b/pkg/models/operations/ignoresubscriptionnamespace.go index 6be3eae4..566831aa 100644 --- a/pkg/models/operations/ignoresubscriptionnamespace.go +++ b/pkg/models/operations/ignoresubscriptionnamespace.go @@ -13,18 +13,18 @@ type IgnoreSubscriptionNamespaceRequest struct { SubscriptionID string `pathParam:"style=simple,explode=false,name=subscriptionID"` } -func (o *IgnoreSubscriptionNamespaceRequest) GetNamespaceName() string { - if o == nil { +func (i *IgnoreSubscriptionNamespaceRequest) GetNamespaceName() string { + if i == nil { return "" } - return o.NamespaceName + return i.NamespaceName } -func (o *IgnoreSubscriptionNamespaceRequest) GetSubscriptionID() string { - if o == nil { +func (i *IgnoreSubscriptionNamespaceRequest) GetSubscriptionID() string { + if i == nil { return "" } - return o.SubscriptionID + return i.SubscriptionID } type IgnoreSubscriptionNamespaceResponse struct { @@ -36,23 +36,23 @@ type IgnoreSubscriptionNamespaceResponse struct { RawResponse *http.Response } -func (o *IgnoreSubscriptionNamespaceResponse) GetContentType() string { - if o == nil { +func (i *IgnoreSubscriptionNamespaceResponse) GetContentType() string { + if i == nil { return "" } - return o.ContentType + return i.ContentType } -func (o *IgnoreSubscriptionNamespaceResponse) GetStatusCode() int { - if o == nil { +func (i *IgnoreSubscriptionNamespaceResponse) GetStatusCode() int { + if i == nil { return 0 } - return o.StatusCode + return i.StatusCode } -func (o *IgnoreSubscriptionNamespaceResponse) GetRawResponse() *http.Response { - if o == nil { +func (i *IgnoreSubscriptionNamespaceResponse) GetRawResponse() *http.Response { + if i == nil { return nil } - return o.RawResponse + return i.RawResponse } diff --git a/pkg/models/operations/linkgithubaccess.go b/pkg/models/operations/linkgithubaccess.go index dda46f95..38b97ad9 100644 --- a/pkg/models/operations/linkgithubaccess.go +++ b/pkg/models/operations/linkgithubaccess.go @@ -12,25 +12,25 @@ type LinkGithubAccessRequest struct { InstallationID *string `queryParam:"style=form,explode=true,name=installation_id"` } -func (o *LinkGithubAccessRequest) GetGithubOidcToken() *string { - if o == nil { +func (l *LinkGithubAccessRequest) GetGithubOidcToken() *string { + if l == nil { return nil } - return o.GithubOidcToken + return l.GithubOidcToken } -func (o *LinkGithubAccessRequest) GetGithubOrg() *string { - if o == nil { +func (l *LinkGithubAccessRequest) GetGithubOrg() *string { + if l == nil { return nil } - return o.GithubOrg + return l.GithubOrg } -func (o *LinkGithubAccessRequest) GetInstallationID() *string { - if o == nil { +func (l *LinkGithubAccessRequest) GetInstallationID() *string { + if l == nil { return nil } - return o.InstallationID + return l.InstallationID } type LinkGithubAccessResponse struct { @@ -42,23 +42,23 @@ type LinkGithubAccessResponse struct { RawResponse *http.Response } -func (o *LinkGithubAccessResponse) GetContentType() string { - if o == nil { +func (l *LinkGithubAccessResponse) GetContentType() string { + if l == nil { return "" } - return o.ContentType + return l.ContentType } -func (o *LinkGithubAccessResponse) GetStatusCode() int { - if o == nil { +func (l *LinkGithubAccessResponse) GetStatusCode() int { + if l == nil { return 0 } - return o.StatusCode + return l.StatusCode } -func (o *LinkGithubAccessResponse) GetRawResponse() *http.Response { - if o == nil { +func (l *LinkGithubAccessResponse) GetRawResponse() *http.Response { + if l == nil { return nil } - return o.RawResponse + return l.RawResponse } diff --git a/pkg/models/operations/listremotesources.go b/pkg/models/operations/listremotesources.go index 55223b0c..71c45a9a 100644 --- a/pkg/models/operations/listremotesources.go +++ b/pkg/models/operations/listremotesources.go @@ -11,11 +11,11 @@ type ListRemoteSourcesRequest struct { NamespaceName string `queryParam:"style=form,explode=true,name=namespace_name"` } -func (o *ListRemoteSourcesRequest) GetNamespaceName() string { - if o == nil { +func (l *ListRemoteSourcesRequest) GetNamespaceName() string { + if l == nil { return "" } - return o.NamespaceName + return l.NamespaceName } type ListRemoteSourcesResponse struct { @@ -29,30 +29,30 @@ type ListRemoteSourcesResponse struct { RawResponse *http.Response } -func (o *ListRemoteSourcesResponse) GetContentType() string { - if o == nil { +func (l *ListRemoteSourcesResponse) GetContentType() string { + if l == nil { return "" } - return o.ContentType + return l.ContentType } -func (o *ListRemoteSourcesResponse) GetRemoteSource() *shared.RemoteSource { - if o == nil { +func (l *ListRemoteSourcesResponse) GetRemoteSource() *shared.RemoteSource { + if l == nil { return nil } - return o.RemoteSource + return l.RemoteSource } -func (o *ListRemoteSourcesResponse) GetStatusCode() int { - if o == nil { +func (l *ListRemoteSourcesResponse) GetStatusCode() int { + if l == nil { return 0 } - return o.StatusCode + return l.StatusCode } -func (o *ListRemoteSourcesResponse) GetRawResponse() *http.Response { - if o == nil { +func (l *ListRemoteSourcesResponse) GetRawResponse() *http.Response { + if l == nil { return nil } - return o.RawResponse + return l.RawResponse } diff --git a/pkg/models/operations/posttags.go b/pkg/models/operations/posttags.go index 156a4374..0b820508 100644 --- a/pkg/models/operations/posttags.go +++ b/pkg/models/operations/posttags.go @@ -13,18 +13,18 @@ type PostTagsRequest struct { NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` } -func (o *PostTagsRequest) GetAddTags() *shared.AddTags { - if o == nil { +func (p *PostTagsRequest) GetAddTags() *shared.AddTags { + if p == nil { return nil } - return o.AddTags + return p.AddTags } -func (o *PostTagsRequest) GetNamespaceName() string { - if o == nil { +func (p *PostTagsRequest) GetNamespaceName() string { + if p == nil { return "" } - return o.NamespaceName + return p.NamespaceName } type PostTagsResponse struct { @@ -36,23 +36,23 @@ type PostTagsResponse struct { RawResponse *http.Response } -func (o *PostTagsResponse) GetContentType() string { - if o == nil { +func (p *PostTagsResponse) GetContentType() string { + if p == nil { return "" } - return o.ContentType + return p.ContentType } -func (o *PostTagsResponse) GetStatusCode() int { - if o == nil { +func (p *PostTagsResponse) GetStatusCode() int { + if p == nil { return 0 } - return o.StatusCode + return p.StatusCode } -func (o *PostTagsResponse) GetRawResponse() *http.Response { - if o == nil { +func (p *PostTagsResponse) GetRawResponse() *http.Response { + if p == nil { return nil } - return o.RawResponse + return p.RawResponse } diff --git a/pkg/models/operations/postworkspaceevents.go b/pkg/models/operations/postworkspaceevents.go index 077849e8..8cb8eb0e 100644 --- a/pkg/models/operations/postworkspaceevents.go +++ b/pkg/models/operations/postworkspaceevents.go @@ -11,11 +11,11 @@ type PostWorkspaceEventsGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *PostWorkspaceEventsGlobals) GetWorkspaceID() *string { - if o == nil { +func (p *PostWorkspaceEventsGlobals) GetWorkspaceID() *string { + if p == nil { return nil } - return o.WorkspaceID + return p.WorkspaceID } type PostWorkspaceEventsRequest struct { @@ -24,18 +24,18 @@ type PostWorkspaceEventsRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *PostWorkspaceEventsRequest) GetRequestBody() []shared.CliEvent { - if o == nil { +func (p *PostWorkspaceEventsRequest) GetRequestBody() []shared.CliEvent { + if p == nil { return []shared.CliEvent{} } - return o.RequestBody + return p.RequestBody } -func (o *PostWorkspaceEventsRequest) GetWorkspaceID() *string { - if o == nil { +func (p *PostWorkspaceEventsRequest) GetWorkspaceID() *string { + if p == nil { return nil } - return o.WorkspaceID + return p.WorkspaceID } type PostWorkspaceEventsResponse struct { @@ -47,23 +47,23 @@ type PostWorkspaceEventsResponse struct { RawResponse *http.Response } -func (o *PostWorkspaceEventsResponse) GetContentType() string { - if o == nil { +func (p *PostWorkspaceEventsResponse) GetContentType() string { + if p == nil { return "" } - return o.ContentType + return p.ContentType } -func (o *PostWorkspaceEventsResponse) GetStatusCode() int { - if o == nil { +func (p *PostWorkspaceEventsResponse) GetStatusCode() int { + if p == nil { return 0 } - return o.StatusCode + return p.StatusCode } -func (o *PostWorkspaceEventsResponse) GetRawResponse() *http.Response { - if o == nil { +func (p *PostWorkspaceEventsResponse) GetRawResponse() *http.Response { + if p == nil { return nil } - return o.RawResponse + return p.RawResponse } diff --git a/pkg/models/operations/preflight.go b/pkg/models/operations/preflight.go index 00d4162e..38e6d925 100644 --- a/pkg/models/operations/preflight.go +++ b/pkg/models/operations/preflight.go @@ -18,30 +18,30 @@ type PreflightResponse struct { RawResponse *http.Response } -func (o *PreflightResponse) GetContentType() string { - if o == nil { +func (p *PreflightResponse) GetContentType() string { + if p == nil { return "" } - return o.ContentType + return p.ContentType } -func (o *PreflightResponse) GetPreflightToken() *shared.PreflightToken { - if o == nil { +func (p *PreflightResponse) GetPreflightToken() *shared.PreflightToken { + if p == nil { return nil } - return o.PreflightToken + return p.PreflightToken } -func (o *PreflightResponse) GetStatusCode() int { - if o == nil { +func (p *PreflightResponse) GetStatusCode() int { + if p == nil { return 0 } - return o.StatusCode + return p.StatusCode } -func (o *PreflightResponse) GetRawResponse() *http.Response { - if o == nil { +func (p *PreflightResponse) GetRawResponse() *http.Response { + if p == nil { return nil } - return o.RawResponse + return p.RawResponse } diff --git a/pkg/models/operations/revokeuseraccesstoworkspace.go b/pkg/models/operations/revokeuseraccesstoworkspace.go index 63012e94..46d40950 100644 --- a/pkg/models/operations/revokeuseraccesstoworkspace.go +++ b/pkg/models/operations/revokeuseraccesstoworkspace.go @@ -10,11 +10,11 @@ type RevokeUserAccessToWorkspaceGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *RevokeUserAccessToWorkspaceGlobals) GetWorkspaceID() *string { - if o == nil { +func (r *RevokeUserAccessToWorkspaceGlobals) GetWorkspaceID() *string { + if r == nil { return nil } - return o.WorkspaceID + return r.WorkspaceID } type RevokeUserAccessToWorkspaceRequest struct { @@ -24,18 +24,18 @@ type RevokeUserAccessToWorkspaceRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *RevokeUserAccessToWorkspaceRequest) GetUserID() string { - if o == nil { +func (r *RevokeUserAccessToWorkspaceRequest) GetUserID() string { + if r == nil { return "" } - return o.UserID + return r.UserID } -func (o *RevokeUserAccessToWorkspaceRequest) GetWorkspaceID() *string { - if o == nil { +func (r *RevokeUserAccessToWorkspaceRequest) GetWorkspaceID() *string { + if r == nil { return nil } - return o.WorkspaceID + return r.WorkspaceID } type RevokeUserAccessToWorkspaceResponse struct { @@ -47,23 +47,23 @@ type RevokeUserAccessToWorkspaceResponse struct { RawResponse *http.Response } -func (o *RevokeUserAccessToWorkspaceResponse) GetContentType() string { - if o == nil { +func (r *RevokeUserAccessToWorkspaceResponse) GetContentType() string { + if r == nil { return "" } - return o.ContentType + return r.ContentType } -func (o *RevokeUserAccessToWorkspaceResponse) GetStatusCode() int { - if o == nil { +func (r *RevokeUserAccessToWorkspaceResponse) GetStatusCode() int { + if r == nil { return 0 } - return o.StatusCode + return r.StatusCode } -func (o *RevokeUserAccessToWorkspaceResponse) GetRawResponse() *http.Response { - if o == nil { +func (r *RevokeUserAccessToWorkspaceResponse) GetRawResponse() *http.Response { + if r == nil { return nil } - return o.RawResponse + return r.RawResponse } diff --git a/pkg/models/operations/searchworkspaceevents.go b/pkg/models/operations/searchworkspaceevents.go index 463d16ca..dfc142c2 100644 --- a/pkg/models/operations/searchworkspaceevents.go +++ b/pkg/models/operations/searchworkspaceevents.go @@ -11,11 +11,11 @@ type SearchWorkspaceEventsGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *SearchWorkspaceEventsGlobals) GetWorkspaceID() *string { - if o == nil { +func (s *SearchWorkspaceEventsGlobals) GetWorkspaceID() *string { + if s == nil { return nil } - return o.WorkspaceID + return s.WorkspaceID } type SearchWorkspaceEventsRequest struct { @@ -39,67 +39,67 @@ type SearchWorkspaceEventsRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *SearchWorkspaceEventsRequest) GetExecutionID() *string { - if o == nil { +func (s *SearchWorkspaceEventsRequest) GetExecutionID() *string { + if s == nil { return nil } - return o.ExecutionID + return s.ExecutionID } -func (o *SearchWorkspaceEventsRequest) GetGenerateGenLockID() *string { - if o == nil { +func (s *SearchWorkspaceEventsRequest) GetGenerateGenLockID() *string { + if s == nil { return nil } - return o.GenerateGenLockID + return s.GenerateGenLockID } -func (o *SearchWorkspaceEventsRequest) GetInteractionType() *shared.InteractionType { - if o == nil { +func (s *SearchWorkspaceEventsRequest) GetInteractionType() *shared.InteractionType { + if s == nil { return nil } - return o.InteractionType + return s.InteractionType } -func (o *SearchWorkspaceEventsRequest) GetLimit() *int64 { - if o == nil { +func (s *SearchWorkspaceEventsRequest) GetLimit() *int64 { + if s == nil { return nil } - return o.Limit + return s.Limit } -func (o *SearchWorkspaceEventsRequest) GetLintReportDigest() *string { - if o == nil { +func (s *SearchWorkspaceEventsRequest) GetLintReportDigest() *string { + if s == nil { return nil } - return o.LintReportDigest + return s.LintReportDigest } -func (o *SearchWorkspaceEventsRequest) GetOpenapiDiffReportDigest() *string { - if o == nil { +func (s *SearchWorkspaceEventsRequest) GetOpenapiDiffReportDigest() *string { + if s == nil { return nil } - return o.OpenapiDiffReportDigest + return s.OpenapiDiffReportDigest } -func (o *SearchWorkspaceEventsRequest) GetSourceRevisionDigest() *string { - if o == nil { +func (s *SearchWorkspaceEventsRequest) GetSourceRevisionDigest() *string { + if s == nil { return nil } - return o.SourceRevisionDigest + return s.SourceRevisionDigest } -func (o *SearchWorkspaceEventsRequest) GetSuccess() *bool { - if o == nil { +func (s *SearchWorkspaceEventsRequest) GetSuccess() *bool { + if s == nil { return nil } - return o.Success + return s.Success } -func (o *SearchWorkspaceEventsRequest) GetWorkspaceID() *string { - if o == nil { +func (s *SearchWorkspaceEventsRequest) GetWorkspaceID() *string { + if s == nil { return nil } - return o.WorkspaceID + return s.WorkspaceID } type SearchWorkspaceEventsResponse struct { @@ -113,30 +113,30 @@ type SearchWorkspaceEventsResponse struct { RawResponse *http.Response } -func (o *SearchWorkspaceEventsResponse) GetCliEventBatch() []shared.CliEvent { - if o == nil { +func (s *SearchWorkspaceEventsResponse) GetCliEventBatch() []shared.CliEvent { + if s == nil { return nil } - return o.CliEventBatch + return s.CliEventBatch } -func (o *SearchWorkspaceEventsResponse) GetContentType() string { - if o == nil { +func (s *SearchWorkspaceEventsResponse) GetContentType() string { + if s == nil { return "" } - return o.ContentType + return s.ContentType } -func (o *SearchWorkspaceEventsResponse) GetStatusCode() int { - if o == nil { +func (s *SearchWorkspaceEventsResponse) GetStatusCode() int { + if s == nil { return 0 } - return o.StatusCode + return s.StatusCode } -func (o *SearchWorkspaceEventsResponse) GetRawResponse() *http.Response { - if o == nil { +func (s *SearchWorkspaceEventsResponse) GetRawResponse() *http.Response { + if s == nil { return nil } - return o.RawResponse + return s.RawResponse } diff --git a/pkg/models/operations/setvisibility.go b/pkg/models/operations/setvisibility.go index 624e7f67..fa17d06a 100644 --- a/pkg/models/operations/setvisibility.go +++ b/pkg/models/operations/setvisibility.go @@ -11,11 +11,11 @@ type SetVisibilityRequestBody struct { Public bool `json:"public"` } -func (o *SetVisibilityRequestBody) GetPublic() bool { - if o == nil { +func (s *SetVisibilityRequestBody) GetPublic() bool { + if s == nil { return false } - return o.Public + return s.Public } type SetVisibilityRequest struct { @@ -24,18 +24,18 @@ type SetVisibilityRequest struct { NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` } -func (o *SetVisibilityRequest) GetRequestBody() *SetVisibilityRequestBody { - if o == nil { +func (s *SetVisibilityRequest) GetRequestBody() *SetVisibilityRequestBody { + if s == nil { return nil } - return o.RequestBody + return s.RequestBody } -func (o *SetVisibilityRequest) GetNamespaceName() string { - if o == nil { +func (s *SetVisibilityRequest) GetNamespaceName() string { + if s == nil { return "" } - return o.NamespaceName + return s.NamespaceName } type SetVisibilityResponse struct { @@ -47,23 +47,23 @@ type SetVisibilityResponse struct { RawResponse *http.Response } -func (o *SetVisibilityResponse) GetContentType() string { - if o == nil { +func (s *SetVisibilityResponse) GetContentType() string { + if s == nil { return "" } - return o.ContentType + return s.ContentType } -func (o *SetVisibilityResponse) GetStatusCode() int { - if o == nil { +func (s *SetVisibilityResponse) GetStatusCode() int { + if s == nil { return 0 } - return o.StatusCode + return s.StatusCode } -func (o *SetVisibilityResponse) GetRawResponse() *http.Response { - if o == nil { +func (s *SetVisibilityResponse) GetRawResponse() *http.Response { + if s == nil { return nil } - return o.RawResponse + return s.RawResponse } diff --git a/pkg/models/operations/setworkspacefeatureflags.go b/pkg/models/operations/setworkspacefeatureflags.go index f6db5808..550ec5b7 100644 --- a/pkg/models/operations/setworkspacefeatureflags.go +++ b/pkg/models/operations/setworkspacefeatureflags.go @@ -18,30 +18,30 @@ type SetWorkspaceFeatureFlagsResponse struct { WorkspaceFeatureFlagResponse *shared.WorkspaceFeatureFlagResponse } -func (o *SetWorkspaceFeatureFlagsResponse) GetContentType() string { - if o == nil { +func (s *SetWorkspaceFeatureFlagsResponse) GetContentType() string { + if s == nil { return "" } - return o.ContentType + return s.ContentType } -func (o *SetWorkspaceFeatureFlagsResponse) GetStatusCode() int { - if o == nil { +func (s *SetWorkspaceFeatureFlagsResponse) GetStatusCode() int { + if s == nil { return 0 } - return o.StatusCode + return s.StatusCode } -func (o *SetWorkspaceFeatureFlagsResponse) GetRawResponse() *http.Response { - if o == nil { +func (s *SetWorkspaceFeatureFlagsResponse) GetRawResponse() *http.Response { + if s == nil { return nil } - return o.RawResponse + return s.RawResponse } -func (o *SetWorkspaceFeatureFlagsResponse) GetWorkspaceFeatureFlagResponse() *shared.WorkspaceFeatureFlagResponse { - if o == nil { +func (s *SetWorkspaceFeatureFlagsResponse) GetWorkspaceFeatureFlagResponse() *shared.WorkspaceFeatureFlagResponse { + if s == nil { return nil } - return o.WorkspaceFeatureFlagResponse + return s.WorkspaceFeatureFlagResponse } diff --git a/pkg/models/operations/suggest.go b/pkg/models/operations/suggest.go index c6038083..3bb9f74b 100644 --- a/pkg/models/operations/suggest.go +++ b/pkg/models/operations/suggest.go @@ -14,18 +14,18 @@ type SuggestRequest struct { XSessionID string `header:"style=simple,explode=false,name=x-session-id"` } -func (o *SuggestRequest) GetSuggestRequestBody() shared.SuggestRequestBody { - if o == nil { +func (s *SuggestRequest) GetSuggestRequestBody() shared.SuggestRequestBody { + if s == nil { return shared.SuggestRequestBody{} } - return o.SuggestRequestBody + return s.SuggestRequestBody } -func (o *SuggestRequest) GetXSessionID() string { - if o == nil { +func (s *SuggestRequest) GetXSessionID() string { + if s == nil { return "" } - return o.XSessionID + return s.XSessionID } type SuggestResponse struct { @@ -40,30 +40,30 @@ type SuggestResponse struct { RawResponse *http.Response } -func (o *SuggestResponse) GetContentType() string { - if o == nil { +func (s *SuggestResponse) GetContentType() string { + if s == nil { return "" } - return o.ContentType + return s.ContentType } -func (o *SuggestResponse) GetSchema() io.ReadCloser { - if o == nil { +func (s *SuggestResponse) GetSchema() io.ReadCloser { + if s == nil { return nil } - return o.Schema + return s.Schema } -func (o *SuggestResponse) GetStatusCode() int { - if o == nil { +func (s *SuggestResponse) GetStatusCode() int { + if s == nil { return 0 } - return o.StatusCode + return s.StatusCode } -func (o *SuggestResponse) GetRawResponse() *http.Response { - if o == nil { +func (s *SuggestResponse) GetRawResponse() *http.Response { + if s == nil { return nil } - return o.RawResponse + return s.RawResponse } diff --git a/pkg/models/operations/suggestitems.go b/pkg/models/operations/suggestitems.go index d3d3b2ee..b1b427ee 100644 --- a/pkg/models/operations/suggestitems.go +++ b/pkg/models/operations/suggestitems.go @@ -17,30 +17,30 @@ type SuggestItemsResponse struct { Strings []string } -func (o *SuggestItemsResponse) GetContentType() string { - if o == nil { +func (s *SuggestItemsResponse) GetContentType() string { + if s == nil { return "" } - return o.ContentType + return s.ContentType } -func (o *SuggestItemsResponse) GetStatusCode() int { - if o == nil { +func (s *SuggestItemsResponse) GetStatusCode() int { + if s == nil { return 0 } - return o.StatusCode + return s.StatusCode } -func (o *SuggestItemsResponse) GetRawResponse() *http.Response { - if o == nil { +func (s *SuggestItemsResponse) GetRawResponse() *http.Response { + if s == nil { return nil } - return o.RawResponse + return s.RawResponse } -func (o *SuggestItemsResponse) GetStrings() []string { - if o == nil { +func (s *SuggestItemsResponse) GetStrings() []string { + if s == nil { return nil } - return o.Strings + return s.Strings } diff --git a/pkg/models/operations/suggestopenapi.go b/pkg/models/operations/suggestopenapi.go index f6112b49..fa92d07d 100644 --- a/pkg/models/operations/suggestopenapi.go +++ b/pkg/models/operations/suggestopenapi.go @@ -14,18 +14,18 @@ type Schema struct { FileName string `multipartForm:"name=fileName"` } -func (o *Schema) GetContent() any { - if o == nil { +func (s *Schema) GetContent() any { + if s == nil { return nil } - return o.Content + return s.Content } -func (o *Schema) GetFileName() string { - if o == nil { +func (s *Schema) GetFileName() string { + if s == nil { return "" } - return o.FileName + return s.FileName } // SuggestOpenAPIRequestBody - The schema file to upload provided as a multipart/form-data file segment. @@ -34,18 +34,18 @@ type SuggestOpenAPIRequestBody struct { Schema Schema `multipartForm:"file,name=schema"` } -func (o *SuggestOpenAPIRequestBody) GetOpts() *shared.SuggestOptsOld { - if o == nil { +func (s *SuggestOpenAPIRequestBody) GetOpts() *shared.SuggestOptsOld { + if s == nil { return nil } - return o.Opts + return s.Opts } -func (o *SuggestOpenAPIRequestBody) GetSchema() Schema { - if o == nil { +func (s *SuggestOpenAPIRequestBody) GetSchema() Schema { + if s == nil { return Schema{} } - return o.Schema + return s.Schema } type SuggestOpenAPIRequest struct { @@ -54,18 +54,18 @@ type SuggestOpenAPIRequest struct { XSessionID string `header:"style=simple,explode=false,name=x-session-id"` } -func (o *SuggestOpenAPIRequest) GetRequestBody() SuggestOpenAPIRequestBody { - if o == nil { +func (s *SuggestOpenAPIRequest) GetRequestBody() SuggestOpenAPIRequestBody { + if s == nil { return SuggestOpenAPIRequestBody{} } - return o.RequestBody + return s.RequestBody } -func (o *SuggestOpenAPIRequest) GetXSessionID() string { - if o == nil { +func (s *SuggestOpenAPIRequest) GetXSessionID() string { + if s == nil { return "" } - return o.XSessionID + return s.XSessionID } type SuggestOpenAPIResponse struct { @@ -80,30 +80,30 @@ type SuggestOpenAPIResponse struct { RawResponse *http.Response } -func (o *SuggestOpenAPIResponse) GetContentType() string { - if o == nil { +func (s *SuggestOpenAPIResponse) GetContentType() string { + if s == nil { return "" } - return o.ContentType + return s.ContentType } -func (o *SuggestOpenAPIResponse) GetSchema() io.ReadCloser { - if o == nil { +func (s *SuggestOpenAPIResponse) GetSchema() io.ReadCloser { + if s == nil { return nil } - return o.Schema + return s.Schema } -func (o *SuggestOpenAPIResponse) GetStatusCode() int { - if o == nil { +func (s *SuggestOpenAPIResponse) GetStatusCode() int { + if s == nil { return 0 } - return o.StatusCode + return s.StatusCode } -func (o *SuggestOpenAPIResponse) GetRawResponse() *http.Response { - if o == nil { +func (s *SuggestOpenAPIResponse) GetRawResponse() *http.Response { + if s == nil { return nil } - return o.RawResponse + return s.RawResponse } diff --git a/pkg/models/operations/suggestopenapiregistry.go b/pkg/models/operations/suggestopenapiregistry.go index d958ebbb..1ed01894 100644 --- a/pkg/models/operations/suggestopenapiregistry.go +++ b/pkg/models/operations/suggestopenapiregistry.go @@ -17,32 +17,32 @@ type SuggestOpenAPIRegistryRequest struct { XSessionID string `header:"style=simple,explode=false,name=x-session-id"` } -func (o *SuggestOpenAPIRegistryRequest) GetSuggestRequestBody() *shared.SuggestRequestBody { - if o == nil { +func (s *SuggestOpenAPIRegistryRequest) GetSuggestRequestBody() *shared.SuggestRequestBody { + if s == nil { return nil } - return o.SuggestRequestBody + return s.SuggestRequestBody } -func (o *SuggestOpenAPIRegistryRequest) GetNamespaceName() string { - if o == nil { +func (s *SuggestOpenAPIRegistryRequest) GetNamespaceName() string { + if s == nil { return "" } - return o.NamespaceName + return s.NamespaceName } -func (o *SuggestOpenAPIRegistryRequest) GetRevisionReference() string { - if o == nil { +func (s *SuggestOpenAPIRegistryRequest) GetRevisionReference() string { + if s == nil { return "" } - return o.RevisionReference + return s.RevisionReference } -func (o *SuggestOpenAPIRegistryRequest) GetXSessionID() string { - if o == nil { +func (s *SuggestOpenAPIRegistryRequest) GetXSessionID() string { + if s == nil { return "" } - return o.XSessionID + return s.XSessionID } type SuggestOpenAPIRegistryResponse struct { @@ -57,30 +57,30 @@ type SuggestOpenAPIRegistryResponse struct { RawResponse *http.Response } -func (o *SuggestOpenAPIRegistryResponse) GetContentType() string { - if o == nil { +func (s *SuggestOpenAPIRegistryResponse) GetContentType() string { + if s == nil { return "" } - return o.ContentType + return s.ContentType } -func (o *SuggestOpenAPIRegistryResponse) GetSchema() io.ReadCloser { - if o == nil { +func (s *SuggestOpenAPIRegistryResponse) GetSchema() io.ReadCloser { + if s == nil { return nil } - return o.Schema + return s.Schema } -func (o *SuggestOpenAPIRegistryResponse) GetStatusCode() int { - if o == nil { +func (s *SuggestOpenAPIRegistryResponse) GetStatusCode() int { + if s == nil { return 0 } - return o.StatusCode + return s.StatusCode } -func (o *SuggestOpenAPIRegistryResponse) GetRawResponse() *http.Response { - if o == nil { +func (s *SuggestOpenAPIRegistryResponse) GetRawResponse() *http.Response { + if s == nil { return nil } - return o.RawResponse + return s.RawResponse } diff --git a/pkg/models/operations/updatepublishingtokenexpiration.go b/pkg/models/operations/updatepublishingtokenexpiration.go index 13f93747..3f961315 100644 --- a/pkg/models/operations/updatepublishingtokenexpiration.go +++ b/pkg/models/operations/updatepublishingtokenexpiration.go @@ -21,24 +21,24 @@ func (u UpdatePublishingTokenExpirationRequestBody) MarshalJSON() ([]byte, error } func (u *UpdatePublishingTokenExpirationRequestBody) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &u, "", false, []string{"valid_until"}); err != nil { return err } return nil } -func (o *UpdatePublishingTokenExpirationRequestBody) GetTokenName() *string { - if o == nil { +func (u *UpdatePublishingTokenExpirationRequestBody) GetTokenName() *string { + if u == nil { return nil } - return o.TokenName + return u.TokenName } -func (o *UpdatePublishingTokenExpirationRequestBody) GetValidUntil() time.Time { - if o == nil { +func (u *UpdatePublishingTokenExpirationRequestBody) GetValidUntil() time.Time { + if u == nil { return time.Time{} } - return o.ValidUntil + return u.ValidUntil } type UpdatePublishingTokenExpirationRequest struct { @@ -48,18 +48,18 @@ type UpdatePublishingTokenExpirationRequest struct { TokenID string `pathParam:"style=simple,explode=false,name=tokenID"` } -func (o *UpdatePublishingTokenExpirationRequest) GetRequestBody() *UpdatePublishingTokenExpirationRequestBody { - if o == nil { +func (u *UpdatePublishingTokenExpirationRequest) GetRequestBody() *UpdatePublishingTokenExpirationRequestBody { + if u == nil { return nil } - return o.RequestBody + return u.RequestBody } -func (o *UpdatePublishingTokenExpirationRequest) GetTokenID() string { - if o == nil { +func (u *UpdatePublishingTokenExpirationRequest) GetTokenID() string { + if u == nil { return "" } - return o.TokenID + return u.TokenID } type UpdatePublishingTokenExpirationResponse struct { @@ -71,23 +71,23 @@ type UpdatePublishingTokenExpirationResponse struct { RawResponse *http.Response } -func (o *UpdatePublishingTokenExpirationResponse) GetContentType() string { - if o == nil { +func (u *UpdatePublishingTokenExpirationResponse) GetContentType() string { + if u == nil { return "" } - return o.ContentType + return u.ContentType } -func (o *UpdatePublishingTokenExpirationResponse) GetStatusCode() int { - if o == nil { +func (u *UpdatePublishingTokenExpirationResponse) GetStatusCode() int { + if u == nil { return 0 } - return o.StatusCode + return u.StatusCode } -func (o *UpdatePublishingTokenExpirationResponse) GetRawResponse() *http.Response { - if o == nil { +func (u *UpdatePublishingTokenExpirationResponse) GetRawResponse() *http.Response { + if u == nil { return nil } - return o.RawResponse + return u.RawResponse } diff --git a/pkg/models/operations/updateworkspacedetails.go b/pkg/models/operations/updateworkspacedetails.go index d81233da..be194a63 100644 --- a/pkg/models/operations/updateworkspacedetails.go +++ b/pkg/models/operations/updateworkspacedetails.go @@ -11,11 +11,11 @@ type UpdateWorkspaceDetailsGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *UpdateWorkspaceDetailsGlobals) GetWorkspaceID() *string { - if o == nil { +func (u *UpdateWorkspaceDetailsGlobals) GetWorkspaceID() *string { + if u == nil { return nil } - return o.WorkspaceID + return u.WorkspaceID } type UpdateWorkspaceDetailsRequest struct { @@ -25,18 +25,18 @@ type UpdateWorkspaceDetailsRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *UpdateWorkspaceDetailsRequest) GetWorkspace() shared.Workspace { - if o == nil { +func (u *UpdateWorkspaceDetailsRequest) GetWorkspace() shared.Workspace { + if u == nil { return shared.Workspace{} } - return o.Workspace + return u.Workspace } -func (o *UpdateWorkspaceDetailsRequest) GetWorkspaceID() *string { - if o == nil { +func (u *UpdateWorkspaceDetailsRequest) GetWorkspaceID() *string { + if u == nil { return nil } - return o.WorkspaceID + return u.WorkspaceID } type UpdateWorkspaceDetailsResponse struct { @@ -48,23 +48,23 @@ type UpdateWorkspaceDetailsResponse struct { RawResponse *http.Response } -func (o *UpdateWorkspaceDetailsResponse) GetContentType() string { - if o == nil { +func (u *UpdateWorkspaceDetailsResponse) GetContentType() string { + if u == nil { return "" } - return o.ContentType + return u.ContentType } -func (o *UpdateWorkspaceDetailsResponse) GetStatusCode() int { - if o == nil { +func (u *UpdateWorkspaceDetailsResponse) GetStatusCode() int { + if u == nil { return 0 } - return o.StatusCode + return u.StatusCode } -func (o *UpdateWorkspaceDetailsResponse) GetRawResponse() *http.Response { - if o == nil { +func (u *UpdateWorkspaceDetailsResponse) GetRawResponse() *http.Response { + if u == nil { return nil } - return o.RawResponse + return u.RawResponse } diff --git a/pkg/models/operations/updateworkspacesettings.go b/pkg/models/operations/updateworkspacesettings.go index a90ab79a..47d49437 100644 --- a/pkg/models/operations/updateworkspacesettings.go +++ b/pkg/models/operations/updateworkspacesettings.go @@ -11,11 +11,11 @@ type UpdateWorkspaceSettingsGlobals struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *UpdateWorkspaceSettingsGlobals) GetWorkspaceID() *string { - if o == nil { +func (u *UpdateWorkspaceSettingsGlobals) GetWorkspaceID() *string { + if u == nil { return nil } - return o.WorkspaceID + return u.WorkspaceID } type UpdateWorkspaceSettingsRequest struct { @@ -25,18 +25,18 @@ type UpdateWorkspaceSettingsRequest struct { WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` } -func (o *UpdateWorkspaceSettingsRequest) GetWorkspaceSettings() shared.WorkspaceSettings { - if o == nil { +func (u *UpdateWorkspaceSettingsRequest) GetWorkspaceSettings() shared.WorkspaceSettings { + if u == nil { return shared.WorkspaceSettings{} } - return o.WorkspaceSettings + return u.WorkspaceSettings } -func (o *UpdateWorkspaceSettingsRequest) GetWorkspaceID() *string { - if o == nil { +func (u *UpdateWorkspaceSettingsRequest) GetWorkspaceID() *string { + if u == nil { return nil } - return o.WorkspaceID + return u.WorkspaceID } type UpdateWorkspaceSettingsResponse struct { @@ -48,23 +48,23 @@ type UpdateWorkspaceSettingsResponse struct { RawResponse *http.Response } -func (o *UpdateWorkspaceSettingsResponse) GetContentType() string { - if o == nil { +func (u *UpdateWorkspaceSettingsResponse) GetContentType() string { + if u == nil { return "" } - return o.ContentType + return u.ContentType } -func (o *UpdateWorkspaceSettingsResponse) GetStatusCode() int { - if o == nil { +func (u *UpdateWorkspaceSettingsResponse) GetStatusCode() int { + if u == nil { return 0 } - return o.StatusCode + return u.StatusCode } -func (o *UpdateWorkspaceSettingsResponse) GetRawResponse() *http.Response { - if o == nil { +func (u *UpdateWorkspaceSettingsResponse) GetRawResponse() *http.Response { + if u == nil { return nil } - return o.RawResponse + return u.RawResponse } diff --git a/pkg/models/operations/uploadreport.go b/pkg/models/operations/uploadreport.go index 4a75b05a..1e973fcd 100644 --- a/pkg/models/operations/uploadreport.go +++ b/pkg/models/operations/uploadreport.go @@ -13,18 +13,18 @@ type File struct { FileName string `multipartForm:"name=fileName"` } -func (o *File) GetContent() any { - if o == nil { +func (f *File) GetContent() any { + if f == nil { return nil } - return o.Content + return f.Content } -func (o *File) GetFileName() string { - if o == nil { +func (f *File) GetFileName() string { + if f == nil { return "" } - return o.FileName + return f.FileName } // UploadReportRequestBody - The report file to upload provided as a multipart/form-data file segment. @@ -33,18 +33,18 @@ type UploadReportRequestBody struct { File File `multipartForm:"file,name=file"` } -func (o *UploadReportRequestBody) GetData() shared.Report { - if o == nil { +func (u *UploadReportRequestBody) GetData() shared.Report { + if u == nil { return shared.Report{} } - return o.Data + return u.Data } -func (o *UploadReportRequestBody) GetFile() File { - if o == nil { +func (u *UploadReportRequestBody) GetFile() File { + if u == nil { return File{} } - return o.File + return u.File } // UploadReportUploadedReport - OK @@ -52,11 +52,11 @@ type UploadReportUploadedReport struct { URL string `json:"url"` } -func (o *UploadReportUploadedReport) GetURL() string { - if o == nil { +func (u *UploadReportUploadedReport) GetURL() string { + if u == nil { return "" } - return o.URL + return u.URL } type UploadReportResponse struct { @@ -70,30 +70,30 @@ type UploadReportResponse struct { UploadedReport *UploadReportUploadedReport } -func (o *UploadReportResponse) GetContentType() string { - if o == nil { +func (u *UploadReportResponse) GetContentType() string { + if u == nil { return "" } - return o.ContentType + return u.ContentType } -func (o *UploadReportResponse) GetStatusCode() int { - if o == nil { +func (u *UploadReportResponse) GetStatusCode() int { + if u == nil { return 0 } - return o.StatusCode + return u.StatusCode } -func (o *UploadReportResponse) GetRawResponse() *http.Response { - if o == nil { +func (u *UploadReportResponse) GetRawResponse() *http.Response { + if u == nil { return nil } - return o.RawResponse + return u.RawResponse } -func (o *UploadReportResponse) GetUploadedReport() *UploadReportUploadedReport { - if o == nil { +func (u *UploadReportResponse) GetUploadedReport() *UploadReportUploadedReport { + if u == nil { return nil } - return o.UploadedReport + return u.UploadedReport } diff --git a/pkg/models/operations/validateapikey.go b/pkg/models/operations/validateapikey.go index ae89b1c1..5c59e57a 100644 --- a/pkg/models/operations/validateapikey.go +++ b/pkg/models/operations/validateapikey.go @@ -18,30 +18,30 @@ type ValidateAPIKeyResponse struct { RawResponse *http.Response } -func (o *ValidateAPIKeyResponse) GetAPIKeyDetails() *shared.APIKeyDetails { - if o == nil { +func (v *ValidateAPIKeyResponse) GetAPIKeyDetails() *shared.APIKeyDetails { + if v == nil { return nil } - return o.APIKeyDetails + return v.APIKeyDetails } -func (o *ValidateAPIKeyResponse) GetContentType() string { - if o == nil { +func (v *ValidateAPIKeyResponse) GetContentType() string { + if v == nil { return "" } - return o.ContentType + return v.ContentType } -func (o *ValidateAPIKeyResponse) GetStatusCode() int { - if o == nil { +func (v *ValidateAPIKeyResponse) GetStatusCode() int { + if v == nil { return 0 } - return o.StatusCode + return v.StatusCode } -func (o *ValidateAPIKeyResponse) GetRawResponse() *http.Response { - if o == nil { +func (v *ValidateAPIKeyResponse) GetRawResponse() *http.Response { + if v == nil { return nil } - return o.RawResponse + return v.RawResponse } diff --git a/pkg/models/shared/accessdetails.go b/pkg/models/shared/accessdetails.go index 22211903..e2129708 100644 --- a/pkg/models/shared/accessdetails.go +++ b/pkg/models/shared/accessdetails.go @@ -42,23 +42,23 @@ type AccessDetails struct { Message string `json:"message"` } -func (o *AccessDetails) GetGenerationAllowed() bool { - if o == nil { +func (a *AccessDetails) GetGenerationAllowed() bool { + if a == nil { return false } - return o.GenerationAllowed + return a.GenerationAllowed } -func (o *AccessDetails) GetLevel() *Level { - if o == nil { +func (a *AccessDetails) GetLevel() *Level { + if a == nil { return nil } - return o.Level + return a.Level } -func (o *AccessDetails) GetMessage() string { - if o == nil { +func (a *AccessDetails) GetMessage() string { + if a == nil { return "" } - return o.Message + return a.Message } diff --git a/pkg/models/shared/accesstoken.go b/pkg/models/shared/accesstoken.go index 4948a042..5676df14 100644 --- a/pkg/models/shared/accesstoken.go +++ b/pkg/models/shared/accesstoken.go @@ -24,52 +24,52 @@ func (a AccessTokenUser) MarshalJSON() ([]byte, error) { } func (a *AccessTokenUser) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &a, "", false, nil); err != nil { return err } return nil } -func (o *AccessTokenUser) GetAdmin() *bool { - if o == nil { +func (a *AccessTokenUser) GetAdmin() *bool { + if a == nil { return nil } - return o.Admin + return a.Admin } -func (o *AccessTokenUser) GetCreatedAt() *time.Time { - if o == nil { +func (a *AccessTokenUser) GetCreatedAt() *time.Time { + if a == nil { return nil } - return o.CreatedAt + return a.CreatedAt } -func (o *AccessTokenUser) GetDisplayName() *string { - if o == nil { +func (a *AccessTokenUser) GetDisplayName() *string { + if a == nil { return nil } - return o.DisplayName + return a.DisplayName } -func (o *AccessTokenUser) GetEmail() *string { - if o == nil { +func (a *AccessTokenUser) GetEmail() *string { + if a == nil { return nil } - return o.Email + return a.Email } -func (o *AccessTokenUser) GetEmailVerified() *bool { - if o == nil { +func (a *AccessTokenUser) GetEmailVerified() *bool { + if a == nil { return nil } - return o.EmailVerified + return a.EmailVerified } -func (o *AccessTokenUser) GetID() *string { - if o == nil { +func (a *AccessTokenUser) GetID() *string { + if a == nil { return nil } - return o.ID + return a.ID } type Workspaces struct { @@ -84,38 +84,38 @@ func (w Workspaces) MarshalJSON() ([]byte, error) { } func (w *Workspaces) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &w, "", false, nil); err != nil { return err } return nil } -func (o *Workspaces) GetAccountType() *AccountType { - if o == nil { +func (w *Workspaces) GetAccountType() *AccountType { + if w == nil { return nil } - return o.AccountType + return w.AccountType } -func (o *Workspaces) GetID() *string { - if o == nil { +func (w *Workspaces) GetID() *string { + if w == nil { return nil } - return o.ID + return w.ID } -func (o *Workspaces) GetName() *string { - if o == nil { +func (w *Workspaces) GetName() *string { + if w == nil { return nil } - return o.Name + return w.Name } -func (o *Workspaces) GetUpdatedAt() *time.Time { - if o == nil { +func (w *Workspaces) GetUpdatedAt() *time.Time { + if w == nil { return nil } - return o.UpdatedAt + return w.UpdatedAt } // An AccessToken is a token that can be used to authenticate with the Speakeasy API. @@ -127,37 +127,37 @@ type AccessToken struct { Workspaces []Workspaces `json:"workspaces,omitempty"` } -func (o *AccessToken) GetAccessToken() string { - if o == nil { +func (a *AccessToken) GetAccessToken() string { + if a == nil { return "" } - return o.AccessToken + return a.AccessToken } -func (o *AccessToken) GetClaims() Claims { - if o == nil { +func (a *AccessToken) GetClaims() Claims { + if a == nil { return Claims{} } - return o.Claims + return a.Claims } -func (o *AccessToken) GetFeatureFlags() []FeatureFlag { - if o == nil { +func (a *AccessToken) GetFeatureFlags() []FeatureFlag { + if a == nil { return nil } - return o.FeatureFlags + return a.FeatureFlags } -func (o *AccessToken) GetUser() AccessTokenUser { - if o == nil { +func (a *AccessToken) GetUser() AccessTokenUser { + if a == nil { return AccessTokenUser{} } - return o.User + return a.User } -func (o *AccessToken) GetWorkspaces() []Workspaces { - if o == nil { +func (a *AccessToken) GetWorkspaces() []Workspaces { + if a == nil { return nil } - return o.Workspaces + return a.Workspaces } diff --git a/pkg/models/shared/addtags.go b/pkg/models/shared/addtags.go index ab899c0b..ee1daa23 100644 --- a/pkg/models/shared/addtags.go +++ b/pkg/models/shared/addtags.go @@ -10,16 +10,16 @@ type AddTags struct { Tags []string `json:"tags"` } -func (o *AddTags) GetRevisionDigest() string { - if o == nil { +func (a *AddTags) GetRevisionDigest() string { + if a == nil { return "" } - return o.RevisionDigest + return a.RevisionDigest } -func (o *AddTags) GetTags() []string { - if o == nil { +func (a *AddTags) GetTags() []string { + if a == nil { return []string{} } - return o.Tags + return a.Tags } diff --git a/pkg/models/shared/annotations.go b/pkg/models/shared/annotations.go index 6410736d..f16e73f2 100644 --- a/pkg/models/shared/annotations.go +++ b/pkg/models/shared/annotations.go @@ -29,86 +29,86 @@ type Annotations struct { OrgOpencontainersImageVersion *string `json:"org.opencontainers.image.version,omitempty"` } -func (o *Annotations) GetOrgOpencontainersImageAuthors() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageAuthors() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageAuthors + return a.OrgOpencontainersImageAuthors } -func (o *Annotations) GetOrgOpencontainersImageCreated() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageCreated() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageCreated + return a.OrgOpencontainersImageCreated } -func (o *Annotations) GetOrgOpencontainersImageDescription() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageDescription() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageDescription + return a.OrgOpencontainersImageDescription } -func (o *Annotations) GetOrgOpencontainersImageDocumentation() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageDocumentation() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageDocumentation + return a.OrgOpencontainersImageDocumentation } -func (o *Annotations) GetOrgOpencontainersImageLicenses() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageLicenses() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageLicenses + return a.OrgOpencontainersImageLicenses } -func (o *Annotations) GetOrgOpencontainersImageRefName() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageRefName() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageRefName + return a.OrgOpencontainersImageRefName } -func (o *Annotations) GetOrgOpencontainersImageRevision() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageRevision() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageRevision + return a.OrgOpencontainersImageRevision } -func (o *Annotations) GetOrgOpencontainersImageSource() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageSource() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageSource + return a.OrgOpencontainersImageSource } -func (o *Annotations) GetOrgOpencontainersImageTitle() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageTitle() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageTitle + return a.OrgOpencontainersImageTitle } -func (o *Annotations) GetOrgOpencontainersImageURL() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageURL() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageURL + return a.OrgOpencontainersImageURL } -func (o *Annotations) GetOrgOpencontainersImageVendor() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageVendor() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageVendor + return a.OrgOpencontainersImageVendor } -func (o *Annotations) GetOrgOpencontainersImageVersion() *string { - if o == nil { +func (a *Annotations) GetOrgOpencontainersImageVersion() *string { + if a == nil { return nil } - return o.OrgOpencontainersImageVersion + return a.OrgOpencontainersImageVersion } diff --git a/pkg/models/shared/apikeydetails.go b/pkg/models/shared/apikeydetails.go index 2397ce58..75125c25 100644 --- a/pkg/models/shared/apikeydetails.go +++ b/pkg/models/shared/apikeydetails.go @@ -27,78 +27,78 @@ func (a APIKeyDetails) MarshalJSON() ([]byte, error) { } func (a *APIKeyDetails) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &a, "", false, []string{"account_type_v2", "billing_add_ons", "enabled_features", "org_slug", "telemetry_disabled", "workspace_created_at", "workspace_id", "workspace_slug"}); err != nil { return err } return nil } -func (o *APIKeyDetails) GetAccountTypeV2() AccountType { - if o == nil { +func (a *APIKeyDetails) GetAccountTypeV2() AccountType { + if a == nil { return AccountType("") } - return o.AccountTypeV2 + return a.AccountTypeV2 } -func (o *APIKeyDetails) GetBillingAddOns() []BillingAddOn { - if o == nil { +func (a *APIKeyDetails) GetBillingAddOns() []BillingAddOn { + if a == nil { return []BillingAddOn{} } - return o.BillingAddOns + return a.BillingAddOns } -func (o *APIKeyDetails) GetEnabledFeatures() []string { - if o == nil { +func (a *APIKeyDetails) GetEnabledFeatures() []string { + if a == nil { return []string{} } - return o.EnabledFeatures + return a.EnabledFeatures } -func (o *APIKeyDetails) GetFeatureFlags() []string { - if o == nil { +func (a *APIKeyDetails) GetFeatureFlags() []string { + if a == nil { return nil } - return o.FeatureFlags + return a.FeatureFlags } -func (o *APIKeyDetails) GetGenerationAccessUnlimited() *bool { - if o == nil { +func (a *APIKeyDetails) GetGenerationAccessUnlimited() *bool { + if a == nil { return nil } - return o.GenerationAccessUnlimited + return a.GenerationAccessUnlimited } -func (o *APIKeyDetails) GetOrgSlug() string { - if o == nil { +func (a *APIKeyDetails) GetOrgSlug() string { + if a == nil { return "" } - return o.OrgSlug + return a.OrgSlug } -func (o *APIKeyDetails) GetTelemetryDisabled() bool { - if o == nil { +func (a *APIKeyDetails) GetTelemetryDisabled() bool { + if a == nil { return false } - return o.TelemetryDisabled + return a.TelemetryDisabled } -func (o *APIKeyDetails) GetWorkspaceCreatedAt() time.Time { - if o == nil { +func (a *APIKeyDetails) GetWorkspaceCreatedAt() time.Time { + if a == nil { return time.Time{} } - return o.WorkspaceCreatedAt + return a.WorkspaceCreatedAt } -func (o *APIKeyDetails) GetWorkspaceID() string { - if o == nil { +func (a *APIKeyDetails) GetWorkspaceID() string { + if a == nil { return "" } - return o.WorkspaceID + return a.WorkspaceID } -func (o *APIKeyDetails) GetWorkspaceSlug() string { - if o == nil { +func (a *APIKeyDetails) GetWorkspaceSlug() string { + if a == nil { return "" } - return o.WorkspaceSlug + return a.WorkspaceSlug } diff --git a/pkg/models/shared/clievent.go b/pkg/models/shared/clievent.go index 1c0fc792..3903b0b6 100644 --- a/pkg/models/shared/clievent.go +++ b/pkg/models/shared/clievent.go @@ -256,582 +256,582 @@ func (c CliEvent) MarshalJSON() ([]byte, error) { } func (c *CliEvent) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &c, "", false, []string{"created_at", "execution_id", "id", "interaction_type", "local_started_at", "speakeasy_api_key_name", "speakeasy_version", "success", "workspace_id"}); err != nil { return err } return nil } -func (o *CliEvent) GetCommitHead() *string { - if o == nil { +func (c *CliEvent) GetCommitHead() *string { + if c == nil { return nil } - return o.CommitHead + return c.CommitHead } -func (o *CliEvent) GetContinuousIntegrationEnvironment() *string { - if o == nil { +func (c *CliEvent) GetContinuousIntegrationEnvironment() *string { + if c == nil { return nil } - return o.ContinuousIntegrationEnvironment + return c.ContinuousIntegrationEnvironment } -func (o *CliEvent) GetCreatedAt() time.Time { - if o == nil { +func (c *CliEvent) GetCreatedAt() time.Time { + if c == nil { return time.Time{} } - return o.CreatedAt + return c.CreatedAt } -func (o *CliEvent) GetDurationMs() *int64 { - if o == nil { +func (c *CliEvent) GetDurationMs() *int64 { + if c == nil { return nil } - return o.DurationMs + return c.DurationMs } -func (o *CliEvent) GetError() *string { - if o == nil { +func (c *CliEvent) GetError() *string { + if c == nil { return nil } - return o.Error + return c.Error } -func (o *CliEvent) GetExecutionID() string { - if o == nil { +func (c *CliEvent) GetExecutionID() string { + if c == nil { return "" } - return o.ExecutionID + return c.ExecutionID } -func (o *CliEvent) GetGenerateBumpType() *GenerateBumpType { - if o == nil { +func (c *CliEvent) GetGenerateBumpType() *GenerateBumpType { + if c == nil { return nil } - return o.GenerateBumpType + return c.GenerateBumpType } -func (o *CliEvent) GetGenerateConfigPostChecksum() *string { - if o == nil { +func (c *CliEvent) GetGenerateConfigPostChecksum() *string { + if c == nil { return nil } - return o.GenerateConfigPostChecksum + return c.GenerateConfigPostChecksum } -func (o *CliEvent) GetGenerateConfigPostRaw() *string { - if o == nil { +func (c *CliEvent) GetGenerateConfigPostRaw() *string { + if c == nil { return nil } - return o.GenerateConfigPostRaw + return c.GenerateConfigPostRaw } -func (o *CliEvent) GetGenerateConfigPostVersion() *string { - if o == nil { +func (c *CliEvent) GetGenerateConfigPostVersion() *string { + if c == nil { return nil } - return o.GenerateConfigPostVersion + return c.GenerateConfigPostVersion } -func (o *CliEvent) GetGenerateConfigPreChecksum() *string { - if o == nil { +func (c *CliEvent) GetGenerateConfigPreChecksum() *string { + if c == nil { return nil } - return o.GenerateConfigPreChecksum + return c.GenerateConfigPreChecksum } -func (o *CliEvent) GetGenerateConfigPreRaw() *string { - if o == nil { +func (c *CliEvent) GetGenerateConfigPreRaw() *string { + if c == nil { return nil } - return o.GenerateConfigPreRaw + return c.GenerateConfigPreRaw } -func (o *CliEvent) GetGenerateConfigPreVersion() *string { - if o == nil { +func (c *CliEvent) GetGenerateConfigPreVersion() *string { + if c == nil { return nil } - return o.GenerateConfigPreVersion + return c.GenerateConfigPreVersion } -func (o *CliEvent) GetGenerateEligibleFeatures() *string { - if o == nil { +func (c *CliEvent) GetGenerateEligibleFeatures() *string { + if c == nil { return nil } - return o.GenerateEligibleFeatures + return c.GenerateEligibleFeatures } -func (o *CliEvent) GetGenerateGenLockID() *string { - if o == nil { +func (c *CliEvent) GetGenerateGenLockID() *string { + if c == nil { return nil } - return o.GenerateGenLockID + return c.GenerateGenLockID } -func (o *CliEvent) GetGenerateGenLockPostFeatures() *string { - if o == nil { +func (c *CliEvent) GetGenerateGenLockPostFeatures() *string { + if c == nil { return nil } - return o.GenerateGenLockPostFeatures + return c.GenerateGenLockPostFeatures } -func (o *CliEvent) GetGenerateGenLockPreBlobDigest() *string { - if o == nil { +func (c *CliEvent) GetGenerateGenLockPreBlobDigest() *string { + if c == nil { return nil } - return o.GenerateGenLockPreBlobDigest + return c.GenerateGenLockPreBlobDigest } -func (o *CliEvent) GetGenerateGenLockPreDocChecksum() *string { - if o == nil { +func (c *CliEvent) GetGenerateGenLockPreDocChecksum() *string { + if c == nil { return nil } - return o.GenerateGenLockPreDocChecksum + return c.GenerateGenLockPreDocChecksum } -func (o *CliEvent) GetGenerateGenLockPreDocVersion() *string { - if o == nil { +func (c *CliEvent) GetGenerateGenLockPreDocVersion() *string { + if c == nil { return nil } - return o.GenerateGenLockPreDocVersion + return c.GenerateGenLockPreDocVersion } -func (o *CliEvent) GetGenerateGenLockPreFeatures() *string { - if o == nil { +func (c *CliEvent) GetGenerateGenLockPreFeatures() *string { + if c == nil { return nil } - return o.GenerateGenLockPreFeatures + return c.GenerateGenLockPreFeatures } -func (o *CliEvent) GetGenerateGenLockPreNamespaceName() *string { - if o == nil { +func (c *CliEvent) GetGenerateGenLockPreNamespaceName() *string { + if c == nil { return nil } - return o.GenerateGenLockPreNamespaceName + return c.GenerateGenLockPreNamespaceName } -func (o *CliEvent) GetGenerateGenLockPreRevisionDigest() *string { - if o == nil { +func (c *CliEvent) GetGenerateGenLockPreRevisionDigest() *string { + if c == nil { return nil } - return o.GenerateGenLockPreRevisionDigest + return c.GenerateGenLockPreRevisionDigest } -func (o *CliEvent) GetGenerateGenLockPreVersion() *string { - if o == nil { +func (c *CliEvent) GetGenerateGenLockPreVersion() *string { + if c == nil { return nil } - return o.GenerateGenLockPreVersion + return c.GenerateGenLockPreVersion } -func (o *CliEvent) GetGenerateNumberOfOperationsIgnored() *int64 { - if o == nil { +func (c *CliEvent) GetGenerateNumberOfOperationsIgnored() *int64 { + if c == nil { return nil } - return o.GenerateNumberOfOperationsIgnored + return c.GenerateNumberOfOperationsIgnored } -func (o *CliEvent) GetGenerateNumberOfOperationsUsed() *int64 { - if o == nil { +func (c *CliEvent) GetGenerateNumberOfOperationsUsed() *int64 { + if c == nil { return nil } - return o.GenerateNumberOfOperationsUsed + return c.GenerateNumberOfOperationsUsed } -func (o *CliEvent) GetGenerateNumberOfTerraformResources() *int64 { - if o == nil { +func (c *CliEvent) GetGenerateNumberOfTerraformResources() *int64 { + if c == nil { return nil } - return o.GenerateNumberOfTerraformResources + return c.GenerateNumberOfTerraformResources } -func (o *CliEvent) GetGenerateOutputTests() *bool { - if o == nil { +func (c *CliEvent) GetGenerateOutputTests() *bool { + if c == nil { return nil } - return o.GenerateOutputTests + return c.GenerateOutputTests } -func (o *CliEvent) GetGeneratePublished() *bool { - if o == nil { +func (c *CliEvent) GetGeneratePublished() *bool { + if c == nil { return nil } - return o.GeneratePublished + return c.GeneratePublished } -func (o *CliEvent) GetGenerateRepoURL() *string { - if o == nil { +func (c *CliEvent) GetGenerateRepoURL() *string { + if c == nil { return nil } - return o.GenerateRepoURL + return c.GenerateRepoURL } -func (o *CliEvent) GetGenerateTarget() *string { - if o == nil { +func (c *CliEvent) GetGenerateTarget() *string { + if c == nil { return nil } - return o.GenerateTarget + return c.GenerateTarget } -func (o *CliEvent) GetGenerateTargetName() *string { - if o == nil { +func (c *CliEvent) GetGenerateTargetName() *string { + if c == nil { return nil } - return o.GenerateTargetName + return c.GenerateTargetName } -func (o *CliEvent) GetGenerateTargetVersion() *string { - if o == nil { +func (c *CliEvent) GetGenerateTargetVersion() *string { + if c == nil { return nil } - return o.GenerateTargetVersion + return c.GenerateTargetVersion } -func (o *CliEvent) GetGenerateVersion() *string { - if o == nil { +func (c *CliEvent) GetGenerateVersion() *string { + if c == nil { return nil } - return o.GenerateVersion + return c.GenerateVersion } -func (o *CliEvent) GetGhActionOrganization() *string { - if o == nil { +func (c *CliEvent) GetGhActionOrganization() *string { + if c == nil { return nil } - return o.GhActionOrganization + return c.GhActionOrganization } -func (o *CliEvent) GetGhActionRef() *string { - if o == nil { +func (c *CliEvent) GetGhActionRef() *string { + if c == nil { return nil } - return o.GhActionRef + return c.GhActionRef } -func (o *CliEvent) GetGhActionRepository() *string { - if o == nil { +func (c *CliEvent) GetGhActionRepository() *string { + if c == nil { return nil } - return o.GhActionRepository + return c.GhActionRepository } -func (o *CliEvent) GetGhActionRunLink() *string { - if o == nil { +func (c *CliEvent) GetGhActionRunLink() *string { + if c == nil { return nil } - return o.GhActionRunLink + return c.GhActionRunLink } -func (o *CliEvent) GetGhActionVersion() *string { - if o == nil { +func (c *CliEvent) GetGhActionVersion() *string { + if c == nil { return nil } - return o.GhActionVersion + return c.GhActionVersion } -func (o *CliEvent) GetGhChangesCommitted() *bool { - if o == nil { +func (c *CliEvent) GetGhChangesCommitted() *bool { + if c == nil { return nil } - return o.GhChangesCommitted + return c.GhChangesCommitted } -func (o *CliEvent) GetGhPullRequest() *string { - if o == nil { +func (c *CliEvent) GetGhPullRequest() *string { + if c == nil { return nil } - return o.GhPullRequest + return c.GhPullRequest } -func (o *CliEvent) GetGitRelativeCwd() *string { - if o == nil { +func (c *CliEvent) GetGitRelativeCwd() *string { + if c == nil { return nil } - return o.GitRelativeCwd + return c.GitRelativeCwd } -func (o *CliEvent) GetGitRemoteDefaultOwner() *string { - if o == nil { +func (c *CliEvent) GetGitRemoteDefaultOwner() *string { + if c == nil { return nil } - return o.GitRemoteDefaultOwner + return c.GitRemoteDefaultOwner } -func (o *CliEvent) GetGitRemoteDefaultRepo() *string { - if o == nil { +func (c *CliEvent) GetGitRemoteDefaultRepo() *string { + if c == nil { return nil } - return o.GitRemoteDefaultRepo + return c.GitRemoteDefaultRepo } -func (o *CliEvent) GetGitUserEmail() *string { - if o == nil { +func (c *CliEvent) GetGitUserEmail() *string { + if c == nil { return nil } - return o.GitUserEmail + return c.GitUserEmail } -func (o *CliEvent) GetGitUserName() *string { - if o == nil { +func (c *CliEvent) GetGitUserName() *string { + if c == nil { return nil } - return o.GitUserName + return c.GitUserName } -func (o *CliEvent) GetHostname() *string { - if o == nil { +func (c *CliEvent) GetHostname() *string { + if c == nil { return nil } - return o.Hostname + return c.Hostname } -func (o *CliEvent) GetID() string { - if o == nil { +func (c *CliEvent) GetID() string { + if c == nil { return "" } - return o.ID + return c.ID } -func (o *CliEvent) GetInteractionType() InteractionType { - if o == nil { +func (c *CliEvent) GetInteractionType() InteractionType { + if c == nil { return InteractionType("") } - return o.InteractionType + return c.InteractionType } -func (o *CliEvent) GetLastStep() *string { - if o == nil { +func (c *CliEvent) GetLastStep() *string { + if c == nil { return nil } - return o.LastStep + return c.LastStep } -func (o *CliEvent) GetLintReportDigest() *string { - if o == nil { +func (c *CliEvent) GetLintReportDigest() *string { + if c == nil { return nil } - return o.LintReportDigest + return c.LintReportDigest } -func (o *CliEvent) GetLintReportErrorCount() *int64 { - if o == nil { +func (c *CliEvent) GetLintReportErrorCount() *int64 { + if c == nil { return nil } - return o.LintReportErrorCount + return c.LintReportErrorCount } -func (o *CliEvent) GetLintReportInfoCount() *int64 { - if o == nil { +func (c *CliEvent) GetLintReportInfoCount() *int64 { + if c == nil { return nil } - return o.LintReportInfoCount + return c.LintReportInfoCount } -func (o *CliEvent) GetLintReportWarningCount() *int64 { - if o == nil { +func (c *CliEvent) GetLintReportWarningCount() *int64 { + if c == nil { return nil } - return o.LintReportWarningCount + return c.LintReportWarningCount } -func (o *CliEvent) GetLocalCompletedAt() *time.Time { - if o == nil { +func (c *CliEvent) GetLocalCompletedAt() *time.Time { + if c == nil { return nil } - return o.LocalCompletedAt + return c.LocalCompletedAt } -func (o *CliEvent) GetLocalStartedAt() time.Time { - if o == nil { +func (c *CliEvent) GetLocalStartedAt() time.Time { + if c == nil { return time.Time{} } - return o.LocalStartedAt + return c.LocalStartedAt } -func (o *CliEvent) GetManagementDocChecksum() *string { - if o == nil { +func (c *CliEvent) GetManagementDocChecksum() *string { + if c == nil { return nil } - return o.ManagementDocChecksum + return c.ManagementDocChecksum } -func (o *CliEvent) GetManagementDocVersion() *string { - if o == nil { +func (c *CliEvent) GetManagementDocVersion() *string { + if c == nil { return nil } - return o.ManagementDocVersion + return c.ManagementDocVersion } -func (o *CliEvent) GetMermaidDiagram() *string { - if o == nil { +func (c *CliEvent) GetMermaidDiagram() *string { + if c == nil { return nil } - return o.MermaidDiagram + return c.MermaidDiagram } -func (o *CliEvent) GetOpenapiDiffBaseSourceBlobDigest() *string { - if o == nil { +func (c *CliEvent) GetOpenapiDiffBaseSourceBlobDigest() *string { + if c == nil { return nil } - return o.OpenapiDiffBaseSourceBlobDigest + return c.OpenapiDiffBaseSourceBlobDigest } -func (o *CliEvent) GetOpenapiDiffBaseSourceNamespaceName() *string { - if o == nil { +func (c *CliEvent) GetOpenapiDiffBaseSourceNamespaceName() *string { + if c == nil { return nil } - return o.OpenapiDiffBaseSourceNamespaceName + return c.OpenapiDiffBaseSourceNamespaceName } -func (o *CliEvent) GetOpenapiDiffBaseSourceRevisionDigest() *string { - if o == nil { +func (c *CliEvent) GetOpenapiDiffBaseSourceRevisionDigest() *string { + if c == nil { return nil } - return o.OpenapiDiffBaseSourceRevisionDigest + return c.OpenapiDiffBaseSourceRevisionDigest } -func (o *CliEvent) GetOpenapiDiffBreakingChangesCount() *int64 { - if o == nil { +func (c *CliEvent) GetOpenapiDiffBreakingChangesCount() *int64 { + if c == nil { return nil } - return o.OpenapiDiffBreakingChangesCount + return c.OpenapiDiffBreakingChangesCount } -func (o *CliEvent) GetOpenapiDiffBumpType() *OpenapiDiffBumpType { - if o == nil { +func (c *CliEvent) GetOpenapiDiffBumpType() *OpenapiDiffBumpType { + if c == nil { return nil } - return o.OpenapiDiffBumpType + return c.OpenapiDiffBumpType } -func (o *CliEvent) GetOpenapiDiffReportDigest() *string { - if o == nil { +func (c *CliEvent) GetOpenapiDiffReportDigest() *string { + if c == nil { return nil } - return o.OpenapiDiffReportDigest + return c.OpenapiDiffReportDigest } -func (o *CliEvent) GetPublishPackageName() *string { - if o == nil { +func (c *CliEvent) GetPublishPackageName() *string { + if c == nil { return nil } - return o.PublishPackageName + return c.PublishPackageName } -func (o *CliEvent) GetPublishPackageRegistryName() *string { - if o == nil { +func (c *CliEvent) GetPublishPackageRegistryName() *string { + if c == nil { return nil } - return o.PublishPackageRegistryName + return c.PublishPackageRegistryName } -func (o *CliEvent) GetPublishPackageURL() *string { - if o == nil { +func (c *CliEvent) GetPublishPackageURL() *string { + if c == nil { return nil } - return o.PublishPackageURL + return c.PublishPackageURL } -func (o *CliEvent) GetPublishPackageVersion() *string { - if o == nil { +func (c *CliEvent) GetPublishPackageVersion() *string { + if c == nil { return nil } - return o.PublishPackageVersion + return c.PublishPackageVersion } -func (o *CliEvent) GetRawCommand() *string { - if o == nil { +func (c *CliEvent) GetRawCommand() *string { + if c == nil { return nil } - return o.RawCommand + return c.RawCommand } -func (o *CliEvent) GetRepoLabel() *string { - if o == nil { +func (c *CliEvent) GetRepoLabel() *string { + if c == nil { return nil } - return o.RepoLabel + return c.RepoLabel } -func (o *CliEvent) GetSourceBlobDigest() *string { - if o == nil { +func (c *CliEvent) GetSourceBlobDigest() *string { + if c == nil { return nil } - return o.SourceBlobDigest + return c.SourceBlobDigest } -func (o *CliEvent) GetSourceNamespaceName() *string { - if o == nil { +func (c *CliEvent) GetSourceNamespaceName() *string { + if c == nil { return nil } - return o.SourceNamespaceName + return c.SourceNamespaceName } -func (o *CliEvent) GetSourceRevisionDigest() *string { - if o == nil { +func (c *CliEvent) GetSourceRevisionDigest() *string { + if c == nil { return nil } - return o.SourceRevisionDigest + return c.SourceRevisionDigest } -func (o *CliEvent) GetSpeakeasyAPIKeyName() string { - if o == nil { +func (c *CliEvent) GetSpeakeasyAPIKeyName() string { + if c == nil { return "" } - return o.SpeakeasyAPIKeyName + return c.SpeakeasyAPIKeyName } -func (o *CliEvent) GetSpeakeasyVersion() string { - if o == nil { +func (c *CliEvent) GetSpeakeasyVersion() string { + if c == nil { return "" } - return o.SpeakeasyVersion + return c.SpeakeasyVersion } -func (o *CliEvent) GetSuccess() bool { - if o == nil { +func (c *CliEvent) GetSuccess() bool { + if c == nil { return false } - return o.Success + return c.Success } -func (o *CliEvent) GetTestReportRaw() *string { - if o == nil { +func (c *CliEvent) GetTestReportRaw() *string { + if c == nil { return nil } - return o.TestReportRaw + return c.TestReportRaw } -func (o *CliEvent) GetWorkflowLockPostRaw() *string { - if o == nil { +func (c *CliEvent) GetWorkflowLockPostRaw() *string { + if c == nil { return nil } - return o.WorkflowLockPostRaw + return c.WorkflowLockPostRaw } -func (o *CliEvent) GetWorkflowLockPreRaw() *string { - if o == nil { +func (c *CliEvent) GetWorkflowLockPreRaw() *string { + if c == nil { return nil } - return o.WorkflowLockPreRaw + return c.WorkflowLockPreRaw } -func (o *CliEvent) GetWorkflowPostRaw() *string { - if o == nil { +func (c *CliEvent) GetWorkflowPostRaw() *string { + if c == nil { return nil } - return o.WorkflowPostRaw + return c.WorkflowPostRaw } -func (o *CliEvent) GetWorkflowPreRaw() *string { - if o == nil { +func (c *CliEvent) GetWorkflowPreRaw() *string { + if c == nil { return nil } - return o.WorkflowPreRaw + return c.WorkflowPreRaw } -func (o *CliEvent) GetWorkspaceID() string { - if o == nil { +func (c *CliEvent) GetWorkspaceID() string { + if c == nil { return "" } - return o.WorkspaceID + return c.WorkspaceID } diff --git a/pkg/models/shared/codesampleschemainput.go b/pkg/models/shared/codesampleschemainput.go index 5065af25..c91fd4b4 100644 --- a/pkg/models/shared/codesampleschemainput.go +++ b/pkg/models/shared/codesampleschemainput.go @@ -8,18 +8,18 @@ type SchemaFile struct { FileName string `multipartForm:"name=fileName"` } -func (o *SchemaFile) GetContent() any { - if o == nil { +func (s *SchemaFile) GetContent() any { + if s == nil { return nil } - return o.Content + return s.Content } -func (o *SchemaFile) GetFileName() string { - if o == nil { +func (s *SchemaFile) GetFileName() string { + if s == nil { return "" } - return o.FileName + return s.FileName } type CodeSampleSchemaInput struct { @@ -35,37 +35,37 @@ type CodeSampleSchemaInput struct { SDKClassName *string `multipartForm:"name=sdk_class_name"` } -func (o *CodeSampleSchemaInput) GetLanguage() string { - if o == nil { +func (c *CodeSampleSchemaInput) GetLanguage() string { + if c == nil { return "" } - return o.Language + return c.Language } -func (o *CodeSampleSchemaInput) GetOperationIds() []string { - if o == nil { +func (c *CodeSampleSchemaInput) GetOperationIds() []string { + if c == nil { return nil } - return o.OperationIds + return c.OperationIds } -func (o *CodeSampleSchemaInput) GetPackageName() *string { - if o == nil { +func (c *CodeSampleSchemaInput) GetPackageName() *string { + if c == nil { return nil } - return o.PackageName + return c.PackageName } -func (o *CodeSampleSchemaInput) GetSchemaFile() SchemaFile { - if o == nil { +func (c *CodeSampleSchemaInput) GetSchemaFile() SchemaFile { + if c == nil { return SchemaFile{} } - return o.SchemaFile + return c.SchemaFile } -func (o *CodeSampleSchemaInput) GetSDKClassName() *string { - if o == nil { +func (c *CodeSampleSchemaInput) GetSDKClassName() *string { + if c == nil { return nil } - return o.SDKClassName + return c.SDKClassName } diff --git a/pkg/models/shared/diagnostic.go b/pkg/models/shared/diagnostic.go index d22eb016..534fe942 100644 --- a/pkg/models/shared/diagnostic.go +++ b/pkg/models/shared/diagnostic.go @@ -13,30 +13,30 @@ type Diagnostic struct { Type string `json:"type"` } -func (o *Diagnostic) GetHelpMessage() *string { - if o == nil { +func (d *Diagnostic) GetHelpMessage() *string { + if d == nil { return nil } - return o.HelpMessage + return d.HelpMessage } -func (o *Diagnostic) GetMessage() string { - if o == nil { +func (d *Diagnostic) GetMessage() string { + if d == nil { return "" } - return o.Message + return d.Message } -func (o *Diagnostic) GetPath() []string { - if o == nil { +func (d *Diagnostic) GetPath() []string { + if d == nil { return []string{} } - return o.Path + return d.Path } -func (o *Diagnostic) GetType() string { - if o == nil { +func (d *Diagnostic) GetType() string { + if d == nil { return "" } - return o.Type + return d.Type } diff --git a/pkg/models/shared/featureflag.go b/pkg/models/shared/featureflag.go index 62718ce2..9417cf7f 100644 --- a/pkg/models/shared/featureflag.go +++ b/pkg/models/shared/featureflag.go @@ -19,22 +19,22 @@ func (f FeatureFlag) MarshalJSON() ([]byte, error) { } func (f *FeatureFlag) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &f, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &f, "", false, []string{"feature_flag"}); err != nil { return err } return nil } -func (o *FeatureFlag) GetFeatureFlag() WorkspaceFeatureFlag { - if o == nil { +func (f *FeatureFlag) GetFeatureFlag() WorkspaceFeatureFlag { + if f == nil { return WorkspaceFeatureFlag("") } - return o.FeatureFlag + return f.FeatureFlag } -func (o *FeatureFlag) GetTrialEndsAt() *time.Time { - if o == nil { +func (f *FeatureFlag) GetTrialEndsAt() *time.Time { + if f == nil { return nil } - return o.TrialEndsAt + return f.TrialEndsAt } diff --git a/pkg/models/shared/getnamespacesresponse.go b/pkg/models/shared/getnamespacesresponse.go index 7e0bf553..ff9b141d 100644 --- a/pkg/models/shared/getnamespacesresponse.go +++ b/pkg/models/shared/getnamespacesresponse.go @@ -6,9 +6,9 @@ type GetNamespacesResponse struct { Items []Namespace `json:"items"` } -func (o *GetNamespacesResponse) GetItems() []Namespace { - if o == nil { +func (g *GetNamespacesResponse) GetItems() []Namespace { + if g == nil { return []Namespace{} } - return o.Items + return g.Items } diff --git a/pkg/models/shared/getrevisionsresponse.go b/pkg/models/shared/getrevisionsresponse.go index c6cb7c5b..1493961c 100644 --- a/pkg/models/shared/getrevisionsresponse.go +++ b/pkg/models/shared/getrevisionsresponse.go @@ -7,16 +7,16 @@ type GetRevisionsResponse struct { NextPageToken string `json:"next_page_token"` } -func (o *GetRevisionsResponse) GetItems() []Revision { - if o == nil { +func (g *GetRevisionsResponse) GetItems() []Revision { + if g == nil { return []Revision{} } - return o.Items + return g.Items } -func (o *GetRevisionsResponse) GetNextPageToken() string { - if o == nil { +func (g *GetRevisionsResponse) GetNextPageToken() string { + if g == nil { return "" } - return o.NextPageToken + return g.NextPageToken } diff --git a/pkg/models/shared/gettagsresponse.go b/pkg/models/shared/gettagsresponse.go index ed154cba..4206bd58 100644 --- a/pkg/models/shared/gettagsresponse.go +++ b/pkg/models/shared/gettagsresponse.go @@ -6,9 +6,9 @@ type GetTagsResponse struct { Items []Tag `json:"items"` } -func (o *GetTagsResponse) GetItems() []Tag { - if o == nil { +func (g *GetTagsResponse) GetItems() []Tag { + if g == nil { return []Tag{} } - return o.Items + return g.Items } diff --git a/pkg/models/shared/githubconfigurecodesamplesrequest.go b/pkg/models/shared/githubconfigurecodesamplesrequest.go index 7282efe9..fcbf623b 100644 --- a/pkg/models/shared/githubconfigurecodesamplesrequest.go +++ b/pkg/models/shared/githubconfigurecodesamplesrequest.go @@ -12,23 +12,23 @@ type GithubConfigureCodeSamplesRequest struct { TargetName string `json:"targetName"` } -func (o *GithubConfigureCodeSamplesRequest) GetOrg() string { - if o == nil { +func (g *GithubConfigureCodeSamplesRequest) GetOrg() string { + if g == nil { return "" } - return o.Org + return g.Org } -func (o *GithubConfigureCodeSamplesRequest) GetRepo() string { - if o == nil { +func (g *GithubConfigureCodeSamplesRequest) GetRepo() string { + if g == nil { return "" } - return o.Repo + return g.Repo } -func (o *GithubConfigureCodeSamplesRequest) GetTargetName() string { - if o == nil { +func (g *GithubConfigureCodeSamplesRequest) GetTargetName() string { + if g == nil { return "" } - return o.TargetName + return g.TargetName } diff --git a/pkg/models/shared/githubconfigurecodesamplesresponse.go b/pkg/models/shared/githubconfigurecodesamplesresponse.go index 86585b63..23911998 100644 --- a/pkg/models/shared/githubconfigurecodesamplesresponse.go +++ b/pkg/models/shared/githubconfigurecodesamplesresponse.go @@ -12,23 +12,23 @@ type GithubConfigureCodeSamplesResponse struct { Source WorkflowDocument `json:"source"` } -func (o *GithubConfigureCodeSamplesResponse) GetCodeSampleOverlayRegistryURL() string { - if o == nil { +func (g *GithubConfigureCodeSamplesResponse) GetCodeSampleOverlayRegistryURL() string { + if g == nil { return "" } - return o.CodeSampleOverlayRegistryURL + return g.CodeSampleOverlayRegistryURL } -func (o *GithubConfigureCodeSamplesResponse) GetGhActionID() *string { - if o == nil { +func (g *GithubConfigureCodeSamplesResponse) GetGhActionID() *string { + if g == nil { return nil } - return o.GhActionID + return g.GhActionID } -func (o *GithubConfigureCodeSamplesResponse) GetSource() WorkflowDocument { - if o == nil { +func (g *GithubConfigureCodeSamplesResponse) GetSource() WorkflowDocument { + if g == nil { return WorkflowDocument{} } - return o.Source + return g.Source } diff --git a/pkg/models/shared/githubconfiguremintlifyreporequest.go b/pkg/models/shared/githubconfiguremintlifyreporequest.go index e7613dc6..4de333b1 100644 --- a/pkg/models/shared/githubconfiguremintlifyreporequest.go +++ b/pkg/models/shared/githubconfiguremintlifyreporequest.go @@ -16,37 +16,37 @@ type GithubConfigureMintlifyRepoRequest struct { Subdirectory *string `json:"subdirectory,omitempty"` } -func (o *GithubConfigureMintlifyRepoRequest) GetInput() string { - if o == nil { +func (g *GithubConfigureMintlifyRepoRequest) GetInput() string { + if g == nil { return "" } - return o.Input + return g.Input } -func (o *GithubConfigureMintlifyRepoRequest) GetOrg() string { - if o == nil { +func (g *GithubConfigureMintlifyRepoRequest) GetOrg() string { + if g == nil { return "" } - return o.Org + return g.Org } -func (o *GithubConfigureMintlifyRepoRequest) GetOverlays() []string { - if o == nil { +func (g *GithubConfigureMintlifyRepoRequest) GetOverlays() []string { + if g == nil { return []string{} } - return o.Overlays + return g.Overlays } -func (o *GithubConfigureMintlifyRepoRequest) GetRepo() string { - if o == nil { +func (g *GithubConfigureMintlifyRepoRequest) GetRepo() string { + if g == nil { return "" } - return o.Repo + return g.Repo } -func (o *GithubConfigureMintlifyRepoRequest) GetSubdirectory() *string { - if o == nil { +func (g *GithubConfigureMintlifyRepoRequest) GetSubdirectory() *string { + if g == nil { return nil } - return o.Subdirectory + return g.Subdirectory } diff --git a/pkg/models/shared/githubconfiguretargetrequest.go b/pkg/models/shared/githubconfiguretargetrequest.go index 9d1f2197..624ee047 100644 --- a/pkg/models/shared/githubconfiguretargetrequest.go +++ b/pkg/models/shared/githubconfiguretargetrequest.go @@ -10,16 +10,16 @@ type GithubConfigureTargetRequest struct { RepoName string `json:"repo_name"` } -func (o *GithubConfigureTargetRequest) GetOrg() string { - if o == nil { +func (g *GithubConfigureTargetRequest) GetOrg() string { + if g == nil { return "" } - return o.Org + return g.Org } -func (o *GithubConfigureTargetRequest) GetRepoName() string { - if o == nil { +func (g *GithubConfigureTargetRequest) GetRepoName() string { + if g == nil { return "" } - return o.RepoName + return g.RepoName } diff --git a/pkg/models/shared/githubgetactionresponse.go b/pkg/models/shared/githubgetactionresponse.go index fdabdfac..e0e71f84 100644 --- a/pkg/models/shared/githubgetactionresponse.go +++ b/pkg/models/shared/githubgetactionresponse.go @@ -10,16 +10,16 @@ type GithubGetActionResponse struct { RunURL *string `json:"run_url,omitempty"` } -func (o *GithubGetActionResponse) GetRunStatus() *string { - if o == nil { +func (g *GithubGetActionResponse) GetRunStatus() *string { + if g == nil { return nil } - return o.RunStatus + return g.RunStatus } -func (o *GithubGetActionResponse) GetRunURL() *string { - if o == nil { +func (g *GithubGetActionResponse) GetRunURL() *string { + if g == nil { return nil } - return o.RunURL + return g.RunURL } diff --git a/pkg/models/shared/githubmissingpublishingsecretsresponse.go b/pkg/models/shared/githubmissingpublishingsecretsresponse.go index 48be3f25..8828be0f 100644 --- a/pkg/models/shared/githubmissingpublishingsecretsresponse.go +++ b/pkg/models/shared/githubmissingpublishingsecretsresponse.go @@ -7,9 +7,9 @@ type GithubMissingPublishingSecretsResponse struct { MissingSecrets []string `json:"missing_secrets,omitempty"` } -func (o *GithubMissingPublishingSecretsResponse) GetMissingSecrets() []string { - if o == nil { +func (g *GithubMissingPublishingSecretsResponse) GetMissingSecrets() []string { + if g == nil { return nil } - return o.MissingSecrets + return g.MissingSecrets } diff --git a/pkg/models/shared/githubpublishingprresponse.go b/pkg/models/shared/githubpublishingprresponse.go index 02658ce2..dfa7460e 100644 --- a/pkg/models/shared/githubpublishingprresponse.go +++ b/pkg/models/shared/githubpublishingprresponse.go @@ -28,73 +28,73 @@ func (p PullRequestMetadata) MarshalJSON() ([]byte, error) { } func (p *PullRequestMetadata) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &p, "", false, nil); err != nil { return err } return nil } -func (o *PullRequestMetadata) GetBaseBranch() *string { - if o == nil { +func (p *PullRequestMetadata) GetBaseBranch() *string { + if p == nil { return nil } - return o.BaseBranch + return p.BaseBranch } -func (o *PullRequestMetadata) GetCanMerge() *bool { - if o == nil { +func (p *PullRequestMetadata) GetCanMerge() *bool { + if p == nil { return nil } - return o.CanMerge + return p.CanMerge } -func (o *PullRequestMetadata) GetCreatedAt() *time.Time { - if o == nil { +func (p *PullRequestMetadata) GetCreatedAt() *time.Time { + if p == nil { return nil } - return o.CreatedAt + return p.CreatedAt } -func (o *PullRequestMetadata) GetDescription() *string { - if o == nil { +func (p *PullRequestMetadata) GetDescription() *string { + if p == nil { return nil } - return o.Description + return p.Description } -func (o *PullRequestMetadata) GetHeadBranch() *string { - if o == nil { +func (p *PullRequestMetadata) GetHeadBranch() *string { + if p == nil { return nil } - return o.HeadBranch + return p.HeadBranch } -func (o *PullRequestMetadata) GetLabels() []string { - if o == nil { +func (p *PullRequestMetadata) GetLabels() []string { + if p == nil { return nil } - return o.Labels + return p.Labels } -func (o *PullRequestMetadata) GetRequestedReviewers() []string { - if o == nil { +func (p *PullRequestMetadata) GetRequestedReviewers() []string { + if p == nil { return nil } - return o.RequestedReviewers + return p.RequestedReviewers } -func (o *PullRequestMetadata) GetStatus() *string { - if o == nil { +func (p *PullRequestMetadata) GetStatus() *string { + if p == nil { return nil } - return o.Status + return p.Status } -func (o *PullRequestMetadata) GetTitle() *string { - if o == nil { +func (p *PullRequestMetadata) GetTitle() *string { + if p == nil { return nil } - return o.Title + return p.Title } // GithubPublishingPRResponse - Open generation PRs pending publishing @@ -105,23 +105,23 @@ type GithubPublishingPRResponse struct { PullRequestMetadata *PullRequestMetadata `json:"pull_request_metadata,omitempty"` } -func (o *GithubPublishingPRResponse) GetPendingVersion() *string { - if o == nil { +func (g *GithubPublishingPRResponse) GetPendingVersion() *string { + if g == nil { return nil } - return o.PendingVersion + return g.PendingVersion } -func (o *GithubPublishingPRResponse) GetPullRequest() *string { - if o == nil { +func (g *GithubPublishingPRResponse) GetPullRequest() *string { + if g == nil { return nil } - return o.PullRequest + return g.PullRequest } -func (o *GithubPublishingPRResponse) GetPullRequestMetadata() *PullRequestMetadata { - if o == nil { +func (g *GithubPublishingPRResponse) GetPullRequestMetadata() *PullRequestMetadata { + if g == nil { return nil } - return o.PullRequestMetadata + return g.PullRequestMetadata } diff --git a/pkg/models/shared/githubsetupstateresponse.go b/pkg/models/shared/githubsetupstateresponse.go index 7e682da5..4ba34ae8 100644 --- a/pkg/models/shared/githubsetupstateresponse.go +++ b/pkg/models/shared/githubsetupstateresponse.go @@ -7,18 +7,18 @@ type Actions struct { PublishActionConfigured bool `json:"publish_action_configured"` } -func (o *Actions) GetGenerationActionConfigured() bool { - if o == nil { +func (a *Actions) GetGenerationActionConfigured() bool { + if a == nil { return false } - return o.GenerationActionConfigured + return a.GenerationActionConfigured } -func (o *Actions) GetPublishActionConfigured() bool { - if o == nil { +func (a *Actions) GetPublishActionConfigured() bool { + if a == nil { return false } - return o.PublishActionConfigured + return a.PublishActionConfigured } type Secrets struct { @@ -26,18 +26,18 @@ type Secrets struct { PublishingSecretsConfigured bool `json:"publishing_secrets_configured"` } -func (o *Secrets) GetAPIKeyConfigured() bool { - if o == nil { +func (s *Secrets) GetAPIKeyConfigured() bool { + if s == nil { return false } - return o.APIKeyConfigured + return s.APIKeyConfigured } -func (o *Secrets) GetPublishingSecretsConfigured() bool { - if o == nil { +func (s *Secrets) GetPublishingSecretsConfigured() bool { + if s == nil { return false } - return o.PublishingSecretsConfigured + return s.PublishingSecretsConfigured } // GithubSetupStateResponse - The state of a particular SDK targets github setup @@ -47,23 +47,23 @@ type GithubSetupStateResponse struct { Secrets Secrets `json:"secrets"` } -func (o *GithubSetupStateResponse) GetActions() Actions { - if o == nil { +func (g *GithubSetupStateResponse) GetActions() Actions { + if g == nil { return Actions{} } - return o.Actions + return g.Actions } -func (o *GithubSetupStateResponse) GetAppInstalled() bool { - if o == nil { +func (g *GithubSetupStateResponse) GetAppInstalled() bool { + if g == nil { return false } - return o.AppInstalled + return g.AppInstalled } -func (o *GithubSetupStateResponse) GetSecrets() Secrets { - if o == nil { +func (g *GithubSetupStateResponse) GetSecrets() Secrets { + if g == nil { return Secrets{} } - return o.Secrets + return g.Secrets } diff --git a/pkg/models/shared/githubstorepublishingsecretsrequest.go b/pkg/models/shared/githubstorepublishingsecretsrequest.go index e616ef76..11fe0841 100644 --- a/pkg/models/shared/githubstorepublishingsecretsrequest.go +++ b/pkg/models/shared/githubstorepublishingsecretsrequest.go @@ -10,16 +10,16 @@ type GithubStorePublishingSecretsRequest struct { Secrets map[string]string `json:"secrets,omitempty"` } -func (o *GithubStorePublishingSecretsRequest) GetGenerateGenLockID() string { - if o == nil { +func (g *GithubStorePublishingSecretsRequest) GetGenerateGenLockID() string { + if g == nil { return "" } - return o.GenerateGenLockID + return g.GenerateGenLockID } -func (o *GithubStorePublishingSecretsRequest) GetSecrets() map[string]string { - if o == nil { +func (g *GithubStorePublishingSecretsRequest) GetSecrets() map[string]string { + if g == nil { return nil } - return o.Secrets + return g.Secrets } diff --git a/pkg/models/shared/githubtriggeractionrequest.go b/pkg/models/shared/githubtriggeractionrequest.go index 21185371..c4fe66c7 100644 --- a/pkg/models/shared/githubtriggeractionrequest.go +++ b/pkg/models/shared/githubtriggeractionrequest.go @@ -18,44 +18,44 @@ type GithubTriggerActionRequest struct { TargetName *string `json:"target_name,omitempty"` } -func (o *GithubTriggerActionRequest) GetForce() *bool { - if o == nil { +func (g *GithubTriggerActionRequest) GetForce() *bool { + if g == nil { return nil } - return o.Force + return g.Force } -func (o *GithubTriggerActionRequest) GetGenLockID() string { - if o == nil { +func (g *GithubTriggerActionRequest) GetGenLockID() string { + if g == nil { return "" } - return o.GenLockID + return g.GenLockID } -func (o *GithubTriggerActionRequest) GetOrg() string { - if o == nil { +func (g *GithubTriggerActionRequest) GetOrg() string { + if g == nil { return "" } - return o.Org + return g.Org } -func (o *GithubTriggerActionRequest) GetRepoName() string { - if o == nil { +func (g *GithubTriggerActionRequest) GetRepoName() string { + if g == nil { return "" } - return o.RepoName + return g.RepoName } -func (o *GithubTriggerActionRequest) GetSetVersion() *string { - if o == nil { +func (g *GithubTriggerActionRequest) GetSetVersion() *string { + if g == nil { return nil } - return o.SetVersion + return g.SetVersion } -func (o *GithubTriggerActionRequest) GetTargetName() *string { - if o == nil { +func (g *GithubTriggerActionRequest) GetTargetName() *string { + if g == nil { return nil } - return o.TargetName + return g.TargetName } diff --git a/pkg/models/shared/manifest.go b/pkg/models/shared/manifest.go index 943896d7..b1a3ff73 100644 --- a/pkg/models/shared/manifest.go +++ b/pkg/models/shared/manifest.go @@ -16,37 +16,37 @@ type Manifest struct { SchemaVersion *int64 `json:"schemaVersion,omitempty"` } -func (o *Manifest) GetAnnotations() *Annotations { - if o == nil { +func (m *Manifest) GetAnnotations() *Annotations { + if m == nil { return nil } - return o.Annotations + return m.Annotations } -func (o *Manifest) GetArtifactType() *string { - if o == nil { +func (m *Manifest) GetArtifactType() *string { + if m == nil { return nil } - return o.ArtifactType + return m.ArtifactType } -func (o *Manifest) GetLayers() []V2Descriptor { - if o == nil { +func (m *Manifest) GetLayers() []V2Descriptor { + if m == nil { return nil } - return o.Layers + return m.Layers } -func (o *Manifest) GetMediaType() *string { - if o == nil { +func (m *Manifest) GetMediaType() *string { + if m == nil { return nil } - return o.MediaType + return m.MediaType } -func (o *Manifest) GetSchemaVersion() *int64 { - if o == nil { +func (m *Manifest) GetSchemaVersion() *int64 { + if m == nil { return nil } - return o.SchemaVersion + return m.SchemaVersion } diff --git a/pkg/models/shared/namespace.go b/pkg/models/shared/namespace.go index c133630f..773519a3 100644 --- a/pkg/models/shared/namespace.go +++ b/pkg/models/shared/namespace.go @@ -13,18 +13,18 @@ type CompositeSpecMetadata struct { SubscriptionSettings RemoteSourceSubscriptionSettings `json:"subscription_settings"` } -func (o *CompositeSpecMetadata) GetSubscriptionID() string { - if o == nil { +func (c *CompositeSpecMetadata) GetSubscriptionID() string { + if c == nil { return "" } - return o.SubscriptionID + return c.SubscriptionID } -func (o *CompositeSpecMetadata) GetSubscriptionSettings() RemoteSourceSubscriptionSettings { - if o == nil { +func (c *CompositeSpecMetadata) GetSubscriptionSettings() RemoteSourceSubscriptionSettings { + if c == nil { return RemoteSourceSubscriptionSettings{} } - return o.SubscriptionSettings + return c.SubscriptionSettings } // Namespace - A namespace contains many revisions. @@ -47,64 +47,64 @@ func (n Namespace) MarshalJSON() ([]byte, error) { } func (n *Namespace) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &n, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &n, "", false, []string{"created_at", "id", "name", "updated_at"}); err != nil { return err } return nil } -func (o *Namespace) GetArchivedAt() *time.Time { - if o == nil { +func (n *Namespace) GetArchivedAt() *time.Time { + if n == nil { return nil } - return o.ArchivedAt + return n.ArchivedAt } -func (o *Namespace) GetCompositeSpecMetadata() *CompositeSpecMetadata { - if o == nil { +func (n *Namespace) GetCompositeSpecMetadata() *CompositeSpecMetadata { + if n == nil { return nil } - return o.CompositeSpecMetadata + return n.CompositeSpecMetadata } -func (o *Namespace) GetCreatedAt() time.Time { - if o == nil { +func (n *Namespace) GetCreatedAt() time.Time { + if n == nil { return time.Time{} } - return o.CreatedAt + return n.CreatedAt } -func (o *Namespace) GetID() string { - if o == nil { +func (n *Namespace) GetID() string { + if n == nil { return "" } - return o.ID + return n.ID } -func (o *Namespace) GetLatestRevisionMetadata() *RevisionContentsMetadata { - if o == nil { +func (n *Namespace) GetLatestRevisionMetadata() *RevisionContentsMetadata { + if n == nil { return nil } - return o.LatestRevisionMetadata + return n.LatestRevisionMetadata } -func (o *Namespace) GetName() string { - if o == nil { +func (n *Namespace) GetName() string { + if n == nil { return "" } - return o.Name + return n.Name } -func (o *Namespace) GetPublic() *bool { - if o == nil { +func (n *Namespace) GetPublic() *bool { + if n == nil { return nil } - return o.Public + return n.Public } -func (o *Namespace) GetUpdatedAt() time.Time { - if o == nil { +func (n *Namespace) GetUpdatedAt() time.Time { + if n == nil { return time.Time{} } - return o.UpdatedAt + return n.UpdatedAt } diff --git a/pkg/models/shared/oasinfo.go b/pkg/models/shared/oasinfo.go index 83ca81f1..32aebee6 100644 --- a/pkg/models/shared/oasinfo.go +++ b/pkg/models/shared/oasinfo.go @@ -6,11 +6,11 @@ type License struct { Identifier *string `json:"identifier,omitempty"` } -func (o *License) GetIdentifier() *string { - if o == nil { +func (l *License) GetIdentifier() *string { + if l == nil { return nil } - return o.Identifier + return l.Identifier } type OASInfo struct { diff --git a/pkg/models/shared/organization.go b/pkg/models/shared/organization.go index f7e5ad58..667fdc88 100644 --- a/pkg/models/shared/organization.go +++ b/pkg/models/shared/organization.go @@ -27,7 +27,7 @@ func (o Organization) MarshalJSON() ([]byte, error) { } func (o *Organization) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &o, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &o, "", false, []string{"account_type", "created_at", "id", "name", "slug", "sso_activated", "telemetry_disabled", "updated_at"}); err != nil { return err } return nil diff --git a/pkg/models/shared/organizationusageresponse.go b/pkg/models/shared/organizationusageresponse.go index 85084868..df8f3361 100644 --- a/pkg/models/shared/organizationusageresponse.go +++ b/pkg/models/shared/organizationusageresponse.go @@ -23,7 +23,7 @@ func (o OrganizationUsageResponse) MarshalJSON() ([]byte, error) { } func (o *OrganizationUsageResponse) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &o, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &o, "", false, []string{"allowed_languages", "total_allowed_languages", "usage"}); err != nil { return err } return nil diff --git a/pkg/models/shared/preflightrequest.go b/pkg/models/shared/preflightrequest.go index ac2a3d32..84e3df0e 100644 --- a/pkg/models/shared/preflightrequest.go +++ b/pkg/models/shared/preflightrequest.go @@ -6,9 +6,9 @@ type PreflightRequest struct { NamespaceName string `json:"namespace_name"` } -func (o *PreflightRequest) GetNamespaceName() string { - if o == nil { +func (p *PreflightRequest) GetNamespaceName() string { + if p == nil { return "" } - return o.NamespaceName + return p.NamespaceName } diff --git a/pkg/models/shared/preflighttoken.go b/pkg/models/shared/preflighttoken.go index ef85ad94..22d81a7c 100644 --- a/pkg/models/shared/preflighttoken.go +++ b/pkg/models/shared/preflighttoken.go @@ -7,9 +7,9 @@ type PreflightToken struct { AuthToken *string `json:"auth_token,omitempty"` } -func (o *PreflightToken) GetAuthToken() *string { - if o == nil { +func (p *PreflightToken) GetAuthToken() *string { + if p == nil { return nil } - return o.AuthToken + return p.AuthToken } diff --git a/pkg/models/shared/publishingtoken.go b/pkg/models/shared/publishingtoken.go index 5c96b1dc..126b5f39 100644 --- a/pkg/models/shared/publishingtoken.go +++ b/pkg/models/shared/publishingtoken.go @@ -53,92 +53,92 @@ func (p PublishingToken) MarshalJSON() ([]byte, error) { } func (p *PublishingToken) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &p, "", false, []string{"created_at", "created_by", "id", "organization_id", "target_id", "target_resource", "token", "token_name", "valid_until", "workspace_id"}); err != nil { return err } return nil } -func (o *PublishingToken) GetCreatedAt() time.Time { - if o == nil { +func (p *PublishingToken) GetCreatedAt() time.Time { + if p == nil { return time.Time{} } - return o.CreatedAt + return p.CreatedAt } -func (o *PublishingToken) GetCreatedBy() string { - if o == nil { +func (p *PublishingToken) GetCreatedBy() string { + if p == nil { return "" } - return o.CreatedBy + return p.CreatedBy } -func (o *PublishingToken) GetID() string { - if o == nil { +func (p *PublishingToken) GetID() string { + if p == nil { return "" } - return o.ID + return p.ID } -func (o *PublishingToken) GetOrganizationID() string { - if o == nil { +func (p *PublishingToken) GetOrganizationID() string { + if p == nil { return "" } - return o.OrganizationID + return p.OrganizationID } -func (o *PublishingToken) GetTargetID() string { - if o == nil { +func (p *PublishingToken) GetTargetID() string { + if p == nil { return "" } - return o.TargetID + return p.TargetID } -func (o *PublishingToken) GetTargetResource() TargetResource { - if o == nil { +func (p *PublishingToken) GetTargetResource() TargetResource { + if p == nil { return TargetResource("") } - return o.TargetResource + return p.TargetResource } -func (o *PublishingToken) GetToken() string { - if o == nil { +func (p *PublishingToken) GetToken() string { + if p == nil { return "" } - return o.Token + return p.Token } -func (o *PublishingToken) GetTokenName() string { - if o == nil { +func (p *PublishingToken) GetTokenName() string { + if p == nil { return "" } - return o.TokenName + return p.TokenName } -func (o *PublishingToken) GetUpdatedAt() *time.Time { - if o == nil { +func (p *PublishingToken) GetUpdatedAt() *time.Time { + if p == nil { return nil } - return o.UpdatedAt + return p.UpdatedAt } -func (o *PublishingToken) GetUpdatedBy() *string { - if o == nil { +func (p *PublishingToken) GetUpdatedBy() *string { + if p == nil { return nil } - return o.UpdatedBy + return p.UpdatedBy } -func (o *PublishingToken) GetValidUntil() time.Time { - if o == nil { +func (p *PublishingToken) GetValidUntil() time.Time { + if p == nil { return time.Time{} } - return o.ValidUntil + return p.ValidUntil } -func (o *PublishingToken) GetWorkspaceID() string { - if o == nil { +func (p *PublishingToken) GetWorkspaceID() string { + if p == nil { return "" } - return o.WorkspaceID + return p.WorkspaceID } diff --git a/pkg/models/shared/remotedocument.go b/pkg/models/shared/remotedocument.go index 3b6949e8..bb3bedae 100644 --- a/pkg/models/shared/remotedocument.go +++ b/pkg/models/shared/remotedocument.go @@ -7,9 +7,9 @@ type RemoteDocument struct { RegistryURL string `json:"registry_url"` } -func (o *RemoteDocument) GetRegistryURL() string { - if o == nil { +func (r *RemoteDocument) GetRegistryURL() string { + if r == nil { return "" } - return o.RegistryURL + return r.RegistryURL } diff --git a/pkg/models/shared/remotesource.go b/pkg/models/shared/remotesource.go index 5c3642aa..4ad7eebc 100644 --- a/pkg/models/shared/remotesource.go +++ b/pkg/models/shared/remotesource.go @@ -10,23 +10,23 @@ type RemoteSource struct { Overlays []RemoteDocument `json:"overlays,omitempty"` } -func (o *RemoteSource) GetInputs() []RemoteDocument { - if o == nil { +func (r *RemoteSource) GetInputs() []RemoteDocument { + if r == nil { return []RemoteDocument{} } - return o.Inputs + return r.Inputs } -func (o *RemoteSource) GetOutput() RemoteDocument { - if o == nil { +func (r *RemoteSource) GetOutput() RemoteDocument { + if r == nil { return RemoteDocument{} } - return o.Output + return r.Output } -func (o *RemoteSource) GetOverlays() []RemoteDocument { - if o == nil { +func (r *RemoteSource) GetOverlays() []RemoteDocument { + if r == nil { return nil } - return o.Overlays + return r.Overlays } diff --git a/pkg/models/shared/remotesourcesubscriptionsettings.go b/pkg/models/shared/remotesourcesubscriptionsettings.go index 97f87988..ed47fc77 100644 --- a/pkg/models/shared/remotesourcesubscriptionsettings.go +++ b/pkg/models/shared/remotesourcesubscriptionsettings.go @@ -9,30 +9,30 @@ type RemoteSourceSubscriptionSettings struct { OverlayNamespaces []string `json:"overlay_namespaces"` } -func (o *RemoteSourceSubscriptionSettings) GetBaseSpecNamespaces() []string { - if o == nil { +func (r *RemoteSourceSubscriptionSettings) GetBaseSpecNamespaces() []string { + if r == nil { return []string{} } - return o.BaseSpecNamespaces + return r.BaseSpecNamespaces } -func (o *RemoteSourceSubscriptionSettings) GetIgnoredNamespaces() []string { - if o == nil { +func (r *RemoteSourceSubscriptionSettings) GetIgnoredNamespaces() []string { + if r == nil { return nil } - return o.IgnoredNamespaces + return r.IgnoredNamespaces } -func (o *RemoteSourceSubscriptionSettings) GetOutputNamespace() string { - if o == nil { +func (r *RemoteSourceSubscriptionSettings) GetOutputNamespace() string { + if r == nil { return "" } - return o.OutputNamespace + return r.OutputNamespace } -func (o *RemoteSourceSubscriptionSettings) GetOverlayNamespaces() []string { - if o == nil { +func (r *RemoteSourceSubscriptionSettings) GetOverlayNamespaces() []string { + if r == nil { return []string{} } - return o.OverlayNamespaces + return r.OverlayNamespaces } diff --git a/pkg/models/shared/report.go b/pkg/models/shared/report.go index 3df10d4c..d4190d62 100644 --- a/pkg/models/shared/report.go +++ b/pkg/models/shared/report.go @@ -37,9 +37,9 @@ type Report struct { Type *Type `json:"type,omitempty"` } -func (o *Report) GetType() *Type { - if o == nil { +func (r *Report) GetType() *Type { + if r == nil { return nil } - return o.Type + return r.Type } diff --git a/pkg/models/shared/revision.go b/pkg/models/shared/revision.go index 8eaa732f..beb83b6c 100644 --- a/pkg/models/shared/revision.go +++ b/pkg/models/shared/revision.go @@ -23,57 +23,57 @@ func (r Revision) MarshalJSON() ([]byte, error) { } func (r *Revision) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &r, "", false, []string{"created_at", "digest", "id", "namespace_name", "tags", "updated_at"}); err != nil { return err } return nil } -func (o *Revision) GetContentsMetadata() *RevisionContentsMetadata { - if o == nil { +func (r *Revision) GetContentsMetadata() *RevisionContentsMetadata { + if r == nil { return nil } - return o.ContentsMetadata + return r.ContentsMetadata } -func (o *Revision) GetCreatedAt() time.Time { - if o == nil { +func (r *Revision) GetCreatedAt() time.Time { + if r == nil { return time.Time{} } - return o.CreatedAt + return r.CreatedAt } -func (o *Revision) GetDigest() string { - if o == nil { +func (r *Revision) GetDigest() string { + if r == nil { return "" } - return o.Digest + return r.Digest } -func (o *Revision) GetID() string { - if o == nil { +func (r *Revision) GetID() string { + if r == nil { return "" } - return o.ID + return r.ID } -func (o *Revision) GetNamespaceName() string { - if o == nil { +func (r *Revision) GetNamespaceName() string { + if r == nil { return "" } - return o.NamespaceName + return r.NamespaceName } -func (o *Revision) GetTags() []string { - if o == nil { +func (r *Revision) GetTags() []string { + if r == nil { return []string{} } - return o.Tags + return r.Tags } -func (o *Revision) GetUpdatedAt() time.Time { - if o == nil { +func (r *Revision) GetUpdatedAt() time.Time { + if r == nil { return time.Time{} } - return o.UpdatedAt + return r.UpdatedAt } diff --git a/pkg/models/shared/revisioncontentsmetadata.go b/pkg/models/shared/revisioncontentsmetadata.go index 2c0b5061..8d1ac775 100644 --- a/pkg/models/shared/revisioncontentsmetadata.go +++ b/pkg/models/shared/revisioncontentsmetadata.go @@ -67,99 +67,99 @@ func (r RevisionContentsMetadata) MarshalJSON() ([]byte, error) { } func (r *RevisionContentsMetadata) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &r, "", false, []string{"contains_code_samples", "created_at", "description", "hash", "namespace", "num_overlay_actions", "operation_ids", "revision_digest", "tags", "title", "type", "version", "workspace_id"}); err != nil { return err } return nil } -func (o *RevisionContentsMetadata) GetContainsCodeSamples() bool { - if o == nil { +func (r *RevisionContentsMetadata) GetContainsCodeSamples() bool { + if r == nil { return false } - return o.ContainsCodeSamples + return r.ContainsCodeSamples } -func (o *RevisionContentsMetadata) GetCreatedAt() time.Time { - if o == nil { +func (r *RevisionContentsMetadata) GetCreatedAt() time.Time { + if r == nil { return time.Time{} } - return o.CreatedAt + return r.CreatedAt } -func (o *RevisionContentsMetadata) GetDescription() string { - if o == nil { +func (r *RevisionContentsMetadata) GetDescription() string { + if r == nil { return "" } - return o.Description + return r.Description } -func (o *RevisionContentsMetadata) GetHash() string { - if o == nil { +func (r *RevisionContentsMetadata) GetHash() string { + if r == nil { return "" } - return o.Hash + return r.Hash } -func (o *RevisionContentsMetadata) GetNamespace() string { - if o == nil { +func (r *RevisionContentsMetadata) GetNamespace() string { + if r == nil { return "" } - return o.Namespace + return r.Namespace } -func (o *RevisionContentsMetadata) GetNumOverlayActions() int64 { - if o == nil { +func (r *RevisionContentsMetadata) GetNumOverlayActions() int64 { + if r == nil { return 0 } - return o.NumOverlayActions + return r.NumOverlayActions } -func (o *RevisionContentsMetadata) GetOperationIds() []string { - if o == nil { +func (r *RevisionContentsMetadata) GetOperationIds() []string { + if r == nil { return []string{} } - return o.OperationIds + return r.OperationIds } -func (o *RevisionContentsMetadata) GetRevisionDigest() string { - if o == nil { +func (r *RevisionContentsMetadata) GetRevisionDigest() string { + if r == nil { return "" } - return o.RevisionDigest + return r.RevisionDigest } -func (o *RevisionContentsMetadata) GetTags() []string { - if o == nil { +func (r *RevisionContentsMetadata) GetTags() []string { + if r == nil { return []string{} } - return o.Tags + return r.Tags } -func (o *RevisionContentsMetadata) GetTitle() string { - if o == nil { +func (r *RevisionContentsMetadata) GetTitle() string { + if r == nil { return "" } - return o.Title + return r.Title } -func (o *RevisionContentsMetadata) GetType() RevisionContentsMetadataType { - if o == nil { +func (r *RevisionContentsMetadata) GetType() RevisionContentsMetadataType { + if r == nil { return RevisionContentsMetadataType("") } - return o.Type + return r.Type } -func (o *RevisionContentsMetadata) GetVersion() string { - if o == nil { +func (r *RevisionContentsMetadata) GetVersion() string { + if r == nil { return "" } - return o.Version + return r.Version } -func (o *RevisionContentsMetadata) GetWorkspaceID() string { - if o == nil { +func (r *RevisionContentsMetadata) GetWorkspaceID() string { + if r == nil { return "" } - return o.WorkspaceID + return r.WorkspaceID } diff --git a/pkg/models/shared/schemastoreitem.go b/pkg/models/shared/schemastoreitem.go index e4f101fc..b5305a8f 100644 --- a/pkg/models/shared/schemastoreitem.go +++ b/pkg/models/shared/schemastoreitem.go @@ -49,50 +49,50 @@ func (s SchemaStoreItem) MarshalJSON() ([]byte, error) { } func (s *SchemaStoreItem) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &s, "", false, []string{"created_at", "format", "id", "packageName", "sdkClassname", "spec"}); err != nil { return err } return nil } -func (o *SchemaStoreItem) GetCreatedAt() time.Time { - if o == nil { +func (s *SchemaStoreItem) GetCreatedAt() time.Time { + if s == nil { return time.Time{} } - return o.CreatedAt + return s.CreatedAt } -func (o *SchemaStoreItem) GetFormat() Format { - if o == nil { +func (s *SchemaStoreItem) GetFormat() Format { + if s == nil { return Format("") } - return o.Format + return s.Format } -func (o *SchemaStoreItem) GetID() string { - if o == nil { +func (s *SchemaStoreItem) GetID() string { + if s == nil { return "" } - return o.ID + return s.ID } -func (o *SchemaStoreItem) GetPackageName() string { - if o == nil { +func (s *SchemaStoreItem) GetPackageName() string { + if s == nil { return "" } - return o.PackageName + return s.PackageName } -func (o *SchemaStoreItem) GetSDKClassname() string { - if o == nil { +func (s *SchemaStoreItem) GetSDKClassname() string { + if s == nil { return "" } - return o.SDKClassname + return s.SDKClassname } -func (o *SchemaStoreItem) GetSpec() string { - if o == nil { +func (s *SchemaStoreItem) GetSpec() string { + if s == nil { return "" } - return o.Spec + return s.Spec } diff --git a/pkg/models/shared/security.go b/pkg/models/shared/security.go index df0f082b..faab20a9 100644 --- a/pkg/models/shared/security.go +++ b/pkg/models/shared/security.go @@ -8,23 +8,23 @@ type Security struct { WorkspaceIdentifier *string `security:"scheme,type=apiKey,subtype=header,name=x-workspace-identifier"` } -func (o *Security) GetAPIKey() *string { - if o == nil { +func (s *Security) GetAPIKey() *string { + if s == nil { return nil } - return o.APIKey + return s.APIKey } -func (o *Security) GetBearer() *string { - if o == nil { +func (s *Security) GetBearer() *string { + if s == nil { return nil } - return o.Bearer + return s.Bearer } -func (o *Security) GetWorkspaceIdentifier() *string { - if o == nil { +func (s *Security) GetWorkspaceIdentifier() *string { + if s == nil { return nil } - return o.WorkspaceIdentifier + return s.WorkspaceIdentifier } diff --git a/pkg/models/shared/shorturl.go b/pkg/models/shared/shorturl.go index 501e4427..6dc85dab 100644 --- a/pkg/models/shared/shorturl.go +++ b/pkg/models/shared/shorturl.go @@ -7,16 +7,16 @@ type ShortURL struct { ShortURL string `json:"short_url"` } -func (o *ShortURL) GetFullURL() string { - if o == nil { +func (s *ShortURL) GetFullURL() string { + if s == nil { return "" } - return o.FullURL + return s.FullURL } -func (o *ShortURL) GetShortURL() string { - if o == nil { +func (s *ShortURL) GetShortURL() string { + if s == nil { return "" } - return o.ShortURL + return s.ShortURL } diff --git a/pkg/models/shared/ssometadata.go b/pkg/models/shared/ssometadata.go index fa545b88..54a1d6cb 100644 --- a/pkg/models/shared/ssometadata.go +++ b/pkg/models/shared/ssometadata.go @@ -8,16 +8,16 @@ type SSOMetadata struct { SsoDomains []string `json:"sso_domains"` } -func (o *SSOMetadata) GetSsoActivated() bool { - if o == nil { +func (s *SSOMetadata) GetSsoActivated() bool { + if s == nil { return false } - return o.SsoActivated + return s.SsoActivated } -func (o *SSOMetadata) GetSsoDomains() []string { - if o == nil { +func (s *SSOMetadata) GetSsoDomains() []string { + if s == nil { return []string{} } - return o.SsoDomains + return s.SsoDomains } diff --git a/pkg/models/shared/suggestitemsrequestbody.go b/pkg/models/shared/suggestitemsrequestbody.go index 501360b6..b085a7f2 100644 --- a/pkg/models/shared/suggestitemsrequestbody.go +++ b/pkg/models/shared/suggestitemsrequestbody.go @@ -9,16 +9,16 @@ type SuggestItemsRequestBody struct { Prompt string `json:"prompt"` } -func (o *SuggestItemsRequestBody) GetItems() []string { - if o == nil { +func (s *SuggestItemsRequestBody) GetItems() []string { + if s == nil { return []string{} } - return o.Items + return s.Items } -func (o *SuggestItemsRequestBody) GetPrompt() string { - if o == nil { +func (s *SuggestItemsRequestBody) GetPrompt() string { + if s == nil { return "" } - return o.Prompt + return s.Prompt } diff --git a/pkg/models/shared/suggestoptsold.go b/pkg/models/shared/suggestoptsold.go index 16d20fcf..2c8075bc 100644 --- a/pkg/models/shared/suggestoptsold.go +++ b/pkg/models/shared/suggestoptsold.go @@ -38,16 +38,16 @@ type SuggestOptsOld struct { SuggestionType SuggestionType `json:"suggestion_type"` } -func (o *SuggestOptsOld) GetDiagnostics() []Diagnostic { - if o == nil { +func (s *SuggestOptsOld) GetDiagnostics() []Diagnostic { + if s == nil { return nil } - return o.Diagnostics + return s.Diagnostics } -func (o *SuggestOptsOld) GetSuggestionType() SuggestionType { - if o == nil { +func (s *SuggestOptsOld) GetSuggestionType() SuggestionType { + if s == nil { return SuggestionType("") } - return o.SuggestionType + return s.SuggestionType } diff --git a/pkg/models/shared/suggestrequestbody.go b/pkg/models/shared/suggestrequestbody.go index 074f43a2..7448f055 100644 --- a/pkg/models/shared/suggestrequestbody.go +++ b/pkg/models/shared/suggestrequestbody.go @@ -39,23 +39,23 @@ type SuggestRequestBody struct { SuggestionType SuggestRequestBodySuggestionType `json:"suggestion_type"` } -func (o *SuggestRequestBody) GetDiagnostics() []Diagnostic { - if o == nil { +func (s *SuggestRequestBody) GetDiagnostics() []Diagnostic { + if s == nil { return []Diagnostic{} } - return o.Diagnostics + return s.Diagnostics } -func (o *SuggestRequestBody) GetOasSummary() OASSummary { - if o == nil { +func (s *SuggestRequestBody) GetOasSummary() OASSummary { + if s == nil { return OASSummary{} } - return o.OasSummary + return s.OasSummary } -func (o *SuggestRequestBody) GetSuggestionType() SuggestRequestBodySuggestionType { - if o == nil { +func (s *SuggestRequestBody) GetSuggestionType() SuggestRequestBodySuggestionType { + if s == nil { return SuggestRequestBodySuggestionType("") } - return o.SuggestionType + return s.SuggestionType } diff --git a/pkg/models/shared/tag.go b/pkg/models/shared/tag.go index 0f0afec5..775c8879 100644 --- a/pkg/models/shared/tag.go +++ b/pkg/models/shared/tag.go @@ -11,30 +11,30 @@ type Tag struct { RevisionDigest string `json:"revision_digest"` } -func (o *Tag) GetID() string { - if o == nil { +func (t *Tag) GetID() string { + if t == nil { return "" } - return o.ID + return t.ID } -func (o *Tag) GetName() string { - if o == nil { +func (t *Tag) GetName() string { + if t == nil { return "" } - return o.Name + return t.Name } -func (o *Tag) GetNamespaceName() string { - if o == nil { +func (t *Tag) GetNamespaceName() string { + if t == nil { return "" } - return o.NamespaceName + return t.NamespaceName } -func (o *Tag) GetRevisionDigest() string { - if o == nil { +func (t *Tag) GetRevisionDigest() string { + if t == nil { return "" } - return o.RevisionDigest + return t.RevisionDigest } diff --git a/pkg/models/shared/targetsdk.go b/pkg/models/shared/targetsdk.go index 3151a60a..0a14d5a7 100644 --- a/pkg/models/shared/targetsdk.go +++ b/pkg/models/shared/targetsdk.go @@ -105,323 +105,323 @@ func (t TargetSDK) MarshalJSON() ([]byte, error) { } func (t *TargetSDK) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &t, "", false, []string{"generate_gen_lock_id", "generate_target", "id", "last_event_created_at", "last_event_id", "last_event_interaction_type"}); err != nil { return err } return nil } -func (o *TargetSDK) GetCommitHead() *string { - if o == nil { +func (t *TargetSDK) GetCommitHead() *string { + if t == nil { return nil } - return o.CommitHead + return t.CommitHead } -func (o *TargetSDK) GetContinuousIntegrationEnvironment() *string { - if o == nil { +func (t *TargetSDK) GetContinuousIntegrationEnvironment() *string { + if t == nil { return nil } - return o.ContinuousIntegrationEnvironment + return t.ContinuousIntegrationEnvironment } -func (o *TargetSDK) GetError() *string { - if o == nil { +func (t *TargetSDK) GetError() *string { + if t == nil { return nil } - return o.Error + return t.Error } -func (o *TargetSDK) GetGenerateConfigPostVersion() *string { - if o == nil { +func (t *TargetSDK) GetGenerateConfigPostVersion() *string { + if t == nil { return nil } - return o.GenerateConfigPostVersion + return t.GenerateConfigPostVersion } -func (o *TargetSDK) GetGenerateEligibleFeatures() *string { - if o == nil { +func (t *TargetSDK) GetGenerateEligibleFeatures() *string { + if t == nil { return nil } - return o.GenerateEligibleFeatures + return t.GenerateEligibleFeatures } -func (o *TargetSDK) GetGenerateGenLockID() string { - if o == nil { +func (t *TargetSDK) GetGenerateGenLockID() string { + if t == nil { return "" } - return o.GenerateGenLockID + return t.GenerateGenLockID } -func (o *TargetSDK) GetGenerateGenLockPreFeatures() *string { - if o == nil { +func (t *TargetSDK) GetGenerateGenLockPreFeatures() *string { + if t == nil { return nil } - return o.GenerateGenLockPreFeatures + return t.GenerateGenLockPreFeatures } -func (o *TargetSDK) GetGenerateGenLockPreVersion() *string { - if o == nil { +func (t *TargetSDK) GetGenerateGenLockPreVersion() *string { + if t == nil { return nil } - return o.GenerateGenLockPreVersion + return t.GenerateGenLockPreVersion } -func (o *TargetSDK) GetGenerateNumberOfOperationsIgnored() *int64 { - if o == nil { +func (t *TargetSDK) GetGenerateNumberOfOperationsIgnored() *int64 { + if t == nil { return nil } - return o.GenerateNumberOfOperationsIgnored + return t.GenerateNumberOfOperationsIgnored } -func (o *TargetSDK) GetGenerateNumberOfOperationsUsed() *int64 { - if o == nil { +func (t *TargetSDK) GetGenerateNumberOfOperationsUsed() *int64 { + if t == nil { return nil } - return o.GenerateNumberOfOperationsUsed + return t.GenerateNumberOfOperationsUsed } -func (o *TargetSDK) GetGenerateNumberOfTerraformResources() *int64 { - if o == nil { +func (t *TargetSDK) GetGenerateNumberOfTerraformResources() *int64 { + if t == nil { return nil } - return o.GenerateNumberOfTerraformResources + return t.GenerateNumberOfTerraformResources } -func (o *TargetSDK) GetGeneratePublished() *bool { - if o == nil { +func (t *TargetSDK) GetGeneratePublished() *bool { + if t == nil { return nil } - return o.GeneratePublished + return t.GeneratePublished } -func (o *TargetSDK) GetGenerateTarget() string { - if o == nil { +func (t *TargetSDK) GetGenerateTarget() string { + if t == nil { return "" } - return o.GenerateTarget + return t.GenerateTarget } -func (o *TargetSDK) GetGenerateTargetName() *string { - if o == nil { +func (t *TargetSDK) GetGenerateTargetName() *string { + if t == nil { return nil } - return o.GenerateTargetName + return t.GenerateTargetName } -func (o *TargetSDK) GetGenerateTargetVersion() *string { - if o == nil { +func (t *TargetSDK) GetGenerateTargetVersion() *string { + if t == nil { return nil } - return o.GenerateTargetVersion + return t.GenerateTargetVersion } -func (o *TargetSDK) GetGhActionOrganization() *string { - if o == nil { +func (t *TargetSDK) GetGhActionOrganization() *string { + if t == nil { return nil } - return o.GhActionOrganization + return t.GhActionOrganization } -func (o *TargetSDK) GetGhActionRef() *string { - if o == nil { +func (t *TargetSDK) GetGhActionRef() *string { + if t == nil { return nil } - return o.GhActionRef + return t.GhActionRef } -func (o *TargetSDK) GetGhActionRepository() *string { - if o == nil { +func (t *TargetSDK) GetGhActionRepository() *string { + if t == nil { return nil } - return o.GhActionRepository + return t.GhActionRepository } -func (o *TargetSDK) GetGhActionRunLink() *string { - if o == nil { +func (t *TargetSDK) GetGhActionRunLink() *string { + if t == nil { return nil } - return o.GhActionRunLink + return t.GhActionRunLink } -func (o *TargetSDK) GetGhActionVersion() *string { - if o == nil { +func (t *TargetSDK) GetGhActionVersion() *string { + if t == nil { return nil } - return o.GhActionVersion + return t.GhActionVersion } -func (o *TargetSDK) GetGitRelativeCwd() *string { - if o == nil { +func (t *TargetSDK) GetGitRelativeCwd() *string { + if t == nil { return nil } - return o.GitRelativeCwd + return t.GitRelativeCwd } -func (o *TargetSDK) GetGitRemoteDefaultOwner() *string { - if o == nil { +func (t *TargetSDK) GetGitRemoteDefaultOwner() *string { + if t == nil { return nil } - return o.GitRemoteDefaultOwner + return t.GitRemoteDefaultOwner } -func (o *TargetSDK) GetGitRemoteDefaultRepo() *string { - if o == nil { +func (t *TargetSDK) GetGitRemoteDefaultRepo() *string { + if t == nil { return nil } - return o.GitRemoteDefaultRepo + return t.GitRemoteDefaultRepo } -func (o *TargetSDK) GetGitUserEmail() *string { - if o == nil { +func (t *TargetSDK) GetGitUserEmail() *string { + if t == nil { return nil } - return o.GitUserEmail + return t.GitUserEmail } -func (o *TargetSDK) GetGitUserName() *string { - if o == nil { +func (t *TargetSDK) GetGitUserName() *string { + if t == nil { return nil } - return o.GitUserName + return t.GitUserName } -func (o *TargetSDK) GetHostname() *string { - if o == nil { +func (t *TargetSDK) GetHostname() *string { + if t == nil { return nil } - return o.Hostname + return t.Hostname } -func (o *TargetSDK) GetID() string { - if o == nil { +func (t *TargetSDK) GetID() string { + if t == nil { return "" } - return o.ID + return t.ID } -func (o *TargetSDK) GetLastEventCreatedAt() time.Time { - if o == nil { +func (t *TargetSDK) GetLastEventCreatedAt() time.Time { + if t == nil { return time.Time{} } - return o.LastEventCreatedAt + return t.LastEventCreatedAt } -func (o *TargetSDK) GetLastEventID() string { - if o == nil { +func (t *TargetSDK) GetLastEventID() string { + if t == nil { return "" } - return o.LastEventID + return t.LastEventID } -func (o *TargetSDK) GetLastEventInteractionType() InteractionType { - if o == nil { +func (t *TargetSDK) GetLastEventInteractionType() InteractionType { + if t == nil { return InteractionType("") } - return o.LastEventInteractionType + return t.LastEventInteractionType } -func (o *TargetSDK) GetLastPublishCreatedAt() *time.Time { - if o == nil { +func (t *TargetSDK) GetLastPublishCreatedAt() *time.Time { + if t == nil { return nil } - return o.LastPublishCreatedAt + return t.LastPublishCreatedAt } -func (o *TargetSDK) GetLastPublishGhActionRunLink() *string { - if o == nil { +func (t *TargetSDK) GetLastPublishGhActionRunLink() *string { + if t == nil { return nil } - return o.LastPublishGhActionRunLink + return t.LastPublishGhActionRunLink } -func (o *TargetSDK) GetPublishPackageName() *string { - if o == nil { +func (t *TargetSDK) GetPublishPackageName() *string { + if t == nil { return nil } - return o.PublishPackageName + return t.PublishPackageName } -func (o *TargetSDK) GetPublishPackageRegistryName() *string { - if o == nil { +func (t *TargetSDK) GetPublishPackageRegistryName() *string { + if t == nil { return nil } - return o.PublishPackageRegistryName + return t.PublishPackageRegistryName } -func (o *TargetSDK) GetPublishPackageURL() *string { - if o == nil { +func (t *TargetSDK) GetPublishPackageURL() *string { + if t == nil { return nil } - return o.PublishPackageURL + return t.PublishPackageURL } -func (o *TargetSDK) GetPublishPackageVersion() *string { - if o == nil { +func (t *TargetSDK) GetPublishPackageVersion() *string { + if t == nil { return nil } - return o.PublishPackageVersion + return t.PublishPackageVersion } -func (o *TargetSDK) GetRepoLabel() *string { - if o == nil { +func (t *TargetSDK) GetRepoLabel() *string { + if t == nil { return nil } - return o.RepoLabel + return t.RepoLabel } -func (o *TargetSDK) GetSourceBlobDigest() *string { - if o == nil { +func (t *TargetSDK) GetSourceBlobDigest() *string { + if t == nil { return nil } - return o.SourceBlobDigest + return t.SourceBlobDigest } -func (o *TargetSDK) GetSourceNamespaceName() *string { - if o == nil { +func (t *TargetSDK) GetSourceNamespaceName() *string { + if t == nil { return nil } - return o.SourceNamespaceName + return t.SourceNamespaceName } -func (o *TargetSDK) GetSourceRevisionDigest() *string { - if o == nil { +func (t *TargetSDK) GetSourceRevisionDigest() *string { + if t == nil { return nil } - return o.SourceRevisionDigest + return t.SourceRevisionDigest } -func (o *TargetSDK) GetSuccess() *bool { - if o == nil { +func (t *TargetSDK) GetSuccess() *bool { + if t == nil { return nil } - return o.Success + return t.Success } -func (o *TargetSDK) GetWorkflowLockPostRaw() *string { - if o == nil { +func (t *TargetSDK) GetWorkflowLockPostRaw() *string { + if t == nil { return nil } - return o.WorkflowLockPostRaw + return t.WorkflowLockPostRaw } -func (o *TargetSDK) GetWorkflowLockPreRaw() *string { - if o == nil { +func (t *TargetSDK) GetWorkflowLockPreRaw() *string { + if t == nil { return nil } - return o.WorkflowLockPreRaw + return t.WorkflowLockPreRaw } -func (o *TargetSDK) GetWorkflowPostRaw() *string { - if o == nil { +func (t *TargetSDK) GetWorkflowPostRaw() *string { + if t == nil { return nil } - return o.WorkflowPostRaw + return t.WorkflowPostRaw } -func (o *TargetSDK) GetWorkflowPreRaw() *string { - if o == nil { +func (t *TargetSDK) GetWorkflowPreRaw() *string { + if t == nil { return nil } - return o.WorkflowPreRaw + return t.WorkflowPreRaw } diff --git a/pkg/models/shared/usagesnippet.go b/pkg/models/shared/usagesnippet.go index 9f59b40a..8156a0ea 100644 --- a/pkg/models/shared/usagesnippet.go +++ b/pkg/models/shared/usagesnippet.go @@ -15,37 +15,37 @@ type UsageSnippet struct { Path string `json:"path"` } -func (o *UsageSnippet) GetCode() string { - if o == nil { +func (u *UsageSnippet) GetCode() string { + if u == nil { return "" } - return o.Code + return u.Code } -func (o *UsageSnippet) GetLanguage() string { - if o == nil { +func (u *UsageSnippet) GetLanguage() string { + if u == nil { return "" } - return o.Language + return u.Language } -func (o *UsageSnippet) GetMethod() any { - if o == nil { +func (u *UsageSnippet) GetMethod() any { + if u == nil { return nil } - return o.Method + return u.Method } -func (o *UsageSnippet) GetOperationID() string { - if o == nil { +func (u *UsageSnippet) GetOperationID() string { + if u == nil { return "" } - return o.OperationID + return u.OperationID } -func (o *UsageSnippet) GetPath() string { - if o == nil { +func (u *UsageSnippet) GetPath() string { + if u == nil { return "" } - return o.Path + return u.Path } diff --git a/pkg/models/shared/usagesnippets.go b/pkg/models/shared/usagesnippets.go index 1d8edf83..8f59cd7b 100644 --- a/pkg/models/shared/usagesnippets.go +++ b/pkg/models/shared/usagesnippets.go @@ -6,9 +6,9 @@ type UsageSnippets struct { Snippets []UsageSnippet `json:"snippets"` } -func (o *UsageSnippets) GetSnippets() []UsageSnippet { - if o == nil { +func (u *UsageSnippets) GetSnippets() []UsageSnippet { + if u == nil { return []UsageSnippet{} } - return o.Snippets + return u.Snippets } diff --git a/pkg/models/shared/user.go b/pkg/models/shared/user.go index b5842d5e..aee7a002 100644 --- a/pkg/models/shared/user.go +++ b/pkg/models/shared/user.go @@ -47,120 +47,120 @@ func (u User) MarshalJSON() ([]byte, error) { } func (u *User) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &u, "", false, []string{"admin", "confirmed", "created_at", "display_name", "email", "email_verified", "id", "updated_at", "whitelisted"}); err != nil { return err } return nil } -func (o *User) GetAdmin() bool { - if o == nil { +func (u *User) GetAdmin() bool { + if u == nil { return false } - return o.Admin + return u.Admin } -func (o *User) GetConfirmed() bool { - if o == nil { +func (u *User) GetConfirmed() bool { + if u == nil { return false } - return o.Confirmed + return u.Confirmed } -func (o *User) GetCreatedAt() time.Time { - if o == nil { +func (u *User) GetCreatedAt() time.Time { + if u == nil { return time.Time{} } - return o.CreatedAt + return u.CreatedAt } -func (o *User) GetDefaultWorkspaceID() *string { - if o == nil { +func (u *User) GetDefaultWorkspaceID() *string { + if u == nil { return nil } - return o.DefaultWorkspaceID + return u.DefaultWorkspaceID } -func (o *User) GetDisplayName() string { - if o == nil { +func (u *User) GetDisplayName() string { + if u == nil { return "" } - return o.DisplayName + return u.DisplayName } -func (o *User) GetEmail() string { - if o == nil { +func (u *User) GetEmail() string { + if u == nil { return "" } - return o.Email + return u.Email } -func (o *User) GetEmailVerified() bool { - if o == nil { +func (u *User) GetEmailVerified() bool { + if u == nil { return false } - return o.EmailVerified + return u.EmailVerified } -func (o *User) GetGithubHandle() *string { - if o == nil { +func (u *User) GetGithubHandle() *string { + if u == nil { return nil } - return o.GithubHandle + return u.GithubHandle } -func (o *User) GetHasCreatedAPIKey() *bool { - if o == nil { +func (u *User) GetHasCreatedAPIKey() *bool { + if u == nil { return nil } - return o.HasCreatedAPIKey + return u.HasCreatedAPIKey } -func (o *User) GetID() string { - if o == nil { +func (u *User) GetID() string { + if u == nil { return "" } - return o.ID + return u.ID } -func (o *User) GetInternal() *bool { - if o == nil { +func (u *User) GetInternal() *bool { + if u == nil { return nil } - return o.Internal + return u.Internal } -func (o *User) GetLastLoginAt() *time.Time { - if o == nil { +func (u *User) GetLastLoginAt() *time.Time { + if u == nil { return nil } - return o.LastLoginAt + return u.LastLoginAt } -func (o *User) GetPhotoURL() *string { - if o == nil { +func (u *User) GetPhotoURL() *string { + if u == nil { return nil } - return o.PhotoURL + return u.PhotoURL } -func (o *User) GetPylonIdentityHash() *string { - if o == nil { +func (u *User) GetPylonIdentityHash() *string { + if u == nil { return nil } - return o.PylonIdentityHash + return u.PylonIdentityHash } -func (o *User) GetUpdatedAt() time.Time { - if o == nil { +func (u *User) GetUpdatedAt() time.Time { + if u == nil { return time.Time{} } - return o.UpdatedAt + return u.UpdatedAt } -func (o *User) GetWhitelisted() bool { - if o == nil { +func (u *User) GetWhitelisted() bool { + if u == nil { return false } - return o.Whitelisted + return u.Whitelisted } diff --git a/pkg/models/shared/v2descriptor.go b/pkg/models/shared/v2descriptor.go index c5b422fd..71a59076 100644 --- a/pkg/models/shared/v2descriptor.go +++ b/pkg/models/shared/v2descriptor.go @@ -14,30 +14,30 @@ type V2Descriptor struct { Size *int64 `json:"size,omitempty"` } -func (o *V2Descriptor) GetAnnotations() *Annotations { - if o == nil { +func (v *V2Descriptor) GetAnnotations() *Annotations { + if v == nil { return nil } - return o.Annotations + return v.Annotations } -func (o *V2Descriptor) GetDigest() *string { - if o == nil { +func (v *V2Descriptor) GetDigest() *string { + if v == nil { return nil } - return o.Digest + return v.Digest } -func (o *V2Descriptor) GetMediaType() *string { - if o == nil { +func (v *V2Descriptor) GetMediaType() *string { + if v == nil { return nil } - return o.MediaType + return v.MediaType } -func (o *V2Descriptor) GetSize() *int64 { - if o == nil { +func (v *V2Descriptor) GetSize() *int64 { + if v == nil { return nil } - return o.Size + return v.Size } diff --git a/pkg/models/shared/workflowdocument.go b/pkg/models/shared/workflowdocument.go index 935dc6d5..38af6d25 100644 --- a/pkg/models/shared/workflowdocument.go +++ b/pkg/models/shared/workflowdocument.go @@ -7,18 +7,18 @@ type Auth struct { Secret string `json:"secret"` } -func (o *Auth) GetHeader() string { - if o == nil { +func (a *Auth) GetHeader() string { + if a == nil { return "" } - return o.Header + return a.Header } -func (o *Auth) GetSecret() string { - if o == nil { +func (a *Auth) GetSecret() string { + if a == nil { return "" } - return o.Secret + return a.Secret } // WorkflowDocument - A document referenced by a workflow @@ -27,16 +27,16 @@ type WorkflowDocument struct { Location string `json:"location"` } -func (o *WorkflowDocument) GetAuth() *Auth { - if o == nil { +func (w *WorkflowDocument) GetAuth() *Auth { + if w == nil { return nil } - return o.Auth + return w.Auth } -func (o *WorkflowDocument) GetLocation() string { - if o == nil { +func (w *WorkflowDocument) GetLocation() string { + if w == nil { return "" } - return o.Location + return w.Location } diff --git a/pkg/models/shared/workspace.go b/pkg/models/shared/workspace.go index fcd1773d..16cb97ab 100644 --- a/pkg/models/shared/workspace.go +++ b/pkg/models/shared/workspace.go @@ -28,71 +28,71 @@ func (w Workspace) MarshalJSON() ([]byte, error) { } func (w *Workspace) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &w, "", false, []string{"created_at", "id", "name", "organization_id", "slug", "updated_at", "verified"}); err != nil { return err } return nil } -func (o *Workspace) GetCreatedAt() time.Time { - if o == nil { +func (w *Workspace) GetCreatedAt() time.Time { + if w == nil { return time.Time{} } - return o.CreatedAt + return w.CreatedAt } -func (o *Workspace) GetID() string { - if o == nil { +func (w *Workspace) GetID() string { + if w == nil { return "" } - return o.ID + return w.ID } -func (o *Workspace) GetInactive() *bool { - if o == nil { +func (w *Workspace) GetInactive() *bool { + if w == nil { return nil } - return o.Inactive + return w.Inactive } -func (o *Workspace) GetName() string { - if o == nil { +func (w *Workspace) GetName() string { + if w == nil { return "" } - return o.Name + return w.Name } -func (o *Workspace) GetOrganizationID() string { - if o == nil { +func (w *Workspace) GetOrganizationID() string { + if w == nil { return "" } - return o.OrganizationID + return w.OrganizationID } -func (o *Workspace) GetSlug() string { - if o == nil { +func (w *Workspace) GetSlug() string { + if w == nil { return "" } - return o.Slug + return w.Slug } -func (o *Workspace) GetTelemetryDisabled() *bool { - if o == nil { +func (w *Workspace) GetTelemetryDisabled() *bool { + if w == nil { return nil } - return o.TelemetryDisabled + return w.TelemetryDisabled } -func (o *Workspace) GetUpdatedAt() time.Time { - if o == nil { +func (w *Workspace) GetUpdatedAt() time.Time { + if w == nil { return time.Time{} } - return o.UpdatedAt + return w.UpdatedAt } -func (o *Workspace) GetVerified() bool { - if o == nil { +func (w *Workspace) GetVerified() bool { + if w == nil { return false } - return o.Verified + return w.Verified } diff --git a/pkg/models/shared/workspaceandorganization.go b/pkg/models/shared/workspaceandorganization.go index d3ddcaec..aa93d092 100644 --- a/pkg/models/shared/workspaceandorganization.go +++ b/pkg/models/shared/workspaceandorganization.go @@ -10,16 +10,16 @@ type WorkspaceAndOrganization struct { Workspace Workspace `json:"workspace"` } -func (o *WorkspaceAndOrganization) GetOrganization() Organization { - if o == nil { +func (w *WorkspaceAndOrganization) GetOrganization() Organization { + if w == nil { return Organization{} } - return o.Organization + return w.Organization } -func (o *WorkspaceAndOrganization) GetWorkspace() Workspace { - if o == nil { +func (w *WorkspaceAndOrganization) GetWorkspace() Workspace { + if w == nil { return Workspace{} } - return o.Workspace + return w.Workspace } diff --git a/pkg/models/shared/workspacefeatureflagrequest.go b/pkg/models/shared/workspacefeatureflagrequest.go index e16af760..8d0fb654 100644 --- a/pkg/models/shared/workspacefeatureflagrequest.go +++ b/pkg/models/shared/workspacefeatureflagrequest.go @@ -7,9 +7,9 @@ type WorkspaceFeatureFlagRequest struct { FeatureFlags []WorkspaceFeatureFlag `json:"feature_flags"` } -func (o *WorkspaceFeatureFlagRequest) GetFeatureFlags() []WorkspaceFeatureFlag { - if o == nil { +func (w *WorkspaceFeatureFlagRequest) GetFeatureFlags() []WorkspaceFeatureFlag { + if w == nil { return []WorkspaceFeatureFlag{} } - return o.FeatureFlags + return w.FeatureFlags } diff --git a/pkg/models/shared/workspacefeatureflagresponse.go b/pkg/models/shared/workspacefeatureflagresponse.go index 502947a5..da36b208 100644 --- a/pkg/models/shared/workspacefeatureflagresponse.go +++ b/pkg/models/shared/workspacefeatureflagresponse.go @@ -7,9 +7,9 @@ type WorkspaceFeatureFlagResponse struct { FeatureFlags []FeatureFlag `json:"feature_flags,omitempty"` } -func (o *WorkspaceFeatureFlagResponse) GetFeatureFlags() []FeatureFlag { - if o == nil { +func (w *WorkspaceFeatureFlagResponse) GetFeatureFlags() []FeatureFlag { + if w == nil { return nil } - return o.FeatureFlags + return w.FeatureFlags } diff --git a/pkg/models/shared/workspaceinviteresponse.go b/pkg/models/shared/workspaceinviteresponse.go index 00171ce5..94043065 100644 --- a/pkg/models/shared/workspaceinviteresponse.go +++ b/pkg/models/shared/workspaceinviteresponse.go @@ -7,18 +7,18 @@ type Relationship struct { WorkspaceID string `json:"workspace_id"` } -func (o *Relationship) GetUserID() string { - if o == nil { +func (r *Relationship) GetUserID() string { + if r == nil { return "" } - return o.UserID + return r.UserID } -func (o *Relationship) GetWorkspaceID() string { - if o == nil { +func (r *Relationship) GetWorkspaceID() string { + if r == nil { return "" } - return o.WorkspaceID + return r.WorkspaceID } // WorkspaceInviteResponse - A response for workspace user invite @@ -27,16 +27,16 @@ type WorkspaceInviteResponse struct { Relationship Relationship `json:"relationship"` } -func (o *WorkspaceInviteResponse) GetInviteLink() *string { - if o == nil { +func (w *WorkspaceInviteResponse) GetInviteLink() *string { + if w == nil { return nil } - return o.InviteLink + return w.InviteLink } -func (o *WorkspaceInviteResponse) GetRelationship() Relationship { - if o == nil { +func (w *WorkspaceInviteResponse) GetRelationship() Relationship { + if w == nil { return Relationship{} } - return o.Relationship + return w.Relationship } diff --git a/pkg/models/shared/workspacesettings.go b/pkg/models/shared/workspacesettings.go index d0431ede..6d3a0c9c 100644 --- a/pkg/models/shared/workspacesettings.go +++ b/pkg/models/shared/workspacesettings.go @@ -19,36 +19,36 @@ func (w WorkspaceSettings) MarshalJSON() ([]byte, error) { } func (w *WorkspaceSettings) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &w, "", false, []string{"created_at", "updated_at", "webhook_url", "workspace_id"}); err != nil { return err } return nil } -func (o *WorkspaceSettings) GetCreatedAt() time.Time { - if o == nil { +func (w *WorkspaceSettings) GetCreatedAt() time.Time { + if w == nil { return time.Time{} } - return o.CreatedAt + return w.CreatedAt } -func (o *WorkspaceSettings) GetUpdatedAt() time.Time { - if o == nil { +func (w *WorkspaceSettings) GetUpdatedAt() time.Time { + if w == nil { return time.Time{} } - return o.UpdatedAt + return w.UpdatedAt } -func (o *WorkspaceSettings) GetWebhookURL() string { - if o == nil { +func (w *WorkspaceSettings) GetWebhookURL() string { + if w == nil { return "" } - return o.WebhookURL + return w.WebhookURL } -func (o *WorkspaceSettings) GetWorkspaceID() string { - if o == nil { +func (w *WorkspaceSettings) GetWorkspaceID() string { + if w == nil { return "" } - return o.WorkspaceID + return w.WorkspaceID } diff --git a/pkg/models/shared/workspaceteamresponse.go b/pkg/models/shared/workspaceteamresponse.go index b4cd135a..99ba6af6 100644 --- a/pkg/models/shared/workspaceteamresponse.go +++ b/pkg/models/shared/workspaceteamresponse.go @@ -9,16 +9,16 @@ type WorkspaceTeamResponse struct { Users []User `json:"users"` } -func (o *WorkspaceTeamResponse) GetSsoMetadata() *SSOMetadata { - if o == nil { +func (w *WorkspaceTeamResponse) GetSsoMetadata() *SSOMetadata { + if w == nil { return nil } - return o.SsoMetadata + return w.SsoMetadata } -func (o *WorkspaceTeamResponse) GetUsers() []User { - if o == nil { +func (w *WorkspaceTeamResponse) GetUsers() []User { + if w == nil { return []User{} } - return o.Users + return w.Users } diff --git a/pkg/models/shared/workspacetoken.go b/pkg/models/shared/workspacetoken.go index 194417ff..9ba0dfc4 100644 --- a/pkg/models/shared/workspacetoken.go +++ b/pkg/models/shared/workspacetoken.go @@ -27,85 +27,85 @@ func (w WorkspaceToken) MarshalJSON() ([]byte, error) { } func (w *WorkspaceToken) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &w, "", false, []string{"alg", "created_at", "id", "key", "name", "workspace_id"}); err != nil { return err } return nil } -func (o *WorkspaceToken) GetAlg() string { - if o == nil { +func (w *WorkspaceToken) GetAlg() string { + if w == nil { return "" } - return o.Alg + return w.Alg } -func (o *WorkspaceToken) GetCreatedAt() time.Time { - if o == nil { +func (w *WorkspaceToken) GetCreatedAt() time.Time { + if w == nil { return time.Time{} } - return o.CreatedAt + return w.CreatedAt } -func (o *WorkspaceToken) GetCreatedBy() *string { - if o == nil { +func (w *WorkspaceToken) GetCreatedBy() *string { + if w == nil { return nil } - return o.CreatedBy + return w.CreatedBy } -func (o *WorkspaceToken) GetCreatedByName() *string { - if o == nil { +func (w *WorkspaceToken) GetCreatedByName() *string { + if w == nil { return nil } - return o.CreatedByName + return w.CreatedByName } -func (o *WorkspaceToken) GetCreatedByPhotoURL() *string { - if o == nil { +func (w *WorkspaceToken) GetCreatedByPhotoURL() *string { + if w == nil { return nil } - return o.CreatedByPhotoURL + return w.CreatedByPhotoURL } -func (o *WorkspaceToken) GetEmail() *string { - if o == nil { +func (w *WorkspaceToken) GetEmail() *string { + if w == nil { return nil } - return o.Email + return w.Email } -func (o *WorkspaceToken) GetID() string { - if o == nil { +func (w *WorkspaceToken) GetID() string { + if w == nil { return "" } - return o.ID + return w.ID } -func (o *WorkspaceToken) GetKey() string { - if o == nil { +func (w *WorkspaceToken) GetKey() string { + if w == nil { return "" } - return o.Key + return w.Key } -func (o *WorkspaceToken) GetLastUsed() *time.Time { - if o == nil { +func (w *WorkspaceToken) GetLastUsed() *time.Time { + if w == nil { return nil } - return o.LastUsed + return w.LastUsed } -func (o *WorkspaceToken) GetName() string { - if o == nil { +func (w *WorkspaceToken) GetName() string { + if w == nil { return "" } - return o.Name + return w.Name } -func (o *WorkspaceToken) GetWorkspaceID() string { - if o == nil { +func (w *WorkspaceToken) GetWorkspaceID() string { + if w == nil { return "" } - return o.WorkspaceID + return w.WorkspaceID } diff --git a/pkg/optionalnullable/optionalnullable.go b/pkg/optionalnullable/optionalnullable.go new file mode 100644 index 00000000..c6739be0 --- /dev/null +++ b/pkg/optionalnullable/optionalnullable.go @@ -0,0 +1,233 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package optionalnullable + +import ( + "bytes" + "encoding/json" + "reflect" +) + +// OptionalNullable represents a field that can distinguish between three states: +// 1. Set to a value: field is present with a non-nil value +// 2. Set to nil: field is present but explicitly set to null in JSON +// 3. Unset: field is omitted from JSON entirely +// +// This type is designed to work with JSON marshaling/unmarshaling and supports +// the `omitempty` struct tag to properly omit unset fields from JSON output. +// +// Usage: +// +// type User struct { +// Name OptionalNullable[string] `json:"name,omitempty"` +// Age OptionalNullable[int] `json:"age,omitempty"` +// Tags OptionalNullable[[]string] `json:"tags,omitempty"` +// } +// +// // Set to value +// name := "John" +// user.Name = From(&name) +// +// // Set to nil (will appear as "name": null in JSON) +// user.Name = From[string](nil) +// +// // Leave unset (will be omitted from JSON with omitempty) +// user := User{} +// +// WARNING: Do NOT use *OptionalNullable[T] as a field type. Always use OptionalNullable[T] directly. +// Using *OptionalNullable[T] will break the omitempty behavior and JSON marshaling. +// +// The type is implemented as a map[bool]*T where: +// - nil map represents unset state +// - Map with true key represents set state (value may be nil) +type OptionalNullable[T any] map[bool]*T + +// From creates a new OptionalNullable with the given value. +// Pass nil to create a OptionalNullable that is set to null. +// Pass a pointer to a value to create a OptionalNullable with that value. +// +// Examples: +// +// hello := "hello" +// From(&hello) // set to "hello" +// From[string](nil) // set to null +func From[T any](value *T) OptionalNullable[T] { + return map[bool]*T{ + true: value, + } +} + +// IsNull returns true if the OptionalNullable is explicitly set to nil. +// Returns false if the OptionalNullable is unset or has a value. +// +// Note: This differs from traditional null checks because unset fields +// return false, not true. Use IsSet() to check if a field was provided. +func (n OptionalNullable[T]) IsNull() bool { + v, ok := n[true] + return ok && v == nil +} + +// IsSet returns true if the OptionalNullable has been explicitly set (to either a value or nil). +// Returns false if the OptionalNullable is unset (omitted from JSON). +// +// This is the key method for distinguishing between: +// - Set to nil: IsSet() = true, IsNull() = true +// - Unset: IsSet() = false, IsNull() = false +func (n OptionalNullable[T]) IsSet() bool { + _, ok := n[true] + return ok +} + +// Get returns the internal pointer and whether the field was set. +// +// Return values: +// - (ptr, true): field was set (ptr may be nil if set to null) +// - (nil, false): field was unset/omitted +// +// This method provides direct access to the internal pointer representation. +func (n OptionalNullable[T]) Get() (*T, bool) { + v, ok := n[true] + return v, ok +} + +// GetOrZero returns the value and whether it was set. +// +// Return values: +// - (value, true): field was set to a non-nil value +// - (zero, true): field was explicitly set to nil +// - (zero, false): field was unset/omitted +// +// Examples: +// +// val, ok := nullable.GetOrZero() +// if !ok { +// // Field was unset/omitted +// } else if nullable.IsNull() { +// // Field was explicitly set to null +// } else { +// // Field has a value: val +// } +func (n OptionalNullable[T]) GetOrZero() (T, bool) { + var zero T + + if v, ok := n[true]; ok { + if v == nil { + return zero, true + } + return *v, true + } + return zero, false +} + +// GetUntyped returns the value as interface{} and whether it was set. +// This is useful for reflection-based code that needs to work with the value +// without knowing the specific type T. +// +// Return values: +// - (value, true): field was set to a non-nil value +// - (nil, true): field was explicitly set to nil +// - (nil, false): field was unset/omitted +func (n OptionalNullable[T]) GetUntyped() (interface{}, bool) { + if v, ok := n[true]; ok { + if v == nil { + return nil, true + } + return *v, true + } + return nil, false +} + +// Set sets the OptionalNullable to the given value pointer. +// Pass nil to set the field to null. +// Pass a pointer to a value to set the field to that value. +// +// Examples: +// +// nullable.Set(ptrFrom("hello")) // set to "hello" +// nullable.Set(nil) // set to null +func (n *OptionalNullable[T]) Set(value *T) { + *n = map[bool]*T{ + true: value, + } +} + +// Unset removes the value, making the field unset/omitted. +// After calling Unset(), IsSet() will return false and the field +// will be omitted from JSON output when using omitempty. +func (n *OptionalNullable[T]) Unset() { + *n = map[bool]*T{} +} + +// MarshalJSON implements json.Marshaler. +// +// Behavior: +// - Unset fields: omitted from JSON when struct field has omitempty tag +// - Null fields: serialized as "null" +// - Value fields: serialized as the actual value +// +// The omitempty behavior works because an empty map is considered +// a zero value by Go's JSON package. +func (n OptionalNullable[T]) MarshalJSON() ([]byte, error) { + if n.IsNull() { + return []byte("null"), nil + } + + return json.Marshal(n[true]) +} + +// UnmarshalJSON implements json.Unmarshaler. +// +// Behavior: +// - "null" in JSON: sets the field to null (IsSet=true, IsNull=true) +// - Any other value: sets the field to that value (IsSet=true, IsNull=false) +// - Missing from JSON: field remains unset (IsSet=false, IsNull=false) +func (n *OptionalNullable[T]) UnmarshalJSON(data []byte) error { + if bytes.Equal(data, []byte("null")) { + n.Set(nil) + return nil + } + var v T + if err := json.Unmarshal(data, &v); err != nil { + return err + } + n.Set(&v) + return nil +} + +// NullableInterface defines the interface that all OptionalNullable[T] types implement. +// This interface provides untyped access to optional nullable values for reflection-based code. +type OptionalNullableInterface interface { + GetUntyped() (interface{}, bool) +} + +// AsOptionalNullable attempts to convert a reflect.Value to a OptionalNullableInterface. +// This is a helper function for reflection-based code that needs to check +// if a value implements the optional nullable interface pattern. +// +// Returns: +// - (nullable, true): if the value implements OptionalNullableInterface +// - (nil, false): if the value does not implement OptionalNullableInterface +// +// Example usage: +// +// if nullable, ok := AsOptionalNullable(reflectValue); ok { +// if value, isSet := nullable.GetUntyped(); isSet { +// // Handle the nullable value +// } +// } +func AsOptionalNullable(v reflect.Value) (OptionalNullableInterface, bool) { + // Check if the value can be converted to an interface first + if !v.CanInterface() { + return nil, false + } + + // Check if the underlying value is a nil map (unset nullable) + if v.Kind() == reflect.Map && v.IsNil() { + return nil, false + } + + if nullable, ok := v.Interface().(OptionalNullableInterface); ok { + return nullable, true + } + return nil, false +} diff --git a/pkg/optionalnullable/optionalnullable_test.go b/pkg/optionalnullable/optionalnullable_test.go new file mode 100644 index 00000000..e6e5a01c --- /dev/null +++ b/pkg/optionalnullable/optionalnullable_test.go @@ -0,0 +1,1806 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package optionalnullable + +import ( + "encoding/json" + "reflect" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// Test helper function to create pointers from values +func ptrFrom[T any](value T) *T { + return &value +} + +// Test helper types for comprehensive testing +type TestStruct struct { + Name string `json:"name"` + Age int `json:"age"` +} + +type TestContainer struct { + StringField OptionalNullable[string] `json:"string_field,omitempty"` + IntField OptionalNullable[int] `json:"int_field,omitempty"` + SliceField OptionalNullable[[]string] `json:"slice_field,omitempty"` + StructField OptionalNullable[TestStruct] `json:"struct_field,omitempty"` +} + +// TestNewNullable tests the From constructor +func TestNewNullable(t *testing.T) { + t.Parallel() + t.Run("with string value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom("test")) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "test", got) + }) + + t.Run("with nil pointer", func(t *testing.T) { + t.Parallel() + nullable := From[string](nil) + + assert.True(t, nullable.IsSet()) + assert.True(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "", got) // zero value for string + }) + + t.Run("with int value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom(42)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, 42, got) + }) + + t.Run("with slice value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom([]string{"a", "b", "c"})) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{"a", "b", "c"}, got) + }) + + t.Run("with empty slice", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom([]string{})) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{}, got) + }) + + t.Run("with struct value", func(t *testing.T) { + t.Parallel() + val := TestStruct{Name: "John", Age: 30} + nullable := From(&val) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + v, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, val, v) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, TestStruct{Name: "John", Age: 30}, got) + }) +} + +// TestNewNullableUnset tests the NewNullableUnset constructor +func TestNewNullableUnset(t *testing.T) { + t.Parallel() + t.Run("string type", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[string] + + assert.False(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) // Unset is not null + + got, ok := nullable.GetOrZero() + assert.False(t, ok) + assert.Equal(t, "", got) // zero value for string + }) + + t.Run("int type", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[int] + + assert.False(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) // Unset is not null + + got, ok := nullable.GetOrZero() + assert.False(t, ok) + assert.Equal(t, 0, got) // zero value for int + }) + + t.Run("slice type", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[[]string] + + assert.False(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) // Unset is not null + + got, ok := nullable.GetOrZero() + assert.False(t, ok) + assert.Nil(t, got) // zero value for slice is nil + }) +} + +// TestIsNull tests the IsNull method +func TestIsNull(t *testing.T) { + t.Parallel() + t.Run("with value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom("test")) + assert.False(t, nullable.IsNull()) + }) + + t.Run("with nil pointer", func(t *testing.T) { + t.Parallel() + nullable := From[string](nil) + assert.True(t, nullable.IsNull()) + }) + + t.Run("unset", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[string] + assert.False(t, nullable.IsNull()) + }) +} + +// TestIsSet tests the IsSet method +func TestIsSet(t *testing.T) { + t.Parallel() + t.Run("with value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom("test")) + assert.True(t, nullable.IsSet()) + }) + + t.Run("with nil pointer", func(t *testing.T) { + t.Parallel() + nullable := From[string](nil) + assert.True(t, nullable.IsSet()) + }) + + t.Run("unset", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[string] + assert.False(t, nullable.IsSet()) + }) +} + +// TestGet tests the Get method +func TestGet(t *testing.T) { + t.Parallel() + t.Run("with string value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom("test")) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "test", got) + }) + + t.Run("with nil pointer", func(t *testing.T) { + t.Parallel() + nullable := From[string](nil) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "", got) // zero value + }) + + t.Run("unset", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[string] + + got, ok := nullable.GetOrZero() + assert.False(t, ok) + assert.Equal(t, "", got) // zero value + }) + + t.Run("with slice value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom([]string{"a", "b"})) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{"a", "b"}, got) + }) + + t.Run("with nil slice pointer", func(t *testing.T) { + t.Parallel() + nullable := From[[]string](nil) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Nil(t, got) // zero value for slice is nil + }) +} + +// TestPointer tests the Pointer method +func TestPointer(t *testing.T) { + t.Parallel() + t.Run("with value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom("test")) + + ptr, ok := nullable.Get() + assert.True(t, ok) + assert.NotNil(t, ptr) + assert.Equal(t, "test", *ptr) + }) + + t.Run("with nil pointer", func(t *testing.T) { + t.Parallel() + nullable := From[string](nil) + + ptr, ok := nullable.Get() + assert.True(t, ok) + assert.Nil(t, ptr) + }) + + t.Run("unset", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[string] + + ptr, ok := nullable.Get() + assert.False(t, ok) + assert.Nil(t, ptr) + }) +} + +// TestSet tests the Set method +func TestSet(t *testing.T) { + t.Parallel() + t.Run("set string value", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[string] + + // Initially unset + assert.False(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) // Unset is not null + + // Set a value + nullable.Set(ptrFrom("test")) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "test", got) + }) + + t.Run("set int value", func(t *testing.T) { + t.Parallel() + nullable := OptionalNullable[int]{} + + nullable.Set(ptrFrom(42)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, 42, got) + }) + + t.Run("set slice value", func(t *testing.T) { + t.Parallel() + nullable := OptionalNullable[[]string]{} + + slice := []string{"a", "b"} + nullable.Set(ptrFrom(slice)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{"a", "b"}, got) + }) + + t.Run("set empty slice", func(t *testing.T) { + t.Parallel() + nullable := OptionalNullable[[]string]{} + + slice := []string{} + nullable.Set(ptrFrom(slice)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{}, got) + }) + + t.Run("overwrite existing value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom("original")) + + // Verify original value + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "original", got) + + // Set new value + nullable.Set(ptrFrom("new")) + + got, ok = nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "new", got) + }) +} + +// TestUnset tests the Unset method +func TestUnset(t *testing.T) { + t.Parallel() + t.Run("unset from value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom("test")) + + // Initially set + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + // Unset + nullable.Unset() + + assert.False(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) // After unset is not null + // Value is now internal to the map implementation + + got, ok := nullable.GetOrZero() + assert.False(t, ok) + assert.Equal(t, "", got) // zero value + }) + + t.Run("unset from nil", func(t *testing.T) { + t.Parallel() + nullable := From[string](nil) + + // Initially set to nil + assert.True(t, nullable.IsSet()) + assert.True(t, nullable.IsNull()) // Set to nil should be null + + // Unset + nullable.Unset() + + assert.False(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) // After unset is not null + }) + + t.Run("unset already unset", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[string] + + // Initially unset + assert.False(t, nullable.IsSet()) + + // Unset again + nullable.Unset() + + assert.False(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) // Empty map is not null + }) +} + +// TestMarshalJSON tests JSON marshaling +func TestMarshalJSON(t *testing.T) { + t.Parallel() + t.Run("marshal string value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom("test")) + + data, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, `"test"`, string(data)) + }) + + t.Run("marshal int value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom(42)) + + data, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, `42`, string(data)) + }) + + t.Run("marshal nil value", func(t *testing.T) { + t.Parallel() + nullable := From[string](nil) + + data, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, `null`, string(data)) + }) + + t.Run("marshal slice value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom([]string{"a", "b", "c"})) + + data, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, `["a","b","c"]`, string(data)) + }) + + t.Run("marshal empty slice", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom([]string{})) + + data, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, `[]`, string(data)) + }) + + t.Run("marshal struct value", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom(TestStruct{Name: "John", Age: 30})) + + data, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, `{"name":"John","age":30}`, string(data)) + }) + + // Note: Unset values are not tested here because the current implementation + // doesn't handle unset fields in marshaling (see TODO in the code) +} + +// TestUnmarshalJSON tests JSON unmarshaling +func TestUnmarshalJSON(t *testing.T) { + t.Parallel() + t.Run("unmarshal string value", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[string] + err := json.Unmarshal([]byte(`"test"`), &nullable) + require.NoError(t, err) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "test", got) + }) + + t.Run("unmarshal int value", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[int] + err := json.Unmarshal([]byte(`42`), &nullable) + require.NoError(t, err) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, 42, got) + }) + + t.Run("unmarshal null value", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[string] + err := json.Unmarshal([]byte(`null`), &nullable) + require.NoError(t, err) + + assert.True(t, nullable.IsSet()) + assert.True(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "", got) // zero value + }) + + t.Run("unmarshal slice value", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[[]string] + err := json.Unmarshal([]byte(`["a","b","c"]`), &nullable) + require.NoError(t, err) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{"a", "b", "c"}, got) + }) + + t.Run("unmarshal empty slice", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[[]string] + err := json.Unmarshal([]byte(`[]`), &nullable) + require.NoError(t, err) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{}, got) + }) + + t.Run("unmarshal struct value", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[TestStruct] + err := json.Unmarshal([]byte(`{"name":"John","age":30}`), &nullable) + require.NoError(t, err) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, TestStruct{Name: "John", Age: 30}, got) + }) + + t.Run("unmarshal invalid JSON", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[string] + err := json.Unmarshal([]byte(`invalid`), &nullable) + assert.Error(t, err) + + // Ensure the nullable remains unset after error + assert.False(t, nullable.IsSet()) + }) + + t.Run("unmarshal invalid JSON for int", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[int] + err := json.Unmarshal([]byte(`"not_a_number"`), &nullable) + assert.Error(t, err) + + // Ensure the nullable remains unset after error + assert.False(t, nullable.IsSet()) + }) + + t.Run("unmarshal malformed JSON", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[TestStruct] + err := json.Unmarshal([]byte(`{invalid json`), &nullable) + assert.Error(t, err) + + // Ensure the nullable remains unset after error + assert.False(t, nullable.IsSet()) + }) +} + +// TestJSONRoundTrip tests marshaling and unmarshaling together +func TestJSONRoundTrip(t *testing.T) { + t.Parallel() + t.Run("string value round trip", func(t *testing.T) { + t.Parallel() + nullable1 := From(ptrFrom("test value")) + + // Marshal + data, err := json.Marshal(nullable1) + require.NoError(t, err) + + // Unmarshal + var nullable2 OptionalNullable[string] + err = json.Unmarshal(data, &nullable2) + require.NoError(t, err) + + // Compare + assert.Equal(t, nullable1.IsSet(), nullable2.IsSet()) + assert.Equal(t, nullable1.IsNull(), nullable2.IsNull()) + + got1, ok1 := nullable1.GetOrZero() + got2, ok2 := nullable2.GetOrZero() + assert.Equal(t, ok1, ok2) + assert.Equal(t, got1, got2) + }) + + t.Run("nil value round trip", func(t *testing.T) { + t.Parallel() + nullable1 := From[string](nil) + + // Marshal + data, err := json.Marshal(nullable1) + require.NoError(t, err) + + // Unmarshal + var nullable2 OptionalNullable[string] + err = json.Unmarshal(data, &nullable2) + require.NoError(t, err) + + // Compare + assert.Equal(t, nullable1.IsSet(), nullable2.IsSet()) + assert.Equal(t, nullable1.IsNull(), nullable2.IsNull()) + + got1, ok1 := nullable1.GetOrZero() + got2, ok2 := nullable2.GetOrZero() + assert.Equal(t, ok1, ok2) + assert.Equal(t, got1, got2) + }) + + t.Run("slice round trip", func(t *testing.T) { + t.Parallel() + nullable1 := From(ptrFrom([]string{"a", "b", "c"})) + + // Marshal + data, err := json.Marshal(nullable1) + require.NoError(t, err) + + // Unmarshal + var nullable2 OptionalNullable[[]string] + err = json.Unmarshal(data, &nullable2) + require.NoError(t, err) + + // Compare + assert.Equal(t, nullable1.IsSet(), nullable2.IsSet()) + assert.Equal(t, nullable1.IsNull(), nullable2.IsNull()) + + got1, ok1 := nullable1.GetOrZero() + got2, ok2 := nullable2.GetOrZero() + assert.Equal(t, ok1, ok2) + assert.Equal(t, got1, got2) + }) +} + +// TestJSONToJSONRoundTrip tests starting with JSON and ensuring we can serialize back to the same JSON +func TestJSONToJSONRoundTrip(t *testing.T) { + t.Parallel() + t.Run("string value JSON round trip", func(t *testing.T) { + t.Parallel() + originalJSON := `"hello world"` + + // Unmarshal from JSON + var nullable OptionalNullable[string] + err := json.Unmarshal([]byte(originalJSON), &nullable) + require.NoError(t, err) + + // Verify state + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "hello world", got) + + // Marshal back to JSON + resultJSON, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, originalJSON, string(resultJSON)) + }) + + t.Run("null value JSON round trip", func(t *testing.T) { + t.Parallel() + originalJSON := `null` + + // Unmarshal from JSON + var nullable OptionalNullable[string] + err := json.Unmarshal([]byte(originalJSON), &nullable) + require.NoError(t, err) + + // Verify state + assert.True(t, nullable.IsSet()) + assert.True(t, nullable.IsNull()) + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "", got) // zero value + + // Marshal back to JSON + resultJSON, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, originalJSON, string(resultJSON)) + }) + + t.Run("int value JSON round trip", func(t *testing.T) { + t.Parallel() + originalJSON := `42` + + // Unmarshal from JSON + var nullable OptionalNullable[int] + err := json.Unmarshal([]byte(originalJSON), &nullable) + require.NoError(t, err) + + // Verify state + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, 42, got) + + // Marshal back to JSON + resultJSON, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, originalJSON, string(resultJSON)) + }) + + t.Run("slice value JSON round trip", func(t *testing.T) { + t.Parallel() + originalJSON := `["a","b","c"]` + + // Unmarshal from JSON + var nullable OptionalNullable[[]string] + err := json.Unmarshal([]byte(originalJSON), &nullable) + require.NoError(t, err) + + // Verify state + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{"a", "b", "c"}, got) + + // Marshal back to JSON + resultJSON, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, originalJSON, string(resultJSON)) + }) + + t.Run("empty slice JSON round trip", func(t *testing.T) { + t.Parallel() + originalJSON := `[]` + + // Unmarshal from JSON + var nullable OptionalNullable[[]string] + err := json.Unmarshal([]byte(originalJSON), &nullable) + require.NoError(t, err) + + // Verify state + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{}, got) + + // Marshal back to JSON + resultJSON, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, originalJSON, string(resultJSON)) + }) + + t.Run("struct value JSON round trip", func(t *testing.T) { + t.Parallel() + originalJSON := `{"name":"Alice","age":25}` + + // Unmarshal from JSON + var nullable OptionalNullable[TestStruct] + err := json.Unmarshal([]byte(originalJSON), &nullable) + require.NoError(t, err) + + // Verify state + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, TestStruct{Name: "Alice", Age: 25}, got) + + // Marshal back to JSON + resultJSON, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, originalJSON, string(resultJSON)) + }) +} + +// TestContainerStates tests comprehensive state detection and serialization with TestContainer +func TestContainerStates(t *testing.T) { + t.Parallel() + t.Run("all fields set to values", func(t *testing.T) { + t.Parallel() + container := TestContainer{ + StringField: From(ptrFrom("hello")), + IntField: From(ptrFrom(42)), + SliceField: From(ptrFrom([]string{"a", "b"})), + StructField: From(ptrFrom(TestStruct{Name: "John", Age: 30})), + } + + // Verify all fields are set and not null + assert.True(t, container.StringField.IsSet()) + assert.False(t, container.StringField.IsNull()) + assert.True(t, container.IntField.IsSet()) + assert.False(t, container.IntField.IsNull()) + assert.True(t, container.SliceField.IsSet()) + assert.False(t, container.SliceField.IsNull()) + assert.True(t, container.StructField.IsSet()) + assert.False(t, container.StructField.IsNull()) + + // Verify values + stringVal, ok := container.StringField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "hello", stringVal) + + intVal, ok := container.IntField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, 42, intVal) + + sliceVal, ok := container.SliceField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{"a", "b"}, sliceVal) + + structVal, ok := container.StructField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, TestStruct{Name: "John", Age: 30}, structVal) + + // Test JSON serialization + data, err := json.Marshal(container) + require.NoError(t, err) + + var result map[string]interface{} + err = json.Unmarshal(data, &result) + require.NoError(t, err) + + assert.Equal(t, "hello", result["string_field"]) + assert.Equal(t, float64(42), result["int_field"]) // JSON numbers are float64 + assert.Equal(t, []interface{}{"a", "b"}, result["slice_field"]) + structResult := result["struct_field"].(map[string]interface{}) + assert.Equal(t, "John", structResult["name"]) + assert.Equal(t, float64(30), structResult["age"]) + }) + + t.Run("all fields set to nil", func(t *testing.T) { + t.Parallel() + container := TestContainer{ + StringField: From[string](nil), + IntField: From[int](nil), + SliceField: From[[]string](nil), + StructField: From[TestStruct](nil), + } + + // Verify all fields are set but null + assert.True(t, container.StringField.IsSet()) + assert.True(t, container.StringField.IsNull()) + assert.True(t, container.IntField.IsSet()) + assert.True(t, container.IntField.IsNull()) + assert.True(t, container.SliceField.IsSet()) + assert.True(t, container.SliceField.IsNull()) + assert.True(t, container.StructField.IsSet()) + assert.True(t, container.StructField.IsNull()) + + // Verify GetOrZero() behavior for nil values + stringVal, ok := container.StringField.GetOrZero() + assert.True(t, ok) // set to nil still returns true + assert.Equal(t, "", stringVal) // zero value + + intVal, ok := container.IntField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, 0, intVal) // zero value + + sliceVal, ok := container.SliceField.GetOrZero() + assert.True(t, ok) + assert.Nil(t, sliceVal) // zero value for slice is nil + + structVal, ok := container.StructField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, TestStruct{}, structVal) // zero value + + // Test JSON serialization - all should be null + data, err := json.Marshal(container) + require.NoError(t, err) + + var result map[string]interface{} + err = json.Unmarshal(data, &result) + require.NoError(t, err) + + assert.Nil(t, result["string_field"]) + assert.Nil(t, result["int_field"]) + assert.Nil(t, result["slice_field"]) + assert.Nil(t, result["struct_field"]) + }) + + t.Run("all fields unset", func(t *testing.T) { + t.Parallel() + container := TestContainer{} + + // Verify all fields are unset + assert.False(t, container.StringField.IsSet()) + assert.False(t, container.StringField.IsNull()) // unset is not null in new implementation + assert.False(t, container.IntField.IsSet()) + assert.False(t, container.IntField.IsNull()) + assert.False(t, container.SliceField.IsSet()) + assert.False(t, container.SliceField.IsNull()) + assert.False(t, container.StructField.IsSet()) + assert.False(t, container.StructField.IsNull()) + + // Verify GetOrZero() behavior for unset values + stringVal, ok := container.StringField.GetOrZero() + assert.False(t, ok) // unset returns false + assert.Equal(t, "", stringVal) // zero value + + intVal, ok := container.IntField.GetOrZero() + assert.False(t, ok) + assert.Equal(t, 0, intVal) // zero value + + sliceVal, ok := container.SliceField.GetOrZero() + assert.False(t, ok) + assert.Nil(t, sliceVal) // zero value + + structVal, ok := container.StructField.GetOrZero() + assert.False(t, ok) + assert.Equal(t, TestStruct{}, structVal) // zero value + + // Test JSON serialization - unset fields should be omitted due to omitempty + data, err := json.Marshal(container) + require.NoError(t, err) + + var result map[string]interface{} + err = json.Unmarshal(data, &result) + require.NoError(t, err) + + // With omitempty, unset fields should not appear in JSON + assert.NotContains(t, result, "string_field") + assert.NotContains(t, result, "int_field") + assert.NotContains(t, result, "slice_field") + assert.NotContains(t, result, "struct_field") + }) + + t.Run("slice field states: nil vs unset vs empty vs set", func(t *testing.T) { + t.Parallel() + // Test all possible slice states + nilSlice := TestContainer{ + SliceField: From[[]string](nil), // explicitly set to nil + } + unsetSlice := TestContainer{} // unset + emptySlice := TestContainer{ + SliceField: From(ptrFrom([]string{})), // empty slice + } + setSlice := TestContainer{ + SliceField: From(ptrFrom([]string{"a", "b"})), // slice with values + } + + // Verify nil slice + assert.True(t, nilSlice.SliceField.IsSet()) + assert.True(t, nilSlice.SliceField.IsNull()) + val, ok := nilSlice.SliceField.GetOrZero() + assert.True(t, ok) + assert.Nil(t, val) + + // Verify unset slice + assert.False(t, unsetSlice.SliceField.IsSet()) + assert.False(t, unsetSlice.SliceField.IsNull()) // Unset is not null + val, ok = unsetSlice.SliceField.GetOrZero() + assert.False(t, ok) + assert.Nil(t, val) + + // Verify empty slice + assert.True(t, emptySlice.SliceField.IsSet()) + assert.False(t, emptySlice.SliceField.IsNull()) + val, ok = emptySlice.SliceField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{}, val) + + // Verify set slice + assert.True(t, setSlice.SliceField.IsSet()) + assert.False(t, setSlice.SliceField.IsNull()) + val, ok = setSlice.SliceField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, []string{"a", "b"}, val) + + // Test JSON serialization for each state + nilData, err := json.Marshal(nilSlice) + require.NoError(t, err) + assert.Contains(t, string(nilData), `"slice_field":null`) + + unsetData, err := json.Marshal(unsetSlice) + require.NoError(t, err) + assert.NotContains(t, string(unsetData), "slice_field") // omitted due to omitempty + + emptyData, err := json.Marshal(emptySlice) + require.NoError(t, err) + assert.Contains(t, string(emptyData), `"slice_field":[]`) + + setData, err := json.Marshal(setSlice) + require.NoError(t, err) + assert.Contains(t, string(setData), `"slice_field":["a","b"]`) + }) + + t.Run("mixed states container", func(t *testing.T) { + t.Parallel() + container := TestContainer{ + StringField: From(ptrFrom("hello")), // set to value + IntField: From[int](nil), // set to nil + StructField: From(ptrFrom(TestStruct{Name: "Alice", Age: 25})), // set to value + } + + // Verify states + assert.True(t, container.StringField.IsSet()) + assert.False(t, container.StringField.IsNull()) + + assert.True(t, container.IntField.IsSet()) + assert.True(t, container.IntField.IsNull()) + + assert.False(t, container.SliceField.IsSet()) + assert.False(t, container.SliceField.IsNull()) // Unset is not null + + assert.True(t, container.StructField.IsSet()) + assert.False(t, container.StructField.IsNull()) + + // Test JSON serialization + data, err := json.Marshal(container) + require.NoError(t, err) + + var result map[string]interface{} + err = json.Unmarshal(data, &result) + require.NoError(t, err) + + assert.Equal(t, "hello", result["string_field"]) + assert.Nil(t, result["int_field"]) + assert.NotContains(t, result, "slice_field") // unset, so omitted + structResult := result["struct_field"].(map[string]interface{}) + assert.Equal(t, "Alice", structResult["name"]) + assert.Equal(t, float64(25), structResult["age"]) + }) + + t.Run("JSON unmarshaling preserves states", func(t *testing.T) { + t.Parallel() + // JSON with some fields missing, some null, some with values + jsonData := `{ + "string_field": "test", + "int_field": null, + "struct_field": {"name": "Bob", "age": 35} + }` + + var container TestContainer + err := json.Unmarshal([]byte(jsonData), &container) + require.NoError(t, err) + + // string_field: present with value + assert.True(t, container.StringField.IsSet()) + assert.False(t, container.StringField.IsNull()) + stringVal, ok := container.StringField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "test", stringVal) + + // int_field: present but null + assert.True(t, container.IntField.IsSet()) + assert.True(t, container.IntField.IsNull()) + intVal, ok := container.IntField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, 0, intVal) // zero value + + // slice_field: missing from JSON, should remain unset + assert.False(t, container.SliceField.IsSet()) + assert.False(t, container.SliceField.IsNull()) // Unset is not null + sliceVal, ok := container.SliceField.GetOrZero() + assert.False(t, ok) + assert.Nil(t, sliceVal) + + // struct_field: present with value + assert.True(t, container.StructField.IsSet()) + assert.False(t, container.StructField.IsNull()) + structVal, ok := container.StructField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, TestStruct{Name: "Bob", Age: 35}, structVal) + }) +} + +// TestNilVsUnsetDistinction tests the key feature of distinguishing nil from unset +func TestNilVsUnsetDistinction(t *testing.T) { + t.Parallel() + t.Run("explicit nil vs unset", func(t *testing.T) { + t.Parallel() + // Explicitly set to nil + explicitNil := From[string](nil) + + // Unset + var unset OptionalNullable[string] + + // Both are null, but only one is set + assert.True(t, explicitNil.IsNull()) + assert.True(t, explicitNil.IsSet()) + + assert.False(t, unset.IsNull()) // Unset is not null + assert.False(t, unset.IsSet()) + + // Get behavior differs + got1, ok1 := explicitNil.GetOrZero() + got2, ok2 := unset.GetOrZero() + + assert.True(t, ok1) // explicitly set to nil returns true + assert.False(t, ok2) // unset returns false + assert.Equal(t, "", got1) // both return zero value + assert.Equal(t, "", got2) + + // Get behavior differs + ptr1, ok1 := explicitNil.Get() + ptr2, ok2 := unset.Get() + + assert.True(t, ok1) // explicitly set to nil returns true + assert.False(t, ok2) // unset returns false + assert.Nil(t, ptr1) // both return nil pointer + assert.Nil(t, ptr2) + }) + + t.Run("empty slice vs nil slice vs unset", func(t *testing.T) { + t.Parallel() + // Empty slice + emptyNullable := From(ptrFrom([]string{})) + + // Nil slice + nilNullable := From[[]string](nil) + + // Unset + var unsetNullable OptionalNullable[[]string] + + // All have different characteristics + assert.True(t, emptyNullable.IsSet()) + assert.False(t, emptyNullable.IsNull()) + + assert.True(t, nilNullable.IsSet()) + assert.True(t, nilNullable.IsNull()) + + assert.False(t, unsetNullable.IsSet()) + assert.False(t, unsetNullable.IsNull()) // Unset is not null + + // Get behavior + got1, ok1 := emptyNullable.GetOrZero() + got2, ok2 := nilNullable.GetOrZero() + got3, ok3 := unsetNullable.GetOrZero() + + assert.True(t, ok1) + assert.Equal(t, []string{}, got1) + + assert.True(t, ok2) + assert.Nil(t, got2) + + assert.False(t, ok3) + assert.Nil(t, got3) + }) +} + +// TestJSONOmitEmpty tests behavior with omitempty tag +func TestJSONOmitEmpty(t *testing.T) { + t.Parallel() + t.Run("marshal with omitempty", func(t *testing.T) { + t.Parallel() + // Test container with various nullable states + container := TestContainer{ + StringField: From(ptrFrom("test")), + IntField: From(ptrFrom(42)), + StructField: From[TestStruct](nil), // explicitly nil + } + + data, err := json.Marshal(container) + require.NoError(t, err) + + // Parse back to verify structure + var result map[string]interface{} + err = json.Unmarshal(data, &result) + require.NoError(t, err) + + // Should contain set fields + assert.Contains(t, result, "string_field") + assert.Contains(t, result, "int_field") + assert.Contains(t, result, "struct_field") + + // Should not contain unset field (due to omitempty) + // Note: This depends on how the marshaling handles unset fields + // The current implementation doesn't handle this case properly (see TODO) + }) + + t.Run("unmarshal missing fields", func(t *testing.T) { + t.Parallel() + // JSON with some fields missing + jsonData := `{"string_field": "test", "int_field": null}` + + var container TestContainer + err := json.Unmarshal([]byte(jsonData), &container) + require.NoError(t, err) + + // Present fields should be set + assert.True(t, container.StringField.IsSet()) + assert.False(t, container.StringField.IsNull()) + got, ok := container.StringField.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "test", got) + + // Null field should be set to nil + assert.True(t, container.IntField.IsSet()) + assert.True(t, container.IntField.IsNull()) + + // Missing fields should remain unset + assert.False(t, container.SliceField.IsSet()) + assert.False(t, container.StructField.IsSet()) + }) +} + +// TestEdgeCases tests various edge cases +func TestEdgeCases(t *testing.T) { + t.Parallel() + t.Run("zero values", func(t *testing.T) { + t.Parallel() + // Test with zero values that are not nil + intNullable := From(ptrFrom(0)) + stringNullable := From(ptrFrom("")) + + assert.True(t, intNullable.IsSet()) + assert.False(t, intNullable.IsNull()) + got, ok := intNullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, 0, got) + + assert.True(t, stringNullable.IsSet()) + assert.False(t, stringNullable.IsNull()) + got2, ok2 := stringNullable.GetOrZero() + assert.True(t, ok2) + assert.Equal(t, "", got2) + }) + + t.Run("pointer to pointer", func(t *testing.T) { + t.Parallel() + // Test with pointer to pointer type + inner := "test" + nullable := From(ptrFrom(&inner)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, &inner, got) + assert.Equal(t, "test", *got) + }) + + t.Run("complex struct", func(t *testing.T) { + t.Parallel() + complexStruct := struct { + Name string + Values []int + Metadata map[string]string + }{ + Name: "complex", + Values: []int{1, 2, 3}, + Metadata: map[string]string{ + "key1": "value1", + "key2": "value2", + }, + } + + nullable := From(ptrFrom(complexStruct)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, complexStruct, got) + }) +} + +// TestDoublePointers tests comprehensive double pointer scenarios +func TestDoublePointers(t *testing.T) { + t.Parallel() + + t.Run("string double pointer with value", func(t *testing.T) { + t.Parallel() + inner := "hello world" + ptr := &inner + nullable := From(ptrFrom(ptr)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, ptr, got) + assert.Equal(t, &inner, got) + assert.Equal(t, "hello world", *got) + }) + + t.Run("int double pointer with value", func(t *testing.T) { + t.Parallel() + inner := 42 + ptr := &inner + nullable := From(ptrFrom(ptr)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, ptr, got) + assert.Equal(t, &inner, got) + assert.Equal(t, 42, *got) + }) + + t.Run("double pointer to nil", func(t *testing.T) { + t.Parallel() + var ptr *string = nil + nullable := From(ptrFrom(ptr)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, ptr, got) + assert.Nil(t, got) + }) + + t.Run("nil double pointer", func(t *testing.T) { + t.Parallel() + nullable := From[*string](nil) + + assert.True(t, nullable.IsSet()) + assert.True(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Nil(t, got) // zero value for **string is nil + }) + + t.Run("unset double pointer", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[*string] + + assert.False(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.False(t, ok) + assert.Nil(t, got) // zero value for **string is nil + }) + + t.Run("double pointer modification", func(t *testing.T) { + t.Parallel() + inner := "original" + ptr := &inner + nullable := From(ptrFrom(ptr)) + + // Verify original value + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "original", *got) + + // Modify through double pointer + *got = "modified" + assert.Equal(t, "modified", inner) + assert.Equal(t, "modified", *got) + }) + + t.Run("double pointer to struct", func(t *testing.T) { + t.Parallel() + inner := TestStruct{Name: "Alice", Age: 30} + ptr := &inner + nullable := From(ptrFrom(ptr)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, ptr, got) + assert.Equal(t, TestStruct{Name: "Alice", Age: 30}, *got) + + // Modify through double pointer + (*got).Name = "Bob" + assert.Equal(t, "Bob", inner.Name) + assert.Equal(t, "Bob", (*got).Name) + }) + + t.Run("double pointer to slice", func(t *testing.T) { + t.Parallel() + inner := []string{"a", "b", "c"} + ptr := &inner + nullable := From(ptrFrom(ptr)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, ptr, got) + assert.Equal(t, []string{"a", "b", "c"}, *got) + + // Modify through double pointer + *got = append(*got, "d") + assert.Equal(t, []string{"a", "b", "c", "d"}, inner) + assert.Equal(t, []string{"a", "b", "c", "d"}, *got) + }) + + t.Run("double pointer to empty slice", func(t *testing.T) { + t.Parallel() + inner := []string{} + ptr := &inner + nullable := From(ptrFrom(ptr)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, ptr, got) + assert.Equal(t, []string{}, *got) + }) + + t.Run("double pointer to nil slice", func(t *testing.T) { + t.Parallel() + var inner []string = nil + ptr := &inner + nullable := From(ptrFrom(ptr)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, ptr, got) + assert.Nil(t, *got) + }) + + t.Run("double pointer JSON marshaling", func(t *testing.T) { + t.Parallel() + inner := "json test" + ptr := &inner + nullable := From(ptrFrom(ptr)) + + data, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, `"json test"`, string(data)) + }) + + t.Run("double pointer JSON unmarshaling", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[*string] + err := json.Unmarshal([]byte(`"json test"`), &nullable) + require.NoError(t, err) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.NotNil(t, got) + assert.Equal(t, "json test", *got) + }) + + t.Run("double pointer JSON null marshaling", func(t *testing.T) { + t.Parallel() + nullable := From[*string](nil) + + data, err := json.Marshal(nullable) + require.NoError(t, err) + assert.Equal(t, `null`, string(data)) + }) + + t.Run("double pointer JSON null unmarshaling", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[*string] + err := json.Unmarshal([]byte(`null`), &nullable) + require.NoError(t, err) + + assert.True(t, nullable.IsSet()) + assert.True(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Nil(t, got) + }) + + t.Run("double pointer round trip", func(t *testing.T) { + t.Parallel() + inner := "round trip test" + ptr := &inner + nullable1 := From(ptrFrom(ptr)) + + // Marshal + data, err := json.Marshal(nullable1) + require.NoError(t, err) + + // Unmarshal + var nullable2 OptionalNullable[*string] + err = json.Unmarshal(data, &nullable2) + require.NoError(t, err) + + // Compare states + assert.Equal(t, nullable1.IsSet(), nullable2.IsSet()) + assert.Equal(t, nullable1.IsNull(), nullable2.IsNull()) + + got1, ok1 := nullable1.GetOrZero() + got2, ok2 := nullable2.GetOrZero() + assert.Equal(t, ok1, ok2) + + // Values should be equal + assert.Equal(t, *got1, *got2) + }) + + t.Run("triple pointer", func(t *testing.T) { + t.Parallel() + inner := "triple" + ptr1 := &inner + ptr2 := &ptr1 + nullable := From(ptrFrom(ptr2)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, ptr2, got) + assert.Equal(t, ptr1, *got) + assert.Equal(t, "triple", **got) + }) + + t.Run("double pointer set and unset", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[*string] + + // Initially unset + assert.False(t, nullable.IsSet()) + + // Set to double pointer + inner := "set test" + ptr := &inner + nullable.Set(ptrFrom(ptr)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "set test", *got) + + // Set to nil + nullable.Set(nil) + + assert.True(t, nullable.IsSet()) + assert.True(t, nullable.IsNull()) + + got, ok = nullable.GetOrZero() + assert.True(t, ok) + assert.Nil(t, got) + + // Unset + nullable.Unset() + + assert.False(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok = nullable.GetOrZero() + assert.False(t, ok) + assert.Nil(t, got) + }) + + t.Run("double pointer Get method", func(t *testing.T) { + t.Parallel() + inner := "get test" + ptr := &inner + nullable := From(ptrFrom(ptr)) + + // Test Get method + gotPtr, ok := nullable.Get() + assert.True(t, ok) + assert.NotNil(t, gotPtr) + assert.Equal(t, ptr, *gotPtr) + assert.Equal(t, "get test", **gotPtr) + + // Test with nil + nilNullable := From[*string](nil) + gotPtr, ok = nilNullable.Get() + assert.True(t, ok) + assert.Nil(t, gotPtr) + + // Test with unset + var unsetNullable OptionalNullable[*string] + gotPtr, ok = unsetNullable.Get() + assert.False(t, ok) + assert.Nil(t, gotPtr) + }) + + t.Run("double pointer zero values", func(t *testing.T) { + t.Parallel() + // Test with zero value string + inner := "" + ptr := &inner + nullable := From(ptrFrom(ptr)) + + assert.True(t, nullable.IsSet()) + assert.False(t, nullable.IsNull()) + + got, ok := nullable.GetOrZero() + assert.True(t, ok) + assert.Equal(t, "", *got) + + // Test with zero value int + innerInt := 0 + ptrInt := &innerInt + nullableInt := From(ptrFrom(ptrInt)) + + assert.True(t, nullableInt.IsSet()) + assert.False(t, nullableInt.IsNull()) + + gotInt, okInt := nullableInt.GetOrZero() + assert.True(t, okInt) + assert.Equal(t, 0, *gotInt) + }) +} + +// TestAsOptionalNullable tests the AsOptionalNullable helper function +func TestAsOptionalNullable(t *testing.T) { + t.Parallel() + + t.Run("with nullable string", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom("test")) + reflectValue := reflect.ValueOf(nullable) + + result, ok := AsOptionalNullable(reflectValue) + assert.True(t, ok) + assert.NotNil(t, result) + + value, isSet := result.GetUntyped() + assert.True(t, isSet) + assert.Equal(t, "test", value) + }) + + t.Run("with nullable int", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom(42)) + reflectValue := reflect.ValueOf(nullable) + + result, ok := AsOptionalNullable(reflectValue) + assert.True(t, ok) + assert.NotNil(t, result) + + value, isSet := result.GetUntyped() + assert.True(t, isSet) + assert.Equal(t, 42, value) + }) + + t.Run("with nullable nil", func(t *testing.T) { + t.Parallel() + nullable := From[string](nil) + reflectValue := reflect.ValueOf(nullable) + + result, ok := AsOptionalNullable(reflectValue) + assert.True(t, ok) + assert.NotNil(t, result) + + value, isSet := result.GetUntyped() + assert.True(t, isSet) + assert.Nil(t, value) + }) + + t.Run("with unset nullable", func(t *testing.T) { + t.Parallel() + var nullable OptionalNullable[string] + reflectValue := reflect.ValueOf(nullable) + + result, ok := AsOptionalNullable(reflectValue) + assert.False(t, ok) + assert.Nil(t, result) + }) + + t.Run("with non-nullable string", func(t *testing.T) { + t.Parallel() + regularString := "not nullable" + reflectValue := reflect.ValueOf(regularString) + + result, ok := AsOptionalNullable(reflectValue) + assert.False(t, ok) + assert.Nil(t, result) + }) + + t.Run("with non-nullable int", func(t *testing.T) { + t.Parallel() + regularInt := 42 + reflectValue := reflect.ValueOf(regularInt) + + result, ok := AsOptionalNullable(reflectValue) + assert.False(t, ok) + assert.Nil(t, result) + }) + + t.Run("with non-nullable map", func(t *testing.T) { + t.Parallel() + regularMap := map[string]int{"key": 42} + reflectValue := reflect.ValueOf(regularMap) + + result, ok := AsOptionalNullable(reflectValue) + assert.False(t, ok) + assert.Nil(t, result) + }) + + t.Run("with non-nullable struct", func(t *testing.T) { + t.Parallel() + regularStruct := TestStruct{Name: "test", Age: 30} + reflectValue := reflect.ValueOf(regularStruct) + + result, ok := AsOptionalNullable(reflectValue) + assert.False(t, ok) + assert.Nil(t, result) + }) + + t.Run("with nullable double pointer", func(t *testing.T) { + t.Parallel() + inner := "test" + ptr := &inner + nullable := From(ptrFrom(ptr)) + reflectValue := reflect.ValueOf(nullable) + + result, ok := AsOptionalNullable(reflectValue) + assert.True(t, ok) + assert.NotNil(t, result) + + value, isSet := result.GetUntyped() + assert.True(t, isSet) + assert.Equal(t, ptr, value) + assert.Equal(t, "test", *value.(*string)) + }) + + t.Run("with nullable slice", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom([]string{"a", "b", "c"})) + reflectValue := reflect.ValueOf(nullable) + + result, ok := AsOptionalNullable(reflectValue) + assert.True(t, ok) + assert.NotNil(t, result) + + value, isSet := result.GetUntyped() + assert.True(t, isSet) + assert.Equal(t, []string{"a", "b", "c"}, value) + }) + + t.Run("with nullable struct", func(t *testing.T) { + t.Parallel() + testStruct := TestStruct{Name: "Alice", Age: 25} + nullable := From(ptrFrom(testStruct)) + reflectValue := reflect.ValueOf(nullable) + + result, ok := AsOptionalNullable(reflectValue) + assert.True(t, ok) + assert.NotNil(t, result) + + value, isSet := result.GetUntyped() + assert.True(t, isSet) + assert.Equal(t, testStruct, value) + }) + + t.Run("with pointer to nullable", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom("test")) + ptrToNullable := &nullable + reflectValue := reflect.ValueOf(ptrToNullable) + + // This should work since the pointer to nullable still contains a nullable + result, ok := AsOptionalNullable(reflectValue) + assert.True(t, ok) + assert.NotNil(t, result) + + value, isSet := result.GetUntyped() + assert.True(t, isSet) + assert.Equal(t, "test", value) + }) + + t.Run("with interface containing nullable", func(t *testing.T) { + t.Parallel() + nullable := From(ptrFrom("test")) + var iface interface{} = nullable + reflectValue := reflect.ValueOf(iface) + + result, ok := AsOptionalNullable(reflectValue) + assert.True(t, ok) + assert.NotNil(t, result) + + value, isSet := result.GetUntyped() + assert.True(t, isSet) + assert.Equal(t, "test", value) + }) +} diff --git a/pkg/types/decimal.go b/pkg/types/decimal.go deleted file mode 100644 index d8429bc6..00000000 --- a/pkg/types/decimal.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package types - -import ( - "fmt" - - "github.com/ericlagergren/decimal" -) - -// MustNewDecimalFromString returns an instance of Decimal from a string -// Avoid using this function in production code. -func MustNewDecimalFromString(s string) *decimal.Big { - d, ok := new(decimal.Big).SetString(s) - if !ok { - panic(fmt.Errorf("failed to parse string as decimal.Big")) - } - - return d -} diff --git a/pkg/utils/form.go b/pkg/utils/form.go index b0121c69..650eee1b 100644 --- a/pkg/utils/form.go +++ b/pkg/utils/form.go @@ -10,8 +10,7 @@ import ( "strings" "time" - "github.com/ericlagergren/decimal" - + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/optionalnullable" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" ) @@ -41,8 +40,6 @@ func populateForm(paramName string, explode bool, objType reflect.Type, objValue formValues.Add(paramName, valToString(objValue.Interface())) case big.Int: formValues.Add(paramName, valToString(objValue.Interface())) - case decimal.Big: - formValues.Add(paramName, valToString(objValue.Interface())) default: var items []string @@ -64,7 +61,13 @@ func populateForm(paramName string, explode bool, objType reflect.Type, objValue } if explode { - formValues.Add(fieldName, valToString(valType.Interface())) + if valType.Kind() == reflect.Slice || valType.Kind() == reflect.Array { + for i := 0; i < valType.Len(); i++ { + formValues.Add(fieldName, valToString(valType.Index(i).Interface())) + } + } else { + formValues.Add(fieldName, valToString(valType.Interface())) + } } else { items = append(items, fmt.Sprintf("%s%s%s", fieldName, delimiter, valToString(valType.Interface()))) } @@ -75,6 +78,16 @@ func populateForm(paramName string, explode bool, objType reflect.Type, objValue } } case reflect.Map: + // check if optionalnullable.OptionalNullable[T] + if nullableValue, ok := optionalnullable.AsOptionalNullable(objValue); ok { + // Handle optionalnullable.OptionalNullable[T] using GetUntyped method + if value, isSet := nullableValue.GetUntyped(); isSet && value != nil { + formValues.Add(paramName, valToString(value)) + } + // If not set or explicitly null, skip adding to form + return formValues + } + items := []string{} iter := objValue.MapRange() diff --git a/pkg/utils/headers.go b/pkg/utils/headers.go index a07608bd..b231e0d1 100644 --- a/pkg/utils/headers.go +++ b/pkg/utils/headers.go @@ -8,6 +8,8 @@ import ( "net/http" "reflect" "strings" + + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/optionalnullable" ) func PopulateHeaders(_ context.Context, req *http.Request, headers interface{}, globals interface{}) { @@ -98,6 +100,16 @@ func serializeHeader(objType reflect.Type, objValue reflect.Value, explode bool) return strings.Join(items, ",") case reflect.Map: + // check if optionalnullable.OptionalNullable[T] + if nullableValue, ok := optionalnullable.AsOptionalNullable(objValue); ok { + // Handle optionalnullable.OptionalNullable[T] using GetUntyped method + if value, isSet := nullableValue.GetUntyped(); isSet && value != nil { + return valToString(value) + } + // If not set or explicitly null, return empty string + return "" + } + items := []string{} iter := objValue.MapRange() diff --git a/pkg/utils/json.go b/pkg/utils/json.go index 6924a3c8..929313ff 100644 --- a/pkg/utils/json.go +++ b/pkg/utils/json.go @@ -5,6 +5,7 @@ package utils import ( "bytes" "encoding/json" + "errors" "fmt" "math/big" "reflect" @@ -14,8 +15,6 @@ import ( "unsafe" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" - - "github.com/ericlagergren/decimal" ) func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, error) { @@ -40,21 +39,30 @@ func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, e fieldName := field.Name omitEmpty := false + omitZero := false jsonTag := field.Tag.Get("json") if jsonTag != "" { for _, tag := range strings.Split(jsonTag, ",") { if tag == "omitempty" { omitEmpty = true + } else if tag == "omitzero" { + omitZero = true } else { fieldName = tag } } } - if isNil(field.Type, fieldVal) && field.Tag.Get("const") == "" { - if omitEmpty { + if (omitEmpty || omitZero) && field.Tag.Get("const") == "" { + // Both omitempty and omitzero skip zero values (including nil) + if isNil(field.Type, fieldVal) { + continue + } + + if omitZero && fieldVal.IsZero() { continue } + } if !field.IsExported() && field.Tag.Get("const") == "" { @@ -114,9 +122,9 @@ func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, e } } -func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool, disallowUnknownFields bool) error { +func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool, requiredFields []string) error { if reflect.TypeOf(v).Kind() != reflect.Ptr { - return fmt.Errorf("v must be a pointer") + return errors.New("v must be a pointer") } typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) @@ -124,19 +132,25 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool switch { case isModelType(typ): if topLevel || bytes.Equal(b, []byte("null")) { - d := json.NewDecoder(bytes.NewReader(b)) - if disallowUnknownFields { - d.DisallowUnknownFields() - } - return d.Decode(v) + return json.Unmarshal(b, v) } - var unmarhsaled map[string]json.RawMessage + var unmarshaled map[string]json.RawMessage - if err := json.Unmarshal(b, &unmarhsaled); err != nil { + if err := json.Unmarshal(b, &unmarshaled); err != nil { return err } + missingFields := []string{} + for _, requiredField := range requiredFields { + if _, ok := unmarshaled[requiredField]; !ok { + missingFields = append(missingFields, requiredField) + } + } + if len(missingFields) > 0 { + return fmt.Errorf("missing required fields: %s", strings.Join(missingFields, ", ")) + } + var additionalPropertiesField *reflect.StructField var additionalPropertiesValue *reflect.Value @@ -149,7 +163,7 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool jsonTag := field.Tag.Get("json") if jsonTag != "" { for _, tag := range strings.Split(jsonTag, ",") { - if tag != "omitempty" { + if tag != "omitempty" && tag != "omitzero" { fieldName = tag } } @@ -163,7 +177,7 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool // If we receive a value for a const field ignore it but mark it as unmarshaled if field.Tag.Get("const") != "" { - if r, ok := unmarhsaled[fieldName]; ok { + if r, ok := unmarshaled[fieldName]; ok { val := string(r) if strings.HasPrefix(val, `"`) && strings.HasSuffix(val, `"`) { @@ -178,13 +192,13 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool return fmt.Errorf("const field `%s` does not match expected value `%s` got `%s`", fieldName, constValue, val) } - delete(unmarhsaled, fieldName) + delete(unmarshaled, fieldName) } } else if !field.IsExported() { continue } - value, ok := unmarhsaled[fieldName] + value, ok := unmarshaled[fieldName] if !ok { defaultTag, defaultOk := field.Tag.Lookup("default") if defaultOk { @@ -192,26 +206,22 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool ok = true } } else { - delete(unmarhsaled, fieldName) + delete(unmarshaled, fieldName) } if ok { - if err := unmarshalValue(value, fieldVal, field.Tag, disallowUnknownFields); err != nil { + if err := unmarshalValue(value, fieldVal, field.Tag); err != nil { return err } } } - keys := make([]string, 0, len(unmarhsaled)) - for k := range unmarhsaled { + keys := make([]string, 0, len(unmarshaled)) + for k := range unmarshaled { keys = append(keys, k) } if len(keys) > 0 { - if disallowUnknownFields && (additionalPropertiesField == nil || additionalPropertiesValue == nil) { - return fmt.Errorf("unknown fields: %v", keys) - } - if additionalPropertiesField != nil && additionalPropertiesValue != nil { typeOfMap := additionalPropertiesField.Type if additionalPropertiesValue.Type().Kind() == reflect.Interface { @@ -222,10 +232,10 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool mapValue := reflect.MakeMap(typeOfMap) - for key, value := range unmarhsaled { + for key, value := range unmarshaled { val := reflect.New(typeOfMap.Elem()) - if err := unmarshalValue(value, val, additionalPropertiesField.Tag, disallowUnknownFields); err != nil { + if err := unmarshalValue(value, val, additionalPropertiesField.Tag); err != nil { return err } @@ -244,7 +254,7 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool } } default: - return unmarshalValue(b, reflect.ValueOf(v), tag, disallowUnknownFields) + return unmarshalValue(b, reflect.ValueOf(v), tag) } return nil @@ -284,6 +294,11 @@ func marshalValue(v interface{}, tag reflect.StructTag) (json.RawMessage, error) return []byte("null"), nil } + // Check if the map implements json.Marshaler (like optionalnullable.OptionalNullable[T]) + if marshaler, ok := val.Interface().(json.Marshaler); ok { + return marshaler.MarshalJSON() + } + out := map[string]json.RawMessage{} for _, key := range val.MapKeys() { @@ -337,17 +352,6 @@ func marshalValue(v interface{}, tag reflect.StructTag) (json.RawMessage, error) b := val.Interface().(big.Int) return []byte(fmt.Sprintf(`"%s"`, (&b).String())), nil } - case reflect.TypeOf(decimal.Big{}): - format := tag.Get("decimal") - if format == "number" { - b := val.Interface().(decimal.Big) - f, ok := (&b).Float64() - if ok { - return []byte(b.String()), nil - } - - return []byte(fmt.Sprintf(`%f`, f)), nil - } } } @@ -378,11 +382,6 @@ func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.Struc if format == "string" { return []byte(fmt.Sprintf(`"%s"`, tagValue)) } - case reflect.TypeOf(decimal.Big{}): - decimalTag := tag.Get("decimal") - if decimalTag != "number" { - return []byte(fmt.Sprintf(`"%s"`, tagValue)) - } case reflect.TypeOf(types.Date{}): return []byte(fmt.Sprintf(`"%s"`, tagValue)) default: @@ -394,7 +393,7 @@ func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.Struc return []byte(tagValue) } -func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTag, disallowUnknownFields bool) error { +func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTag) error { if bytes.Equal(value, []byte("null")) { if v.CanAddr() { return json.Unmarshal(value, v.Addr().Interface()) @@ -466,18 +465,18 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa } } - var unmarhsaled map[string]json.RawMessage + var unmarshaled map[string]json.RawMessage - if err := json.Unmarshal(value, &unmarhsaled); err != nil { + if err := json.Unmarshal(value, &unmarshaled); err != nil { return err } m := reflect.MakeMap(typ) - for k, value := range unmarhsaled { + for k, value := range unmarshaled { itemVal := reflect.New(typ.Elem()) - if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { + if err := unmarshalValue(value, itemVal, tag); err != nil { return err } @@ -498,7 +497,7 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa for index, value := range unmarshaled { itemVal := reflect.New(typ.Elem()) - if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { + if err := unmarshalValue(value, itemVal, tag); err != nil { return err } @@ -563,27 +562,6 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa v.Set(reflect.ValueOf(b)) return nil - case reflect.TypeOf(decimal.Big{}): - var d *decimal.Big - format := tag.Get("decimal") - if format == "number" { - var ok bool - d, ok = new(decimal.Big).SetString(string(value)) - if !ok { - return fmt.Errorf("failed to parse number as decimal.Big") - } - } else { - if err := json.Unmarshal(value, &d); err != nil { - return err - } - } - - if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Ptr { - v = v.Elem() - } - - v.Set(reflect.ValueOf(d)) - return nil case reflect.TypeOf(types.Date{}): var s string @@ -616,11 +594,7 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa val = v.Interface() } - d := json.NewDecoder(bytes.NewReader(value)) - if disallowUnknownFields { - d.DisallowUnknownFields() - } - return d.Decode(val) + return json.Unmarshal(value, val) } func dereferencePointers(typ reflect.Type, val reflect.Value) (reflect.Type, reflect.Value) { @@ -652,8 +626,6 @@ func isComplexValueType(typ reflect.Type) bool { fallthrough case reflect.TypeOf(big.Int{}): fallthrough - case reflect.TypeOf(decimal.Big{}): - fallthrough case reflect.TypeOf(types.Date{}): return true } @@ -673,3 +645,215 @@ func isModelType(typ reflect.Type) bool { return false } + +// CalculateJSONSize returns the byte size of the JSON representation of a value. +// This is used to determine which union type variant has the most data. +func CalculateJSONSize(v interface{}) int { + data, err := json.Marshal(v) + if err != nil { + return 0 + } + return len(data) +} + +// UnionCandidate represents a candidate type during union deserialization +type UnionCandidate struct { + FieldCount int + Size int + Type any // The union type enum value + Value any // The unmarshaled value +} + +// CountFields recursively counts the number of valid (non-nil, non-zero) fields set in a value. +// This is used as the primary discriminator for union types, with JSON size as a tiebreaker. +func CountFields(v interface{}) int { + if v == nil { + return 0 + } + + typ := reflect.TypeOf(v) + val := reflect.ValueOf(v) + + // Dereference pointers + for typ.Kind() == reflect.Ptr { + if val.IsNil() { + return 0 + } + typ = typ.Elem() + val = val.Elem() + } + + return countFieldsRecursive(typ, val) +} + +// PickBestCandidate selects the best union type candidate using a multi-stage filtering approach: +// 1. If multiple candidates, filter by field count (keep only those with max field count) +// 2. If still multiple, filter by JSON size (keep only those with max size) +// 3. Return the first remaining candidate +func PickBestCandidate(candidates []UnionCandidate) *UnionCandidate { + if len(candidates) == 0 { + return nil + } + + if len(candidates) == 1 { + return &candidates[0] + } + + // Filter by field count if we have multiple candidates + if len(candidates) > 1 { + maxFieldCount := -1 + for i := range candidates { + candidates[i].FieldCount = CountFields(candidates[i].Value) + if candidates[i].FieldCount > maxFieldCount { + maxFieldCount = candidates[i].FieldCount + } + } + + // Keep only candidates with maximum field count + filtered := make([]UnionCandidate, 0, len(candidates)) + for _, c := range candidates { + if c.FieldCount == maxFieldCount { + filtered = append(filtered, c) + } + } + candidates = filtered + } + + if len(candidates) == 1 { + return &candidates[0] + } + + // Filter by JSON size if we still have multiple candidates + if len(candidates) > 1 { + maxSize := -1 + for i := range candidates { + candidates[i].Size = CalculateJSONSize(candidates[i].Value) + if candidates[i].Size > maxSize { + maxSize = candidates[i].Size + } + } + + // Keep only candidates with maximum size + filtered := make([]UnionCandidate, 0, len(candidates)) + for _, c := range candidates { + if c.Size == maxSize { + filtered = append(filtered, c) + } + } + candidates = filtered + } + + // Pick the first remaining candidate + return &candidates[0] +} + +func countFieldsRecursive(typ reflect.Type, val reflect.Value) int { + count := 0 + + switch typ.Kind() { + case reflect.Struct: + // Handle special types + switch typ { + case reflect.TypeOf(time.Time{}): + if !val.Interface().(time.Time).IsZero() { + return 1 + } + return 0 + case reflect.TypeOf(big.Int{}): + b := val.Interface().(big.Int) + if b.Sign() != 0 { + return 1 + } + return 0 + case reflect.TypeOf(types.Date{}): + // Date is always counted if it exists + return 1 + } + + // For regular structs, count non-zero fields + for i := 0; i < typ.NumField(); i++ { + field := typ.Field(i) + fieldVal := val.Field(i) + + // Skip unexported fields and const fields + if !field.IsExported() || field.Tag.Get("const") != "" { + continue + } + + // Skip fields tagged with json:"-" + jsonTag := field.Tag.Get("json") + if jsonTag == "-" { + continue + } + + fieldTyp := field.Type + // Dereference pointer types for the field + for fieldTyp.Kind() == reflect.Ptr { + if fieldVal.IsNil() { + break + } + fieldTyp = fieldTyp.Elem() + fieldVal = fieldVal.Elem() + } + + if !isNil(field.Type, val.Field(i)) { + count += countFieldsRecursive(fieldTyp, fieldVal) + } + } + + case reflect.Slice, reflect.Array: + if val.IsNil() || val.Len() == 0 { + return 0 + } + // Count each array/slice element + for i := 0; i < val.Len(); i++ { + itemVal := val.Index(i) + itemTyp := itemVal.Type() + + // Dereference pointer types + for itemTyp.Kind() == reflect.Ptr { + if itemVal.IsNil() { + break + } + itemTyp = itemTyp.Elem() + itemVal = itemVal.Elem() + } + + if !isNil(itemTyp, itemVal) { + count += countFieldsRecursive(itemTyp, itemVal) + } + } + + case reflect.String: + if val.String() != "" { + count = 1 + } + + case reflect.Bool: + // Bools always count as a field (even if false) + count = 1 + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if val.Int() != 0 { + count = 1 + } + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + if val.Uint() != 0 { + count = 1 + } + + case reflect.Float32, reflect.Float64: + if val.Float() != 0 { + count = 1 + } + + default: + // For any other type, if it's not zero, count it as 1 + if !val.IsZero() { + count = 1 + } + } + + return count +} diff --git a/pkg/utils/pathparams.go b/pkg/utils/pathparams.go index bb495f0c..4c761944 100644 --- a/pkg/utils/pathparams.go +++ b/pkg/utils/pathparams.go @@ -11,8 +11,7 @@ import ( "strings" "time" - "github.com/ericlagergren/decimal" - + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/optionalnullable" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" ) @@ -114,6 +113,16 @@ func getSimplePathParams(parentName string, objType reflect.Type, objValue refle } pathParams[parentName] = strings.Join(ppVals, ",") case reflect.Map: + // check if optionalnullable.OptionalNullable[T] + if nullableValue, ok := optionalnullable.AsOptionalNullable(objValue); ok { + // Handle optionalnullable.OptionalNullable[T] using GetUntyped method + if value, isSet := nullableValue.GetUntyped(); isSet && value != nil { + pathParams[parentName] = valToString(value) + } + // If not set or explicitly null, return nil (skip parameter) + return pathParams + } + if objValue.Len() == 0 { return nil } @@ -135,8 +144,6 @@ func getSimplePathParams(parentName string, objType reflect.Type, objValue refle pathParams[parentName] = valToString(objValue.Interface()) case big.Int: pathParams[parentName] = valToString(objValue.Interface()) - case decimal.Big: - pathParams[parentName] = valToString(objValue.Interface()) default: var ppVals []string for i := 0; i < objType.NumField(); i++ { diff --git a/pkg/utils/queryparams.go b/pkg/utils/queryparams.go index 9f720877..e912e8d3 100644 --- a/pkg/utils/queryparams.go +++ b/pkg/utils/queryparams.go @@ -12,8 +12,7 @@ import ( "reflect" "time" - "github.com/ericlagergren/decimal" - + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/optionalnullable" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" ) @@ -43,10 +42,13 @@ func PopulateQueryParams(_ context.Context, req *http.Request, queryParams inter } func populateQueryParams(queryParams interface{}, globals interface{}, values url.Values, skipFields []string) ([]string, error) { - queryParamsStructType, queryParamsValType := dereferencePointers(reflect.TypeOf(queryParams), reflect.ValueOf(queryParams)) + queryParamsVal := reflect.ValueOf(queryParams) + if queryParamsVal.Kind() == reflect.Pointer && queryParamsVal.IsNil() { + return nil, nil + } + queryParamsStructType, queryParamsValType := dereferencePointers(reflect.TypeOf(queryParams), queryParamsVal) globalsAlreadyPopulated := []string{} - for i := 0; i < queryParamsStructType.NumField(); i++ { fieldType := queryParamsStructType.Field(i) valType := queryParamsValType.Field(i) @@ -157,6 +159,16 @@ func populateDeepObjectParams(tag *paramTag, objType reflect.Type, objValue refl switch objValue.Kind() { case reflect.Map: + // check if optionalnullable.OptionalNullable[T] + if nullableValue, ok := optionalnullable.AsOptionalNullable(objValue); ok { + // Handle optionalnullable.OptionalNullable[T] using GetUntyped method + if value, isSet := nullableValue.GetUntyped(); isSet && value != nil { + values.Add(tag.ParamName, valToString(value)) + } + // If not set or explicitly null, skip adding to values + return values + } + populateDeepObjectParamsMap(values, tag.ParamName, objValue) case reflect.Struct: populateDeepObjectParamsStruct(values, tag.ParamName, objValue) @@ -235,7 +247,7 @@ func populateDeepObjectParamsStruct(qsValues url.Values, priorScope string, stru populateDeepObjectParamsMap(qsValues, scope, fieldValue) case reflect.Struct: switch fieldValue.Type() { - case reflect.TypeOf(big.Int{}), reflect.TypeOf(decimal.Big{}), reflect.TypeOf(time.Time{}), reflect.TypeOf(types.Date{}): + case reflect.TypeOf(big.Int{}), reflect.TypeOf(time.Time{}), reflect.TypeOf(types.Date{}): qsValues.Add(scope, valToString(fieldValue.Interface())) continue diff --git a/pkg/utils/requestbody.go b/pkg/utils/requestbody.go index 8fe01ad4..fb84d61e 100644 --- a/pkg/utils/requestbody.go +++ b/pkg/utils/requestbody.go @@ -7,10 +7,15 @@ import ( "context" "fmt" "io" + "mime" "mime/multipart" + "net/textproto" "net/url" + "path/filepath" "reflect" "regexp" + + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/optionalnullable" ) const ( @@ -166,9 +171,21 @@ func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { tag := parseMultipartFormTag(field) if tag.File { - if err := encodeMultipartFormDataFile(writer, tag.Name, fieldType, valType); err != nil { - writer.Close() - return "", err + switch fieldType.Kind() { + case reflect.Slice, reflect.Array: + for i := 0; i < valType.Len(); i++ { + arrayVal := valType.Index(i) + + if err := encodeMultipartFormDataFile(writer, tag.Name+"[]", arrayVal.Type(), arrayVal); err != nil { + writer.Close() + return "", err + } + } + default: + if err := encodeMultipartFormDataFile(writer, tag.Name, fieldType, valType); err != nil { + writer.Close() + return "", err + } } } else if tag.JSON { jw, err := writer.CreateFormField(tag.Name) @@ -243,7 +260,18 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldName string, fieldTyp return fmt.Errorf("invalid multipart/form-data file") } - fw, err := w.CreateFormFile(fieldName, fileName) + // Detect content type based on file extension + contentType := mime.TypeByExtension(filepath.Ext(fileName)) + if contentType == "" { + contentType = "application/octet-stream" + } + + // Create multipart header with proper content type + h := make(textproto.MIMEHeader) + h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="%s"; filename="%s"`, fieldName, fileName)) + h.Set("Content-Type", contentType) + + fw, err := w.CreatePart(h) if err != nil { return err } @@ -251,6 +279,11 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldName string, fieldTyp return err } + // Reset seek position to 0 if the reader supports seeking + if seeker, ok := reader.(io.Seeker); ok { + _, _ = seeker.Seek(0, io.SeekStart) + } + return nil } @@ -309,6 +342,17 @@ func encodeFormData(fieldName string, w io.Writer, data interface{}) error { } } case reflect.Map: + // check if optionalnullable.OptionalNullable[T] + if nullableValue, ok := optionalnullable.AsOptionalNullable(requestValType); ok { + // Handle optionalnullable.OptionalNullable[T] using GetUntyped method + if value, isSet := nullableValue.GetUntyped(); isSet && value != nil { + dataValues.Set(fieldName, valToString(value)) + } + // If not set or explicitly null, skip adding to form + break + } + + // Handle regular map for _, k := range requestValType.MapKeys() { v := requestValType.MapIndex(k) dataValues.Set(fmt.Sprintf("%v", k.Interface()), valToString(v.Interface())) diff --git a/pkg/utils/retries.go b/pkg/utils/retries.go index 2d351eee..89d2d7e8 100644 --- a/pkg/utils/retries.go +++ b/pkg/utils/retries.go @@ -7,10 +7,12 @@ import ( "errors" "fmt" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/retry" + "io" "math" "math/rand" "net/http" "net/url" + "slices" "strconv" "strings" "time" @@ -27,6 +29,17 @@ type Retries struct { StatusCodes []string } +var ( + // IETF RFC 7231 4.2 safe and idempotent HTTP methods for connection retries + idempotentHTTPMethods = []string{ + http.MethodDelete, + http.MethodGet, + http.MethodHead, + http.MethodOptions, + http.MethodPut, + } +) + func Retry(ctx context.Context, r Retries, operation func() (*http.Response, error)) (*http.Response, error) { switch r.Config.Strategy { case "backoff": @@ -49,11 +62,48 @@ func Retry(ctx context.Context, r Retries, operation func() (*http.Response, err res, err := operation() if err != nil { + if !r.Config.RetryConnectionErrors { + return retry.Permanent(err) + } + + var httpMethod string + + // Use http.Request method if available + if res != nil && res.Request != nil { + httpMethod = res.Request.Method + } + + isIdempotentHTTPMethod := slices.Contains(idempotentHTTPMethods, httpMethod) urlError := new(url.Error) + if errors.As(err, &urlError) { - if (urlError.Temporary() || urlError.Timeout()) && r.Config.RetryConnectionErrors { + if urlError.Temporary() || urlError.Timeout() { return err } + + // In certain error cases, the http.Request may not have + // been populated, so use url.Error.Op which only has its + // first character capitalized from the original request + // HTTP method. + if httpMethod == "" { + httpMethod = strings.ToUpper(urlError.Op) + } + + isIdempotentHTTPMethod = slices.Contains(idempotentHTTPMethods, httpMethod) + + // Connection closed + if errors.Is(urlError.Err, io.EOF) && isIdempotentHTTPMethod { + return err + } + } + + // syscall detection is not available on every platform, so + // fallback to best effort string detection. + isBrokenPipeError := strings.Contains(err.Error(), "broken pipe") + isConnectionResetError := strings.Contains(err.Error(), "connection reset") + + if (isBrokenPipeError || isConnectionResetError) && isIdempotentHTTPMethod { + return err } return retry.Permanent(err) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 6f1f538b..0415b536 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -14,8 +14,6 @@ import ( "strconv" "strings" "time" - - "github.com/ericlagergren/decimal" ) const ( @@ -40,8 +38,8 @@ func UnmarshalJsonFromResponseBody(body io.Reader, out interface{}, tag string) if err != nil { return fmt.Errorf("error reading response body: %w", err) } - if err := UnmarshalJSON(data, out, reflect.StructTag(tag), true, false); err != nil { - return fmt.Errorf("error unmarshalling json response body: %w", err) + if err := UnmarshalJSON(data, out, reflect.StructTag(tag), true, nil); err != nil { + return fmt.Errorf("error unmarshaling json response body: %w", err) } return nil @@ -183,8 +181,6 @@ func valToString(val interface{}) string { return v.Format(time.RFC3339Nano) case big.Int: return v.String() - case decimal.Big: - return v.String() default: return fmt.Sprintf("%v", v) } @@ -245,6 +241,21 @@ func isNil(typ reflect.Type, val reflect.Value) bool { return false } +func isEmptyContainer(typ reflect.Type, val reflect.Value) bool { + if isNil(typ, val) { + return true + } + + switch typ.Kind() { + case reflect.Slice, reflect.Array: + return val.Len() == 0 + case reflect.Map: + return val.Len() == 0 + default: + return false + } +} + func contains(arr []string, str string) bool { for _, a := range arr { if a == str { diff --git a/publishingtokens.go b/publishingtokens.go index 43e48c50..30c45288 100644 --- a/publishingtokens.go +++ b/publishingtokens.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -17,12 +18,16 @@ import ( ) type PublishingTokens struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newPublishingTokens(sdkConfig sdkConfiguration) *PublishingTokens { +func newPublishingTokens(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *PublishingTokens { return &PublishingTokens{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -53,11 +58,13 @@ func (s *PublishingTokens) Create(ctx context.Context, request *operations.Creat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "createPublishingToken", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "createPublishingToken", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -113,15 +120,17 @@ func (s *PublishingTokens) Create(ctx context.Context, request *operations.Creat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -138,7 +147,7 @@ func (s *PublishingTokens) Create(ctx context.Context, request *operations.Creat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -146,13 +155,13 @@ func (s *PublishingTokens) Create(ctx context.Context, request *operations.Creat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -165,17 +174,17 @@ func (s *PublishingTokens) Create(ctx context.Context, request *operations.Creat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -276,11 +285,13 @@ func (s *PublishingTokens) Delete(ctx context.Context, request operations.Delete } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "deletePublishingToken", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "deletePublishingToken", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -329,15 +340,17 @@ func (s *PublishingTokens) Delete(ctx context.Context, request operations.Delete "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -354,7 +367,7 @@ func (s *PublishingTokens) Delete(ctx context.Context, request operations.Delete err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -362,13 +375,13 @@ func (s *PublishingTokens) Delete(ctx context.Context, request operations.Delete if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -381,17 +394,17 @@ func (s *PublishingTokens) Delete(ctx context.Context, request operations.Delete err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -472,11 +485,13 @@ func (s *PublishingTokens) Get(ctx context.Context, request operations.GetPublis } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getPublishingTokenByID", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getPublishingTokenByID", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -525,15 +540,17 @@ func (s *PublishingTokens) Get(ctx context.Context, request operations.GetPublis "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -550,7 +567,7 @@ func (s *PublishingTokens) Get(ctx context.Context, request operations.GetPublis err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -558,13 +575,13 @@ func (s *PublishingTokens) Get(ctx context.Context, request operations.GetPublis if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -577,17 +594,17 @@ func (s *PublishingTokens) Get(ctx context.Context, request operations.GetPublis err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -688,11 +705,13 @@ func (s *PublishingTokens) List(ctx context.Context, opts ...operations.Option) } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getPublishingToken", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getPublishingToken", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -741,15 +760,17 @@ func (s *PublishingTokens) List(ctx context.Context, opts ...operations.Option) "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -766,7 +787,7 @@ func (s *PublishingTokens) List(ctx context.Context, opts ...operations.Option) err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -774,13 +795,13 @@ func (s *PublishingTokens) List(ctx context.Context, opts ...operations.Option) if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -793,17 +814,17 @@ func (s *PublishingTokens) List(ctx context.Context, opts ...operations.Option) err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -904,11 +925,13 @@ func (s *PublishingTokens) ResolveMetadata(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getPublishingTokenPublicMetadata", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getPublishingTokenPublicMetadata", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -957,15 +980,17 @@ func (s *PublishingTokens) ResolveMetadata(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -982,7 +1007,7 @@ func (s *PublishingTokens) ResolveMetadata(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -990,13 +1015,13 @@ func (s *PublishingTokens) ResolveMetadata(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1009,17 +1034,17 @@ func (s *PublishingTokens) ResolveMetadata(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1120,11 +1145,13 @@ func (s *PublishingTokens) ResolveTarget(ctx context.Context, request operations } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getPublishingTokenTargetByID", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getPublishingTokenTargetByID", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1173,15 +1200,17 @@ func (s *PublishingTokens) ResolveTarget(ctx context.Context, request operations "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1198,7 +1227,7 @@ func (s *PublishingTokens) ResolveTarget(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1206,13 +1235,13 @@ func (s *PublishingTokens) ResolveTarget(ctx context.Context, request operations if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1225,17 +1254,17 @@ func (s *PublishingTokens) ResolveTarget(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1332,11 +1361,13 @@ func (s *PublishingTokens) Update(ctx context.Context, request operations.Update } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "updatePublishingTokenExpiration", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "updatePublishingTokenExpiration", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1392,15 +1423,17 @@ func (s *PublishingTokens) Update(ctx context.Context, request operations.Update "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1417,7 +1450,7 @@ func (s *PublishingTokens) Update(ctx context.Context, request operations.Update err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1425,13 +1458,13 @@ func (s *PublishingTokens) Update(ctx context.Context, request operations.Update if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1444,17 +1477,17 @@ func (s *PublishingTokens) Update(ctx context.Context, request operations.Update err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/reports.go b/reports.go index 00c4fee1..dcc539f9 100644 --- a/reports.go +++ b/reports.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -17,12 +18,16 @@ import ( // Reports - REST APIs for managing reports (lint reports, change reports, etc) type Reports struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newReports(sdkConfig sdkConfiguration) *Reports { +func newReports(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Reports { return &Reports{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *Reports) GetChangesReportSignedURL(ctx context.Context, request operati } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getChangesReportSignedUrl", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getChangesReportSignedUrl", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -105,15 +112,17 @@ func (s *Reports) GetChangesReportSignedURL(ctx context.Context, request operati "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -130,7 +139,7 @@ func (s *Reports) GetChangesReportSignedURL(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -138,13 +147,13 @@ func (s *Reports) GetChangesReportSignedURL(ctx context.Context, request operati if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -157,17 +166,17 @@ func (s *Reports) GetChangesReportSignedURL(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -252,11 +261,13 @@ func (s *Reports) GetLintingReportSignedURL(ctx context.Context, request operati } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getLintingReportSignedUrl", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getLintingReportSignedUrl", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -305,15 +316,17 @@ func (s *Reports) GetLintingReportSignedURL(ctx context.Context, request operati "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -330,7 +343,7 @@ func (s *Reports) GetLintingReportSignedURL(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -338,13 +351,13 @@ func (s *Reports) GetLintingReportSignedURL(ctx context.Context, request operati if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -357,17 +370,17 @@ func (s *Reports) GetLintingReportSignedURL(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -452,11 +465,13 @@ func (s *Reports) UploadReport(ctx context.Context, request operations.UploadRep } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "uploadReport", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "uploadReport", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "multipart", `request:"mediaType=multipart/form-data"`) if err != nil { @@ -512,15 +527,17 @@ func (s *Reports) UploadReport(ctx context.Context, request operations.UploadRep "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -537,7 +554,7 @@ func (s *Reports) UploadReport(ctx context.Context, request operations.UploadRep err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -545,13 +562,13 @@ func (s *Reports) UploadReport(ctx context.Context, request operations.UploadRep if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -564,17 +581,17 @@ func (s *Reports) UploadReport(ctx context.Context, request operations.UploadRep err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/schemastore.go b/schemastore.go index 078feec0..53374a50 100644 --- a/schemastore.go +++ b/schemastore.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -17,12 +18,16 @@ import ( ) type SchemaStore struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newSchemaStore(sdkConfig sdkConfiguration) *SchemaStore { +func newSchemaStore(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *SchemaStore { return &SchemaStore{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *SchemaStore) CreateSchemaStoreItem(ctx context.Context, request operati } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "createSchemaStoreItem", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "createSchemaStoreItem", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -112,15 +119,17 @@ func (s *SchemaStore) CreateSchemaStoreItem(ctx context.Context, request operati "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -137,7 +146,7 @@ func (s *SchemaStore) CreateSchemaStoreItem(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -145,13 +154,13 @@ func (s *SchemaStore) CreateSchemaStoreItem(ctx context.Context, request operati if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -164,17 +173,17 @@ func (s *SchemaStore) CreateSchemaStoreItem(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -274,11 +283,13 @@ func (s *SchemaStore) GetSchemaStoreItem(ctx context.Context, request *operation } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getSchemaStoreItem", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getSchemaStoreItem", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -334,15 +345,17 @@ func (s *SchemaStore) GetSchemaStoreItem(ctx context.Context, request *operation "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -359,7 +372,7 @@ func (s *SchemaStore) GetSchemaStoreItem(ctx context.Context, request *operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -367,13 +380,13 @@ func (s *SchemaStore) GetSchemaStoreItem(ctx context.Context, request *operation if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -386,17 +399,17 @@ func (s *SchemaStore) GetSchemaStoreItem(ctx context.Context, request *operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/shorturls.go b/shorturls.go index d69cdd54..4cfb2775 100644 --- a/shorturls.go +++ b/shorturls.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -18,12 +19,16 @@ import ( // ShortURLs - REST APIs for managing short URLs type ShortURLs struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newShortURLs(sdkConfig sdkConfiguration) *ShortURLs { +func newShortURLs(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *ShortURLs { return &ShortURLs{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -53,11 +58,13 @@ func (s *ShortURLs) Create(ctx context.Context, request operations.CreateRequest } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -113,15 +120,17 @@ func (s *ShortURLs) Create(ctx context.Context, request operations.CreateRequest "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -138,7 +147,7 @@ func (s *ShortURLs) Create(ctx context.Context, request operations.CreateRequest err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -146,13 +155,13 @@ func (s *ShortURLs) Create(ctx context.Context, request operations.CreateRequest if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -165,17 +174,17 @@ func (s *ShortURLs) Create(ctx context.Context, request operations.CreateRequest err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/speakeasy.go b/speakeasy.go index 122603c9..fff530da 100644 --- a/speakeasy.go +++ b/speakeasy.go @@ -1,10 +1,13 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 + +// Generated from OpenAPI doc version 0.4.0 and generator version 2.745.2 import ( "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/globals" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" @@ -23,7 +26,7 @@ var ServerList = map[string]string{ ServerProd: "https://api.prod.speakeasy.com", } -// HTTPClient provides an interface for suplying the SDK with a custom HTTP client +// HTTPClient provides an interface for supplying the SDK with a custom HTTP client type HTTPClient interface { Do(req *http.Request) (*http.Response, error) } @@ -49,38 +52,11 @@ func Float64(f float64) *float64 { return &f } // Pointer provides a helper function to return a pointer to a type func Pointer[T any](v T) *T { return &v } -type sdkConfiguration struct { - Client HTTPClient - Security func(context.Context) (interface{}, error) - ServerURL string - Server string - Language string - OpenAPIDocVersion string - SDKVersion string - GenVersion string - UserAgent string - Globals globals.Globals - RetryConfig *retry.Config - Hooks *hooks.Hooks - Timeout *time.Duration -} - -func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { - if c.ServerURL != "" { - return c.ServerURL, nil - } - - if c.Server == "" { - c.Server = "prod" - } - - return ServerList[c.Server], nil -} - // Speakeasy API: The Subscriptions API manages subscriptions for CLI and registry events // // /docs - The Speakeasy Platform Documentation type Speakeasy struct { + SDKVersion string // REST APIs for working with Registry artifacts Artifacts *Artifacts // REST APIs for managing Authentication @@ -106,7 +82,8 @@ type Speakeasy struct { // REST APIs for managing events captured by a speakeasy binary (CLI, GitHub Action etc) Events *Events - sdkConfiguration sdkConfiguration + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } type SDKOption func(*Speakeasy) @@ -187,15 +164,13 @@ func WithTimeout(timeout time.Duration) SDKOption { // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *Speakeasy { sdk := &Speakeasy{ - sdkConfiguration: sdkConfiguration{ - Language: "go", - OpenAPIDocVersion: "0.4.0", - SDKVersion: "3.26.7", - GenVersion: "2.597.9", - UserAgent: "speakeasy-sdk/go 3.26.7 2.597.9 0.4.0 github.com/speakeasy-api/speakeasy-client-sdk-go", - Globals: globals.Globals{}, - Hooks: hooks.New(), + SDKVersion: "3.27.0", + sdkConfiguration: config.SDKConfiguration{ + UserAgent: "speakeasy-sdk/go 3.27.0 2.745.2 0.4.0 github.com/speakeasy-api/speakeasy-client-sdk-go/v3", + Globals: globals.Globals{}, + ServerList: ServerList, }, + hooks: hooks.New(), } for _, opt := range opts { opt(sdk) @@ -208,36 +183,24 @@ func New(opts ...SDKOption) *Speakeasy { currentServerURL, _ := sdk.sdkConfiguration.GetServerDetails() serverURL := currentServerURL - serverURL, sdk.sdkConfiguration.Client = sdk.sdkConfiguration.Hooks.SDKInit(currentServerURL, sdk.sdkConfiguration.Client) - if serverURL != currentServerURL { + serverURL, sdk.sdkConfiguration.Client = sdk.hooks.SDKInit(currentServerURL, sdk.sdkConfiguration.Client) + if currentServerURL != serverURL { sdk.sdkConfiguration.ServerURL = serverURL } - sdk.Artifacts = newArtifacts(sdk.sdkConfiguration) - - sdk.Auth = newAuth(sdk.sdkConfiguration) - - sdk.CodeSamples = newCodeSamples(sdk.sdkConfiguration) - - sdk.Github = newGithub(sdk.sdkConfiguration) - - sdk.Organizations = newOrganizations(sdk.sdkConfiguration) - - sdk.PublishingTokens = newPublishingTokens(sdk.sdkConfiguration) - - sdk.Reports = newReports(sdk.sdkConfiguration) - - sdk.SchemaStore = newSchemaStore(sdk.sdkConfiguration) - - sdk.ShortURLs = newShortURLs(sdk.sdkConfiguration) - - sdk.Subscriptions = newSubscriptions(sdk.sdkConfiguration) - - sdk.Suggest = newSuggest(sdk.sdkConfiguration) - - sdk.Workspaces = newWorkspaces(sdk.sdkConfiguration) - - sdk.Events = newEvents(sdk.sdkConfiguration) + sdk.Artifacts = newArtifacts(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Auth = newAuth(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.CodeSamples = newCodeSamples(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Github = newGithub(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Organizations = newOrganizations(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.PublishingTokens = newPublishingTokens(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Reports = newReports(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.SchemaStore = newSchemaStore(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.ShortURLs = newShortURLs(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Subscriptions = newSubscriptions(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Suggest = newSuggest(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Workspaces = newWorkspaces(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Events = newEvents(sdk, sdk.sdkConfiguration, sdk.hooks) return sdk } diff --git a/subscriptions.go b/subscriptions.go index bb4f946e..f9dba353 100644 --- a/subscriptions.go +++ b/subscriptions.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -16,12 +17,16 @@ import ( // Subscriptions - REST APIs for managing subscriptions type Subscriptions struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newSubscriptions(sdkConfig sdkConfiguration) *Subscriptions { +func newSubscriptions(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Subscriptions { return &Subscriptions{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -51,11 +56,13 @@ func (s *Subscriptions) ActivateSubscriptionNamespace(ctx context.Context, reque } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "activateSubscriptionNamespace", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "activateSubscriptionNamespace", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -104,15 +111,17 @@ func (s *Subscriptions) ActivateSubscriptionNamespace(ctx context.Context, reque "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -129,7 +138,7 @@ func (s *Subscriptions) ActivateSubscriptionNamespace(ctx context.Context, reque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -137,13 +146,13 @@ func (s *Subscriptions) ActivateSubscriptionNamespace(ctx context.Context, reque if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -156,17 +165,17 @@ func (s *Subscriptions) ActivateSubscriptionNamespace(ctx context.Context, reque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -246,11 +255,13 @@ func (s *Subscriptions) IgnoreSubscriptionNamespace(ctx context.Context, request } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "ignoreSubscriptionNamespace", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "ignoreSubscriptionNamespace", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -299,15 +310,17 @@ func (s *Subscriptions) IgnoreSubscriptionNamespace(ctx context.Context, request "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -324,7 +337,7 @@ func (s *Subscriptions) IgnoreSubscriptionNamespace(ctx context.Context, request err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -332,13 +345,13 @@ func (s *Subscriptions) IgnoreSubscriptionNamespace(ctx context.Context, request if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -351,17 +364,17 @@ func (s *Subscriptions) IgnoreSubscriptionNamespace(ctx context.Context, request err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/suggest.go b/suggest.go index a10eb1ba..b811b363 100644 --- a/suggest.go +++ b/suggest.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -18,12 +19,16 @@ import ( // Suggest - REST APIs for managing LLM OAS suggestions type Suggest struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newSuggest(sdkConfig sdkConfiguration) *Suggest { +func newSuggest(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Suggest { return &Suggest{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -54,11 +59,13 @@ func (s *Suggest) Suggest(ctx context.Context, request operations.SuggestRequest } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "suggest", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "suggest", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "SuggestRequestBody", "json", `request:"mediaType=application/json"`) if err != nil { @@ -116,15 +123,17 @@ func (s *Suggest) Suggest(ctx context.Context, request operations.SuggestRequest "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -141,7 +150,7 @@ func (s *Suggest) Suggest(ctx context.Context, request operations.SuggestRequest err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -149,13 +158,13 @@ func (s *Suggest) Suggest(ctx context.Context, request operations.SuggestRequest if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -168,17 +177,17 @@ func (s *Suggest) Suggest(ctx context.Context, request operations.SuggestRequest err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -255,11 +264,13 @@ func (s *Suggest) SuggestItems(ctx context.Context, request shared.SuggestItemsR } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "suggestItems", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "suggestItems", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -315,15 +326,17 @@ func (s *Suggest) SuggestItems(ctx context.Context, request shared.SuggestItemsR "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -340,7 +353,7 @@ func (s *Suggest) SuggestItems(ctx context.Context, request shared.SuggestItemsR err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -348,13 +361,13 @@ func (s *Suggest) SuggestItems(ctx context.Context, request shared.SuggestItemsR if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -367,17 +380,17 @@ func (s *Suggest) SuggestItems(ctx context.Context, request shared.SuggestItemsR err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -463,11 +476,13 @@ func (s *Suggest) SuggestOpenAPI(ctx context.Context, request operations.Suggest } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "suggestOpenAPI", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "suggestOpenAPI", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "multipart", `request:"mediaType=multipart/form-data"`) if err != nil { @@ -525,15 +540,17 @@ func (s *Suggest) SuggestOpenAPI(ctx context.Context, request operations.Suggest "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -550,7 +567,7 @@ func (s *Suggest) SuggestOpenAPI(ctx context.Context, request operations.Suggest err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -558,13 +575,13 @@ func (s *Suggest) SuggestOpenAPI(ctx context.Context, request operations.Suggest if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -577,17 +594,17 @@ func (s *Suggest) SuggestOpenAPI(ctx context.Context, request operations.Suggest err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -665,11 +682,13 @@ func (s *Suggest) SuggestOpenAPIRegistry(ctx context.Context, request operations } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "suggestOpenAPIRegistry", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "suggestOpenAPIRegistry", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "SuggestRequestBody", "json", `request:"mediaType=application/json"`) if err != nil { @@ -727,15 +746,17 @@ func (s *Suggest) SuggestOpenAPIRegistry(ctx context.Context, request operations "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -752,7 +773,7 @@ func (s *Suggest) SuggestOpenAPIRegistry(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -760,13 +781,13 @@ func (s *Suggest) SuggestOpenAPIRegistry(ctx context.Context, request operations if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -779,17 +800,17 @@ func (s *Suggest) SuggestOpenAPIRegistry(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/tests/artifacts_test.go b/tests/artifacts_test.go index 3f94e02f..14fa3aaf 100644 --- a/tests/artifacts_test.go +++ b/tests/artifacts_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" @@ -19,11 +19,11 @@ func TestArtifacts_CreateRemoteSource(t *testing.T) { testHTTPClient := createTestHTTPClient("createRemoteSource") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -38,11 +38,11 @@ func TestArtifacts_GetBlob(t *testing.T) { testHTTPClient := createTestHTTPClient("getBlob") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -62,11 +62,11 @@ func TestArtifacts_GetManifest(t *testing.T) { testHTTPClient := createTestHTTPClient("getManifest") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -82,13 +82,13 @@ func TestArtifacts_GetManifest(t *testing.T) { assert.Equal(t, &shared.Manifest{ Layers: []shared.V2Descriptor{ shared.V2Descriptor{ - Digest: speakeasyclientsdkgo.String("sha256:5d20c808ce198565ff70b3ed23a991dd49afac45dece63474b27ce6ed036adc6"), - MediaType: speakeasyclientsdkgo.String("application/vnd.docker.image.rootfs.diff.tar.gzip"), - Size: speakeasyclientsdkgo.Int64(2107098), + Digest: v3.Pointer("sha256:5d20c808ce198565ff70b3ed23a991dd49afac45dece63474b27ce6ed036adc6"), + MediaType: v3.Pointer("application/vnd.docker.image.rootfs.diff.tar.gzip"), + Size: v3.Pointer[int64](2107098), }, }, - MediaType: speakeasyclientsdkgo.String("application/vnd.docker.distribution.manifest.v2+json"), - SchemaVersion: speakeasyclientsdkgo.Int64(2), + MediaType: v3.Pointer("application/vnd.docker.distribution.manifest.v2+json"), + SchemaVersion: v3.Pointer[int64](2), }, res.Manifest) } @@ -98,11 +98,11 @@ func TestArtifacts_GetNamespaces(t *testing.T) { testHTTPClient := createTestHTTPClient("getNamespaces") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -140,11 +140,11 @@ func TestArtifacts_GetRevisions(t *testing.T) { testHTTPClient := createTestHTTPClient("getRevisions") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -177,11 +177,11 @@ func TestArtifacts_GetTags(t *testing.T) { testHTTPClient := createTestHTTPClient("getTags") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -202,11 +202,11 @@ func TestArtifacts_ListRemoteSources(t *testing.T) { testHTTPClient := createTestHTTPClient("listRemoteSources") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -237,11 +237,11 @@ func TestArtifacts_PostTags(t *testing.T) { testHTTPClient := createTestHTTPClient("postTags") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -258,11 +258,11 @@ func TestArtifacts_SetVisibility(t *testing.T) { testHTTPClient := createTestHTTPClient("setVisibility") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -279,11 +279,11 @@ func TestArtifacts_ArchiveNamespace(t *testing.T) { testHTTPClient := createTestHTTPClient("archiveNamespace") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/tests/auth_test.go b/tests/auth_test.go index df29582b..add7b140 100644 --- a/tests/auth_test.go +++ b/tests/auth_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" @@ -19,11 +19,11 @@ func TestAuth_GetWorkspaceAccess(t *testing.T) { testHTTPClient := createTestHTTPClient("getWorkspaceAccess") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -43,9 +43,9 @@ func TestAuth_GetAccessToken(t *testing.T) { testHTTPClient := createTestHTTPClient("getAccessToken") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), ) res, err := s.Auth.GetAccessToken(ctx, operations.GetAccessTokenRequest{ @@ -67,11 +67,11 @@ func TestAuth_GetUser(t *testing.T) { testHTTPClient := createTestHTTPClient("getUser") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -98,11 +98,11 @@ func TestAuth_ValidateAPIKey(t *testing.T) { testHTTPClient := createTestHTTPClient("validateApiKey") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/tests/codesamples_test.go b/tests/codesamples_test.go index c7b9c47a..4320dd37 100644 --- a/tests/codesamples_test.go +++ b/tests/codesamples_test.go @@ -4,12 +4,13 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "os" "testing" ) @@ -18,11 +19,11 @@ func TestCodesamples_GetCodeSamples(t *testing.T) { testHTTPClient := createTestHTTPClient("getCodeSamples") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -39,21 +40,185 @@ func TestCodesamples_GetCodeSamples(t *testing.T) { Language: "", Method: "", OperationID: "", - Path: "/usr/bin", + Path: "/mnt", }, shared.UsageSnippet{ Code: "", Language: "", Method: "", OperationID: "", - Path: "/sys", + Path: "/bin", }, shared.UsageSnippet{ Code: "", Language: "", Method: "", OperationID: "", - Path: "/root", + Path: "/opt/bin", + }, + }, + }, res.UsageSnippets) + +} + +func TestCodesamples_GenerateCodeSamplePreviewDefault(t *testing.T) { + ctx := context.Background() + + testHTTPClient := createTestHTTPClient("generateCodeSamplePreview-default") + + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), + }), + ) + + example, fileErr := os.Open("../.speakeasy/testfiles/example.file") + require.NoError(t, fileErr) + + res, err := s.CodeSamples.GenerateCodeSamplePreview(ctx, shared.CodeSampleSchemaInput{ + Language: "", + SchemaFile: shared.SchemaFile{ + Content: example, + FileName: "example.file", + }, + }) + require.NoError(t, err) + assert.Contains(t, []any{200, 201, 202, 203, 204, 205, 206, 207, 208, 226}, res.StatusCode) + assert.NotNil(t, res.UsageSnippets) + assert.Equal(t, &shared.UsageSnippets{ + Snippets: []shared.UsageSnippet{ + shared.UsageSnippet{ + Code: "import { Petstore } from \"petstore-sdk\";\n" + + "\n" + + "const petstore = new Petstore({\n" + + " apiKey: \"\",\n" + + "});\n" + + "\n" + + "async function run() {\n" + + " const result = await petstore.pet.getById({\n" + + " id: 137396,\n" + + " });\n" + + "\n" + + " // Handle the result\n" + + " console.log(result);\n" + + "}\n" + + "\n" + + "run();", + Language: "typescript", + Method: "get", + OperationID: "getPetById", + Path: "/pet/{id}", + }, + }, + }, res.UsageSnippets) + +} + +func TestCodesamples_GetCodeSamplesDefault(t *testing.T) { + ctx := context.Background() + + testHTTPClient := createTestHTTPClient("getCodeSamples-default") + + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), + }), + ) + + res, err := s.CodeSamples.Get(ctx, operations.GetCodeSamplesRequest{ + Languages: []string{ + "python", + "javascript", + }, + MethodPaths: []operations.MethodPaths{ + operations.MethodPaths{ + Method: shared.HTTPMethodGet, + Path: "/pets", + }, + }, + OperationIds: []string{ + "getPets", + }, + RegistryURL: "https://spec.speakeasy.com/my-org/my-workspace/my-source", + }) + require.NoError(t, err) + assert.Contains(t, []any{200, 201, 202, 203, 204, 205, 206, 207, 208, 226}, res.StatusCode) + assert.NotNil(t, res.UsageSnippets) + assert.Equal(t, &shared.UsageSnippets{ + Snippets: []shared.UsageSnippet{ + shared.UsageSnippet{ + Code: "import { Petstore } from \"petstore-sdk\";\n" + + "\n" + + "const petstore = new Petstore({\n" + + " apiKey: \"\",\n" + + "});\n" + + "\n" + + "async function run() {\n" + + " const result = await petstore.pet.getById({\n" + + " id: 137396,\n" + + " });\n" + + "\n" + + " // Handle the result\n" + + " console.log(result);\n" + + "}\n" + + "\n" + + "run();", + Language: "typescript", + Method: "get", + OperationID: "getPetById", + Path: "/pet/{id}", + }, + }, + }, res.UsageSnippets) + +} + +func TestCodesamples_GetCodeSamplePreviewAsyncDefault(t *testing.T) { + ctx := context.Background() + + testHTTPClient := createTestHTTPClient("getCodeSamplePreviewAsync-default") + + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), + }), + ) + + res, err := s.CodeSamples.GetCodeSamplePreviewAsync(ctx, operations.GetCodeSamplePreviewAsyncRequest{ + JobID: "", + }) + require.NoError(t, err) + assert.Contains(t, []any{200, 201, 202, 203, 204, 205, 206, 207, 208, 226}, res.StatusCode) + assert.NotNil(t, res.UsageSnippets) + assert.Equal(t, &shared.UsageSnippets{ + Snippets: []shared.UsageSnippet{ + shared.UsageSnippet{ + Code: "import { Petstore } from \"petstore-sdk\";\n" + + "\n" + + "const petstore = new Petstore({\n" + + " apiKey: \"\",\n" + + "});\n" + + "\n" + + "async function run() {\n" + + " const result = await petstore.pet.getById({\n" + + " id: 137396,\n" + + " });\n" + + "\n" + + " // Handle the result\n" + + " console.log(result);\n" + + "}\n" + + "\n" + + "run();", + Language: "typescript", + Method: "get", + OperationID: "getPetById", + Path: "/pet/{id}", }, }, }, res.UsageSnippets) diff --git a/tests/github_test.go b/tests/github_test.go index e51a53dd..b44d3517 100644 --- a/tests/github_test.go +++ b/tests/github_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/utils" @@ -18,11 +18,11 @@ func TestGithub_CheckGithubAccess(t *testing.T) { testHTTPClient := createTestHTTPClient("checkGithubAccess") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -40,11 +40,11 @@ func TestGithub_GithubConfigureCodeSamples(t *testing.T) { testHTTPClient := createTestHTTPClient("githubConfigureCodeSamples") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -70,11 +70,11 @@ func TestGithub_GithubConfigureMintlifyRepo(t *testing.T) { testHTTPClient := createTestHTTPClient("githubConfigureMintlifyRepo") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -96,11 +96,11 @@ func TestGithub_GithubConfigureTarget(t *testing.T) { testHTTPClient := createTestHTTPClient("githubConfigureTarget") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -118,11 +118,11 @@ func TestGithub_GetGithubSetupState(t *testing.T) { testHTTPClient := createTestHTTPClient("getGithubSetupState") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -153,11 +153,11 @@ func TestGithub_LinkGithubAccess(t *testing.T) { testHTTPClient := createTestHTTPClient("linkGithubAccess") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -172,11 +172,11 @@ func TestGithub_GithubStorePublishingSecrets(t *testing.T) { testHTTPClient := createTestHTTPClient("githubStorePublishingSecrets") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -193,11 +193,11 @@ func TestGithub_GithubTriggerAction(t *testing.T) { testHTTPClient := createTestHTTPClient("githubTriggerAction") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/tests/mockserver/internal/handler/pathgetv1artifactsnamespaces.go b/tests/mockserver/internal/handler/pathgetv1artifactsnamespaces.go index 9c50dae7..808c8994 100644 --- a/tests/mockserver/internal/handler/pathgetv1artifactsnamespaces.go +++ b/tests/mockserver/internal/handler/pathgetv1artifactsnamespaces.go @@ -56,24 +56,24 @@ func testGetNamespacesGetNamespaces0(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.GetNamespacesResponse{ + var respBody *components.GetNamespacesResponse = &components.GetNamespacesResponse{ Items: []components.Namespace{ components.Namespace{ - CreatedAt: types.MustTimeFromString("2024-01-20T10:11:46.428Z"), ID: "", Name: "", + CreatedAt: types.MustTimeFromString("2024-01-20T10:11:46.428Z"), UpdatedAt: types.MustTimeFromString("2022-01-07T04:43:36.873Z"), }, components.Namespace{ - CreatedAt: types.MustTimeFromString("2023-07-06T07:26:30.970Z"), ID: "", Name: "", + CreatedAt: types.MustTimeFromString("2023-07-06T07:26:30.970Z"), UpdatedAt: types.MustTimeFromString("2024-01-31T11:34:19.590Z"), }, components.Namespace{ - CreatedAt: types.MustTimeFromString("2022-08-10T13:43:30.983Z"), ID: "", Name: "", + CreatedAt: types.MustTimeFromString("2022-08-10T13:43:30.983Z"), UpdatedAt: types.MustTimeFromString("2022-07-15T08:41:36.371Z"), }, }, diff --git a/tests/mockserver/internal/handler/pathgetv1artifactsnamespacesnamespacenamerevisions.go b/tests/mockserver/internal/handler/pathgetv1artifactsnamespacesnamespacenamerevisions.go index 330c0a42..f8ffcc08 100644 --- a/tests/mockserver/internal/handler/pathgetv1artifactsnamespacesnamespacenamerevisions.go +++ b/tests/mockserver/internal/handler/pathgetv1artifactsnamespacesnamespacenamerevisions.go @@ -56,16 +56,16 @@ func testGetRevisionsGetRevisions0(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.GetRevisionsResponse{ + var respBody *components.GetRevisionsResponse = &components.GetRevisionsResponse{ Items: []components.Revision{ components.Revision{ - CreatedAt: types.MustTimeFromString("2024-09-16T19:17:04.361Z"), - Digest: "sha256:6d1ef012b5674ad8a127ecfa9b5e6f5178d171b90ee462846974177fd9bdd39f", ID: "", + Digest: "sha256:6d1ef012b5674ad8a127ecfa9b5e6f5178d171b90ee462846974177fd9bdd39f", NamespaceName: "", Tags: []string{ "", }, + CreatedAt: types.MustTimeFromString("2024-09-16T19:17:04.361Z"), UpdatedAt: types.MustTimeFromString("2023-12-06T05:58:38.953Z"), }, }, diff --git a/tests/mockserver/internal/handler/pathgetv1artifactsnamespacesnamespacenametags.go b/tests/mockserver/internal/handler/pathgetv1artifactsnamespacesnamespacenametags.go index bd59f3b9..992f175c 100644 --- a/tests/mockserver/internal/handler/pathgetv1artifactsnamespacesnamespacenametags.go +++ b/tests/mockserver/internal/handler/pathgetv1artifactsnamespacesnamespacenametags.go @@ -55,7 +55,7 @@ func testGetTagsGetTags0(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.GetTagsResponse{ + var respBody *components.GetTagsResponse = &components.GetTagsResponse{ Items: []components.Tag{}, } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1artifactsremotesources.go b/tests/mockserver/internal/handler/pathgetv1artifactsremotesources.go index f807b9cd..4afa80b4 100644 --- a/tests/mockserver/internal/handler/pathgetv1artifactsremotesources.go +++ b/tests/mockserver/internal/handler/pathgetv1artifactsremotesources.go @@ -55,7 +55,7 @@ func testListRemoteSourcesListRemoteSources0(w http.ResponseWriter, req *http.Re http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.RemoteSource{ + var respBody *components.RemoteSource = &components.RemoteSource{ Inputs: []components.RemoteDocument{ components.RemoteDocument{ RegistryURL: "https://well-lit-cap.net", diff --git a/tests/mockserver/internal/handler/pathgetv1authaccesstoken.go b/tests/mockserver/internal/handler/pathgetv1authaccesstoken.go index bd8a2562..72305862 100644 --- a/tests/mockserver/internal/handler/pathgetv1authaccesstoken.go +++ b/tests/mockserver/internal/handler/pathgetv1authaccesstoken.go @@ -30,6 +30,21 @@ func pathGetV1AuthAccessToken(dir *logging.HTTPFileDirectory, rt *tracking.Reque } func testGetAccessTokenGetAccessToken0(w http.ResponseWriter, req *http.Request) { + if err := assert.SecurityAuthorizationHeader(req, true, "Bearer"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.SecurityHeader(req, "x-api-key", true); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.SecurityHeader(req, "x-workspace-identifier", true); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } if err := assert.AcceptHeader(req, []string{"application/json"}); err != nil { log.Printf("assertion error: %s\n", err) http.Error(w, err.Error(), http.StatusBadRequest) @@ -40,7 +55,7 @@ func testGetAccessTokenGetAccessToken0(w http.ResponseWriter, req *http.Request) http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.AccessToken{ + var respBody *components.AccessToken = &components.AccessToken{ AccessToken: "", Claims: components.Claims{}, User: components.AccessTokenUser{}, diff --git a/tests/mockserver/internal/handler/pathgetv1authvalidate.go b/tests/mockserver/internal/handler/pathgetv1authvalidate.go index bdb328cb..333d2cdf 100644 --- a/tests/mockserver/internal/handler/pathgetv1authvalidate.go +++ b/tests/mockserver/internal/handler/pathgetv1authvalidate.go @@ -56,21 +56,21 @@ func testValidateAPIKeyValidateAPIKey0(w http.ResponseWriter, req *http.Request) http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.APIKeyDetails{ + var respBody *components.APIKeyDetails = &components.APIKeyDetails{ + WorkspaceID: "", + WorkspaceSlug: "", + OrgSlug: "", AccountTypeV2: components.AccountTypeEnterprise, - BillingAddOns: []components.BillingAddOn{ - components.BillingAddOnCustomCodeRegions, - }, EnabledFeatures: []string{ "", "", "", }, - OrgSlug: "", + BillingAddOns: []components.BillingAddOn{ + components.BillingAddOnSDKTesting, + }, TelemetryDisabled: true, WorkspaceCreatedAt: types.MustTimeFromString("2024-04-24T00:30:38.626Z"), - WorkspaceID: "", - WorkspaceSlug: "", } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1codesample.go b/tests/mockserver/internal/handler/pathgetv1codesample.go index 64da0961..971986d3 100644 --- a/tests/mockserver/internal/handler/pathgetv1codesample.go +++ b/tests/mockserver/internal/handler/pathgetv1codesample.go @@ -23,6 +23,8 @@ func pathGetV1CodeSample(dir *logging.HTTPFileDirectory, rt *tracking.RequestTra switch fmt.Sprintf("%s[%d]", test, count) { case "getCodeSamples[0]": dir.HandlerFunc("getCodeSamples", testGetCodeSamplesGetCodeSamples0)(w, req) + case "getCodeSamples-default[0]": + dir.HandlerFunc("getCodeSamples", testGetCodeSamplesGetCodeSamplesDefault0)(w, req) default: http.Error(w, fmt.Sprintf("Unknown test: %s[%d]", test, count), http.StatusBadRequest) } @@ -55,28 +57,95 @@ func testGetCodeSamplesGetCodeSamples0(w http.ResponseWriter, req *http.Request) http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.UsageSnippets{ + var respBody *components.UsageSnippets = &components.UsageSnippets{ Snippets: []components.UsageSnippet{ components.UsageSnippet{ - Code: "", - Language: "", + Path: "/opt/share", Method: "", OperationID: "", - Path: "/root", + Language: "", + Code: "", }, components.UsageSnippet{ - Code: "", - Language: "", + Path: "/usr/src", Method: "", OperationID: "", - Path: "/opt/sbin", + Language: "", + Code: "", }, components.UsageSnippet{ - Code: "", - Language: "", + Path: "/var/spool", Method: "", OperationID: "", - Path: "/tmp", + Language: "", + Code: "", + }, + }, + } + respBodyBytes, err := utils.MarshalJSON(respBody, "", true) + + if err != nil { + http.Error( + w, + "Unable to encode response body as JSON: "+err.Error(), + http.StatusInternalServerError, + ) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write(respBodyBytes) +} + +func testGetCodeSamplesGetCodeSamplesDefault0(w http.ResponseWriter, req *http.Request) { + if err := assert.SecurityAuthorizationHeader(req, true, "Bearer"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.SecurityHeader(req, "x-api-key", true); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.SecurityHeader(req, "x-workspace-identifier", true); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.AcceptHeader(req, []string{"application/json"}); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + if err := assert.HeaderExists(req, "User-Agent"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + var respBody *components.UsageSnippets = &components.UsageSnippets{ + Snippets: []components.UsageSnippet{ + components.UsageSnippet{ + Path: "/pet/{id}", + Method: "get", + OperationID: "getPetById", + Language: "typescript", + Code: "import { Petstore } from \"petstore-sdk\";\n" + + "\n" + + "const petstore = new Petstore({\n" + + " apiKey: \"\",\n" + + "});\n" + + "\n" + + "async function run() {\n" + + " const result = await petstore.pet.getById({\n" + + " id: 137396,\n" + + " });\n" + + "\n" + + " // Handle the result\n" + + " console.log(result);\n" + + "}\n" + + "\n" + + "run();", }, }, } diff --git a/tests/mockserver/internal/handler/pathgetv1codesamplepreviewasyncjobid.go b/tests/mockserver/internal/handler/pathgetv1codesamplepreviewasyncjobid.go index 44d8a052..f3f3e67a 100644 --- a/tests/mockserver/internal/handler/pathgetv1codesamplepreviewasyncjobid.go +++ b/tests/mockserver/internal/handler/pathgetv1codesamplepreviewasyncjobid.go @@ -22,6 +22,8 @@ func pathGetV1CodeSamplePreviewAsyncJobID(dir *logging.HTTPFileDirectory, rt *tr count := rt.GetRequestCount(test, instanceID) switch fmt.Sprintf("%s[%d]", test, count) { + case "getCodeSamplePreviewAsync-default[0]": + dir.HandlerFunc("getCodeSamplePreviewAsync", testGetCodeSamplePreviewAsyncGetCodeSamplePreviewAsyncDefault0)(w, req) case "getCodeSamplePreviewAsync[0]": dir.HandlerFunc("getCodeSamplePreviewAsync", testGetCodeSamplePreviewAsyncGetCodeSamplePreviewAsync0)(w, req) default: @@ -30,6 +32,73 @@ func pathGetV1CodeSamplePreviewAsyncJobID(dir *logging.HTTPFileDirectory, rt *tr } } +func testGetCodeSamplePreviewAsyncGetCodeSamplePreviewAsyncDefault0(w http.ResponseWriter, req *http.Request) { + if err := assert.SecurityAuthorizationHeader(req, true, "Bearer"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.SecurityHeader(req, "x-api-key", true); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.SecurityHeader(req, "x-workspace-identifier", true); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.AcceptHeader(req, []string{"application/json"}); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + if err := assert.HeaderExists(req, "User-Agent"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + var respBody *components.UsageSnippets = &components.UsageSnippets{ + Snippets: []components.UsageSnippet{ + components.UsageSnippet{ + Path: "/pet/{id}", + Method: "get", + OperationID: "getPetById", + Language: "typescript", + Code: "import { Petstore } from \"petstore-sdk\";\n" + + "\n" + + "const petstore = new Petstore({\n" + + " apiKey: \"\",\n" + + "});\n" + + "\n" + + "async function run() {\n" + + " const result = await petstore.pet.getById({\n" + + " id: 137396,\n" + + " });\n" + + "\n" + + " // Handle the result\n" + + " console.log(result);\n" + + "}\n" + + "\n" + + "run();", + }, + }, + } + respBodyBytes, err := utils.MarshalJSON(respBody, "", true) + + if err != nil { + http.Error( + w, + "Unable to encode response body as JSON: "+err.Error(), + http.StatusInternalServerError, + ) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write(respBodyBytes) +} + func testGetCodeSamplePreviewAsyncGetCodeSamplePreviewAsync0(w http.ResponseWriter, req *http.Request) { if err := assert.SecurityAuthorizationHeader(req, true, "Bearer"); err != nil { log.Printf("assertion error: %s\n", err) @@ -56,7 +125,7 @@ func testGetCodeSamplePreviewAsyncGetCodeSamplePreviewAsync0(w http.ResponseWrit http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &operations.GetCodeSamplePreviewAsyncResponseBody{ + var respBody *operations.GetCodeSamplePreviewAsyncResponseBody = &operations.GetCodeSamplePreviewAsyncResponseBody{ Status: components.CodeSamplesJobStatusPending, } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1githubsetup.go b/tests/mockserver/internal/handler/pathgetv1githubsetup.go index a61859cf..28715633 100644 --- a/tests/mockserver/internal/handler/pathgetv1githubsetup.go +++ b/tests/mockserver/internal/handler/pathgetv1githubsetup.go @@ -55,12 +55,12 @@ func testGetGithubSetupStateGetGithubSetupState0(w http.ResponseWriter, req *htt http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.GithubSetupStateResponse{ + var respBody *components.GithubSetupStateResponse = &components.GithubSetupStateResponse{ + AppInstalled: false, Actions: components.Actions{ GenerationActionConfigured: false, PublishActionConfigured: false, }, - AppInstalled: false, Secrets: components.Secrets{ APIKeyConfigured: true, PublishingSecretsConfigured: true, diff --git a/tests/mockserver/internal/handler/pathgetv1ociv2organizationslugworkspaceslugnamespacenamemanifestsrevisionreference.go b/tests/mockserver/internal/handler/pathgetv1ociv2organizationslugworkspaceslugnamespacenamemanifestsrevisionreference.go index f609546e..d3c5741c 100644 --- a/tests/mockserver/internal/handler/pathgetv1ociv2organizationslugworkspaceslugnamespacenamemanifestsrevisionreference.go +++ b/tests/mockserver/internal/handler/pathgetv1ociv2organizationslugworkspaceslugnamespacenamemanifestsrevisionreference.go @@ -56,7 +56,9 @@ func testGetManifestGetManifest0(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.Manifest{ + var respBody *components.Manifest = &components.Manifest{ + SchemaVersion: types.Int64(2), + MediaType: types.String("application/vnd.docker.distribution.manifest.v2+json"), Layers: []components.V2Descriptor{ components.V2Descriptor{ Digest: types.String("sha256:5d20c808ce198565ff70b3ed23a991dd49afac45dece63474b27ce6ed036adc6"), @@ -64,8 +66,6 @@ func testGetManifestGetManifest0(w http.ResponseWriter, req *http.Request) { Size: types.Int64(2107098), }, }, - MediaType: types.String("application/vnd.docker.distribution.manifest.v2+json"), - SchemaVersion: types.Int64(2), } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1organizationaddons.go b/tests/mockserver/internal/handler/pathgetv1organizationaddons.go index f90b3bda..836ba171 100644 --- a/tests/mockserver/internal/handler/pathgetv1organizationaddons.go +++ b/tests/mockserver/internal/handler/pathgetv1organizationaddons.go @@ -55,8 +55,10 @@ func testGetBillingAddOnsGetBillingAddOns0(w http.ResponseWriter, req *http.Requ http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.OrganizationBillingAddOnResponse{ - AddOns: []components.BillingAddOn{}, + var respBody *components.OrganizationBillingAddOnResponse = &components.OrganizationBillingAddOnResponse{ + AddOns: []components.BillingAddOn{ + components.BillingAddOnSnippetAi, + }, } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1organizationorganizationid.go b/tests/mockserver/internal/handler/pathgetv1organizationorganizationid.go index d1eadb2f..24def307 100644 --- a/tests/mockserver/internal/handler/pathgetv1organizationorganizationid.go +++ b/tests/mockserver/internal/handler/pathgetv1organizationorganizationid.go @@ -56,15 +56,15 @@ func testGetOrganizationGetOrganization0(w http.ResponseWriter, req *http.Reques http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.Organization{ - AccountType: components.AccountTypeBusiness, - CreatedAt: types.MustTimeFromString("2023-09-05T11:33:52.011Z"), + var respBody *components.Organization = &components.Organization{ ID: "", Name: "", Slug: "", - SsoActivated: false, + AccountType: components.AccountTypeBusiness, TelemetryDisabled: false, + CreatedAt: types.MustTimeFromString("2023-09-05T11:33:52.011Z"), UpdatedAt: types.MustTimeFromString("2023-07-26T06:33:15.810Z"), + SsoActivated: false, } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1organizations.go b/tests/mockserver/internal/handler/pathgetv1organizations.go index 88d83d39..cb6d56f3 100644 --- a/tests/mockserver/internal/handler/pathgetv1organizations.go +++ b/tests/mockserver/internal/handler/pathgetv1organizations.go @@ -56,16 +56,16 @@ func testGetOrganizationsGetOrganizations0(w http.ResponseWriter, req *http.Requ http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := []components.Organization{ + var respBody []components.Organization = []components.Organization{ components.Organization{ - AccountType: components.AccountTypeFree, - CreatedAt: types.MustTimeFromString("2023-10-18T22:25:06.537Z"), ID: "", Name: "", Slug: "", - SsoActivated: true, + AccountType: components.AccountTypeFree, TelemetryDisabled: false, + CreatedAt: types.MustTimeFromString("2023-10-18T22:25:06.537Z"), UpdatedAt: types.MustTimeFromString("2022-01-18T20:59:19.735Z"), + SsoActivated: true, }, } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1organizationusage.go b/tests/mockserver/internal/handler/pathgetv1organizationusage.go index e3e72423..ef5e3fde 100644 --- a/tests/mockserver/internal/handler/pathgetv1organizationusage.go +++ b/tests/mockserver/internal/handler/pathgetv1organizationusage.go @@ -55,35 +55,22 @@ func testGetOrganizationUsageGetOrganizationUsage0(w http.ResponseWriter, req *h http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.OrganizationUsageResponse{ - AllowedLanguages: []string{}, - TotalAllowedLanguages: 863126, + var respBody *components.OrganizationUsageResponse = &components.OrganizationUsageResponse{ Usage: []components.OrganizationUsage{ components.OrganizationUsage{ - Accessible: false, - AccessibleFeatures: []string{ - "", - }, - GenLockIds: []string{ - "", - "", - "", - }, - Language: "", - MaxOperations: 224089, NumberOfOperations: 939867, + MaxOperations: 224089, + Language: "", UsedFeatures: []string{ "", "", "", }, - Workspaces: []string{ + AccessibleFeatures: []string{ "", }, - }, - components.OrganizationUsage{ Accessible: false, - AccessibleFeatures: []string{ + Workspaces: []string{ "", }, GenLockIds: []string{ @@ -91,18 +78,31 @@ func testGetOrganizationUsageGetOrganizationUsage0(w http.ResponseWriter, req *h "", "", }, - Language: "", - MaxOperations: 863126, + }, + components.OrganizationUsage{ NumberOfOperations: 478406, + MaxOperations: 863126, + Language: "", UsedFeatures: []string{ "", "", }, + AccessibleFeatures: []string{ + "", + }, + Accessible: false, Workspaces: []string{ "", }, + GenLockIds: []string{ + "", + "", + "", + }, }, }, + TotalAllowedLanguages: 863126, + AllowedLanguages: []string{}, } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1publishingtokens.go b/tests/mockserver/internal/handler/pathgetv1publishingtokens.go index e1ba9724..19cb9541 100644 --- a/tests/mockserver/internal/handler/pathgetv1publishingtokens.go +++ b/tests/mockserver/internal/handler/pathgetv1publishingtokens.go @@ -56,41 +56,38 @@ func testGetPublishingTokenGetPublishingToken0(w http.ResponseWriter, req *http. http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := []components.PublishingToken{ + var respBody []components.PublishingToken = []components.PublishingToken{ components.PublishingToken{ - CreatedAt: types.MustTimeFromString("2023-01-18T23:26:03.849Z"), - CreatedBy: "", ID: "", - OrganizationID: "", - TargetID: "", - TargetResource: components.TargetResourceDocument, Token: "", - TokenName: "", ValidUntil: types.MustTimeFromString("2024-08-24T11:59:25.466Z"), + TokenName: "", + TargetID: "", + CreatedAt: types.MustTimeFromString("2023-01-18T23:26:03.849Z"), + CreatedBy: "", + OrganizationID: "", WorkspaceID: "", }, components.PublishingToken{ - CreatedAt: types.MustTimeFromString("2023-08-07T04:00:26.830Z"), - CreatedBy: "", ID: "", - OrganizationID: "", - TargetID: "", - TargetResource: components.TargetResourceDocument, Token: "", - TokenName: "", ValidUntil: types.MustTimeFromString("2025-02-22T20:20:27.935Z"), + TokenName: "", + TargetID: "", + CreatedAt: types.MustTimeFromString("2023-08-07T04:00:26.830Z"), + CreatedBy: "", + OrganizationID: "", WorkspaceID: "", }, components.PublishingToken{ - CreatedAt: types.MustTimeFromString("2024-01-27T14:50:38.288Z"), - CreatedBy: "", ID: "", - OrganizationID: "", - TargetID: "", - TargetResource: components.TargetResourceDocument, Token: "", - TokenName: "", ValidUntil: types.MustTimeFromString("2024-10-22T15:05:16.239Z"), + TokenName: "", + TargetID: "", + CreatedAt: types.MustTimeFromString("2024-01-27T14:50:38.288Z"), + CreatedBy: "", + OrganizationID: "", WorkspaceID: "", }, } diff --git a/tests/mockserver/internal/handler/pathgetv1publishingtokenstokenid.go b/tests/mockserver/internal/handler/pathgetv1publishingtokenstokenid.go index 79e5fabb..6dc951d2 100644 --- a/tests/mockserver/internal/handler/pathgetv1publishingtokenstokenid.go +++ b/tests/mockserver/internal/handler/pathgetv1publishingtokenstokenid.go @@ -56,16 +56,15 @@ func testGetPublishingTokenByIDGetPublishingTokenById0(w http.ResponseWriter, re http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.PublishingToken{ - CreatedAt: types.MustTimeFromString("2025-10-20T08:51:57.553Z"), - CreatedBy: "", + var respBody *components.PublishingToken = &components.PublishingToken{ ID: "", - OrganizationID: "", - TargetID: "", - TargetResource: components.TargetResourceDocument, Token: "", + ValidUntil: types.MustTimeFromString("2024-12-08T21:35:55.501Z"), TokenName: "", - ValidUntil: types.MustTimeFromString("2024-04-24T14:17:38.418Z"), + TargetID: "", + CreatedAt: types.MustTimeFromString("2025-10-20T08:51:57.553Z"), + CreatedBy: "", + OrganizationID: "", WorkspaceID: "", } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1publishingtokenstokenidmetadata.go b/tests/mockserver/internal/handler/pathgetv1publishingtokenstokenidmetadata.go index d56cbfc4..b480ea9a 100644 --- a/tests/mockserver/internal/handler/pathgetv1publishingtokenstokenidmetadata.go +++ b/tests/mockserver/internal/handler/pathgetv1publishingtokenstokenidmetadata.go @@ -55,7 +55,7 @@ func testGetPublishingTokenPublicMetadataGetPublishingTokenPublicMetadata0(w htt http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &operations.GetPublishingTokenPublicMetadataResponseBody{} + var respBody *operations.GetPublishingTokenPublicMetadataResponseBody = &operations.GetPublishingTokenPublicMetadataResponseBody{} respBodyBytes, err := utils.MarshalJSON(respBody, "", true) if err != nil { diff --git a/tests/mockserver/internal/handler/pathgetv1reportschangesdocumentchecksum.go b/tests/mockserver/internal/handler/pathgetv1reportschangesdocumentchecksum.go index 5ed5775c..a0fe7db7 100644 --- a/tests/mockserver/internal/handler/pathgetv1reportschangesdocumentchecksum.go +++ b/tests/mockserver/internal/handler/pathgetv1reportschangesdocumentchecksum.go @@ -55,7 +55,7 @@ func testGetChangesReportSignedURLGetChangesReportSignedUrl0(w http.ResponseWrit http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &operations.GetChangesReportSignedURLSignedAccess{ + var respBody *operations.GetChangesReportSignedURLSignedAccess = &operations.GetChangesReportSignedURLSignedAccess{ URL: "https://rosy-masterpiece.biz/", } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1reportslintingdocumentchecksum.go b/tests/mockserver/internal/handler/pathgetv1reportslintingdocumentchecksum.go index 1a80ccc8..8e2ec5c2 100644 --- a/tests/mockserver/internal/handler/pathgetv1reportslintingdocumentchecksum.go +++ b/tests/mockserver/internal/handler/pathgetv1reportslintingdocumentchecksum.go @@ -55,7 +55,7 @@ func testGetLintingReportSignedURLGetLintingReportSignedUrl0(w http.ResponseWrit http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &operations.GetLintingReportSignedURLSignedAccess{ + var respBody *operations.GetLintingReportSignedURLSignedAccess = &operations.GetLintingReportSignedURLSignedAccess{ URL: "https://negligible-merit.info", } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1schemastore.go b/tests/mockserver/internal/handler/pathgetv1schemastore.go index 92251cfc..b70fa188 100644 --- a/tests/mockserver/internal/handler/pathgetv1schemastore.go +++ b/tests/mockserver/internal/handler/pathgetv1schemastore.go @@ -61,13 +61,13 @@ func testGetSchemaStoreItemGetSchemaStoreItem0(w http.ResponseWriter, req *http. http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.SchemaStoreItem{ - CreatedAt: types.MustTimeFromString("2023-02-14T01:44:55.437Z"), - Format: components.FormatYaml, + var respBody *components.SchemaStoreItem = &components.SchemaStoreItem{ ID: "", + Spec: "", PackageName: "", SDKClassname: "", - Spec: "", + CreatedAt: types.MustTimeFromString("2023-02-14T01:44:55.437Z"), + Format: components.FormatYaml, } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1user.go b/tests/mockserver/internal/handler/pathgetv1user.go index 57a15c89..22f9956c 100644 --- a/tests/mockserver/internal/handler/pathgetv1user.go +++ b/tests/mockserver/internal/handler/pathgetv1user.go @@ -56,16 +56,16 @@ func testGetUserGetUser0(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.User{ - Admin: false, - Confirmed: true, - CreatedAt: types.MustTimeFromString("2024-09-05T08:59:40.988Z"), - DisplayName: "Tianna_Prohaska", + var respBody *components.User = &components.User{ + ID: "", Email: "Morton82@gmail.com", EmailVerified: false, - ID: "", - UpdatedAt: types.MustTimeFromString("2022-08-28T03:26:52.335Z"), + DisplayName: "Tianna_Prohaska", + Confirmed: true, Whitelisted: true, + Admin: false, + CreatedAt: types.MustTimeFromString("2024-09-05T08:59:40.988Z"), + UpdatedAt: types.MustTimeFromString("2022-08-28T03:26:52.335Z"), } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1workspace.go b/tests/mockserver/internal/handler/pathgetv1workspace.go index 7d43e536..70d83556 100644 --- a/tests/mockserver/internal/handler/pathgetv1workspace.go +++ b/tests/mockserver/internal/handler/pathgetv1workspace.go @@ -56,17 +56,7 @@ func testGetWorkspaceByContextGetWorkspaceByContext0(w http.ResponseWriter, req http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.WorkspaceAndOrganization{ - Organization: components.Organization{ - AccountType: components.AccountTypeBusiness, - CreatedAt: types.MustTimeFromString("2023-09-05T11:33:52.011Z"), - ID: "", - Name: "", - Slug: "", - SsoActivated: false, - TelemetryDisabled: false, - UpdatedAt: types.MustTimeFromString("2023-07-26T06:33:15.810Z"), - }, + var respBody *components.WorkspaceAndOrganization = &components.WorkspaceAndOrganization{ Workspace: components.Workspace{ CreatedAt: types.MustTimeFromString("2024-11-29T01:50:48.954Z"), ID: "", @@ -77,6 +67,16 @@ func testGetWorkspaceByContextGetWorkspaceByContext0(w http.ResponseWriter, req UpdatedAt: types.MustTimeFromString("2023-05-10T02:28:23.533Z"), Verified: true, }, + Organization: components.Organization{ + ID: "", + Name: "", + Slug: "", + AccountType: components.AccountTypeBusiness, + TelemetryDisabled: false, + CreatedAt: types.MustTimeFromString("2023-09-05T11:33:52.011Z"), + UpdatedAt: types.MustTimeFromString("2023-07-26T06:33:15.810Z"), + SsoActivated: false, + }, } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathgetv1workspaceaccess.go b/tests/mockserver/internal/handler/pathgetv1workspaceaccess.go index e27e3402..b4947244 100644 --- a/tests/mockserver/internal/handler/pathgetv1workspaceaccess.go +++ b/tests/mockserver/internal/handler/pathgetv1workspaceaccess.go @@ -55,7 +55,7 @@ func testGetWorkspaceAccessGetWorkspaceAccess0(w http.ResponseWriter, req *http. http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.AccessDetails{ + var respBody *components.AccessDetails = &components.AccessDetails{ GenerationAllowed: true, Message: "", } diff --git a/tests/mockserver/internal/handler/pathgetv1workspaces.go b/tests/mockserver/internal/handler/pathgetv1workspaces.go index 5004223a..8d1c0277 100644 --- a/tests/mockserver/internal/handler/pathgetv1workspaces.go +++ b/tests/mockserver/internal/handler/pathgetv1workspaces.go @@ -56,7 +56,7 @@ func testGetWorkspacesGetWorkspaces0(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := []components.Workspace{ + var respBody []components.Workspace = []components.Workspace{ components.Workspace{ CreatedAt: types.MustTimeFromString("2022-03-06T21:36:22.528Z"), ID: "", diff --git a/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceid.go b/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceid.go index b59ed97f..53f450bb 100644 --- a/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceid.go +++ b/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceid.go @@ -56,7 +56,7 @@ func testGetWorkspaceGetWorkspace0(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.Workspace{ + var respBody *components.Workspace = &components.Workspace{ CreatedAt: types.MustTimeFromString("2024-11-17T10:14:22.985Z"), ID: "", Name: "", diff --git a/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceidfeatureflags.go b/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceidfeatureflags.go index 2c720172..8b674d67 100644 --- a/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceidfeatureflags.go +++ b/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceidfeatureflags.go @@ -55,7 +55,7 @@ func testGetWorkspaceFeatureFlagsGetWorkspaceFeatureFlags0(w http.ResponseWriter http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.WorkspaceFeatureFlagResponse{} + var respBody *components.WorkspaceFeatureFlagResponse = &components.WorkspaceFeatureFlagResponse{} respBodyBytes, err := utils.MarshalJSON(respBody, "", true) if err != nil { diff --git a/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceidsettings.go b/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceidsettings.go index 2b1f28d4..b6c148bc 100644 --- a/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceidsettings.go +++ b/tests/mockserver/internal/handler/pathgetv1workspaceworkspaceidsettings.go @@ -56,11 +56,11 @@ func testGetWorkspaceSettingsGetWorkspaceSettings0(w http.ResponseWriter, req *h http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.WorkspaceSettings{ + var respBody *components.WorkspaceSettings = &components.WorkspaceSettings{ + WorkspaceID: "", + WebhookURL: "https://different-amendment.com/", CreatedAt: types.MustTimeFromString("2024-05-29T22:34:47.605Z"), UpdatedAt: types.MustTimeFromString("2023-02-24T21:50:01.663Z"), - WebhookURL: "https://different-amendment.com/", - WorkspaceID: "", } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathpostv1codesamplepreview.go b/tests/mockserver/internal/handler/pathpostv1codesamplepreview.go index b37b455f..9c3dd035 100644 --- a/tests/mockserver/internal/handler/pathpostv1codesamplepreview.go +++ b/tests/mockserver/internal/handler/pathpostv1codesamplepreview.go @@ -21,6 +21,8 @@ func pathPostV1CodeSamplePreview(dir *logging.HTTPFileDirectory, rt *tracking.Re count := rt.GetRequestCount(test, instanceID) switch fmt.Sprintf("%s[%d]", test, count) { + case "generateCodeSamplePreview-default[0]": + dir.HandlerFunc("generateCodeSamplePreview", testGenerateCodeSamplePreviewGenerateCodeSamplePreviewDefault0)(w, req) case "generateCodeSamplePreview[0]": dir.HandlerFunc("generateCodeSamplePreview", testGenerateCodeSamplePreviewGenerateCodeSamplePreview0)(w, req) default: @@ -29,7 +31,7 @@ func pathPostV1CodeSamplePreview(dir *logging.HTTPFileDirectory, rt *tracking.Re } } -func testGenerateCodeSamplePreviewGenerateCodeSamplePreview0(w http.ResponseWriter, req *http.Request) { +func testGenerateCodeSamplePreviewGenerateCodeSamplePreviewDefault0(w http.ResponseWriter, req *http.Request) { if err := assert.SecurityAuthorizationHeader(req, true, "Bearer"); err != nil { log.Printf("assertion error: %s\n", err) http.Error(w, err.Error(), http.StatusUnauthorized) @@ -60,9 +62,13 @@ func testGenerateCodeSamplePreviewGenerateCodeSamplePreview0(w http.ResponseWrit http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.UsageSnippets{ + var respBody *components.UsageSnippets = &components.UsageSnippets{ Snippets: []components.UsageSnippet{ components.UsageSnippet{ + Path: "/pet/{id}", + Method: "get", + OperationID: "getPetById", + Language: "typescript", Code: "import { Petstore } from \"petstore-sdk\";\n" + "\n" + "const petstore = new Petstore({\n" + @@ -79,10 +85,78 @@ func testGenerateCodeSamplePreviewGenerateCodeSamplePreview0(w http.ResponseWrit "}\n" + "\n" + "run();", - Language: "typescript", + }, + }, + } + respBodyBytes, err := utils.MarshalJSON(respBody, "", true) + + if err != nil { + http.Error( + w, + "Unable to encode response body as JSON: "+err.Error(), + http.StatusInternalServerError, + ) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write(respBodyBytes) +} + +func testGenerateCodeSamplePreviewGenerateCodeSamplePreview0(w http.ResponseWriter, req *http.Request) { + if err := assert.SecurityAuthorizationHeader(req, true, "Bearer"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.SecurityHeader(req, "x-api-key", true); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.SecurityHeader(req, "x-workspace-identifier", true); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.ContentType(req, "multipart/form-data", true); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + if err := assert.AcceptHeader(req, []string{"application/json"}); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + if err := assert.HeaderExists(req, "User-Agent"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + var respBody *components.UsageSnippets = &components.UsageSnippets{ + Snippets: []components.UsageSnippet{ + components.UsageSnippet{ + Path: "/pet/{id}", Method: "get", OperationID: "getPetById", - Path: "/pet/{id}", + Language: "typescript", + Code: "import { Petstore } from \"petstore-sdk\";\n" + + "\n" + + "const petstore = new Petstore({\n" + + " apiKey: \"\",\n" + + "});\n" + + "\n" + + "async function run() {\n" + + " const result = await petstore.pet.getById({\n" + + " id: 137396,\n" + + " });\n" + + "\n" + + " // Handle the result\n" + + " console.log(result);\n" + + "}\n" + + "\n" + + "run();", }, }, } diff --git a/tests/mockserver/internal/handler/pathpostv1codesamplepreviewasync.go b/tests/mockserver/internal/handler/pathpostv1codesamplepreviewasync.go index 6fa80435..af1ae296 100644 --- a/tests/mockserver/internal/handler/pathpostv1codesamplepreviewasync.go +++ b/tests/mockserver/internal/handler/pathpostv1codesamplepreviewasync.go @@ -61,7 +61,7 @@ func testGenerateCodeSamplePreviewAsyncGenerateCodeSamplePreviewAsync0(w http.Re http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &operations.GenerateCodeSamplePreviewAsyncResponseBody{ + var respBody *operations.GenerateCodeSamplePreviewAsyncResponseBody = &operations.GenerateCodeSamplePreviewAsyncResponseBody{ JobID: "", Status: components.CodeSamplesJobStatusRunning, } diff --git a/tests/mockserver/internal/handler/pathpostv1githubconfigurecodesamples.go b/tests/mockserver/internal/handler/pathpostv1githubconfigurecodesamples.go index 6e66152a..73bb2ebe 100644 --- a/tests/mockserver/internal/handler/pathpostv1githubconfigurecodesamples.go +++ b/tests/mockserver/internal/handler/pathpostv1githubconfigurecodesamples.go @@ -60,11 +60,11 @@ func testGithubConfigureCodeSamplesGithubConfigureCodeSamples0(w http.ResponseWr http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.GithubConfigureCodeSamplesResponse{ - CodeSampleOverlayRegistryURL: "https://giving-handover.net", + var respBody *components.GithubConfigureCodeSamplesResponse = &components.GithubConfigureCodeSamplesResponse{ Source: components.WorkflowDocument{ Location: "", }, + CodeSampleOverlayRegistryURL: "https://giving-handover.net", } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathpostv1organization.go b/tests/mockserver/internal/handler/pathpostv1organization.go index 9ddeaf2b..6bf755f9 100644 --- a/tests/mockserver/internal/handler/pathpostv1organization.go +++ b/tests/mockserver/internal/handler/pathpostv1organization.go @@ -61,15 +61,15 @@ func testCreateOrganizationCreateOrganization0(w http.ResponseWriter, req *http. http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.Organization{ - AccountType: components.AccountTypeFree, - CreatedAt: types.MustTimeFromString("2024-05-22T22:27:14.379Z"), + var respBody *components.Organization = &components.Organization{ ID: "", Name: "", Slug: "", - SsoActivated: false, + AccountType: components.AccountTypeFree, TelemetryDisabled: false, + CreatedAt: types.MustTimeFromString("2024-05-22T22:27:14.379Z"), UpdatedAt: types.MustTimeFromString("2022-01-01T02:16:41.381Z"), + SsoActivated: false, } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathpostv1organizationaddons.go b/tests/mockserver/internal/handler/pathpostv1organizationaddons.go index 44290ca7..55614a16 100644 --- a/tests/mockserver/internal/handler/pathpostv1organizationaddons.go +++ b/tests/mockserver/internal/handler/pathpostv1organizationaddons.go @@ -60,12 +60,8 @@ func testCreateBillingAddOnsCreateBillingAddOns0(w http.ResponseWriter, req *htt http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.OrganizationBillingAddOnResponse{ - AddOns: []components.BillingAddOn{ - components.BillingAddOnCustomCodeRegions, - components.BillingAddOnCustomCodeRegions, - components.BillingAddOnSDKTesting, - }, + var respBody *components.OrganizationBillingAddOnResponse = &components.OrganizationBillingAddOnResponse{ + AddOns: []components.BillingAddOn{}, } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathpostv1publishingtokens.go b/tests/mockserver/internal/handler/pathpostv1publishingtokens.go index 8a17a448..dee4c080 100644 --- a/tests/mockserver/internal/handler/pathpostv1publishingtokens.go +++ b/tests/mockserver/internal/handler/pathpostv1publishingtokens.go @@ -61,16 +61,15 @@ func testCreatePublishingTokenCreatePublishingToken0(w http.ResponseWriter, req http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.PublishingToken{ - CreatedAt: types.MustTimeFromString("2023-12-11T20:09:47.767Z"), - CreatedBy: "", + var respBody *components.PublishingToken = &components.PublishingToken{ ID: "", - OrganizationID: "", - TargetID: "", - TargetResource: components.TargetResourceDocument, Token: "", + ValidUntil: types.MustTimeFromString("2024-08-24T11:59:25.466Z"), TokenName: "", - ValidUntil: types.MustTimeFromString("2025-02-22T20:20:27.935Z"), + TargetID: "", + CreatedAt: types.MustTimeFromString("2023-12-11T20:09:47.767Z"), + CreatedBy: "", + OrganizationID: "", WorkspaceID: "", } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathpostv1reports.go b/tests/mockserver/internal/handler/pathpostv1reports.go index 4f28f8a7..dd311d18 100644 --- a/tests/mockserver/internal/handler/pathpostv1reports.go +++ b/tests/mockserver/internal/handler/pathpostv1reports.go @@ -60,7 +60,7 @@ func testUploadReportUploadReport0(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &operations.UploadReportUploadedReport{ + var respBody *operations.UploadedReport = &operations.UploadedReport{ URL: "https://cluttered-stall.info", } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathpostv1schemastore.go b/tests/mockserver/internal/handler/pathpostv1schemastore.go index 5abadd05..d7f0c6ad 100644 --- a/tests/mockserver/internal/handler/pathpostv1schemastore.go +++ b/tests/mockserver/internal/handler/pathpostv1schemastore.go @@ -61,13 +61,13 @@ func testCreateSchemaStoreItemCreateSchemaStoreItem0(w http.ResponseWriter, req http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.SchemaStoreItem{ - CreatedAt: types.MustTimeFromString("2024-08-06T03:45:46.936Z"), - Format: components.FormatJSON, + var respBody *components.SchemaStoreItem = &components.SchemaStoreItem{ ID: "", + Spec: "", PackageName: "", SDKClassname: "", - Spec: "", + CreatedAt: types.MustTimeFromString("2023-06-13T18:33:55.488Z"), + Format: components.FormatJSON, } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathpostv1shorturls.go b/tests/mockserver/internal/handler/pathpostv1shorturls.go index d9802d62..8147b4bc 100644 --- a/tests/mockserver/internal/handler/pathpostv1shorturls.go +++ b/tests/mockserver/internal/handler/pathpostv1shorturls.go @@ -60,9 +60,9 @@ func testCreateCreate0(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.ShortURL{ - FullURL: "https://probable-heating.com/", + var respBody *components.ShortURL = &components.ShortURL{ ShortURL: "https://standard-utilization.com/", + FullURL: "https://probable-heating.com/", } respBodyBytes, err := utils.MarshalJSON(respBody, "", true) diff --git a/tests/mockserver/internal/handler/pathpostv1suggestitems.go b/tests/mockserver/internal/handler/pathpostv1suggestitems.go index 162df046..28c3f814 100644 --- a/tests/mockserver/internal/handler/pathpostv1suggestitems.go +++ b/tests/mockserver/internal/handler/pathpostv1suggestitems.go @@ -59,7 +59,7 @@ func testSuggestItemsSuggestItems0(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := []string{ + var respBody []string = []string{ "", "", } diff --git a/tests/mockserver/internal/handler/pathpostv1workspace.go b/tests/mockserver/internal/handler/pathpostv1workspace.go index e9bc07ee..d31bf75d 100644 --- a/tests/mockserver/internal/handler/pathpostv1workspace.go +++ b/tests/mockserver/internal/handler/pathpostv1workspace.go @@ -61,7 +61,7 @@ func testCreateWorkspaceCreateWorkspace0(w http.ResponseWriter, req *http.Reques http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.Workspace{ + var respBody *components.Workspace = &components.Workspace{ CreatedAt: types.MustTimeFromString("2022-03-17T15:39:20.911Z"), ID: "", Name: "", diff --git a/tests/mockserver/internal/handler/pathpostv1workspacefeatureflags.go b/tests/mockserver/internal/handler/pathpostv1workspacefeatureflags.go index cbc92399..61331612 100644 --- a/tests/mockserver/internal/handler/pathpostv1workspacefeatureflags.go +++ b/tests/mockserver/internal/handler/pathpostv1workspacefeatureflags.go @@ -60,7 +60,7 @@ func testSetWorkspaceFeatureFlagsSetWorkspaceFeatureFlags0(w http.ResponseWriter http.Error(w, err.Error(), http.StatusBadRequest) return } - respBody := &components.WorkspaceFeatureFlagResponse{} + var respBody *components.WorkspaceFeatureFlagResponse = &components.WorkspaceFeatureFlagResponse{} respBodyBytes, err := utils.MarshalJSON(respBody, "", true) if err != nil { diff --git a/tests/mockserver/internal/sdk/models/components/accessdetails.go b/tests/mockserver/internal/sdk/models/components/accessdetails.go index a9a9817d..ff99a886 100644 --- a/tests/mockserver/internal/sdk/models/components/accessdetails.go +++ b/tests/mockserver/internal/sdk/models/components/accessdetails.go @@ -38,8 +38,8 @@ func (e *Level) UnmarshalJSON(data []byte) error { type AccessDetails struct { GenerationAllowed bool `json:"generation_allowed"` - Level *Level `json:"level,omitempty"` Message string `json:"message"` + Level *Level `json:"level,omitempty"` } func (o *AccessDetails) GetGenerationAllowed() bool { @@ -49,16 +49,16 @@ func (o *AccessDetails) GetGenerationAllowed() bool { return o.GenerationAllowed } -func (o *AccessDetails) GetLevel() *Level { +func (o *AccessDetails) GetMessage() string { if o == nil { - return nil + return "" } - return o.Level + return o.Message } -func (o *AccessDetails) GetMessage() string { +func (o *AccessDetails) GetLevel() *Level { if o == nil { - return "" + return nil } - return o.Message + return o.Level } diff --git a/tests/mockserver/internal/sdk/models/components/accesstoken.go b/tests/mockserver/internal/sdk/models/components/accesstoken.go index 9734ce3e..002c840a 100644 --- a/tests/mockserver/internal/sdk/models/components/accesstoken.go +++ b/tests/mockserver/internal/sdk/models/components/accesstoken.go @@ -11,12 +11,12 @@ type Claims struct { } type AccessTokenUser struct { + Email *string `json:"email,omitempty"` + ID *string `json:"id,omitempty"` + DisplayName *string `json:"display_name,omitempty"` Admin *bool `json:"admin,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - Email *string `json:"email,omitempty"` EmailVerified *bool `json:"email_verified,omitempty"` - ID *string `json:"id,omitempty"` } func (a AccessTokenUser) MarshalJSON() ([]byte, error) { @@ -24,24 +24,24 @@ func (a AccessTokenUser) MarshalJSON() ([]byte, error) { } func (a *AccessTokenUser) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &a, "", false, nil); err != nil { return err } return nil } -func (o *AccessTokenUser) GetAdmin() *bool { +func (o *AccessTokenUser) GetEmail() *string { if o == nil { return nil } - return o.Admin + return o.Email } -func (o *AccessTokenUser) GetCreatedAt() *time.Time { +func (o *AccessTokenUser) GetID() *string { if o == nil { return nil } - return o.CreatedAt + return o.ID } func (o *AccessTokenUser) GetDisplayName() *string { @@ -51,80 +51,80 @@ func (o *AccessTokenUser) GetDisplayName() *string { return o.DisplayName } -func (o *AccessTokenUser) GetEmail() *string { +func (o *AccessTokenUser) GetAdmin() *bool { if o == nil { return nil } - return o.Email + return o.Admin } -func (o *AccessTokenUser) GetEmailVerified() *bool { +func (o *AccessTokenUser) GetCreatedAt() *time.Time { if o == nil { return nil } - return o.EmailVerified + return o.CreatedAt } -func (o *AccessTokenUser) GetID() *string { +func (o *AccessTokenUser) GetEmailVerified() *bool { if o == nil { return nil } - return o.ID + return o.EmailVerified } -type Workspaces struct { - AccountType *AccountType `json:"account_type,omitempty"` +type AccessTokenWorkspace struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` + AccountType *AccountType `json:"account_type,omitempty"` } -func (w Workspaces) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(w, "", false) +func (a AccessTokenWorkspace) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) } -func (w *Workspaces) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { +func (a *AccessTokenWorkspace) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, nil); err != nil { return err } return nil } -func (o *Workspaces) GetAccountType() *AccountType { +func (o *AccessTokenWorkspace) GetID() *string { if o == nil { return nil } - return o.AccountType + return o.ID } -func (o *Workspaces) GetID() *string { +func (o *AccessTokenWorkspace) GetName() *string { if o == nil { return nil } - return o.ID + return o.Name } -func (o *Workspaces) GetName() *string { +func (o *AccessTokenWorkspace) GetUpdatedAt() *time.Time { if o == nil { return nil } - return o.Name + return o.UpdatedAt } -func (o *Workspaces) GetUpdatedAt() *time.Time { +func (o *AccessTokenWorkspace) GetAccountType() *AccountType { if o == nil { return nil } - return o.UpdatedAt + return o.AccountType } // An AccessToken is a token that can be used to authenticate with the Speakeasy API. type AccessToken struct { - AccessToken string `json:"access_token"` - Claims Claims `json:"claims"` - FeatureFlags []FeatureFlag `json:"feature_flags,omitempty"` - User AccessTokenUser `json:"user"` - Workspaces []Workspaces `json:"workspaces,omitempty"` + AccessToken string `json:"access_token"` + Claims Claims `json:"claims"` + User AccessTokenUser `json:"user"` + Workspaces []AccessTokenWorkspace `json:"workspaces,omitempty"` + FeatureFlags []FeatureFlag `json:"feature_flags,omitempty"` } func (o *AccessToken) GetAccessToken() string { @@ -141,13 +141,6 @@ func (o *AccessToken) GetClaims() Claims { return o.Claims } -func (o *AccessToken) GetFeatureFlags() []FeatureFlag { - if o == nil { - return nil - } - return o.FeatureFlags -} - func (o *AccessToken) GetUser() AccessTokenUser { if o == nil { return AccessTokenUser{} @@ -155,9 +148,16 @@ func (o *AccessToken) GetUser() AccessTokenUser { return o.User } -func (o *AccessToken) GetWorkspaces() []Workspaces { +func (o *AccessToken) GetWorkspaces() []AccessTokenWorkspace { if o == nil { return nil } return o.Workspaces } + +func (o *AccessToken) GetFeatureFlags() []FeatureFlag { + if o == nil { + return nil + } + return o.FeatureFlags +} diff --git a/tests/mockserver/internal/sdk/models/components/annotations.go b/tests/mockserver/internal/sdk/models/components/annotations.go index 5d2f7f12..735293c6 100644 --- a/tests/mockserver/internal/sdk/models/components/annotations.go +++ b/tests/mockserver/internal/sdk/models/components/annotations.go @@ -4,50 +4,50 @@ package components // Annotations type Annotations struct { - // The authors of the image - OrgOpencontainersImageAuthors *string `json:"org.opencontainers.image.authors,omitempty"` // The time the image was created OrgOpencontainersImageCreated *string `json:"org.opencontainers.image.created,omitempty"` - // Human-readable description of the software packaged in the image - OrgOpencontainersImageDescription *string `json:"org.opencontainers.image.description,omitempty"` + // The authors of the image + OrgOpencontainersImageAuthors *string `json:"org.opencontainers.image.authors,omitempty"` + // The URL of the image + OrgOpencontainersImageURL *string `json:"org.opencontainers.image.url,omitempty"` // The documentation URL of the image OrgOpencontainersImageDocumentation *string `json:"org.opencontainers.image.documentation,omitempty"` - OrgOpencontainersImageLicenses *string `json:"org.opencontainers.image.licenses,omitempty"` - // Name of the reference for a target - OrgOpencontainersImageRefName *string `json:"org.opencontainers.image.ref.name,omitempty"` - // Source control revision identifier - OrgOpencontainersImageRevision *string `json:"org.opencontainers.image.revision,omitempty"` // The URL to get source code for building the image OrgOpencontainersImageSource *string `json:"org.opencontainers.image.source,omitempty"` - // Human-readable title of the image - OrgOpencontainersImageTitle *string `json:"org.opencontainers.image.title,omitempty"` - // The URL of the image - OrgOpencontainersImageURL *string `json:"org.opencontainers.image.url,omitempty"` - // Name of the distributing entity, organization or individual. - OrgOpencontainersImageVendor *string `json:"org.opencontainers.image.vendor,omitempty"` // The version of the packaged software OrgOpencontainersImageVersion *string `json:"org.opencontainers.image.version,omitempty"` + // Source control revision identifier + OrgOpencontainersImageRevision *string `json:"org.opencontainers.image.revision,omitempty"` + // Name of the distributing entity, organization or individual. + OrgOpencontainersImageVendor *string `json:"org.opencontainers.image.vendor,omitempty"` + OrgOpencontainersImageLicenses *string `json:"org.opencontainers.image.licenses,omitempty"` + // Name of the reference for a target + OrgOpencontainersImageRefName *string `json:"org.opencontainers.image.ref.name,omitempty"` + // Human-readable title of the image + OrgOpencontainersImageTitle *string `json:"org.opencontainers.image.title,omitempty"` + // Human-readable description of the software packaged in the image + OrgOpencontainersImageDescription *string `json:"org.opencontainers.image.description,omitempty"` } -func (o *Annotations) GetOrgOpencontainersImageAuthors() *string { +func (o *Annotations) GetOrgOpencontainersImageCreated() *string { if o == nil { return nil } - return o.OrgOpencontainersImageAuthors + return o.OrgOpencontainersImageCreated } -func (o *Annotations) GetOrgOpencontainersImageCreated() *string { +func (o *Annotations) GetOrgOpencontainersImageAuthors() *string { if o == nil { return nil } - return o.OrgOpencontainersImageCreated + return o.OrgOpencontainersImageAuthors } -func (o *Annotations) GetOrgOpencontainersImageDescription() *string { +func (o *Annotations) GetOrgOpencontainersImageURL() *string { if o == nil { return nil } - return o.OrgOpencontainersImageDescription + return o.OrgOpencontainersImageURL } func (o *Annotations) GetOrgOpencontainersImageDocumentation() *string { @@ -57,18 +57,18 @@ func (o *Annotations) GetOrgOpencontainersImageDocumentation() *string { return o.OrgOpencontainersImageDocumentation } -func (o *Annotations) GetOrgOpencontainersImageLicenses() *string { +func (o *Annotations) GetOrgOpencontainersImageSource() *string { if o == nil { return nil } - return o.OrgOpencontainersImageLicenses + return o.OrgOpencontainersImageSource } -func (o *Annotations) GetOrgOpencontainersImageRefName() *string { +func (o *Annotations) GetOrgOpencontainersImageVersion() *string { if o == nil { return nil } - return o.OrgOpencontainersImageRefName + return o.OrgOpencontainersImageVersion } func (o *Annotations) GetOrgOpencontainersImageRevision() *string { @@ -78,37 +78,37 @@ func (o *Annotations) GetOrgOpencontainersImageRevision() *string { return o.OrgOpencontainersImageRevision } -func (o *Annotations) GetOrgOpencontainersImageSource() *string { +func (o *Annotations) GetOrgOpencontainersImageVendor() *string { if o == nil { return nil } - return o.OrgOpencontainersImageSource + return o.OrgOpencontainersImageVendor } -func (o *Annotations) GetOrgOpencontainersImageTitle() *string { +func (o *Annotations) GetOrgOpencontainersImageLicenses() *string { if o == nil { return nil } - return o.OrgOpencontainersImageTitle + return o.OrgOpencontainersImageLicenses } -func (o *Annotations) GetOrgOpencontainersImageURL() *string { +func (o *Annotations) GetOrgOpencontainersImageRefName() *string { if o == nil { return nil } - return o.OrgOpencontainersImageURL + return o.OrgOpencontainersImageRefName } -func (o *Annotations) GetOrgOpencontainersImageVendor() *string { +func (o *Annotations) GetOrgOpencontainersImageTitle() *string { if o == nil { return nil } - return o.OrgOpencontainersImageVendor + return o.OrgOpencontainersImageTitle } -func (o *Annotations) GetOrgOpencontainersImageVersion() *string { +func (o *Annotations) GetOrgOpencontainersImageDescription() *string { if o == nil { return nil } - return o.OrgOpencontainersImageVersion + return o.OrgOpencontainersImageDescription } diff --git a/tests/mockserver/internal/sdk/models/components/apikeydetails.go b/tests/mockserver/internal/sdk/models/components/apikeydetails.go index 1b1653fb..5549db03 100644 --- a/tests/mockserver/internal/sdk/models/components/apikeydetails.go +++ b/tests/mockserver/internal/sdk/models/components/apikeydetails.go @@ -8,18 +8,18 @@ import ( ) type APIKeyDetails struct { - AccountTypeV2 AccountType `json:"account_type_v2"` - BillingAddOns []BillingAddOn `json:"billing_add_ons"` - EnabledFeatures []string `json:"enabled_features"` + WorkspaceID string `json:"workspace_id"` + WorkspaceSlug string `json:"workspace_slug"` + OrgSlug string `json:"org_slug"` + GenerationAccessUnlimited *bool `json:"generation_access_unlimited,omitempty"` + AccountTypeV2 AccountType `json:"account_type_v2"` + EnabledFeatures []string `json:"enabled_features"` + BillingAddOns []BillingAddOn `json:"billing_add_ons"` // Deprecated: This will be removed in a future release, please migrate away from it as soon as possible. - FeatureFlags []string `json:"feature_flags,omitempty"` - GenerationAccessUnlimited *bool `json:"generation_access_unlimited,omitempty"` - OrgSlug string `json:"org_slug"` - TelemetryDisabled bool `json:"telemetry_disabled"` + FeatureFlags []string `json:"feature_flags,omitempty"` + TelemetryDisabled bool `json:"telemetry_disabled"` // Workspace creation timestamp. WorkspaceCreatedAt time.Time `json:"workspace_created_at"` - WorkspaceID string `json:"workspace_id"` - WorkspaceSlug string `json:"workspace_slug"` } func (a APIKeyDetails) MarshalJSON() ([]byte, error) { @@ -27,78 +27,78 @@ func (a APIKeyDetails) MarshalJSON() ([]byte, error) { } func (a *APIKeyDetails) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &a, "", false, []string{"workspace_id", "workspace_slug", "org_slug", "account_type_v2", "enabled_features", "billing_add_ons", "telemetry_disabled", "workspace_created_at"}); err != nil { return err } return nil } -func (o *APIKeyDetails) GetAccountTypeV2() AccountType { +func (o *APIKeyDetails) GetWorkspaceID() string { if o == nil { - return AccountType("") + return "" } - return o.AccountTypeV2 + return o.WorkspaceID } -func (o *APIKeyDetails) GetBillingAddOns() []BillingAddOn { +func (o *APIKeyDetails) GetWorkspaceSlug() string { if o == nil { - return []BillingAddOn{} + return "" } - return o.BillingAddOns + return o.WorkspaceSlug } -func (o *APIKeyDetails) GetEnabledFeatures() []string { +func (o *APIKeyDetails) GetOrgSlug() string { if o == nil { - return []string{} + return "" } - return o.EnabledFeatures + return o.OrgSlug } -func (o *APIKeyDetails) GetFeatureFlags() []string { +func (o *APIKeyDetails) GetGenerationAccessUnlimited() *bool { if o == nil { return nil } - return o.FeatureFlags + return o.GenerationAccessUnlimited } -func (o *APIKeyDetails) GetGenerationAccessUnlimited() *bool { +func (o *APIKeyDetails) GetAccountTypeV2() AccountType { if o == nil { - return nil + return AccountType("") } - return o.GenerationAccessUnlimited + return o.AccountTypeV2 } -func (o *APIKeyDetails) GetOrgSlug() string { +func (o *APIKeyDetails) GetEnabledFeatures() []string { if o == nil { - return "" + return []string{} } - return o.OrgSlug + return o.EnabledFeatures } -func (o *APIKeyDetails) GetTelemetryDisabled() bool { +func (o *APIKeyDetails) GetBillingAddOns() []BillingAddOn { if o == nil { - return false + return []BillingAddOn{} } - return o.TelemetryDisabled + return o.BillingAddOns } -func (o *APIKeyDetails) GetWorkspaceCreatedAt() time.Time { +func (o *APIKeyDetails) GetFeatureFlags() []string { if o == nil { - return time.Time{} + return nil } - return o.WorkspaceCreatedAt + return o.FeatureFlags } -func (o *APIKeyDetails) GetWorkspaceID() string { +func (o *APIKeyDetails) GetTelemetryDisabled() bool { if o == nil { - return "" + return false } - return o.WorkspaceID + return o.TelemetryDisabled } -func (o *APIKeyDetails) GetWorkspaceSlug() string { +func (o *APIKeyDetails) GetWorkspaceCreatedAt() time.Time { if o == nil { - return "" + return time.Time{} } - return o.WorkspaceSlug + return o.WorkspaceCreatedAt } diff --git a/tests/mockserver/internal/sdk/models/components/clievent.go b/tests/mockserver/internal/sdk/models/components/clievent.go index f7f3a04e..97289a50 100644 --- a/tests/mockserver/internal/sdk/models/components/clievent.go +++ b/tests/mockserver/internal/sdk/models/components/clievent.go @@ -85,170 +85,170 @@ func (e *OpenapiDiffBumpType) UnmarshalJSON(data []byte) error { } type CliEvent struct { - // Remote commit ID. - CommitHead *string `json:"commit_head,omitempty"` - // Name of the CI environment. - ContinuousIntegrationEnvironment *string `json:"continuous_integration_environment,omitempty"` + // Unique identifier for each event. + ID string `json:"id"` + // Unique identifier for each execution of the CLI. + ExecutionID string `json:"execution_id"` + // Identifier of the workspace. + WorkspaceID string `json:"workspace_id"` + // Identifier of the Speakeasy API key. + SpeakeasyAPIKeyName string `json:"speakeasy_api_key_name"` + // Type of interaction. + InteractionType InteractionType `json:"interaction_type"` + // Timestamp when the event started, in local time. + LocalStartedAt time.Time `json:"local_started_at"` + // Timestamp when the event completed, in local time. + LocalCompletedAt *time.Time `json:"local_completed_at,omitempty"` // Timestamp when the event was created in the database. CreatedAt time.Time `json:"created_at"` + // Version of the Speakeasy CLI. + SpeakeasyVersion string `json:"speakeasy_version"` + // Indicates whether the event was successful. + Success bool `json:"success"` + // Full CLI command. + RawCommand *string `json:"raw_command,omitempty"` // Duration of the event in milliseconds. DurationMs *int64 `json:"duration_ms,omitempty"` - // Error message if the event was not successful. - Error *string `json:"error,omitempty"` - // Unique identifier for each execution of the CLI. - ExecutionID string `json:"execution_id"` - // Bump type of the lock file (calculated semver delta, custom change (manual release), or prerelease/graduate) - GenerateBumpType *GenerateBumpType `json:"generate_bump_type,omitempty"` - // Checksum of the configuration file (post generation) - GenerateConfigPostChecksum *string `json:"generate_config_post_checksum,omitempty"` + // Name of the CI environment. + ContinuousIntegrationEnvironment *string `json:"continuous_integration_environment,omitempty"` + // Link to the GitHub action run. + GhActionRunLink *string `json:"gh_action_run_link,omitempty"` + // Version of the GitHub action. + GhActionVersion *string `json:"gh_action_version,omitempty"` + // GitHub organization of the action. + GhActionOrganization *string `json:"gh_action_organization,omitempty"` + // The reference to a created pull request URL. + GhPullRequest *string `json:"gh_pull_request,omitempty"` + // Whether or not changes were committed from generation in the Github Action. + GhChangesCommitted *bool `json:"gh_changes_committed,omitempty"` + // GitHub Action ref value. + GhActionRef *string `json:"gh_action_ref,omitempty"` + // GitHub repository of the action. + GhActionRepository *string `json:"gh_action_repository,omitempty"` + // Label of the git repository. + RepoLabel *string `json:"repo_label,omitempty"` + // Remote commit ID. + CommitHead *string `json:"commit_head,omitempty"` + // Remote hostname. + Hostname *string `json:"hostname,omitempty"` + // User's name from git configuration. (not GitHub username) + GitUserName *string `json:"git_user_name,omitempty"` + // User email from git configuration. + GitUserEmail *string `json:"git_user_email,omitempty"` + // Default owner for git remote. + GitRemoteDefaultOwner *string `json:"git_remote_default_owner,omitempty"` + // Default repository name for git remote. + GitRemoteDefaultRepo *string `json:"git_remote_default_repo,omitempty"` + // Current working directory relative to the git root. + GitRelativeCwd *string `json:"git_relative_cwd,omitempty"` + // The target of the event. + GenerateTarget *string `json:"generate_target,omitempty"` + // The workflow name of the target. + GenerateTargetName *string `json:"generate_target_name,omitempty"` + // The version of the target. + GenerateTargetVersion *string `json:"generate_target_version,omitempty"` + // gen.lock ID (expected to be a uuid). + GenerateGenLockID *string `json:"generate_gen_lock_id,omitempty"` + // Checksum of the currently Rendered OpenAPI document. + ManagementDocChecksum *string `json:"management_doc_checksum,omitempty"` + // Version taken from info.version field of the Rendered OpenAPI document. + ManagementDocVersion *string `json:"management_doc_version,omitempty"` + // Version of the generation logic used. + GenerateVersion *string `json:"generate_version,omitempty"` + // Indicates whether tests were output. + GenerateOutputTests *bool `json:"generate_output_tests,omitempty"` + // Rendered configuration file (prior to generation) + GenerateConfigPreRaw *string `json:"generate_config_pre_raw,omitempty"` // Rendered configuration file (post generation) GenerateConfigPostRaw *string `json:"generate_config_post_raw,omitempty"` + // The version of the customer's SDK before we generated + GenerateConfigPreVersion *string `json:"generate_config_pre_version,omitempty"` // The version of the customer's SDK that we just generated GenerateConfigPostVersion *string `json:"generate_config_post_version,omitempty"` // Checksum of the configuration file (prior to generation) GenerateConfigPreChecksum *string `json:"generate_config_pre_checksum,omitempty"` - // Rendered configuration file (prior to generation) - GenerateConfigPreRaw *string `json:"generate_config_pre_raw,omitempty"` - // The version of the customer's SDK before we generated - GenerateConfigPreVersion *string `json:"generate_config_pre_version,omitempty"` + // Checksum of the configuration file (post generation) + GenerateConfigPostChecksum *string `json:"generate_config_post_checksum,omitempty"` // Eligible feature set during generation GenerateEligibleFeatures *string `json:"generate_eligible_features,omitempty"` - // gen.lock ID (expected to be a uuid). - GenerateGenLockID *string `json:"generate_gen_lock_id,omitempty"` + // Features prior to generation + GenerateGenLockPreFeatures *string `json:"generate_gen_lock_pre_features,omitempty"` // Features post generation GenerateGenLockPostFeatures *string `json:"generate_gen_lock_post_features,omitempty"` - // Blob digest of the Previous Generation - GenerateGenLockPreBlobDigest *string `json:"generate_gen_lock_pre_blob_digest,omitempty"` - // Checksum of the Previous Rendered OpenAPI document (prior to generation, via gen lock) - GenerateGenLockPreDocChecksum *string `json:"generate_gen_lock_pre_doc_checksum,omitempty"` // info.Version of the Previous Rendered OpenAPI document (prior to generation, via gen lock) GenerateGenLockPreDocVersion *string `json:"generate_gen_lock_pre_doc_version,omitempty"` - // Features prior to generation - GenerateGenLockPreFeatures *string `json:"generate_gen_lock_pre_features,omitempty"` - // Namespace name of the Previous Generation - GenerateGenLockPreNamespaceName *string `json:"generate_gen_lock_pre_namespace_name,omitempty"` - // Revision digest of the Previous Generation - GenerateGenLockPreRevisionDigest *string `json:"generate_gen_lock_pre_revision_digest,omitempty"` + // Checksum of the Previous Rendered OpenAPI document (prior to generation, via gen lock) + GenerateGenLockPreDocChecksum *string `json:"generate_gen_lock_pre_doc_checksum,omitempty"` // Artifact version for the Previous Generation GenerateGenLockPreVersion *string `json:"generate_gen_lock_pre_version,omitempty"` + // Revision digest of the Previous Generation + GenerateGenLockPreRevisionDigest *string `json:"generate_gen_lock_pre_revision_digest,omitempty"` + // Blob digest of the Previous Generation + GenerateGenLockPreBlobDigest *string `json:"generate_gen_lock_pre_blob_digest,omitempty"` + // Namespace name of the Previous Generation + GenerateGenLockPreNamespaceName *string `json:"generate_gen_lock_pre_namespace_name,omitempty"` + // Bump type of the lock file (calculated semver delta, custom change (manual release), or prerelease/graduate) + GenerateBumpType *GenerateBumpType `json:"generate_bump_type,omitempty"` // The number of operations ignored in generation. GenerateNumberOfOperationsIgnored *int64 `json:"generate_number_of_operations_ignored,omitempty"` // The number of operations used in generation. GenerateNumberOfOperationsUsed *int64 `json:"generate_number_of_operations_used,omitempty"` // The number of terraform resources used in generation. GenerateNumberOfTerraformResources *int64 `json:"generate_number_of_terraform_resources,omitempty"` - // Indicates whether tests were output. - GenerateOutputTests *bool `json:"generate_output_tests,omitempty"` // Indicates whether the target was considered published. GeneratePublished *bool `json:"generate_published,omitempty"` // Expected Repo URL, for use in documentation generation. GenerateRepoURL *string `json:"generate_repo_url,omitempty"` - // The target of the event. - GenerateTarget *string `json:"generate_target,omitempty"` - // The workflow name of the target. - GenerateTargetName *string `json:"generate_target_name,omitempty"` - // The version of the target. - GenerateTargetVersion *string `json:"generate_target_version,omitempty"` - // Version of the generation logic used. - GenerateVersion *string `json:"generate_version,omitempty"` - // GitHub organization of the action. - GhActionOrganization *string `json:"gh_action_organization,omitempty"` - // GitHub Action ref value. - GhActionRef *string `json:"gh_action_ref,omitempty"` - // GitHub repository of the action. - GhActionRepository *string `json:"gh_action_repository,omitempty"` - // Link to the GitHub action run. - GhActionRunLink *string `json:"gh_action_run_link,omitempty"` - // Version of the GitHub action. - GhActionVersion *string `json:"gh_action_version,omitempty"` - // Whether or not changes were committed from generation in the Github Action. - GhChangesCommitted *bool `json:"gh_changes_committed,omitempty"` - // The reference to a created pull request URL. - GhPullRequest *string `json:"gh_pull_request,omitempty"` - // Current working directory relative to the git root. - GitRelativeCwd *string `json:"git_relative_cwd,omitempty"` - // Default owner for git remote. - GitRemoteDefaultOwner *string `json:"git_remote_default_owner,omitempty"` - // Default repository name for git remote. - GitRemoteDefaultRepo *string `json:"git_remote_default_repo,omitempty"` - // User email from git configuration. - GitUserEmail *string `json:"git_user_email,omitempty"` - // User's name from git configuration. (not GitHub username) - GitUserName *string `json:"git_user_name,omitempty"` - // Remote hostname. - Hostname *string `json:"hostname,omitempty"` - // Unique identifier for each event. - ID string `json:"id"` - // Type of interaction. - InteractionType InteractionType `json:"interaction_type"` - // The last step of the event. - LastStep *string `json:"last_step,omitempty"` + // URL of the published package. + PublishPackageURL *string `json:"publish_package_url,omitempty"` + // Name of the published package. + PublishPackageName *string `json:"publish_package_name,omitempty"` + // Version of the published package. + PublishPackageVersion *string `json:"publish_package_version,omitempty"` + // Name of the registry where the package was published. + PublishPackageRegistryName *string `json:"publish_package_registry_name,omitempty"` + // The revision digest of the source. + SourceRevisionDigest *string `json:"source_revision_digest,omitempty"` + // The blob digest of the source. + SourceBlobDigest *string `json:"source_blob_digest,omitempty"` + // The namespace name of the source. + SourceNamespaceName *string `json:"source_namespace_name,omitempty"` // The checksum of the lint report. LintReportDigest *string `json:"lint_report_digest,omitempty"` // The number of errors in the lint report. LintReportErrorCount *int64 `json:"lint_report_error_count,omitempty"` - // The number of info messages in the lint report. - LintReportInfoCount *int64 `json:"lint_report_info_count,omitempty"` // The number of warnings in the lint report. LintReportWarningCount *int64 `json:"lint_report_warning_count,omitempty"` - // Timestamp when the event completed, in local time. - LocalCompletedAt *time.Time `json:"local_completed_at,omitempty"` - // Timestamp when the event started, in local time. - LocalStartedAt time.Time `json:"local_started_at"` - // Checksum of the currently Rendered OpenAPI document. - ManagementDocChecksum *string `json:"management_doc_checksum,omitempty"` - // Version taken from info.version field of the Rendered OpenAPI document. - ManagementDocVersion *string `json:"management_doc_version,omitempty"` - // Mermaid diagram - MermaidDiagram *string `json:"mermaid_diagram,omitempty"` + // The number of info messages in the lint report. + LintReportInfoCount *int64 `json:"lint_report_info_count,omitempty"` + // The checksum of the openapi diff report. + OpenapiDiffReportDigest *string `json:"openapi_diff_report_digest,omitempty"` + // The revision digest of the base source. + OpenapiDiffBaseSourceRevisionDigest *string `json:"openapi_diff_base_source_revision_digest,omitempty"` // The blob digest of the base source. OpenapiDiffBaseSourceBlobDigest *string `json:"openapi_diff_base_source_blob_digest,omitempty"` // The namespace name of the base source. OpenapiDiffBaseSourceNamespaceName *string `json:"openapi_diff_base_source_namespace_name,omitempty"` - // The revision digest of the base source. - OpenapiDiffBaseSourceRevisionDigest *string `json:"openapi_diff_base_source_revision_digest,omitempty"` // The number of breaking changes in the openapi diff report. OpenapiDiffBreakingChangesCount *int64 `json:"openapi_diff_breaking_changes_count,omitempty"` // Bump type of the lock file (calculated semver delta, or a custom change (manual release)) OpenapiDiffBumpType *OpenapiDiffBumpType `json:"openapi_diff_bump_type,omitempty"` - // The checksum of the openapi diff report. - OpenapiDiffReportDigest *string `json:"openapi_diff_report_digest,omitempty"` - // Name of the published package. - PublishPackageName *string `json:"publish_package_name,omitempty"` - // Name of the registry where the package was published. - PublishPackageRegistryName *string `json:"publish_package_registry_name,omitempty"` - // URL of the published package. - PublishPackageURL *string `json:"publish_package_url,omitempty"` - // Version of the published package. - PublishPackageVersion *string `json:"publish_package_version,omitempty"` - // Full CLI command. - RawCommand *string `json:"raw_command,omitempty"` - // Label of the git repository. - RepoLabel *string `json:"repo_label,omitempty"` - // The blob digest of the source. - SourceBlobDigest *string `json:"source_blob_digest,omitempty"` - // The namespace name of the source. - SourceNamespaceName *string `json:"source_namespace_name,omitempty"` - // The revision digest of the source. - SourceRevisionDigest *string `json:"source_revision_digest,omitempty"` - // Identifier of the Speakeasy API key. - SpeakeasyAPIKeyName string `json:"speakeasy_api_key_name"` - // Version of the Speakeasy CLI. - SpeakeasyVersion string `json:"speakeasy_version"` - // Indicates whether the event was successful. - Success bool `json:"success"` + // Error message if the event was not successful. + Error *string `json:"error,omitempty"` + // Mermaid diagram + MermaidDiagram *string `json:"mermaid_diagram,omitempty"` + // The last step of the event. + LastStep *string `json:"last_step,omitempty"` // The raw test report xml TestReportRaw *string `json:"test_report_raw,omitempty"` - // Workflow lock file (post execution) - WorkflowLockPostRaw *string `json:"workflow_lock_post_raw,omitempty"` - // Workflow lock file (prior to execution) - WorkflowLockPreRaw *string `json:"workflow_lock_pre_raw,omitempty"` - // Workflow file (post execution) - WorkflowPostRaw *string `json:"workflow_post_raw,omitempty"` // Workflow file (prior to execution) WorkflowPreRaw *string `json:"workflow_pre_raw,omitempty"` - // Identifier of the workspace. - WorkspaceID string `json:"workspace_id"` + // Workflow file (post execution) + WorkflowPostRaw *string `json:"workflow_post_raw,omitempty"` + // Workflow lock file (prior to execution) + WorkflowLockPreRaw *string `json:"workflow_lock_pre_raw,omitempty"` + // Workflow lock file (post execution) + WorkflowLockPostRaw *string `json:"workflow_lock_post_raw,omitempty"` } func (c CliEvent) MarshalJSON() ([]byte, error) { @@ -256,213 +256,206 @@ func (c CliEvent) MarshalJSON() ([]byte, error) { } func (c *CliEvent) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &c, "", false, []string{"id", "execution_id", "workspace_id", "speakeasy_api_key_name", "interaction_type", "local_started_at", "created_at", "speakeasy_version", "success"}); err != nil { return err } return nil } -func (o *CliEvent) GetCommitHead() *string { - if o == nil { - return nil - } - return o.CommitHead -} - -func (o *CliEvent) GetContinuousIntegrationEnvironment() *string { +func (o *CliEvent) GetID() string { if o == nil { - return nil + return "" } - return o.ContinuousIntegrationEnvironment + return o.ID } -func (o *CliEvent) GetCreatedAt() time.Time { +func (o *CliEvent) GetExecutionID() string { if o == nil { - return time.Time{} + return "" } - return o.CreatedAt + return o.ExecutionID } -func (o *CliEvent) GetDurationMs() *int64 { +func (o *CliEvent) GetWorkspaceID() string { if o == nil { - return nil + return "" } - return o.DurationMs + return o.WorkspaceID } -func (o *CliEvent) GetError() *string { +func (o *CliEvent) GetSpeakeasyAPIKeyName() string { if o == nil { - return nil + return "" } - return o.Error + return o.SpeakeasyAPIKeyName } -func (o *CliEvent) GetExecutionID() string { +func (o *CliEvent) GetInteractionType() InteractionType { if o == nil { - return "" + return InteractionType("") } - return o.ExecutionID + return o.InteractionType } -func (o *CliEvent) GetGenerateBumpType() *GenerateBumpType { +func (o *CliEvent) GetLocalStartedAt() time.Time { if o == nil { - return nil + return time.Time{} } - return o.GenerateBumpType + return o.LocalStartedAt } -func (o *CliEvent) GetGenerateConfigPostChecksum() *string { +func (o *CliEvent) GetLocalCompletedAt() *time.Time { if o == nil { return nil } - return o.GenerateConfigPostChecksum + return o.LocalCompletedAt } -func (o *CliEvent) GetGenerateConfigPostRaw() *string { +func (o *CliEvent) GetCreatedAt() time.Time { if o == nil { - return nil + return time.Time{} } - return o.GenerateConfigPostRaw + return o.CreatedAt } -func (o *CliEvent) GetGenerateConfigPostVersion() *string { +func (o *CliEvent) GetSpeakeasyVersion() string { if o == nil { - return nil + return "" } - return o.GenerateConfigPostVersion + return o.SpeakeasyVersion } -func (o *CliEvent) GetGenerateConfigPreChecksum() *string { +func (o *CliEvent) GetSuccess() bool { if o == nil { - return nil + return false } - return o.GenerateConfigPreChecksum + return o.Success } -func (o *CliEvent) GetGenerateConfigPreRaw() *string { +func (o *CliEvent) GetRawCommand() *string { if o == nil { return nil } - return o.GenerateConfigPreRaw + return o.RawCommand } -func (o *CliEvent) GetGenerateConfigPreVersion() *string { +func (o *CliEvent) GetDurationMs() *int64 { if o == nil { return nil } - return o.GenerateConfigPreVersion + return o.DurationMs } -func (o *CliEvent) GetGenerateEligibleFeatures() *string { +func (o *CliEvent) GetContinuousIntegrationEnvironment() *string { if o == nil { return nil } - return o.GenerateEligibleFeatures + return o.ContinuousIntegrationEnvironment } -func (o *CliEvent) GetGenerateGenLockID() *string { +func (o *CliEvent) GetGhActionRunLink() *string { if o == nil { return nil } - return o.GenerateGenLockID + return o.GhActionRunLink } -func (o *CliEvent) GetGenerateGenLockPostFeatures() *string { +func (o *CliEvent) GetGhActionVersion() *string { if o == nil { return nil } - return o.GenerateGenLockPostFeatures + return o.GhActionVersion } -func (o *CliEvent) GetGenerateGenLockPreBlobDigest() *string { +func (o *CliEvent) GetGhActionOrganization() *string { if o == nil { return nil } - return o.GenerateGenLockPreBlobDigest + return o.GhActionOrganization } -func (o *CliEvent) GetGenerateGenLockPreDocChecksum() *string { +func (o *CliEvent) GetGhPullRequest() *string { if o == nil { return nil } - return o.GenerateGenLockPreDocChecksum + return o.GhPullRequest } -func (o *CliEvent) GetGenerateGenLockPreDocVersion() *string { +func (o *CliEvent) GetGhChangesCommitted() *bool { if o == nil { return nil } - return o.GenerateGenLockPreDocVersion + return o.GhChangesCommitted } -func (o *CliEvent) GetGenerateGenLockPreFeatures() *string { +func (o *CliEvent) GetGhActionRef() *string { if o == nil { return nil } - return o.GenerateGenLockPreFeatures + return o.GhActionRef } -func (o *CliEvent) GetGenerateGenLockPreNamespaceName() *string { +func (o *CliEvent) GetGhActionRepository() *string { if o == nil { return nil } - return o.GenerateGenLockPreNamespaceName + return o.GhActionRepository } -func (o *CliEvent) GetGenerateGenLockPreRevisionDigest() *string { +func (o *CliEvent) GetRepoLabel() *string { if o == nil { return nil } - return o.GenerateGenLockPreRevisionDigest + return o.RepoLabel } -func (o *CliEvent) GetGenerateGenLockPreVersion() *string { +func (o *CliEvent) GetCommitHead() *string { if o == nil { return nil } - return o.GenerateGenLockPreVersion + return o.CommitHead } -func (o *CliEvent) GetGenerateNumberOfOperationsIgnored() *int64 { +func (o *CliEvent) GetHostname() *string { if o == nil { return nil } - return o.GenerateNumberOfOperationsIgnored + return o.Hostname } -func (o *CliEvent) GetGenerateNumberOfOperationsUsed() *int64 { +func (o *CliEvent) GetGitUserName() *string { if o == nil { return nil } - return o.GenerateNumberOfOperationsUsed + return o.GitUserName } -func (o *CliEvent) GetGenerateNumberOfTerraformResources() *int64 { +func (o *CliEvent) GetGitUserEmail() *string { if o == nil { return nil } - return o.GenerateNumberOfTerraformResources + return o.GitUserEmail } -func (o *CliEvent) GetGenerateOutputTests() *bool { +func (o *CliEvent) GetGitRemoteDefaultOwner() *string { if o == nil { return nil } - return o.GenerateOutputTests + return o.GitRemoteDefaultOwner } -func (o *CliEvent) GetGeneratePublished() *bool { +func (o *CliEvent) GetGitRemoteDefaultRepo() *string { if o == nil { return nil } - return o.GeneratePublished + return o.GitRemoteDefaultRepo } -func (o *CliEvent) GetGenerateRepoURL() *string { +func (o *CliEvent) GetGitRelativeCwd() *string { if o == nil { return nil } - return o.GenerateRepoURL + return o.GitRelativeCwd } func (o *CliEvent) GetGenerateTarget() *string { @@ -486,333 +479,340 @@ func (o *CliEvent) GetGenerateTargetVersion() *string { return o.GenerateTargetVersion } -func (o *CliEvent) GetGenerateVersion() *string { +func (o *CliEvent) GetGenerateGenLockID() *string { if o == nil { return nil } - return o.GenerateVersion + return o.GenerateGenLockID } -func (o *CliEvent) GetGhActionOrganization() *string { +func (o *CliEvent) GetManagementDocChecksum() *string { if o == nil { return nil } - return o.GhActionOrganization + return o.ManagementDocChecksum } -func (o *CliEvent) GetGhActionRef() *string { +func (o *CliEvent) GetManagementDocVersion() *string { if o == nil { return nil } - return o.GhActionRef + return o.ManagementDocVersion } -func (o *CliEvent) GetGhActionRepository() *string { +func (o *CliEvent) GetGenerateVersion() *string { if o == nil { return nil } - return o.GhActionRepository + return o.GenerateVersion } -func (o *CliEvent) GetGhActionRunLink() *string { +func (o *CliEvent) GetGenerateOutputTests() *bool { if o == nil { return nil } - return o.GhActionRunLink + return o.GenerateOutputTests } -func (o *CliEvent) GetGhActionVersion() *string { +func (o *CliEvent) GetGenerateConfigPreRaw() *string { if o == nil { return nil } - return o.GhActionVersion + return o.GenerateConfigPreRaw } -func (o *CliEvent) GetGhChangesCommitted() *bool { +func (o *CliEvent) GetGenerateConfigPostRaw() *string { if o == nil { return nil } - return o.GhChangesCommitted + return o.GenerateConfigPostRaw } -func (o *CliEvent) GetGhPullRequest() *string { +func (o *CliEvent) GetGenerateConfigPreVersion() *string { if o == nil { return nil } - return o.GhPullRequest + return o.GenerateConfigPreVersion } -func (o *CliEvent) GetGitRelativeCwd() *string { +func (o *CliEvent) GetGenerateConfigPostVersion() *string { if o == nil { return nil } - return o.GitRelativeCwd + return o.GenerateConfigPostVersion } -func (o *CliEvent) GetGitRemoteDefaultOwner() *string { +func (o *CliEvent) GetGenerateConfigPreChecksum() *string { if o == nil { return nil } - return o.GitRemoteDefaultOwner + return o.GenerateConfigPreChecksum } -func (o *CliEvent) GetGitRemoteDefaultRepo() *string { +func (o *CliEvent) GetGenerateConfigPostChecksum() *string { if o == nil { return nil } - return o.GitRemoteDefaultRepo + return o.GenerateConfigPostChecksum } -func (o *CliEvent) GetGitUserEmail() *string { +func (o *CliEvent) GetGenerateEligibleFeatures() *string { if o == nil { return nil } - return o.GitUserEmail + return o.GenerateEligibleFeatures } -func (o *CliEvent) GetGitUserName() *string { +func (o *CliEvent) GetGenerateGenLockPreFeatures() *string { if o == nil { return nil } - return o.GitUserName + return o.GenerateGenLockPreFeatures } -func (o *CliEvent) GetHostname() *string { +func (o *CliEvent) GetGenerateGenLockPostFeatures() *string { if o == nil { return nil } - return o.Hostname + return o.GenerateGenLockPostFeatures } -func (o *CliEvent) GetID() string { +func (o *CliEvent) GetGenerateGenLockPreDocVersion() *string { if o == nil { - return "" + return nil } - return o.ID + return o.GenerateGenLockPreDocVersion } -func (o *CliEvent) GetInteractionType() InteractionType { +func (o *CliEvent) GetGenerateGenLockPreDocChecksum() *string { if o == nil { - return InteractionType("") + return nil } - return o.InteractionType + return o.GenerateGenLockPreDocChecksum } -func (o *CliEvent) GetLastStep() *string { +func (o *CliEvent) GetGenerateGenLockPreVersion() *string { if o == nil { return nil } - return o.LastStep + return o.GenerateGenLockPreVersion } -func (o *CliEvent) GetLintReportDigest() *string { +func (o *CliEvent) GetGenerateGenLockPreRevisionDigest() *string { if o == nil { return nil } - return o.LintReportDigest + return o.GenerateGenLockPreRevisionDigest } -func (o *CliEvent) GetLintReportErrorCount() *int64 { +func (o *CliEvent) GetGenerateGenLockPreBlobDigest() *string { if o == nil { return nil } - return o.LintReportErrorCount + return o.GenerateGenLockPreBlobDigest } -func (o *CliEvent) GetLintReportInfoCount() *int64 { +func (o *CliEvent) GetGenerateGenLockPreNamespaceName() *string { if o == nil { return nil } - return o.LintReportInfoCount + return o.GenerateGenLockPreNamespaceName } -func (o *CliEvent) GetLintReportWarningCount() *int64 { +func (o *CliEvent) GetGenerateBumpType() *GenerateBumpType { if o == nil { return nil } - return o.LintReportWarningCount + return o.GenerateBumpType } -func (o *CliEvent) GetLocalCompletedAt() *time.Time { +func (o *CliEvent) GetGenerateNumberOfOperationsIgnored() *int64 { if o == nil { return nil } - return o.LocalCompletedAt + return o.GenerateNumberOfOperationsIgnored } -func (o *CliEvent) GetLocalStartedAt() time.Time { +func (o *CliEvent) GetGenerateNumberOfOperationsUsed() *int64 { if o == nil { - return time.Time{} + return nil } - return o.LocalStartedAt + return o.GenerateNumberOfOperationsUsed } -func (o *CliEvent) GetManagementDocChecksum() *string { +func (o *CliEvent) GetGenerateNumberOfTerraformResources() *int64 { if o == nil { return nil } - return o.ManagementDocChecksum + return o.GenerateNumberOfTerraformResources } -func (o *CliEvent) GetManagementDocVersion() *string { +func (o *CliEvent) GetGeneratePublished() *bool { if o == nil { return nil } - return o.ManagementDocVersion + return o.GeneratePublished } -func (o *CliEvent) GetMermaidDiagram() *string { +func (o *CliEvent) GetGenerateRepoURL() *string { if o == nil { return nil } - return o.MermaidDiagram + return o.GenerateRepoURL } -func (o *CliEvent) GetOpenapiDiffBaseSourceBlobDigest() *string { +func (o *CliEvent) GetPublishPackageURL() *string { if o == nil { return nil } - return o.OpenapiDiffBaseSourceBlobDigest + return o.PublishPackageURL } -func (o *CliEvent) GetOpenapiDiffBaseSourceNamespaceName() *string { +func (o *CliEvent) GetPublishPackageName() *string { if o == nil { return nil } - return o.OpenapiDiffBaseSourceNamespaceName + return o.PublishPackageName } -func (o *CliEvent) GetOpenapiDiffBaseSourceRevisionDigest() *string { +func (o *CliEvent) GetPublishPackageVersion() *string { if o == nil { return nil } - return o.OpenapiDiffBaseSourceRevisionDigest + return o.PublishPackageVersion } -func (o *CliEvent) GetOpenapiDiffBreakingChangesCount() *int64 { +func (o *CliEvent) GetPublishPackageRegistryName() *string { if o == nil { return nil } - return o.OpenapiDiffBreakingChangesCount + return o.PublishPackageRegistryName } -func (o *CliEvent) GetOpenapiDiffBumpType() *OpenapiDiffBumpType { +func (o *CliEvent) GetSourceRevisionDigest() *string { if o == nil { return nil } - return o.OpenapiDiffBumpType + return o.SourceRevisionDigest } -func (o *CliEvent) GetOpenapiDiffReportDigest() *string { +func (o *CliEvent) GetSourceBlobDigest() *string { if o == nil { return nil } - return o.OpenapiDiffReportDigest + return o.SourceBlobDigest } -func (o *CliEvent) GetPublishPackageName() *string { +func (o *CliEvent) GetSourceNamespaceName() *string { if o == nil { return nil } - return o.PublishPackageName + return o.SourceNamespaceName } -func (o *CliEvent) GetPublishPackageRegistryName() *string { +func (o *CliEvent) GetLintReportDigest() *string { if o == nil { return nil } - return o.PublishPackageRegistryName + return o.LintReportDigest } -func (o *CliEvent) GetPublishPackageURL() *string { +func (o *CliEvent) GetLintReportErrorCount() *int64 { if o == nil { return nil } - return o.PublishPackageURL + return o.LintReportErrorCount } -func (o *CliEvent) GetPublishPackageVersion() *string { +func (o *CliEvent) GetLintReportWarningCount() *int64 { if o == nil { return nil } - return o.PublishPackageVersion + return o.LintReportWarningCount } -func (o *CliEvent) GetRawCommand() *string { +func (o *CliEvent) GetLintReportInfoCount() *int64 { if o == nil { return nil } - return o.RawCommand + return o.LintReportInfoCount } -func (o *CliEvent) GetRepoLabel() *string { +func (o *CliEvent) GetOpenapiDiffReportDigest() *string { if o == nil { return nil } - return o.RepoLabel + return o.OpenapiDiffReportDigest } -func (o *CliEvent) GetSourceBlobDigest() *string { +func (o *CliEvent) GetOpenapiDiffBaseSourceRevisionDigest() *string { if o == nil { return nil } - return o.SourceBlobDigest + return o.OpenapiDiffBaseSourceRevisionDigest } -func (o *CliEvent) GetSourceNamespaceName() *string { +func (o *CliEvent) GetOpenapiDiffBaseSourceBlobDigest() *string { if o == nil { return nil } - return o.SourceNamespaceName + return o.OpenapiDiffBaseSourceBlobDigest } -func (o *CliEvent) GetSourceRevisionDigest() *string { +func (o *CliEvent) GetOpenapiDiffBaseSourceNamespaceName() *string { if o == nil { return nil } - return o.SourceRevisionDigest + return o.OpenapiDiffBaseSourceNamespaceName } -func (o *CliEvent) GetSpeakeasyAPIKeyName() string { +func (o *CliEvent) GetOpenapiDiffBreakingChangesCount() *int64 { if o == nil { - return "" + return nil } - return o.SpeakeasyAPIKeyName + return o.OpenapiDiffBreakingChangesCount } -func (o *CliEvent) GetSpeakeasyVersion() string { +func (o *CliEvent) GetOpenapiDiffBumpType() *OpenapiDiffBumpType { if o == nil { - return "" + return nil } - return o.SpeakeasyVersion + return o.OpenapiDiffBumpType } -func (o *CliEvent) GetSuccess() bool { +func (o *CliEvent) GetError() *string { if o == nil { - return false + return nil } - return o.Success + return o.Error } -func (o *CliEvent) GetTestReportRaw() *string { +func (o *CliEvent) GetMermaidDiagram() *string { if o == nil { return nil } - return o.TestReportRaw + return o.MermaidDiagram } -func (o *CliEvent) GetWorkflowLockPostRaw() *string { +func (o *CliEvent) GetLastStep() *string { if o == nil { return nil } - return o.WorkflowLockPostRaw + return o.LastStep } -func (o *CliEvent) GetWorkflowLockPreRaw() *string { +func (o *CliEvent) GetTestReportRaw() *string { if o == nil { return nil } - return o.WorkflowLockPreRaw + return o.TestReportRaw +} + +func (o *CliEvent) GetWorkflowPreRaw() *string { + if o == nil { + return nil + } + return o.WorkflowPreRaw } func (o *CliEvent) GetWorkflowPostRaw() *string { @@ -822,16 +822,16 @@ func (o *CliEvent) GetWorkflowPostRaw() *string { return o.WorkflowPostRaw } -func (o *CliEvent) GetWorkflowPreRaw() *string { +func (o *CliEvent) GetWorkflowLockPreRaw() *string { if o == nil { return nil } - return o.WorkflowPreRaw + return o.WorkflowLockPreRaw } -func (o *CliEvent) GetWorkspaceID() string { +func (o *CliEvent) GetWorkflowLockPostRaw() *string { if o == nil { - return "" + return nil } - return o.WorkspaceID + return o.WorkflowLockPostRaw } diff --git a/tests/mockserver/internal/sdk/models/components/codesampleschemainput.go b/tests/mockserver/internal/sdk/models/components/codesampleschemainput.go index 286a1867..96e486af 100644 --- a/tests/mockserver/internal/sdk/models/components/codesampleschemainput.go +++ b/tests/mockserver/internal/sdk/models/components/codesampleschemainput.go @@ -7,68 +7,68 @@ import ( ) type SchemaFile struct { - Content io.Reader `multipartForm:"content"` FileName string `multipartForm:"name=fileName"` + Content io.Reader `multipartForm:"content"` } -func (o *SchemaFile) GetContent() io.Reader { +func (o *SchemaFile) GetFileName() string { if o == nil { - return nil + return "" } - return o.Content + return o.FileName } -func (o *SchemaFile) GetFileName() string { +func (o *SchemaFile) GetContent() io.Reader { if o == nil { - return "" + return nil } - return o.FileName + return o.Content } type CodeSampleSchemaInput struct { + // The name of the package + PackageName *string `multipartForm:"name=package_name"` + // The SDK class name + SDKClassName *string `multipartForm:"name=sdk_class_name"` // The language to generate code samples for Language string `multipartForm:"name=language"` // A list of operations IDs to generate code samples for OperationIds []string `multipartForm:"name=operation_ids"` - // The name of the package - PackageName *string `multipartForm:"name=package_name"` // The OpenAPI file to be uploaded SchemaFile SchemaFile `multipartForm:"file"` - // The SDK class name - SDKClassName *string `multipartForm:"name=sdk_class_name"` } -func (o *CodeSampleSchemaInput) GetLanguage() string { +func (o *CodeSampleSchemaInput) GetPackageName() *string { if o == nil { - return "" + return nil } - return o.Language + return o.PackageName } -func (o *CodeSampleSchemaInput) GetOperationIds() []string { +func (o *CodeSampleSchemaInput) GetSDKClassName() *string { if o == nil { return nil } - return o.OperationIds + return o.SDKClassName } -func (o *CodeSampleSchemaInput) GetPackageName() *string { +func (o *CodeSampleSchemaInput) GetLanguage() string { if o == nil { - return nil + return "" } - return o.PackageName + return o.Language } -func (o *CodeSampleSchemaInput) GetSchemaFile() SchemaFile { +func (o *CodeSampleSchemaInput) GetOperationIds() []string { if o == nil { - return SchemaFile{} + return nil } - return o.SchemaFile + return o.OperationIds } -func (o *CodeSampleSchemaInput) GetSDKClassName() *string { +func (o *CodeSampleSchemaInput) GetSchemaFile() SchemaFile { if o == nil { - return nil + return SchemaFile{} } - return o.SDKClassName + return o.SchemaFile } diff --git a/tests/mockserver/internal/sdk/models/components/diagnostic.go b/tests/mockserver/internal/sdk/models/components/diagnostic.go index 9a487f6b..9ea7d0c8 100644 --- a/tests/mockserver/internal/sdk/models/components/diagnostic.go +++ b/tests/mockserver/internal/sdk/models/components/diagnostic.go @@ -3,21 +3,14 @@ package components type Diagnostic struct { - // Help message for how to fix the issue - HelpMessage *string `json:"helpMessage,omitempty"` // Message describing the issue Message string `json:"message"` // Schema path to the issue Path []string `json:"path"` // Issue type Type string `json:"type"` -} - -func (o *Diagnostic) GetHelpMessage() *string { - if o == nil { - return nil - } - return o.HelpMessage + // Help message for how to fix the issue + HelpMessage *string `json:"helpMessage,omitempty"` } func (o *Diagnostic) GetMessage() string { @@ -40,3 +33,10 @@ func (o *Diagnostic) GetType() string { } return o.Type } + +func (o *Diagnostic) GetHelpMessage() *string { + if o == nil { + return nil + } + return o.HelpMessage +} diff --git a/tests/mockserver/internal/sdk/models/components/featureflag.go b/tests/mockserver/internal/sdk/models/components/featureflag.go index d3b2ac65..d3998629 100644 --- a/tests/mockserver/internal/sdk/models/components/featureflag.go +++ b/tests/mockserver/internal/sdk/models/components/featureflag.go @@ -19,7 +19,7 @@ func (f FeatureFlag) MarshalJSON() ([]byte, error) { } func (f *FeatureFlag) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &f, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &f, "", false, []string{"feature_flag"}); err != nil { return err } return nil diff --git a/tests/mockserver/internal/sdk/models/components/githubconfigurecodesamplesresponse.go b/tests/mockserver/internal/sdk/models/components/githubconfigurecodesamplesresponse.go index dd34085d..221ac27d 100644 --- a/tests/mockserver/internal/sdk/models/components/githubconfigurecodesamplesresponse.go +++ b/tests/mockserver/internal/sdk/models/components/githubconfigurecodesamplesresponse.go @@ -4,12 +4,19 @@ package components // GithubConfigureCodeSamplesResponse - A response to configure GitHub code samples type GithubConfigureCodeSamplesResponse struct { + // A document referenced by a workflow + Source WorkflowDocument `json:"source"` // The URL of the code sample overlay registry CodeSampleOverlayRegistryURL string `json:"codeSampleOverlayRegistryURL"` // The ID of the GitHub action that was dispatched GhActionID *string `json:"ghActionID,omitempty"` - // A document referenced by a workflow - Source WorkflowDocument `json:"source"` +} + +func (o *GithubConfigureCodeSamplesResponse) GetSource() WorkflowDocument { + if o == nil { + return WorkflowDocument{} + } + return o.Source } func (o *GithubConfigureCodeSamplesResponse) GetCodeSampleOverlayRegistryURL() string { @@ -25,10 +32,3 @@ func (o *GithubConfigureCodeSamplesResponse) GetGhActionID() *string { } return o.GhActionID } - -func (o *GithubConfigureCodeSamplesResponse) GetSource() WorkflowDocument { - if o == nil { - return WorkflowDocument{} - } - return o.Source -} diff --git a/tests/mockserver/internal/sdk/models/components/githubconfiguremintlifyreporequest.go b/tests/mockserver/internal/sdk/models/components/githubconfiguremintlifyreporequest.go index 6cd79892..992acb7a 100644 --- a/tests/mockserver/internal/sdk/models/components/githubconfiguremintlifyreporequest.go +++ b/tests/mockserver/internal/sdk/models/components/githubconfiguremintlifyreporequest.go @@ -4,49 +4,49 @@ package components // GithubConfigureMintlifyRepoRequest - A request to configure a GitHub repository for mintlify type GithubConfigureMintlifyRepoRequest struct { - // The input OpenAPI document - Input string `json:"input"` // The GitHub organization name Org string `json:"org"` - // The overlays to apply - Overlays []string `json:"overlays"` // The GitHub repository name Repo string `json:"repo"` // The subdirectory (location of mint.json) Subdirectory *string `json:"subdirectory,omitempty"` + // The input OpenAPI document + Input string `json:"input"` + // The overlays to apply + Overlays []string `json:"overlays"` } -func (o *GithubConfigureMintlifyRepoRequest) GetInput() string { +func (o *GithubConfigureMintlifyRepoRequest) GetOrg() string { if o == nil { return "" } - return o.Input + return o.Org } -func (o *GithubConfigureMintlifyRepoRequest) GetOrg() string { +func (o *GithubConfigureMintlifyRepoRequest) GetRepo() string { if o == nil { return "" } - return o.Org + return o.Repo } -func (o *GithubConfigureMintlifyRepoRequest) GetOverlays() []string { +func (o *GithubConfigureMintlifyRepoRequest) GetSubdirectory() *string { if o == nil { - return []string{} + return nil } - return o.Overlays + return o.Subdirectory } -func (o *GithubConfigureMintlifyRepoRequest) GetRepo() string { +func (o *GithubConfigureMintlifyRepoRequest) GetInput() string { if o == nil { return "" } - return o.Repo + return o.Input } -func (o *GithubConfigureMintlifyRepoRequest) GetSubdirectory() *string { +func (o *GithubConfigureMintlifyRepoRequest) GetOverlays() []string { if o == nil { - return nil + return []string{} } - return o.Subdirectory + return o.Overlays } diff --git a/tests/mockserver/internal/sdk/models/components/githubgetactionresponse.go b/tests/mockserver/internal/sdk/models/components/githubgetactionresponse.go index 705d61c8..f4ad0788 100644 --- a/tests/mockserver/internal/sdk/models/components/githubgetactionresponse.go +++ b/tests/mockserver/internal/sdk/models/components/githubgetactionresponse.go @@ -4,22 +4,22 @@ package components // GithubGetActionResponse - response to a getting the latest action run on a GitHub request type GithubGetActionResponse struct { - // The status of the latest action run if available - RunStatus *string `json:"run_status,omitempty"` // The URL for latest action run if available RunURL *string `json:"run_url,omitempty"` + // The status of the latest action run if available + RunStatus *string `json:"run_status,omitempty"` } -func (o *GithubGetActionResponse) GetRunStatus() *string { +func (o *GithubGetActionResponse) GetRunURL() *string { if o == nil { return nil } - return o.RunStatus + return o.RunURL } -func (o *GithubGetActionResponse) GetRunURL() *string { +func (o *GithubGetActionResponse) GetRunStatus() *string { if o == nil { return nil } - return o.RunURL + return o.RunStatus } diff --git a/tests/mockserver/internal/sdk/models/components/githubpublishingprresponse.go b/tests/mockserver/internal/sdk/models/components/githubpublishingprresponse.go index 4a309d45..a03c4cd9 100644 --- a/tests/mockserver/internal/sdk/models/components/githubpublishingprresponse.go +++ b/tests/mockserver/internal/sdk/models/components/githubpublishingprresponse.go @@ -9,18 +9,18 @@ import ( // PullRequestMetadata - This can only be populated when the github app is installed for a repo type PullRequestMetadata struct { - BaseBranch *string `json:"base_branch,omitempty"` - CanMerge *bool `json:"can_merge,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` + Status *string `json:"status,omitempty"` + Title *string `json:"title,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` // truncated to first 1000 characters Description *string `json:"description,omitempty"` HeadBranch *string `json:"head_branch,omitempty"` + BaseBranch *string `json:"base_branch,omitempty"` + CanMerge *bool `json:"can_merge,omitempty"` // List of github labels Labels []string `json:"labels,omitempty"` // List of github handles RequestedReviewers []string `json:"requested_reviewers,omitempty"` - Status *string `json:"status,omitempty"` - Title *string `json:"title,omitempty"` } func (p PullRequestMetadata) MarshalJSON() ([]byte, error) { @@ -28,24 +28,24 @@ func (p PullRequestMetadata) MarshalJSON() ([]byte, error) { } func (p *PullRequestMetadata) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &p, "", false, nil); err != nil { return err } return nil } -func (o *PullRequestMetadata) GetBaseBranch() *string { +func (o *PullRequestMetadata) GetStatus() *string { if o == nil { return nil } - return o.BaseBranch + return o.Status } -func (o *PullRequestMetadata) GetCanMerge() *bool { +func (o *PullRequestMetadata) GetTitle() *string { if o == nil { return nil } - return o.CanMerge + return o.Title } func (o *PullRequestMetadata) GetCreatedAt() *time.Time { @@ -69,54 +69,54 @@ func (o *PullRequestMetadata) GetHeadBranch() *string { return o.HeadBranch } -func (o *PullRequestMetadata) GetLabels() []string { +func (o *PullRequestMetadata) GetBaseBranch() *string { if o == nil { return nil } - return o.Labels + return o.BaseBranch } -func (o *PullRequestMetadata) GetRequestedReviewers() []string { +func (o *PullRequestMetadata) GetCanMerge() *bool { if o == nil { return nil } - return o.RequestedReviewers + return o.CanMerge } -func (o *PullRequestMetadata) GetStatus() *string { +func (o *PullRequestMetadata) GetLabels() []string { if o == nil { return nil } - return o.Status + return o.Labels } -func (o *PullRequestMetadata) GetTitle() *string { +func (o *PullRequestMetadata) GetRequestedReviewers() []string { if o == nil { return nil } - return o.Title + return o.RequestedReviewers } // GithubPublishingPRResponse - Open generation PRs pending publishing type GithubPublishingPRResponse struct { - PendingVersion *string `json:"pending_version,omitempty"` PullRequest *string `json:"pull_request,omitempty"` + PendingVersion *string `json:"pending_version,omitempty"` // This can only be populated when the github app is installed for a repo PullRequestMetadata *PullRequestMetadata `json:"pull_request_metadata,omitempty"` } -func (o *GithubPublishingPRResponse) GetPendingVersion() *string { +func (o *GithubPublishingPRResponse) GetPullRequest() *string { if o == nil { return nil } - return o.PendingVersion + return o.PullRequest } -func (o *GithubPublishingPRResponse) GetPullRequest() *string { +func (o *GithubPublishingPRResponse) GetPendingVersion() *string { if o == nil { return nil } - return o.PullRequest + return o.PendingVersion } func (o *GithubPublishingPRResponse) GetPullRequestMetadata() *PullRequestMetadata { diff --git a/tests/mockserver/internal/sdk/models/components/githubsetupstateresponse.go b/tests/mockserver/internal/sdk/models/components/githubsetupstateresponse.go index de2a5833..869e5be6 100644 --- a/tests/mockserver/internal/sdk/models/components/githubsetupstateresponse.go +++ b/tests/mockserver/internal/sdk/models/components/githubsetupstateresponse.go @@ -42,23 +42,23 @@ func (o *Secrets) GetPublishingSecretsConfigured() bool { // GithubSetupStateResponse - The state of a particular SDK targets github setup type GithubSetupStateResponse struct { - Actions Actions `json:"actions"` AppInstalled bool `json:"app_installed"` + Actions Actions `json:"actions"` Secrets Secrets `json:"secrets"` } -func (o *GithubSetupStateResponse) GetActions() Actions { +func (o *GithubSetupStateResponse) GetAppInstalled() bool { if o == nil { - return Actions{} + return false } - return o.Actions + return o.AppInstalled } -func (o *GithubSetupStateResponse) GetAppInstalled() bool { +func (o *GithubSetupStateResponse) GetActions() Actions { if o == nil { - return false + return Actions{} } - return o.AppInstalled + return o.Actions } func (o *GithubSetupStateResponse) GetSecrets() Secrets { diff --git a/tests/mockserver/internal/sdk/models/components/githubtriggeractionrequest.go b/tests/mockserver/internal/sdk/models/components/githubtriggeractionrequest.go index c8d6a62a..ed34b596 100644 --- a/tests/mockserver/internal/sdk/models/components/githubtriggeractionrequest.go +++ b/tests/mockserver/internal/sdk/models/components/githubtriggeractionrequest.go @@ -4,46 +4,46 @@ package components // GithubTriggerActionRequest - A request to trigger an action on a GitHub target type GithubTriggerActionRequest struct { - // Force an SDK generation - Force *bool `json:"force,omitempty"` - // The generation lock ID - GenLockID string `json:"gen_lock_id"` // The GitHub organization name Org string `json:"org"` // The GitHub repository name RepoName string `json:"repo_name"` - // A version to override the SDK too in workflow dispatch - SetVersion *string `json:"set_version,omitempty"` // The target name for the action TargetName *string `json:"target_name,omitempty"` + // The generation lock ID + GenLockID string `json:"gen_lock_id"` + // A version to override the SDK too in workflow dispatch + SetVersion *string `json:"set_version,omitempty"` + // Force an SDK generation + Force *bool `json:"force,omitempty"` } -func (o *GithubTriggerActionRequest) GetForce() *bool { +func (o *GithubTriggerActionRequest) GetOrg() string { if o == nil { - return nil + return "" } - return o.Force + return o.Org } -func (o *GithubTriggerActionRequest) GetGenLockID() string { +func (o *GithubTriggerActionRequest) GetRepoName() string { if o == nil { return "" } - return o.GenLockID + return o.RepoName } -func (o *GithubTriggerActionRequest) GetOrg() string { +func (o *GithubTriggerActionRequest) GetTargetName() *string { if o == nil { - return "" + return nil } - return o.Org + return o.TargetName } -func (o *GithubTriggerActionRequest) GetRepoName() string { +func (o *GithubTriggerActionRequest) GetGenLockID() string { if o == nil { return "" } - return o.RepoName + return o.GenLockID } func (o *GithubTriggerActionRequest) GetSetVersion() *string { @@ -53,9 +53,9 @@ func (o *GithubTriggerActionRequest) GetSetVersion() *string { return o.SetVersion } -func (o *GithubTriggerActionRequest) GetTargetName() *string { +func (o *GithubTriggerActionRequest) GetForce() *bool { if o == nil { return nil } - return o.TargetName + return o.Force } diff --git a/tests/mockserver/internal/sdk/models/components/manifest.go b/tests/mockserver/internal/sdk/models/components/manifest.go index 46dc9552..7e3f2357 100644 --- a/tests/mockserver/internal/sdk/models/components/manifest.go +++ b/tests/mockserver/internal/sdk/models/components/manifest.go @@ -4,49 +4,49 @@ package components // Manifest - Returns the requested manifest file type Manifest struct { - // Annotations - Annotations *Annotations `json:"annotations,omitempty"` + // Schema version + SchemaVersion *int64 `json:"schemaVersion,omitempty"` + // Media type usually application/vnd.docker.distribution.manifest.v2+json if this is in the accept header + MediaType *string `json:"mediaType,omitempty"` // Type of artifact ArtifactType *string `json:"artifactType,omitempty"` + // Annotations + Annotations *Annotations `json:"annotations,omitempty"` // List of V2 image layer information Layers []V2Descriptor `json:"layers,omitempty"` - // Media type usually application/vnd.docker.distribution.manifest.v2+json if this is in the accept header - MediaType *string `json:"mediaType,omitempty"` - // Schema version - SchemaVersion *int64 `json:"schemaVersion,omitempty"` } -func (o *Manifest) GetAnnotations() *Annotations { +func (o *Manifest) GetSchemaVersion() *int64 { if o == nil { return nil } - return o.Annotations + return o.SchemaVersion } -func (o *Manifest) GetArtifactType() *string { +func (o *Manifest) GetMediaType() *string { if o == nil { return nil } - return o.ArtifactType + return o.MediaType } -func (o *Manifest) GetLayers() []V2Descriptor { +func (o *Manifest) GetArtifactType() *string { if o == nil { return nil } - return o.Layers + return o.ArtifactType } -func (o *Manifest) GetMediaType() *string { +func (o *Manifest) GetAnnotations() *Annotations { if o == nil { return nil } - return o.MediaType + return o.Annotations } -func (o *Manifest) GetSchemaVersion() *int64 { +func (o *Manifest) GetLayers() []V2Descriptor { if o == nil { return nil } - return o.SchemaVersion + return o.Layers } diff --git a/tests/mockserver/internal/sdk/models/components/namespace.go b/tests/mockserver/internal/sdk/models/components/namespace.go index fe3b1649..472101a5 100644 --- a/tests/mockserver/internal/sdk/models/components/namespace.go +++ b/tests/mockserver/internal/sdk/models/components/namespace.go @@ -29,17 +29,17 @@ func (o *CompositeSpecMetadata) GetSubscriptionSettings() RemoteSourceSubscripti // Namespace - A namespace contains many revisions. type Namespace struct { - ArchivedAt *time.Time `json:"archived_at,omitempty"` - CompositeSpecMetadata *CompositeSpecMetadata `json:"composite_spec_metadata,omitempty"` - CreatedAt time.Time `json:"created_at"` // {organization_slug}/{workspace_slug}/{namespace_name} - ID string `json:"id"` - LatestRevisionMetadata *RevisionContentsMetadata `json:"latest_revision_metadata,omitempty"` + ID string `json:"id"` // A human-readable name for the namespace. - Name string `json:"name"` - // Indicates whether the namespace is publicly accessible - Public *bool `json:"public,omitempty"` + Name string `json:"name"` + CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` + // Indicates whether the namespace is publicly accessible + Public *bool `json:"public,omitempty"` + ArchivedAt *time.Time `json:"archived_at,omitempty"` + LatestRevisionMetadata *RevisionContentsMetadata `json:"latest_revision_metadata,omitempty"` + CompositeSpecMetadata *CompositeSpecMetadata `json:"composite_spec_metadata,omitempty"` } func (n Namespace) MarshalJSON() ([]byte, error) { @@ -47,24 +47,24 @@ func (n Namespace) MarshalJSON() ([]byte, error) { } func (n *Namespace) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &n, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &n, "", false, []string{"id", "name", "created_at", "updated_at"}); err != nil { return err } return nil } -func (o *Namespace) GetArchivedAt() *time.Time { +func (o *Namespace) GetID() string { if o == nil { - return nil + return "" } - return o.ArchivedAt + return o.ID } -func (o *Namespace) GetCompositeSpecMetadata() *CompositeSpecMetadata { +func (o *Namespace) GetName() string { if o == nil { - return nil + return "" } - return o.CompositeSpecMetadata + return o.Name } func (o *Namespace) GetCreatedAt() time.Time { @@ -74,37 +74,37 @@ func (o *Namespace) GetCreatedAt() time.Time { return o.CreatedAt } -func (o *Namespace) GetID() string { +func (o *Namespace) GetUpdatedAt() time.Time { if o == nil { - return "" + return time.Time{} } - return o.ID + return o.UpdatedAt } -func (o *Namespace) GetLatestRevisionMetadata() *RevisionContentsMetadata { +func (o *Namespace) GetPublic() *bool { if o == nil { return nil } - return o.LatestRevisionMetadata + return o.Public } -func (o *Namespace) GetName() string { +func (o *Namespace) GetArchivedAt() *time.Time { if o == nil { - return "" + return nil } - return o.Name + return o.ArchivedAt } -func (o *Namespace) GetPublic() *bool { +func (o *Namespace) GetLatestRevisionMetadata() *RevisionContentsMetadata { if o == nil { return nil } - return o.Public + return o.LatestRevisionMetadata } -func (o *Namespace) GetUpdatedAt() time.Time { +func (o *Namespace) GetCompositeSpecMetadata() *CompositeSpecMetadata { if o == nil { - return time.Time{} + return nil } - return o.UpdatedAt + return o.CompositeSpecMetadata } diff --git a/tests/mockserver/internal/sdk/models/components/oasinfo.go b/tests/mockserver/internal/sdk/models/components/oasinfo.go index 25a2df2b..3232cb9d 100644 --- a/tests/mockserver/internal/sdk/models/components/oasinfo.go +++ b/tests/mockserver/internal/sdk/models/components/oasinfo.go @@ -14,25 +14,18 @@ func (o *License) GetIdentifier() *string { } type OASInfo struct { - Description string `json:"description"` - License License `json:"license"` - Summary string `json:"summary"` Title string `json:"title"` + Summary string `json:"summary"` + Description string `json:"description"` Version string `json:"version"` + License License `json:"license"` } -func (o *OASInfo) GetDescription() string { +func (o *OASInfo) GetTitle() string { if o == nil { return "" } - return o.Description -} - -func (o *OASInfo) GetLicense() License { - if o == nil { - return License{} - } - return o.License + return o.Title } func (o *OASInfo) GetSummary() string { @@ -42,11 +35,11 @@ func (o *OASInfo) GetSummary() string { return o.Summary } -func (o *OASInfo) GetTitle() string { +func (o *OASInfo) GetDescription() string { if o == nil { return "" } - return o.Title + return o.Description } func (o *OASInfo) GetVersion() string { @@ -55,3 +48,10 @@ func (o *OASInfo) GetVersion() string { } return o.Version } + +func (o *OASInfo) GetLicense() License { + if o == nil { + return License{} + } + return o.License +} diff --git a/tests/mockserver/internal/sdk/models/components/oasoperation.go b/tests/mockserver/internal/sdk/models/components/oasoperation.go index 16a136e5..99c5e586 100644 --- a/tests/mockserver/internal/sdk/models/components/oasoperation.go +++ b/tests/mockserver/internal/sdk/models/components/oasoperation.go @@ -3,27 +3,13 @@ package components type OASOperation struct { - Description string `json:"description"` - GroupOverride *string `json:"group_override,omitempty"` Method string `json:"method"` - MethodNameOverride *string `json:"method_name_override,omitempty"` - OperationID string `json:"operation_id"` Path string `json:"path"` + OperationID string `json:"operation_id"` + Description string `json:"description"` Tags []string `json:"tags"` -} - -func (o *OASOperation) GetDescription() string { - if o == nil { - return "" - } - return o.Description -} - -func (o *OASOperation) GetGroupOverride() *string { - if o == nil { - return nil - } - return o.GroupOverride + MethodNameOverride *string `json:"method_name_override,omitempty"` + GroupOverride *string `json:"group_override,omitempty"` } func (o *OASOperation) GetMethod() string { @@ -33,11 +19,11 @@ func (o *OASOperation) GetMethod() string { return o.Method } -func (o *OASOperation) GetMethodNameOverride() *string { +func (o *OASOperation) GetPath() string { if o == nil { - return nil + return "" } - return o.MethodNameOverride + return o.Path } func (o *OASOperation) GetOperationID() string { @@ -47,11 +33,11 @@ func (o *OASOperation) GetOperationID() string { return o.OperationID } -func (o *OASOperation) GetPath() string { +func (o *OASOperation) GetDescription() string { if o == nil { return "" } - return o.Path + return o.Description } func (o *OASOperation) GetTags() []string { @@ -60,3 +46,17 @@ func (o *OASOperation) GetTags() []string { } return o.Tags } + +func (o *OASOperation) GetMethodNameOverride() *string { + if o == nil { + return nil + } + return o.MethodNameOverride +} + +func (o *OASOperation) GetGroupOverride() *string { + if o == nil { + return nil + } + return o.GroupOverride +} diff --git a/tests/mockserver/internal/sdk/models/components/organization.go b/tests/mockserver/internal/sdk/models/components/organization.go index a4491608..0910e8b7 100644 --- a/tests/mockserver/internal/sdk/models/components/organization.go +++ b/tests/mockserver/internal/sdk/models/components/organization.go @@ -9,17 +9,17 @@ import ( // Organization - A speakeasy organization type Organization struct { - AccountType AccountType `json:"account_type"` - CreatedAt time.Time `json:"created_at"` - FreeTrialExpiry *time.Time `json:"free_trial_expiry,omitempty"` ID string `json:"id"` - Internal *bool `json:"internal,omitempty"` Name string `json:"name"` Slug string `json:"slug"` - SsoActivated bool `json:"sso_activated"` - SsoConnectionID *string `json:"sso_connection_id,omitempty"` + AccountType AccountType `json:"account_type"` TelemetryDisabled bool `json:"telemetry_disabled"` + CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` + FreeTrialExpiry *time.Time `json:"free_trial_expiry,omitempty"` + SsoConnectionID *string `json:"sso_connection_id,omitempty"` + SsoActivated bool `json:"sso_activated"` + Internal *bool `json:"internal,omitempty"` } func (o Organization) MarshalJSON() ([]byte, error) { @@ -27,66 +27,66 @@ func (o Organization) MarshalJSON() ([]byte, error) { } func (o *Organization) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &o, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &o, "", false, []string{"id", "name", "slug", "account_type", "telemetry_disabled", "created_at", "updated_at", "sso_activated"}); err != nil { return err } return nil } -func (o *Organization) GetAccountType() AccountType { +func (o *Organization) GetID() string { if o == nil { - return AccountType("") + return "" } - return o.AccountType + return o.ID } -func (o *Organization) GetCreatedAt() time.Time { +func (o *Organization) GetName() string { if o == nil { - return time.Time{} + return "" } - return o.CreatedAt + return o.Name } -func (o *Organization) GetFreeTrialExpiry() *time.Time { +func (o *Organization) GetSlug() string { if o == nil { - return nil + return "" } - return o.FreeTrialExpiry + return o.Slug } -func (o *Organization) GetID() string { +func (o *Organization) GetAccountType() AccountType { if o == nil { - return "" + return AccountType("") } - return o.ID + return o.AccountType } -func (o *Organization) GetInternal() *bool { +func (o *Organization) GetTelemetryDisabled() bool { if o == nil { - return nil + return false } - return o.Internal + return o.TelemetryDisabled } -func (o *Organization) GetName() string { +func (o *Organization) GetCreatedAt() time.Time { if o == nil { - return "" + return time.Time{} } - return o.Name + return o.CreatedAt } -func (o *Organization) GetSlug() string { +func (o *Organization) GetUpdatedAt() time.Time { if o == nil { - return "" + return time.Time{} } - return o.Slug + return o.UpdatedAt } -func (o *Organization) GetSsoActivated() bool { +func (o *Organization) GetFreeTrialExpiry() *time.Time { if o == nil { - return false + return nil } - return o.SsoActivated + return o.FreeTrialExpiry } func (o *Organization) GetSsoConnectionID() *string { @@ -96,16 +96,16 @@ func (o *Organization) GetSsoConnectionID() *string { return o.SsoConnectionID } -func (o *Organization) GetTelemetryDisabled() bool { +func (o *Organization) GetSsoActivated() bool { if o == nil { return false } - return o.TelemetryDisabled + return o.SsoActivated } -func (o *Organization) GetUpdatedAt() time.Time { +func (o *Organization) GetInternal() *bool { if o == nil { - return time.Time{} + return nil } - return o.UpdatedAt + return o.Internal } diff --git a/tests/mockserver/internal/sdk/models/components/organizationusage.go b/tests/mockserver/internal/sdk/models/components/organizationusage.go index e6198663..7b784649 100644 --- a/tests/mockserver/internal/sdk/models/components/organizationusage.go +++ b/tests/mockserver/internal/sdk/models/components/organizationusage.go @@ -3,43 +3,36 @@ package components type OrganizationUsage struct { - // Indicates if the features are accessible - Accessible bool `json:"accessible"` - // Features that are accessible - AccessibleFeatures []string `json:"accessible_features"` - // List of generation lock IDs - GenLockIds []string `json:"gen_lock_ids"` - // The programming language used - Language string `json:"language"` - // Maximum Number of operations per SDK specific in contract - MaxOperations int64 `json:"max_operations"` // Number of operations performed NumberOfOperations int64 `json:"number_of_operations"` + // Maximum Number of operations per SDK specific in contract + MaxOperations int64 `json:"max_operations"` + // The programming language used + Language string `json:"language"` // Features that have been used UsedFeatures []string `json:"used_features"` + // Features that are accessible + AccessibleFeatures []string `json:"accessible_features"` + // Indicates if the features are accessible + Accessible bool `json:"accessible"` // List of workspace IDs Workspaces []string `json:"workspaces"` + // List of generation lock IDs + GenLockIds []string `json:"gen_lock_ids"` } -func (o *OrganizationUsage) GetAccessible() bool { - if o == nil { - return false - } - return o.Accessible -} - -func (o *OrganizationUsage) GetAccessibleFeatures() []string { +func (o *OrganizationUsage) GetNumberOfOperations() int64 { if o == nil { - return []string{} + return 0 } - return o.AccessibleFeatures + return o.NumberOfOperations } -func (o *OrganizationUsage) GetGenLockIds() []string { +func (o *OrganizationUsage) GetMaxOperations() int64 { if o == nil { - return []string{} + return 0 } - return o.GenLockIds + return o.MaxOperations } func (o *OrganizationUsage) GetLanguage() string { @@ -49,25 +42,25 @@ func (o *OrganizationUsage) GetLanguage() string { return o.Language } -func (o *OrganizationUsage) GetMaxOperations() int64 { +func (o *OrganizationUsage) GetUsedFeatures() []string { if o == nil { - return 0 + return []string{} } - return o.MaxOperations + return o.UsedFeatures } -func (o *OrganizationUsage) GetNumberOfOperations() int64 { +func (o *OrganizationUsage) GetAccessibleFeatures() []string { if o == nil { - return 0 + return []string{} } - return o.NumberOfOperations + return o.AccessibleFeatures } -func (o *OrganizationUsage) GetUsedFeatures() []string { +func (o *OrganizationUsage) GetAccessible() bool { if o == nil { - return []string{} + return false } - return o.UsedFeatures + return o.Accessible } func (o *OrganizationUsage) GetWorkspaces() []string { @@ -76,3 +69,10 @@ func (o *OrganizationUsage) GetWorkspaces() []string { } return o.Workspaces } + +func (o *OrganizationUsage) GetGenLockIds() []string { + if o == nil { + return []string{} + } + return o.GenLockIds +} diff --git a/tests/mockserver/internal/sdk/models/components/organizationusageresponse.go b/tests/mockserver/internal/sdk/models/components/organizationusageresponse.go index 4ffcb215..f4497c52 100644 --- a/tests/mockserver/internal/sdk/models/components/organizationusageresponse.go +++ b/tests/mockserver/internal/sdk/models/components/organizationusageresponse.go @@ -9,13 +9,13 @@ import ( // OrganizationUsageResponse - A billing summary of organization usage type OrganizationUsageResponse struct { - // List of allowed languages - AllowedLanguages []string `json:"allowed_languages"` + Usage []OrganizationUsage `json:"usage"` // Expiry date of the free trial, will be null if no trial FreeTrialExpiry *time.Time `json:"free_trial_expiry,omitempty"` // Total number of allowed languages, -1 if unlimited - TotalAllowedLanguages int64 `json:"total_allowed_languages"` - Usage []OrganizationUsage `json:"usage"` + TotalAllowedLanguages int64 `json:"total_allowed_languages"` + // List of allowed languages + AllowedLanguages []string `json:"allowed_languages"` } func (o OrganizationUsageResponse) MarshalJSON() ([]byte, error) { @@ -23,17 +23,17 @@ func (o OrganizationUsageResponse) MarshalJSON() ([]byte, error) { } func (o *OrganizationUsageResponse) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &o, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &o, "", false, []string{"usage", "total_allowed_languages", "allowed_languages"}); err != nil { return err } return nil } -func (o *OrganizationUsageResponse) GetAllowedLanguages() []string { +func (o *OrganizationUsageResponse) GetUsage() []OrganizationUsage { if o == nil { - return []string{} + return []OrganizationUsage{} } - return o.AllowedLanguages + return o.Usage } func (o *OrganizationUsageResponse) GetFreeTrialExpiry() *time.Time { @@ -50,9 +50,9 @@ func (o *OrganizationUsageResponse) GetTotalAllowedLanguages() int64 { return o.TotalAllowedLanguages } -func (o *OrganizationUsageResponse) GetUsage() []OrganizationUsage { +func (o *OrganizationUsageResponse) GetAllowedLanguages() []string { if o == nil { - return []OrganizationUsage{} + return []string{} } - return o.Usage + return o.AllowedLanguages } diff --git a/tests/mockserver/internal/sdk/models/components/publishingtoken.go b/tests/mockserver/internal/sdk/models/components/publishingtoken.go index aa6e0a85..ce7c2af9 100644 --- a/tests/mockserver/internal/sdk/models/components/publishingtoken.go +++ b/tests/mockserver/internal/sdk/models/components/publishingtoken.go @@ -34,17 +34,17 @@ func (e *TargetResource) UnmarshalJSON(data []byte) error { // PublishingToken - A token used to publish to a target type PublishingToken struct { - CreatedAt time.Time `json:"created_at"` - CreatedBy string `json:"created_by"` ID string `json:"id"` - OrganizationID string `json:"organization_id"` - TargetID string `json:"target_id"` - TargetResource TargetResource `json:"target_resource"` Token string `json:"token"` + ValidUntil time.Time `json:"valid_until"` TokenName string `json:"token_name"` + TargetID string `json:"target_id"` + TargetResource TargetResource `json:"target_resource"` + CreatedAt time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at,omitempty"` + CreatedBy string `json:"created_by"` UpdatedBy *string `json:"updated_by,omitempty"` - ValidUntil time.Time `json:"valid_until"` + OrganizationID string `json:"organization_id"` WorkspaceID string `json:"workspace_id"` } @@ -53,38 +53,38 @@ func (p PublishingToken) MarshalJSON() ([]byte, error) { } func (p *PublishingToken) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &p, "", false, []string{"id", "token", "valid_until", "token_name", "target_id", "target_resource", "created_at", "created_by", "organization_id", "workspace_id"}); err != nil { return err } return nil } -func (o *PublishingToken) GetCreatedAt() time.Time { +func (o *PublishingToken) GetID() string { if o == nil { - return time.Time{} + return "" } - return o.CreatedAt + return o.ID } -func (o *PublishingToken) GetCreatedBy() string { +func (o *PublishingToken) GetToken() string { if o == nil { return "" } - return o.CreatedBy + return o.Token } -func (o *PublishingToken) GetID() string { +func (o *PublishingToken) GetValidUntil() time.Time { if o == nil { - return "" + return time.Time{} } - return o.ID + return o.ValidUntil } -func (o *PublishingToken) GetOrganizationID() string { +func (o *PublishingToken) GetTokenName() string { if o == nil { return "" } - return o.OrganizationID + return o.TokenName } func (o *PublishingToken) GetTargetID() string { @@ -101,25 +101,25 @@ func (o *PublishingToken) GetTargetResource() TargetResource { return o.TargetResource } -func (o *PublishingToken) GetToken() string { +func (o *PublishingToken) GetCreatedAt() time.Time { if o == nil { - return "" + return time.Time{} } - return o.Token + return o.CreatedAt } -func (o *PublishingToken) GetTokenName() string { +func (o *PublishingToken) GetUpdatedAt() *time.Time { if o == nil { - return "" + return nil } - return o.TokenName + return o.UpdatedAt } -func (o *PublishingToken) GetUpdatedAt() *time.Time { +func (o *PublishingToken) GetCreatedBy() string { if o == nil { - return nil + return "" } - return o.UpdatedAt + return o.CreatedBy } func (o *PublishingToken) GetUpdatedBy() *string { @@ -129,11 +129,11 @@ func (o *PublishingToken) GetUpdatedBy() *string { return o.UpdatedBy } -func (o *PublishingToken) GetValidUntil() time.Time { +func (o *PublishingToken) GetOrganizationID() string { if o == nil { - return time.Time{} + return "" } - return o.ValidUntil + return o.OrganizationID } func (o *PublishingToken) GetWorkspaceID() string { diff --git a/tests/mockserver/internal/sdk/models/components/remotesource.go b/tests/mockserver/internal/sdk/models/components/remotesource.go index e5f36e81..1a853599 100644 --- a/tests/mockserver/internal/sdk/models/components/remotesource.go +++ b/tests/mockserver/internal/sdk/models/components/remotesource.go @@ -4,10 +4,10 @@ package components // RemoteSource - Remote source configuration type RemoteSource struct { - Inputs []RemoteDocument `json:"inputs"` - // A document hosted in the registry - Output RemoteDocument `json:"output"` + Inputs []RemoteDocument `json:"inputs"` Overlays []RemoteDocument `json:"overlays,omitempty"` + // A document hosted in the registry + Output RemoteDocument `json:"output"` } func (o *RemoteSource) GetInputs() []RemoteDocument { @@ -17,16 +17,16 @@ func (o *RemoteSource) GetInputs() []RemoteDocument { return o.Inputs } -func (o *RemoteSource) GetOutput() RemoteDocument { +func (o *RemoteSource) GetOverlays() []RemoteDocument { if o == nil { - return RemoteDocument{} + return nil } - return o.Output + return o.Overlays } -func (o *RemoteSource) GetOverlays() []RemoteDocument { +func (o *RemoteSource) GetOutput() RemoteDocument { if o == nil { - return nil + return RemoteDocument{} } - return o.Overlays + return o.Output } diff --git a/tests/mockserver/internal/sdk/models/components/remotesourcesubscriptionsettings.go b/tests/mockserver/internal/sdk/models/components/remotesourcesubscriptionsettings.go index d13d2552..0ec8a36b 100644 --- a/tests/mockserver/internal/sdk/models/components/remotesourcesubscriptionsettings.go +++ b/tests/mockserver/internal/sdk/models/components/remotesourcesubscriptionsettings.go @@ -4,9 +4,9 @@ package components type RemoteSourceSubscriptionSettings struct { BaseSpecNamespaces []string `json:"base_spec_namespaces"` + OverlayNamespaces []string `json:"overlay_namespaces"` IgnoredNamespaces []string `json:"ignored_namespaces,omitempty"` OutputNamespace string `json:"output_namespace"` - OverlayNamespaces []string `json:"overlay_namespaces"` } func (o *RemoteSourceSubscriptionSettings) GetBaseSpecNamespaces() []string { @@ -16,6 +16,13 @@ func (o *RemoteSourceSubscriptionSettings) GetBaseSpecNamespaces() []string { return o.BaseSpecNamespaces } +func (o *RemoteSourceSubscriptionSettings) GetOverlayNamespaces() []string { + if o == nil { + return []string{} + } + return o.OverlayNamespaces +} + func (o *RemoteSourceSubscriptionSettings) GetIgnoredNamespaces() []string { if o == nil { return nil @@ -29,10 +36,3 @@ func (o *RemoteSourceSubscriptionSettings) GetOutputNamespace() string { } return o.OutputNamespace } - -func (o *RemoteSourceSubscriptionSettings) GetOverlayNamespaces() []string { - if o == nil { - return []string{} - } - return o.OverlayNamespaces -} diff --git a/tests/mockserver/internal/sdk/models/components/report.go b/tests/mockserver/internal/sdk/models/components/report.go index 3a3d7fe7..11a0464e 100644 --- a/tests/mockserver/internal/sdk/models/components/report.go +++ b/tests/mockserver/internal/sdk/models/components/report.go @@ -7,17 +7,17 @@ import ( "fmt" ) -type Type string +type ReportType string const ( - TypeLinting Type = "linting" - TypeChanges Type = "changes" + ReportTypeLinting ReportType = "linting" + ReportTypeChanges ReportType = "changes" ) -func (e Type) ToPointer() *Type { +func (e ReportType) ToPointer() *ReportType { return &e } -func (e *Type) UnmarshalJSON(data []byte) error { +func (e *ReportType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -26,18 +26,18 @@ func (e *Type) UnmarshalJSON(data []byte) error { case "linting": fallthrough case "changes": - *e = Type(v) + *e = ReportType(v) return nil default: - return fmt.Errorf("invalid value for Type: %v", v) + return fmt.Errorf("invalid value for ReportType: %v", v) } } type Report struct { - Type *Type `json:"type,omitempty"` + Type *ReportType `json:"type,omitempty"` } -func (o *Report) GetType() *Type { +func (o *Report) GetType() *ReportType { if o == nil { return nil } diff --git a/tests/mockserver/internal/sdk/models/components/revision.go b/tests/mockserver/internal/sdk/models/components/revision.go index 6a88e808..b743c9ee 100644 --- a/tests/mockserver/internal/sdk/models/components/revision.go +++ b/tests/mockserver/internal/sdk/models/components/revision.go @@ -8,14 +8,14 @@ import ( ) type Revision struct { + // Format {namespace_id}/{revision_digest} + ID string `json:"id"` + Digest string `json:"digest"` + NamespaceName string `json:"namespace_name"` + Tags []string `json:"tags"` ContentsMetadata *RevisionContentsMetadata `json:"contents_metadata,omitempty"` CreatedAt time.Time `json:"created_at"` - Digest string `json:"digest"` - // Format {namespace_id}/{revision_digest} - ID string `json:"id"` - NamespaceName string `json:"namespace_name"` - Tags []string `json:"tags"` - UpdatedAt time.Time `json:"updated_at"` + UpdatedAt time.Time `json:"updated_at"` } func (r Revision) MarshalJSON() ([]byte, error) { @@ -23,24 +23,17 @@ func (r Revision) MarshalJSON() ([]byte, error) { } func (r *Revision) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &r, "", false, []string{"id", "digest", "namespace_name", "tags", "created_at", "updated_at"}); err != nil { return err } return nil } -func (o *Revision) GetContentsMetadata() *RevisionContentsMetadata { - if o == nil { - return nil - } - return o.ContentsMetadata -} - -func (o *Revision) GetCreatedAt() time.Time { +func (o *Revision) GetID() string { if o == nil { - return time.Time{} + return "" } - return o.CreatedAt + return o.ID } func (o *Revision) GetDigest() string { @@ -50,13 +43,6 @@ func (o *Revision) GetDigest() string { return o.Digest } -func (o *Revision) GetID() string { - if o == nil { - return "" - } - return o.ID -} - func (o *Revision) GetNamespaceName() string { if o == nil { return "" @@ -71,6 +57,20 @@ func (o *Revision) GetTags() []string { return o.Tags } +func (o *Revision) GetContentsMetadata() *RevisionContentsMetadata { + if o == nil { + return nil + } + return o.ContentsMetadata +} + +func (o *Revision) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + func (o *Revision) GetUpdatedAt() time.Time { if o == nil { return time.Time{} diff --git a/tests/mockserver/internal/sdk/models/components/revisioncontentsmetadata.go b/tests/mockserver/internal/sdk/models/components/revisioncontentsmetadata.go index b2b60595..a24742b8 100644 --- a/tests/mockserver/internal/sdk/models/components/revisioncontentsmetadata.go +++ b/tests/mockserver/internal/sdk/models/components/revisioncontentsmetadata.go @@ -36,30 +36,30 @@ func (e *RevisionContentsMetadataType) UnmarshalJSON(data []byte) error { } type RevisionContentsMetadata struct { - // Whether the OAS contains code samples. - ContainsCodeSamples bool `json:"contains_code_samples"` - CreatedAt time.Time `json:"created_at"` - // The OAS description - Description string `json:"description"` - // The hash of the contents - Hash string `json:"hash"` + Type RevisionContentsMetadataType `json:"type"` + // The workspace ID + WorkspaceID string `json:"workspace_id"` // The fully qualified namespace Namespace string `json:"namespace"` - // The number of overlay actions in the OAS. Will be 0 if the OAS is not an overlay. - NumOverlayActions int64 `json:"num_overlay_actions"` - // The operation IDs contained in the OAS. Will be empty if the OAS is an overlay. - OperationIds []string `json:"operation_ids"` // The digest of the parent bundle RevisionDigest string `json:"revision_digest"` - // The tags contained in the OAS -- NOT the OCI tags. Will be empty if the OAS is an overlay. - Tags []string `json:"tags"` // The OAS title - Title string `json:"title"` - Type RevisionContentsMetadataType `json:"type"` + Title string `json:"title"` + // The OAS description + Description string `json:"description"` // The OAS version Version string `json:"version"` - // The workspace ID - WorkspaceID string `json:"workspace_id"` + // The hash of the contents + Hash string `json:"hash"` + // The tags contained in the OAS -- NOT the OCI tags. Will be empty if the OAS is an overlay. + Tags []string `json:"tags"` + // The operation IDs contained in the OAS. Will be empty if the OAS is an overlay. + OperationIds []string `json:"operation_ids"` + // The number of overlay actions in the OAS. Will be 0 if the OAS is not an overlay. + NumOverlayActions int64 `json:"num_overlay_actions"` + // Whether the OAS contains code samples. + ContainsCodeSamples bool `json:"contains_code_samples"` + CreatedAt time.Time `json:"created_at"` } func (r RevisionContentsMetadata) MarshalJSON() ([]byte, error) { @@ -67,66 +67,66 @@ func (r RevisionContentsMetadata) MarshalJSON() ([]byte, error) { } func (r *RevisionContentsMetadata) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &r, "", false, []string{"type", "workspace_id", "namespace", "revision_digest", "title", "description", "version", "hash", "tags", "operation_ids", "num_overlay_actions", "contains_code_samples", "created_at"}); err != nil { return err } return nil } -func (o *RevisionContentsMetadata) GetContainsCodeSamples() bool { +func (o *RevisionContentsMetadata) GetType() RevisionContentsMetadataType { if o == nil { - return false + return RevisionContentsMetadataType("") } - return o.ContainsCodeSamples + return o.Type } -func (o *RevisionContentsMetadata) GetCreatedAt() time.Time { +func (o *RevisionContentsMetadata) GetWorkspaceID() string { if o == nil { - return time.Time{} + return "" } - return o.CreatedAt + return o.WorkspaceID } -func (o *RevisionContentsMetadata) GetDescription() string { +func (o *RevisionContentsMetadata) GetNamespace() string { if o == nil { return "" } - return o.Description + return o.Namespace } -func (o *RevisionContentsMetadata) GetHash() string { +func (o *RevisionContentsMetadata) GetRevisionDigest() string { if o == nil { return "" } - return o.Hash + return o.RevisionDigest } -func (o *RevisionContentsMetadata) GetNamespace() string { +func (o *RevisionContentsMetadata) GetTitle() string { if o == nil { return "" } - return o.Namespace + return o.Title } -func (o *RevisionContentsMetadata) GetNumOverlayActions() int64 { +func (o *RevisionContentsMetadata) GetDescription() string { if o == nil { - return 0 + return "" } - return o.NumOverlayActions + return o.Description } -func (o *RevisionContentsMetadata) GetOperationIds() []string { +func (o *RevisionContentsMetadata) GetVersion() string { if o == nil { - return []string{} + return "" } - return o.OperationIds + return o.Version } -func (o *RevisionContentsMetadata) GetRevisionDigest() string { +func (o *RevisionContentsMetadata) GetHash() string { if o == nil { return "" } - return o.RevisionDigest + return o.Hash } func (o *RevisionContentsMetadata) GetTags() []string { @@ -136,30 +136,30 @@ func (o *RevisionContentsMetadata) GetTags() []string { return o.Tags } -func (o *RevisionContentsMetadata) GetTitle() string { +func (o *RevisionContentsMetadata) GetOperationIds() []string { if o == nil { - return "" + return []string{} } - return o.Title + return o.OperationIds } -func (o *RevisionContentsMetadata) GetType() RevisionContentsMetadataType { +func (o *RevisionContentsMetadata) GetNumOverlayActions() int64 { if o == nil { - return RevisionContentsMetadataType("") + return 0 } - return o.Type + return o.NumOverlayActions } -func (o *RevisionContentsMetadata) GetVersion() string { +func (o *RevisionContentsMetadata) GetContainsCodeSamples() bool { if o == nil { - return "" + return false } - return o.Version + return o.ContainsCodeSamples } -func (o *RevisionContentsMetadata) GetWorkspaceID() string { +func (o *RevisionContentsMetadata) GetCreatedAt() time.Time { if o == nil { - return "" + return time.Time{} } - return o.WorkspaceID + return o.CreatedAt } diff --git a/tests/mockserver/internal/sdk/models/components/schemastoreitem.go b/tests/mockserver/internal/sdk/models/components/schemastoreitem.go index 5d0bbfcd..fa3a8a1a 100644 --- a/tests/mockserver/internal/sdk/models/components/schemastoreitem.go +++ b/tests/mockserver/internal/sdk/models/components/schemastoreitem.go @@ -36,12 +36,12 @@ func (e *Format) UnmarshalJSON(data []byte) error { } type SchemaStoreItem struct { - CreatedAt time.Time `json:"created_at"` - Format Format `json:"format"` ID string `json:"id"` + Spec string `json:"spec"` PackageName string `json:"packageName"` SDKClassname string `json:"sdkClassname"` - Spec string `json:"spec"` + CreatedAt time.Time `json:"created_at"` + Format Format `json:"format"` } func (s SchemaStoreItem) MarshalJSON() ([]byte, error) { @@ -49,31 +49,24 @@ func (s SchemaStoreItem) MarshalJSON() ([]byte, error) { } func (s *SchemaStoreItem) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &s, "", false, []string{"id", "spec", "packageName", "sdkClassname", "created_at", "format"}); err != nil { return err } return nil } -func (o *SchemaStoreItem) GetCreatedAt() time.Time { - if o == nil { - return time.Time{} - } - return o.CreatedAt -} - -func (o *SchemaStoreItem) GetFormat() Format { +func (o *SchemaStoreItem) GetID() string { if o == nil { - return Format("") + return "" } - return o.Format + return o.ID } -func (o *SchemaStoreItem) GetID() string { +func (o *SchemaStoreItem) GetSpec() string { if o == nil { return "" } - return o.ID + return o.Spec } func (o *SchemaStoreItem) GetPackageName() string { @@ -90,9 +83,16 @@ func (o *SchemaStoreItem) GetSDKClassname() string { return o.SDKClassname } -func (o *SchemaStoreItem) GetSpec() string { +func (o *SchemaStoreItem) GetCreatedAt() time.Time { if o == nil { - return "" + return time.Time{} } - return o.Spec + return o.CreatedAt +} + +func (o *SchemaStoreItem) GetFormat() Format { + if o == nil { + return Format("") + } + return o.Format } diff --git a/tests/mockserver/internal/sdk/models/components/security.go b/tests/mockserver/internal/sdk/models/components/security.go index 67dddeda..dbdba57e 100644 --- a/tests/mockserver/internal/sdk/models/components/security.go +++ b/tests/mockserver/internal/sdk/models/components/security.go @@ -4,8 +4,8 @@ package components type Security struct { APIKey *string `security:"scheme,type=apiKey,subtype=header,name=x-api-key"` - Bearer *string `security:"scheme,type=http,subtype=bearer,name=Authorization"` WorkspaceIdentifier *string `security:"scheme,type=apiKey,subtype=header,name=x-workspace-identifier"` + Bearer *string `security:"scheme,type=http,subtype=bearer,name=Authorization"` } func (o *Security) GetAPIKey() *string { @@ -15,16 +15,16 @@ func (o *Security) GetAPIKey() *string { return o.APIKey } -func (o *Security) GetBearer() *string { +func (o *Security) GetWorkspaceIdentifier() *string { if o == nil { return nil } - return o.Bearer + return o.WorkspaceIdentifier } -func (o *Security) GetWorkspaceIdentifier() *string { +func (o *Security) GetBearer() *string { if o == nil { return nil } - return o.WorkspaceIdentifier + return o.Bearer } diff --git a/tests/mockserver/internal/sdk/models/components/shorturl.go b/tests/mockserver/internal/sdk/models/components/shorturl.go index efd16921..e98a8a06 100644 --- a/tests/mockserver/internal/sdk/models/components/shorturl.go +++ b/tests/mockserver/internal/sdk/models/components/shorturl.go @@ -3,20 +3,20 @@ package components type ShortURL struct { - FullURL string `json:"full_url"` ShortURL string `json:"short_url"` + FullURL string `json:"full_url"` } -func (o *ShortURL) GetFullURL() string { +func (o *ShortURL) GetShortURL() string { if o == nil { return "" } - return o.FullURL + return o.ShortURL } -func (o *ShortURL) GetShortURL() string { +func (o *ShortURL) GetFullURL() string { if o == nil { return "" } - return o.ShortURL + return o.FullURL } diff --git a/tests/mockserver/internal/sdk/models/components/suggestitemsrequestbody.go b/tests/mockserver/internal/sdk/models/components/suggestitemsrequestbody.go index 9a4d1e56..a71a0640 100644 --- a/tests/mockserver/internal/sdk/models/components/suggestitemsrequestbody.go +++ b/tests/mockserver/internal/sdk/models/components/suggestitemsrequestbody.go @@ -3,22 +3,22 @@ package components type SuggestItemsRequestBody struct { - // The list of "things" to get suggestions for. One suggestion will be returned for each item in the list. - Items []string `json:"items"` // The prompt to use for the suggestion. Think of this as the "preamble". Prompt string `json:"prompt"` + // The list of "things" to get suggestions for. One suggestion will be returned for each item in the list. + Items []string `json:"items"` } -func (o *SuggestItemsRequestBody) GetItems() []string { +func (o *SuggestItemsRequestBody) GetPrompt() string { if o == nil { - return []string{} + return "" } - return o.Items + return o.Prompt } -func (o *SuggestItemsRequestBody) GetPrompt() string { +func (o *SuggestItemsRequestBody) GetItems() []string { if o == nil { - return "" + return []string{} } - return o.Prompt + return o.Items } diff --git a/tests/mockserver/internal/sdk/models/components/suggestoptsold.go b/tests/mockserver/internal/sdk/models/components/suggestoptsold.go index 8811c81c..23e6bf41 100644 --- a/tests/mockserver/internal/sdk/models/components/suggestoptsold.go +++ b/tests/mockserver/internal/sdk/models/components/suggestoptsold.go @@ -7,17 +7,17 @@ import ( "fmt" ) -type SuggestionType string +type SuggestOptsOldSuggestionType string const ( - SuggestionTypeMethodNames SuggestionType = "method-names" - SuggestionTypeDiagnosticsOnly SuggestionType = "diagnostics-only" + SuggestOptsOldSuggestionTypeMethodNames SuggestOptsOldSuggestionType = "method-names" + SuggestOptsOldSuggestionTypeDiagnosticsOnly SuggestOptsOldSuggestionType = "diagnostics-only" ) -func (e SuggestionType) ToPointer() *SuggestionType { +func (e SuggestOptsOldSuggestionType) ToPointer() *SuggestOptsOldSuggestionType { return &e } -func (e *SuggestionType) UnmarshalJSON(data []byte) error { +func (e *SuggestOptsOldSuggestionType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -26,28 +26,28 @@ func (e *SuggestionType) UnmarshalJSON(data []byte) error { case "method-names": fallthrough case "diagnostics-only": - *e = SuggestionType(v) + *e = SuggestOptsOldSuggestionType(v) return nil default: - return fmt.Errorf("invalid value for SuggestionType: %v", v) + return fmt.Errorf("invalid value for SuggestOptsOldSuggestionType: %v", v) } } type SuggestOptsOld struct { - Diagnostics []Diagnostic `json:"diagnostics,omitempty"` - SuggestionType SuggestionType `json:"suggestion_type"` + SuggestionType SuggestOptsOldSuggestionType `json:"suggestion_type"` + Diagnostics []Diagnostic `json:"diagnostics,omitempty"` } -func (o *SuggestOptsOld) GetDiagnostics() []Diagnostic { +func (o *SuggestOptsOld) GetSuggestionType() SuggestOptsOldSuggestionType { if o == nil { - return nil + return SuggestOptsOldSuggestionType("") } - return o.Diagnostics + return o.SuggestionType } -func (o *SuggestOptsOld) GetSuggestionType() SuggestionType { +func (o *SuggestOptsOld) GetDiagnostics() []Diagnostic { if o == nil { - return SuggestionType("") + return nil } - return o.SuggestionType + return o.Diagnostics } diff --git a/tests/mockserver/internal/sdk/models/components/suggestrequestbody.go b/tests/mockserver/internal/sdk/models/components/suggestrequestbody.go index abb5d619..2c93064b 100644 --- a/tests/mockserver/internal/sdk/models/components/suggestrequestbody.go +++ b/tests/mockserver/internal/sdk/models/components/suggestrequestbody.go @@ -34,16 +34,9 @@ func (e *SuggestRequestBodySuggestionType) UnmarshalJSON(data []byte) error { } type SuggestRequestBody struct { - Diagnostics []Diagnostic `json:"diagnostics"` OasSummary OASSummary `json:"oas_summary"` SuggestionType SuggestRequestBodySuggestionType `json:"suggestion_type"` -} - -func (o *SuggestRequestBody) GetDiagnostics() []Diagnostic { - if o == nil { - return []Diagnostic{} - } - return o.Diagnostics + Diagnostics []Diagnostic `json:"diagnostics"` } func (o *SuggestRequestBody) GetOasSummary() OASSummary { @@ -59,3 +52,10 @@ func (o *SuggestRequestBody) GetSuggestionType() SuggestRequestBodySuggestionTyp } return o.SuggestionType } + +func (o *SuggestRequestBody) GetDiagnostics() []Diagnostic { + if o == nil { + return []Diagnostic{} + } + return o.Diagnostics +} diff --git a/tests/mockserver/internal/sdk/models/components/targetsdk.go b/tests/mockserver/internal/sdk/models/components/targetsdk.go index aac8a832..773f1e6a 100644 --- a/tests/mockserver/internal/sdk/models/components/targetsdk.go +++ b/tests/mockserver/internal/sdk/models/components/targetsdk.go @@ -8,22 +8,40 @@ import ( ) type TargetSDK struct { + // Unique identifier of the target the same as `generate_gen_lock_id` + ID string `json:"id"` + // Unique identifier of the last event for the target + LastEventID string `json:"last_event_id"` + // Timestamp when the event was created in the database. + LastEventCreatedAt time.Time `json:"last_event_created_at"` + // Type of interaction. + LastEventInteractionType InteractionType `json:"last_event_interaction_type"` + // Indicates whether the event was successful. + Success *bool `json:"success,omitempty"` // Remote commit ID. CommitHead *string `json:"commit_head,omitempty"` - // Name of the CI environment. - ContinuousIntegrationEnvironment *string `json:"continuous_integration_environment,omitempty"` - // Error message if the last event was not successful. - Error *string `json:"error,omitempty"` - // Version of the generated target (post generation) - GenerateConfigPostVersion *string `json:"generate_config_post_version,omitempty"` - // Eligible feature set during generation - GenerateEligibleFeatures *string `json:"generate_eligible_features,omitempty"` + // Default owner for git remote. + GitRemoteDefaultOwner *string `json:"git_remote_default_owner,omitempty"` + // Default repository name for git remote. + GitRemoteDefaultRepo *string `json:"git_remote_default_repo,omitempty"` + // Current working directory relative to the git root. + GitRelativeCwd *string `json:"git_relative_cwd,omitempty"` + // eg `typescript`, `terraform`, `python` + GenerateTarget string `json:"generate_target"` + // The workflow name of the target. + GenerateTargetName *string `json:"generate_target_name,omitempty"` // gen.lock ID (expected to be a uuid). The same as `id`. A unique identifier for the target. GenerateGenLockID string `json:"generate_gen_lock_id"` + // The version of the Speakeasy generator for this target eg v2 of the typescript generator. + GenerateTargetVersion *string `json:"generate_target_version,omitempty"` + // Version of the generated target (post generation) + GenerateConfigPostVersion *string `json:"generate_config_post_version,omitempty"` // Features prior to generation GenerateGenLockPreFeatures *string `json:"generate_gen_lock_pre_features,omitempty"` // Artifact version for the Previous Generation GenerateGenLockPreVersion *string `json:"generate_gen_lock_pre_version,omitempty"` + // Eligible feature set during generation + GenerateEligibleFeatures *string `json:"generate_eligible_features,omitempty"` // The number of operations ignored in generation. GenerateNumberOfOperationsIgnored *int64 `json:"generate_number_of_operations_ignored,omitempty"` // The number of operations used in generation. @@ -32,72 +50,54 @@ type TargetSDK struct { GenerateNumberOfTerraformResources *int64 `json:"generate_number_of_terraform_resources,omitempty"` // Indicates whether the target was considered published. GeneratePublished *bool `json:"generate_published,omitempty"` - // eg `typescript`, `terraform`, `python` - GenerateTarget string `json:"generate_target"` - // The workflow name of the target. - GenerateTargetName *string `json:"generate_target_name,omitempty"` - // The version of the Speakeasy generator for this target eg v2 of the typescript generator. - GenerateTargetVersion *string `json:"generate_target_version,omitempty"` - // GitHub organization of the action. - GhActionOrganization *string `json:"gh_action_organization,omitempty"` + // Name of the CI environment. + ContinuousIntegrationEnvironment *string `json:"continuous_integration_environment,omitempty"` // GitHub Action ref value. GhActionRef *string `json:"gh_action_ref,omitempty"` - // GitHub repository of the action. - GhActionRepository *string `json:"gh_action_repository,omitempty"` // Link to the GitHub action run. GhActionRunLink *string `json:"gh_action_run_link,omitempty"` // Version of the GitHub action. GhActionVersion *string `json:"gh_action_version,omitempty"` - // Current working directory relative to the git root. - GitRelativeCwd *string `json:"git_relative_cwd,omitempty"` - // Default owner for git remote. - GitRemoteDefaultOwner *string `json:"git_remote_default_owner,omitempty"` - // Default repository name for git remote. - GitRemoteDefaultRepo *string `json:"git_remote_default_repo,omitempty"` - // User email from git configuration. - GitUserEmail *string `json:"git_user_email,omitempty"` - // User's name from git configuration. (not GitHub username) - GitUserName *string `json:"git_user_name,omitempty"` - // Remote hostname. - Hostname *string `json:"hostname,omitempty"` - // Unique identifier of the target the same as `generate_gen_lock_id` - ID string `json:"id"` - // Timestamp when the event was created in the database. - LastEventCreatedAt time.Time `json:"last_event_created_at"` - // Unique identifier of the last event for the target - LastEventID string `json:"last_event_id"` - // Type of interaction. - LastEventInteractionType InteractionType `json:"last_event_interaction_type"` - // Timestamp when the last publishing event was created. - LastPublishCreatedAt *time.Time `json:"last_publish_created_at,omitempty"` - // Link to the GitHub action run for the last publishing event. - LastPublishGhActionRunLink *string `json:"last_publish_gh_action_run_link,omitempty"` - // Name of the published package. - PublishPackageName *string `json:"publish_package_name,omitempty"` - // Name of the registry where the package was published. - PublishPackageRegistryName *string `json:"publish_package_registry_name,omitempty"` - // URL of the published package. - PublishPackageURL *string `json:"publish_package_url,omitempty"` - // Version of the published package. - PublishPackageVersion *string `json:"publish_package_version,omitempty"` + // GitHub organization of the action. + GhActionOrganization *string `json:"gh_action_organization,omitempty"` + // GitHub repository of the action. + GhActionRepository *string `json:"gh_action_repository,omitempty"` // Label of the git repository. RepoLabel *string `json:"repo_label,omitempty"` + // Remote hostname. + Hostname *string `json:"hostname,omitempty"` + // User's name from git configuration. (not GitHub username) + GitUserName *string `json:"git_user_name,omitempty"` + // User email from git configuration. + GitUserEmail *string `json:"git_user_email,omitempty"` + // The revision digest of the source. + SourceRevisionDigest *string `json:"source_revision_digest,omitempty"` // The blob digest of the source. SourceBlobDigest *string `json:"source_blob_digest,omitempty"` // The namespace name of the source. SourceNamespaceName *string `json:"source_namespace_name,omitempty"` - // The revision digest of the source. - SourceRevisionDigest *string `json:"source_revision_digest,omitempty"` - // Indicates whether the event was successful. - Success *bool `json:"success,omitempty"` - // Workflow lock file (post execution) - WorkflowLockPostRaw *string `json:"workflow_lock_post_raw,omitempty"` - // Workflow lock file (prior to execution) - WorkflowLockPreRaw *string `json:"workflow_lock_pre_raw,omitempty"` - // Workflow file (post execution) - WorkflowPostRaw *string `json:"workflow_post_raw,omitempty"` + // Error message if the last event was not successful. + Error *string `json:"error,omitempty"` // Workflow file (prior to execution) WorkflowPreRaw *string `json:"workflow_pre_raw,omitempty"` + // Workflow file (post execution) + WorkflowPostRaw *string `json:"workflow_post_raw,omitempty"` + // Workflow lock file (prior to execution) + WorkflowLockPreRaw *string `json:"workflow_lock_pre_raw,omitempty"` + // Workflow lock file (post execution) + WorkflowLockPostRaw *string `json:"workflow_lock_post_raw,omitempty"` + // URL of the published package. + PublishPackageURL *string `json:"publish_package_url,omitempty"` + // Name of the published package. + PublishPackageName *string `json:"publish_package_name,omitempty"` + // Version of the published package. + PublishPackageVersion *string `json:"publish_package_version,omitempty"` + // Name of the registry where the package was published. + PublishPackageRegistryName *string `json:"publish_package_registry_name,omitempty"` + // Timestamp when the last publishing event was created. + LastPublishCreatedAt *time.Time `json:"last_publish_created_at,omitempty"` + // Link to the GitHub action run for the last publishing event. + LastPublishGhActionRunLink *string `json:"last_publish_gh_action_run_link,omitempty"` } func (t TargetSDK) MarshalJSON() ([]byte, error) { @@ -105,323 +105,323 @@ func (t TargetSDK) MarshalJSON() ([]byte, error) { } func (t *TargetSDK) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &t, "", false, []string{"id", "last_event_id", "last_event_created_at", "last_event_interaction_type", "generate_target", "generate_gen_lock_id"}); err != nil { return err } return nil } -func (o *TargetSDK) GetCommitHead() *string { +func (o *TargetSDK) GetID() string { if o == nil { - return nil + return "" } - return o.CommitHead + return o.ID } -func (o *TargetSDK) GetContinuousIntegrationEnvironment() *string { +func (o *TargetSDK) GetLastEventID() string { if o == nil { - return nil + return "" } - return o.ContinuousIntegrationEnvironment + return o.LastEventID } -func (o *TargetSDK) GetError() *string { +func (o *TargetSDK) GetLastEventCreatedAt() time.Time { if o == nil { - return nil + return time.Time{} } - return o.Error + return o.LastEventCreatedAt } -func (o *TargetSDK) GetGenerateConfigPostVersion() *string { +func (o *TargetSDK) GetLastEventInteractionType() InteractionType { if o == nil { - return nil + return InteractionType("") } - return o.GenerateConfigPostVersion + return o.LastEventInteractionType } -func (o *TargetSDK) GetGenerateEligibleFeatures() *string { +func (o *TargetSDK) GetSuccess() *bool { if o == nil { return nil } - return o.GenerateEligibleFeatures + return o.Success } -func (o *TargetSDK) GetGenerateGenLockID() string { +func (o *TargetSDK) GetCommitHead() *string { if o == nil { - return "" + return nil } - return o.GenerateGenLockID + return o.CommitHead } -func (o *TargetSDK) GetGenerateGenLockPreFeatures() *string { +func (o *TargetSDK) GetGitRemoteDefaultOwner() *string { if o == nil { return nil } - return o.GenerateGenLockPreFeatures + return o.GitRemoteDefaultOwner } -func (o *TargetSDK) GetGenerateGenLockPreVersion() *string { +func (o *TargetSDK) GetGitRemoteDefaultRepo() *string { if o == nil { return nil } - return o.GenerateGenLockPreVersion + return o.GitRemoteDefaultRepo } -func (o *TargetSDK) GetGenerateNumberOfOperationsIgnored() *int64 { +func (o *TargetSDK) GetGitRelativeCwd() *string { if o == nil { return nil } - return o.GenerateNumberOfOperationsIgnored + return o.GitRelativeCwd } -func (o *TargetSDK) GetGenerateNumberOfOperationsUsed() *int64 { +func (o *TargetSDK) GetGenerateTarget() string { if o == nil { - return nil + return "" } - return o.GenerateNumberOfOperationsUsed + return o.GenerateTarget } -func (o *TargetSDK) GetGenerateNumberOfTerraformResources() *int64 { +func (o *TargetSDK) GetGenerateTargetName() *string { if o == nil { return nil } - return o.GenerateNumberOfTerraformResources + return o.GenerateTargetName } -func (o *TargetSDK) GetGeneratePublished() *bool { +func (o *TargetSDK) GetGenerateGenLockID() string { if o == nil { - return nil + return "" } - return o.GeneratePublished + return o.GenerateGenLockID } -func (o *TargetSDK) GetGenerateTarget() string { +func (o *TargetSDK) GetGenerateTargetVersion() *string { if o == nil { - return "" + return nil } - return o.GenerateTarget + return o.GenerateTargetVersion } -func (o *TargetSDK) GetGenerateTargetName() *string { +func (o *TargetSDK) GetGenerateConfigPostVersion() *string { if o == nil { return nil } - return o.GenerateTargetName + return o.GenerateConfigPostVersion } -func (o *TargetSDK) GetGenerateTargetVersion() *string { +func (o *TargetSDK) GetGenerateGenLockPreFeatures() *string { if o == nil { return nil } - return o.GenerateTargetVersion + return o.GenerateGenLockPreFeatures } -func (o *TargetSDK) GetGhActionOrganization() *string { +func (o *TargetSDK) GetGenerateGenLockPreVersion() *string { if o == nil { return nil } - return o.GhActionOrganization + return o.GenerateGenLockPreVersion } -func (o *TargetSDK) GetGhActionRef() *string { +func (o *TargetSDK) GetGenerateEligibleFeatures() *string { if o == nil { return nil } - return o.GhActionRef + return o.GenerateEligibleFeatures } -func (o *TargetSDK) GetGhActionRepository() *string { +func (o *TargetSDK) GetGenerateNumberOfOperationsIgnored() *int64 { if o == nil { return nil } - return o.GhActionRepository + return o.GenerateNumberOfOperationsIgnored } -func (o *TargetSDK) GetGhActionRunLink() *string { +func (o *TargetSDK) GetGenerateNumberOfOperationsUsed() *int64 { if o == nil { return nil } - return o.GhActionRunLink + return o.GenerateNumberOfOperationsUsed } -func (o *TargetSDK) GetGhActionVersion() *string { +func (o *TargetSDK) GetGenerateNumberOfTerraformResources() *int64 { if o == nil { return nil } - return o.GhActionVersion + return o.GenerateNumberOfTerraformResources } -func (o *TargetSDK) GetGitRelativeCwd() *string { +func (o *TargetSDK) GetGeneratePublished() *bool { if o == nil { return nil } - return o.GitRelativeCwd + return o.GeneratePublished } -func (o *TargetSDK) GetGitRemoteDefaultOwner() *string { +func (o *TargetSDK) GetContinuousIntegrationEnvironment() *string { if o == nil { return nil } - return o.GitRemoteDefaultOwner + return o.ContinuousIntegrationEnvironment } -func (o *TargetSDK) GetGitRemoteDefaultRepo() *string { +func (o *TargetSDK) GetGhActionRef() *string { if o == nil { return nil } - return o.GitRemoteDefaultRepo + return o.GhActionRef } -func (o *TargetSDK) GetGitUserEmail() *string { +func (o *TargetSDK) GetGhActionRunLink() *string { if o == nil { return nil } - return o.GitUserEmail + return o.GhActionRunLink } -func (o *TargetSDK) GetGitUserName() *string { +func (o *TargetSDK) GetGhActionVersion() *string { if o == nil { return nil } - return o.GitUserName + return o.GhActionVersion } -func (o *TargetSDK) GetHostname() *string { +func (o *TargetSDK) GetGhActionOrganization() *string { if o == nil { return nil } - return o.Hostname + return o.GhActionOrganization } -func (o *TargetSDK) GetID() string { +func (o *TargetSDK) GetGhActionRepository() *string { if o == nil { - return "" + return nil } - return o.ID + return o.GhActionRepository } -func (o *TargetSDK) GetLastEventCreatedAt() time.Time { +func (o *TargetSDK) GetRepoLabel() *string { if o == nil { - return time.Time{} + return nil } - return o.LastEventCreatedAt + return o.RepoLabel } -func (o *TargetSDK) GetLastEventID() string { +func (o *TargetSDK) GetHostname() *string { if o == nil { - return "" + return nil } - return o.LastEventID + return o.Hostname } -func (o *TargetSDK) GetLastEventInteractionType() InteractionType { +func (o *TargetSDK) GetGitUserName() *string { if o == nil { - return InteractionType("") + return nil } - return o.LastEventInteractionType + return o.GitUserName } -func (o *TargetSDK) GetLastPublishCreatedAt() *time.Time { +func (o *TargetSDK) GetGitUserEmail() *string { if o == nil { return nil } - return o.LastPublishCreatedAt + return o.GitUserEmail } -func (o *TargetSDK) GetLastPublishGhActionRunLink() *string { +func (o *TargetSDK) GetSourceRevisionDigest() *string { if o == nil { return nil } - return o.LastPublishGhActionRunLink + return o.SourceRevisionDigest } -func (o *TargetSDK) GetPublishPackageName() *string { +func (o *TargetSDK) GetSourceBlobDigest() *string { if o == nil { return nil } - return o.PublishPackageName + return o.SourceBlobDigest } -func (o *TargetSDK) GetPublishPackageRegistryName() *string { +func (o *TargetSDK) GetSourceNamespaceName() *string { if o == nil { return nil } - return o.PublishPackageRegistryName + return o.SourceNamespaceName } -func (o *TargetSDK) GetPublishPackageURL() *string { +func (o *TargetSDK) GetError() *string { if o == nil { return nil } - return o.PublishPackageURL + return o.Error } -func (o *TargetSDK) GetPublishPackageVersion() *string { +func (o *TargetSDK) GetWorkflowPreRaw() *string { if o == nil { return nil } - return o.PublishPackageVersion + return o.WorkflowPreRaw } -func (o *TargetSDK) GetRepoLabel() *string { +func (o *TargetSDK) GetWorkflowPostRaw() *string { if o == nil { return nil } - return o.RepoLabel + return o.WorkflowPostRaw } -func (o *TargetSDK) GetSourceBlobDigest() *string { +func (o *TargetSDK) GetWorkflowLockPreRaw() *string { if o == nil { return nil } - return o.SourceBlobDigest + return o.WorkflowLockPreRaw } -func (o *TargetSDK) GetSourceNamespaceName() *string { +func (o *TargetSDK) GetWorkflowLockPostRaw() *string { if o == nil { return nil } - return o.SourceNamespaceName + return o.WorkflowLockPostRaw } -func (o *TargetSDK) GetSourceRevisionDigest() *string { +func (o *TargetSDK) GetPublishPackageURL() *string { if o == nil { return nil } - return o.SourceRevisionDigest + return o.PublishPackageURL } -func (o *TargetSDK) GetSuccess() *bool { +func (o *TargetSDK) GetPublishPackageName() *string { if o == nil { return nil } - return o.Success + return o.PublishPackageName } -func (o *TargetSDK) GetWorkflowLockPostRaw() *string { +func (o *TargetSDK) GetPublishPackageVersion() *string { if o == nil { return nil } - return o.WorkflowLockPostRaw + return o.PublishPackageVersion } -func (o *TargetSDK) GetWorkflowLockPreRaw() *string { +func (o *TargetSDK) GetPublishPackageRegistryName() *string { if o == nil { return nil } - return o.WorkflowLockPreRaw + return o.PublishPackageRegistryName } -func (o *TargetSDK) GetWorkflowPostRaw() *string { +func (o *TargetSDK) GetLastPublishCreatedAt() *time.Time { if o == nil { return nil } - return o.WorkflowPostRaw + return o.LastPublishCreatedAt } -func (o *TargetSDK) GetWorkflowPreRaw() *string { +func (o *TargetSDK) GetLastPublishGhActionRunLink() *string { if o == nil { return nil } - return o.WorkflowPreRaw + return o.LastPublishGhActionRunLink } diff --git a/tests/mockserver/internal/sdk/models/components/usagesnippet.go b/tests/mockserver/internal/sdk/models/components/usagesnippet.go index d3c4dd35..a6801bb0 100644 --- a/tests/mockserver/internal/sdk/models/components/usagesnippet.go +++ b/tests/mockserver/internal/sdk/models/components/usagesnippet.go @@ -3,30 +3,23 @@ package components type UsageSnippet struct { - // The code snippet - Code string `json:"code"` - // The language of the snippet - Language string `json:"language"` + // The path of the operation + Path string `json:"path"` // The HTTP method of the operation Method any `json:"method"` // The operation ID for the snippet OperationID string `json:"operationId"` - // The path of the operation - Path string `json:"path"` -} - -func (o *UsageSnippet) GetCode() string { - if o == nil { - return "" - } - return o.Code + // The language of the snippet + Language string `json:"language"` + // The code snippet + Code string `json:"code"` } -func (o *UsageSnippet) GetLanguage() string { +func (o *UsageSnippet) GetPath() string { if o == nil { return "" } - return o.Language + return o.Path } func (o *UsageSnippet) GetMethod() any { @@ -43,9 +36,16 @@ func (o *UsageSnippet) GetOperationID() string { return o.OperationID } -func (o *UsageSnippet) GetPath() string { +func (o *UsageSnippet) GetLanguage() string { if o == nil { return "" } - return o.Path + return o.Language +} + +func (o *UsageSnippet) GetCode() string { + if o == nil { + return "" + } + return o.Code } diff --git a/tests/mockserver/internal/sdk/models/components/user.go b/tests/mockserver/internal/sdk/models/components/user.go index 3f1ddd58..36bfd5b7 100644 --- a/tests/mockserver/internal/sdk/models/components/user.go +++ b/tests/mockserver/internal/sdk/models/components/user.go @@ -8,38 +8,38 @@ import ( ) type User struct { - // Indicates whether the user is an admin. - Admin bool `json:"admin"` - // Indicates whether the user has been confirmed. - Confirmed bool `json:"confirmed"` - // Timestamp of the user's creation. - CreatedAt time.Time `json:"created_at"` - // Identifier of the default workspace. - DefaultWorkspaceID *string `json:"default_workspace_id,omitempty"` - // Display name of the user. - DisplayName string `json:"display_name"` + // Unique identifier for the user. + ID string `json:"id"` // Email address of the user. Email string `json:"email"` // Indicates whether the email address has been verified. EmailVerified bool `json:"email_verified"` // GitHub handle of the user. GithubHandle *string `json:"github_handle,omitempty"` - // Indicates whether the user has created an API key. Not always populated - HasCreatedAPIKey *bool `json:"has_created_api_key,omitempty"` - // Unique identifier for the user. - ID string `json:"id"` - // Indicates whether the user is internal. - Internal *bool `json:"internal,omitempty"` - // Timestamp of the last login. - LastLoginAt *time.Time `json:"last_login_at,omitempty"` + // Display name of the user. + DisplayName string `json:"display_name"` // URL of the user's photo. PhotoURL *string `json:"photo_url,omitempty"` - // Hash used for pylon identity verification returned on v1/user. - PylonIdentityHash *string `json:"pylon_identity_hash,omitempty"` - // Timestamp of the user's last update. - UpdatedAt time.Time `json:"updated_at"` + // Identifier of the default workspace. + DefaultWorkspaceID *string `json:"default_workspace_id,omitempty"` + // Indicates whether the user has been confirmed. + Confirmed bool `json:"confirmed"` // Indicates whether the user has been whitelisted. Whitelisted bool `json:"whitelisted"` + // Timestamp of the last login. + LastLoginAt *time.Time `json:"last_login_at,omitempty"` + // Indicates whether the user is an admin. + Admin bool `json:"admin"` + // Timestamp of the user's creation. + CreatedAt time.Time `json:"created_at"` + // Timestamp of the user's last update. + UpdatedAt time.Time `json:"updated_at"` + // Indicates whether the user is internal. + Internal *bool `json:"internal,omitempty"` + // Hash used for pylon identity verification returned on v1/user. + PylonIdentityHash *string `json:"pylon_identity_hash,omitempty"` + // Indicates whether the user has created an API key. Not always populated + HasCreatedAPIKey *bool `json:"has_created_api_key,omitempty"` } func (u User) MarshalJSON() ([]byte, error) { @@ -47,38 +47,38 @@ func (u User) MarshalJSON() ([]byte, error) { } func (u *User) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &u, "", false, []string{"id", "email", "email_verified", "display_name", "confirmed", "whitelisted", "admin", "created_at", "updated_at"}); err != nil { return err } return nil } -func (o *User) GetAdmin() bool { +func (o *User) GetID() string { if o == nil { - return false + return "" } - return o.Admin + return o.ID } -func (o *User) GetConfirmed() bool { +func (o *User) GetEmail() string { if o == nil { - return false + return "" } - return o.Confirmed + return o.Email } -func (o *User) GetCreatedAt() time.Time { +func (o *User) GetEmailVerified() bool { if o == nil { - return time.Time{} + return false } - return o.CreatedAt + return o.EmailVerified } -func (o *User) GetDefaultWorkspaceID() *string { +func (o *User) GetGithubHandle() *string { if o == nil { return nil } - return o.DefaultWorkspaceID + return o.GithubHandle } func (o *User) GetDisplayName() string { @@ -88,60 +88,67 @@ func (o *User) GetDisplayName() string { return o.DisplayName } -func (o *User) GetEmail() string { +func (o *User) GetPhotoURL() *string { if o == nil { - return "" + return nil } - return o.Email + return o.PhotoURL } -func (o *User) GetEmailVerified() bool { +func (o *User) GetDefaultWorkspaceID() *string { + if o == nil { + return nil + } + return o.DefaultWorkspaceID +} + +func (o *User) GetConfirmed() bool { if o == nil { return false } - return o.EmailVerified + return o.Confirmed } -func (o *User) GetGithubHandle() *string { +func (o *User) GetWhitelisted() bool { if o == nil { - return nil + return false } - return o.GithubHandle + return o.Whitelisted } -func (o *User) GetHasCreatedAPIKey() *bool { +func (o *User) GetLastLoginAt() *time.Time { if o == nil { return nil } - return o.HasCreatedAPIKey + return o.LastLoginAt } -func (o *User) GetID() string { +func (o *User) GetAdmin() bool { if o == nil { - return "" + return false } - return o.ID + return o.Admin } -func (o *User) GetInternal() *bool { +func (o *User) GetCreatedAt() time.Time { if o == nil { - return nil + return time.Time{} } - return o.Internal + return o.CreatedAt } -func (o *User) GetLastLoginAt() *time.Time { +func (o *User) GetUpdatedAt() time.Time { if o == nil { - return nil + return time.Time{} } - return o.LastLoginAt + return o.UpdatedAt } -func (o *User) GetPhotoURL() *string { +func (o *User) GetInternal() *bool { if o == nil { return nil } - return o.PhotoURL + return o.Internal } func (o *User) GetPylonIdentityHash() *string { @@ -151,16 +158,9 @@ func (o *User) GetPylonIdentityHash() *string { return o.PylonIdentityHash } -func (o *User) GetUpdatedAt() time.Time { - if o == nil { - return time.Time{} - } - return o.UpdatedAt -} - -func (o *User) GetWhitelisted() bool { +func (o *User) GetHasCreatedAPIKey() *bool { if o == nil { - return false + return nil } - return o.Whitelisted + return o.HasCreatedAPIKey } diff --git a/tests/mockserver/internal/sdk/models/components/v2descriptor.go b/tests/mockserver/internal/sdk/models/components/v2descriptor.go index 486af37d..75b5bee2 100644 --- a/tests/mockserver/internal/sdk/models/components/v2descriptor.go +++ b/tests/mockserver/internal/sdk/models/components/v2descriptor.go @@ -4,21 +4,14 @@ package components // V2Descriptor - V2 descriptor type V2Descriptor struct { - // Annotations - Annotations *Annotations `json:"annotations,omitempty"` // Digest Digest *string `json:"digest,omitempty"` // Media type MediaType *string `json:"mediaType,omitempty"` // Size Size *int64 `json:"size,omitempty"` -} - -func (o *V2Descriptor) GetAnnotations() *Annotations { - if o == nil { - return nil - } - return o.Annotations + // Annotations + Annotations *Annotations `json:"annotations,omitempty"` } func (o *V2Descriptor) GetDigest() *string { @@ -41,3 +34,10 @@ func (o *V2Descriptor) GetSize() *int64 { } return o.Size } + +func (o *V2Descriptor) GetAnnotations() *Annotations { + if o == nil { + return nil + } + return o.Annotations +} diff --git a/tests/mockserver/internal/sdk/models/components/workflowdocument.go b/tests/mockserver/internal/sdk/models/components/workflowdocument.go index 3f2c952d..05b9b6b2 100644 --- a/tests/mockserver/internal/sdk/models/components/workflowdocument.go +++ b/tests/mockserver/internal/sdk/models/components/workflowdocument.go @@ -23,20 +23,20 @@ func (o *Auth) GetSecret() string { // WorkflowDocument - A document referenced by a workflow type WorkflowDocument struct { - Auth *Auth `json:"auth,omitempty"` Location string `json:"location"` + Auth *Auth `json:"auth,omitempty"` } -func (o *WorkflowDocument) GetAuth() *Auth { +func (o *WorkflowDocument) GetLocation() string { if o == nil { - return nil + return "" } - return o.Auth + return o.Location } -func (o *WorkflowDocument) GetLocation() string { +func (o *WorkflowDocument) GetAuth() *Auth { if o == nil { - return "" + return nil } - return o.Location + return o.Auth } diff --git a/tests/mockserver/internal/sdk/models/components/workspace.go b/tests/mockserver/internal/sdk/models/components/workspace.go index 090b28cc..f86efaa8 100644 --- a/tests/mockserver/internal/sdk/models/components/workspace.go +++ b/tests/mockserver/internal/sdk/models/components/workspace.go @@ -11,10 +11,10 @@ import ( type Workspace struct { CreatedAt time.Time `json:"created_at"` ID string `json:"id"` - Inactive *bool `json:"inactive,omitempty"` Name string `json:"name"` OrganizationID string `json:"organization_id"` Slug string `json:"slug"` + Inactive *bool `json:"inactive,omitempty"` // Deprecated. Use organization.telemetry_disabled instead. // // Deprecated: This will be removed in a future release, please migrate away from it as soon as possible. @@ -28,7 +28,7 @@ func (w Workspace) MarshalJSON() ([]byte, error) { } func (w *Workspace) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &w, "", false, []string{"created_at", "id", "name", "organization_id", "slug", "updated_at", "verified"}); err != nil { return err } return nil @@ -48,13 +48,6 @@ func (o *Workspace) GetID() string { return o.ID } -func (o *Workspace) GetInactive() *bool { - if o == nil { - return nil - } - return o.Inactive -} - func (o *Workspace) GetName() string { if o == nil { return "" @@ -76,6 +69,13 @@ func (o *Workspace) GetSlug() string { return o.Slug } +func (o *Workspace) GetInactive() *bool { + if o == nil { + return nil + } + return o.Inactive +} + func (o *Workspace) GetTelemetryDisabled() *bool { if o == nil { return nil diff --git a/tests/mockserver/internal/sdk/models/components/workspaceandorganization.go b/tests/mockserver/internal/sdk/models/components/workspaceandorganization.go index 8678d0c0..98cbc1a7 100644 --- a/tests/mockserver/internal/sdk/models/components/workspaceandorganization.go +++ b/tests/mockserver/internal/sdk/models/components/workspaceandorganization.go @@ -4,22 +4,22 @@ package components // WorkspaceAndOrganization - A workspace and organization type WorkspaceAndOrganization struct { - // A speakeasy organization - Organization Organization `json:"organization"` // A speakeasy workspace Workspace Workspace `json:"workspace"` + // A speakeasy organization + Organization Organization `json:"organization"` } -func (o *WorkspaceAndOrganization) GetOrganization() Organization { +func (o *WorkspaceAndOrganization) GetWorkspace() Workspace { if o == nil { - return Organization{} + return Workspace{} } - return o.Organization + return o.Workspace } -func (o *WorkspaceAndOrganization) GetWorkspace() Workspace { +func (o *WorkspaceAndOrganization) GetOrganization() Organization { if o == nil { - return Workspace{} + return Organization{} } - return o.Workspace + return o.Organization } diff --git a/tests/mockserver/internal/sdk/models/components/workspaceinviteresponse.go b/tests/mockserver/internal/sdk/models/components/workspaceinviteresponse.go index f70627c7..6179171f 100644 --- a/tests/mockserver/internal/sdk/models/components/workspaceinviteresponse.go +++ b/tests/mockserver/internal/sdk/models/components/workspaceinviteresponse.go @@ -3,40 +3,40 @@ package components type Relationship struct { - UserID string `json:"user_id"` WorkspaceID string `json:"workspace_id"` + UserID string `json:"user_id"` } -func (o *Relationship) GetUserID() string { +func (o *Relationship) GetWorkspaceID() string { if o == nil { return "" } - return o.UserID + return o.WorkspaceID } -func (o *Relationship) GetWorkspaceID() string { +func (o *Relationship) GetUserID() string { if o == nil { return "" } - return o.WorkspaceID + return o.UserID } // WorkspaceInviteResponse - A response for workspace user invite type WorkspaceInviteResponse struct { - InviteLink *string `json:"invite_link,omitempty"` Relationship Relationship `json:"relationship"` + InviteLink *string `json:"invite_link,omitempty"` } -func (o *WorkspaceInviteResponse) GetInviteLink() *string { +func (o *WorkspaceInviteResponse) GetRelationship() Relationship { if o == nil { - return nil + return Relationship{} } - return o.InviteLink + return o.Relationship } -func (o *WorkspaceInviteResponse) GetRelationship() Relationship { +func (o *WorkspaceInviteResponse) GetInviteLink() *string { if o == nil { - return Relationship{} + return nil } - return o.Relationship + return o.InviteLink } diff --git a/tests/mockserver/internal/sdk/models/components/workspacesettings.go b/tests/mockserver/internal/sdk/models/components/workspacesettings.go index 86337c98..3296d3b6 100644 --- a/tests/mockserver/internal/sdk/models/components/workspacesettings.go +++ b/tests/mockserver/internal/sdk/models/components/workspacesettings.go @@ -8,10 +8,10 @@ import ( ) type WorkspaceSettings struct { + WorkspaceID string `json:"workspace_id"` + WebhookURL string `json:"webhook_url"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` - WebhookURL string `json:"webhook_url"` - WorkspaceID string `json:"workspace_id"` } func (w WorkspaceSettings) MarshalJSON() ([]byte, error) { @@ -19,36 +19,36 @@ func (w WorkspaceSettings) MarshalJSON() ([]byte, error) { } func (w *WorkspaceSettings) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &w, "", false, []string{"workspace_id", "webhook_url", "created_at", "updated_at"}); err != nil { return err } return nil } -func (o *WorkspaceSettings) GetCreatedAt() time.Time { +func (o *WorkspaceSettings) GetWorkspaceID() string { if o == nil { - return time.Time{} + return "" } - return o.CreatedAt + return o.WorkspaceID } -func (o *WorkspaceSettings) GetUpdatedAt() time.Time { +func (o *WorkspaceSettings) GetWebhookURL() string { if o == nil { - return time.Time{} + return "" } - return o.UpdatedAt + return o.WebhookURL } -func (o *WorkspaceSettings) GetWebhookURL() string { +func (o *WorkspaceSettings) GetCreatedAt() time.Time { if o == nil { - return "" + return time.Time{} } - return o.WebhookURL + return o.CreatedAt } -func (o *WorkspaceSettings) GetWorkspaceID() string { +func (o *WorkspaceSettings) GetUpdatedAt() time.Time { if o == nil { - return "" + return time.Time{} } - return o.WorkspaceID + return o.UpdatedAt } diff --git a/tests/mockserver/internal/sdk/models/components/workspaceteamresponse.go b/tests/mockserver/internal/sdk/models/components/workspaceteamresponse.go index 47eb9306..7a3a1a35 100644 --- a/tests/mockserver/internal/sdk/models/components/workspaceteamresponse.go +++ b/tests/mockserver/internal/sdk/models/components/workspaceteamresponse.go @@ -4,21 +4,21 @@ package components // WorkspaceTeamResponse - Workspace team response type WorkspaceTeamResponse struct { + Users []User `json:"users"` // SSO metadata for a workspace SsoMetadata *SSOMetadata `json:"sso_metadata,omitempty"` - Users []User `json:"users"` } -func (o *WorkspaceTeamResponse) GetSsoMetadata() *SSOMetadata { +func (o *WorkspaceTeamResponse) GetUsers() []User { if o == nil { - return nil + return []User{} } - return o.SsoMetadata + return o.Users } -func (o *WorkspaceTeamResponse) GetUsers() []User { +func (o *WorkspaceTeamResponse) GetSsoMetadata() *SSOMetadata { if o == nil { - return []User{} + return nil } - return o.Users + return o.SsoMetadata } diff --git a/tests/mockserver/internal/sdk/models/components/workspacetoken.go b/tests/mockserver/internal/sdk/models/components/workspacetoken.go index e7677781..ef84c513 100644 --- a/tests/mockserver/internal/sdk/models/components/workspacetoken.go +++ b/tests/mockserver/internal/sdk/models/components/workspacetoken.go @@ -9,17 +9,17 @@ import ( // WorkspaceToken - A workspace token type WorkspaceToken struct { + ID string `json:"id"` + Name string `json:"name"` + WorkspaceID string `json:"workspace_id"` Alg string `json:"alg"` + Key string `json:"key"` + LastUsed *time.Time `json:"last_used,omitempty"` CreatedAt time.Time `json:"created_at"` CreatedBy *string `json:"created_by,omitempty"` CreatedByName *string `json:"created_by_name,omitempty"` CreatedByPhotoURL *string `json:"created_by_photo_url,omitempty"` Email *string `json:"email,omitempty"` - ID string `json:"id"` - Key string `json:"key"` - LastUsed *time.Time `json:"last_used,omitempty"` - Name string `json:"name"` - WorkspaceID string `json:"workspace_id"` } func (w WorkspaceToken) MarshalJSON() ([]byte, error) { @@ -27,85 +27,85 @@ func (w WorkspaceToken) MarshalJSON() ([]byte, error) { } func (w *WorkspaceToken) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &w, "", false, []string{"id", "name", "workspace_id", "alg", "key", "created_at"}); err != nil { return err } return nil } -func (o *WorkspaceToken) GetAlg() string { +func (o *WorkspaceToken) GetID() string { if o == nil { return "" } - return o.Alg + return o.ID } -func (o *WorkspaceToken) GetCreatedAt() time.Time { +func (o *WorkspaceToken) GetName() string { if o == nil { - return time.Time{} + return "" } - return o.CreatedAt + return o.Name } -func (o *WorkspaceToken) GetCreatedBy() *string { +func (o *WorkspaceToken) GetWorkspaceID() string { if o == nil { - return nil + return "" } - return o.CreatedBy + return o.WorkspaceID } -func (o *WorkspaceToken) GetCreatedByName() *string { +func (o *WorkspaceToken) GetAlg() string { if o == nil { - return nil + return "" } - return o.CreatedByName + return o.Alg } -func (o *WorkspaceToken) GetCreatedByPhotoURL() *string { +func (o *WorkspaceToken) GetKey() string { if o == nil { - return nil + return "" } - return o.CreatedByPhotoURL + return o.Key } -func (o *WorkspaceToken) GetEmail() *string { +func (o *WorkspaceToken) GetLastUsed() *time.Time { if o == nil { return nil } - return o.Email + return o.LastUsed } -func (o *WorkspaceToken) GetID() string { +func (o *WorkspaceToken) GetCreatedAt() time.Time { if o == nil { - return "" + return time.Time{} } - return o.ID + return o.CreatedAt } -func (o *WorkspaceToken) GetKey() string { +func (o *WorkspaceToken) GetCreatedBy() *string { if o == nil { - return "" + return nil } - return o.Key + return o.CreatedBy } -func (o *WorkspaceToken) GetLastUsed() *time.Time { +func (o *WorkspaceToken) GetCreatedByName() *string { if o == nil { return nil } - return o.LastUsed + return o.CreatedByName } -func (o *WorkspaceToken) GetName() string { +func (o *WorkspaceToken) GetCreatedByPhotoURL() *string { if o == nil { - return "" + return nil } - return o.Name + return o.CreatedByPhotoURL } -func (o *WorkspaceToken) GetWorkspaceID() string { +func (o *WorkspaceToken) GetEmail() *string { if o == nil { - return "" + return nil } - return o.WorkspaceID + return o.Email } diff --git a/tests/mockserver/internal/sdk/models/operations/activatesubscriptionnamespace.go b/tests/mockserver/internal/sdk/models/operations/activatesubscriptionnamespace.go index cb3b6355..7e1d030a 100644 --- a/tests/mockserver/internal/sdk/models/operations/activatesubscriptionnamespace.go +++ b/tests/mockserver/internal/sdk/models/operations/activatesubscriptionnamespace.go @@ -7,24 +7,24 @@ import ( ) type ActivateSubscriptionNamespaceRequest struct { - // The namespace name - NamespaceName string `pathParam:"style=simple,explode=false,name=namespaceName"` // The existing subscription ID SubscriptionID string `pathParam:"style=simple,explode=false,name=subscriptionID"` + // The namespace name + NamespaceName string `pathParam:"style=simple,explode=false,name=namespaceName"` } -func (o *ActivateSubscriptionNamespaceRequest) GetNamespaceName() string { +func (o *ActivateSubscriptionNamespaceRequest) GetSubscriptionID() string { if o == nil { return "" } - return o.NamespaceName + return o.SubscriptionID } -func (o *ActivateSubscriptionNamespaceRequest) GetSubscriptionID() string { +func (o *ActivateSubscriptionNamespaceRequest) GetNamespaceName() string { if o == nil { return "" } - return o.SubscriptionID + return o.NamespaceName } type ActivateSubscriptionNamespaceResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/archivenamespace.go b/tests/mockserver/internal/sdk/models/operations/archivenamespace.go index 453cd1ca..e9b6bb54 100644 --- a/tests/mockserver/internal/sdk/models/operations/archivenamespace.go +++ b/tests/mockserver/internal/sdk/models/operations/archivenamespace.go @@ -17,7 +17,7 @@ func (a ArchiveNamespaceRequestBody) MarshalJSON() ([]byte, error) { } func (a *ArchiveNamespaceRequestBody) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &a, "", false, nil); err != nil { return err } return nil @@ -31,23 +31,23 @@ func (o *ArchiveNamespaceRequestBody) GetArchived() *bool { } type ArchiveNamespaceRequest struct { + NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` // Archived status - RequestBody *ArchiveNamespaceRequestBody `request:"mediaType=application/json"` - NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` + Body *ArchiveNamespaceRequestBody `request:"mediaType=application/json"` } -func (o *ArchiveNamespaceRequest) GetRequestBody() *ArchiveNamespaceRequestBody { +func (o *ArchiveNamespaceRequest) GetNamespaceName() string { if o == nil { - return nil + return "" } - return o.RequestBody + return o.NamespaceName } -func (o *ArchiveNamespaceRequest) GetNamespaceName() string { +func (o *ArchiveNamespaceRequest) GetBody() *ArchiveNamespaceRequestBody { if o == nil { - return "" + return nil } - return o.NamespaceName + return o.Body } type ArchiveNamespaceResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/create.go b/tests/mockserver/internal/sdk/models/operations/create.go index bad9863e..5ae9c8de 100644 --- a/tests/mockserver/internal/sdk/models/operations/create.go +++ b/tests/mockserver/internal/sdk/models/operations/create.go @@ -6,12 +6,12 @@ import ( "mockserver/internal/sdk/models/components" ) -type CreateRequestBody struct { +type CreateRequest struct { // URL to shorten URL string `json:"url"` } -func (o *CreateRequestBody) GetURL() string { +func (o *CreateRequest) GetURL() string { if o == nil { return "" } diff --git a/tests/mockserver/internal/sdk/models/operations/createpublishingtoken.go b/tests/mockserver/internal/sdk/models/operations/createpublishingtoken.go index 86449e5c..037342f9 100644 --- a/tests/mockserver/internal/sdk/models/operations/createpublishingtoken.go +++ b/tests/mockserver/internal/sdk/models/operations/createpublishingtoken.go @@ -8,51 +8,51 @@ import ( "time" ) -// CreatePublishingTokenRequestBody - The publishing token to create -type CreatePublishingTokenRequestBody struct { +// CreatePublishingTokenRequest - The publishing token to create +type CreatePublishingTokenRequest struct { TargetID string `json:"target_id"` TargetResource string `json:"target_resource"` - TokenName string `json:"token_name"` ValidUntil time.Time `json:"valid_until"` + TokenName string `json:"token_name"` } -func (c CreatePublishingTokenRequestBody) MarshalJSON() ([]byte, error) { +func (c CreatePublishingTokenRequest) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(c, "", false) } -func (c *CreatePublishingTokenRequestBody) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { +func (c *CreatePublishingTokenRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, []string{"target_id", "target_resource", "valid_until", "token_name"}); err != nil { return err } return nil } -func (o *CreatePublishingTokenRequestBody) GetTargetID() string { +func (o *CreatePublishingTokenRequest) GetTargetID() string { if o == nil { return "" } return o.TargetID } -func (o *CreatePublishingTokenRequestBody) GetTargetResource() string { +func (o *CreatePublishingTokenRequest) GetTargetResource() string { if o == nil { return "" } return o.TargetResource } -func (o *CreatePublishingTokenRequestBody) GetTokenName() string { +func (o *CreatePublishingTokenRequest) GetValidUntil() time.Time { if o == nil { - return "" + return time.Time{} } - return o.TokenName + return o.ValidUntil } -func (o *CreatePublishingTokenRequestBody) GetValidUntil() time.Time { +func (o *CreatePublishingTokenRequest) GetTokenName() string { if o == nil { - return time.Time{} + return "" } - return o.ValidUntil + return o.TokenName } type CreatePublishingTokenResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/createschemastoreitem.go b/tests/mockserver/internal/sdk/models/operations/createschemastoreitem.go index 996bf876..69133e72 100644 --- a/tests/mockserver/internal/sdk/models/operations/createschemastoreitem.go +++ b/tests/mockserver/internal/sdk/models/operations/createschemastoreitem.go @@ -35,43 +35,43 @@ func (e *Format) UnmarshalJSON(data []byte) error { } } -type CreateSchemaStoreItemRequestBody struct { - // The format of the OpenAPI specification. - Format Format `json:"format"` +type CreateSchemaStoreItemRequest struct { + // The OpenAPI specification to store. + Spec string `json:"spec"` // The package name to use in code snippets / quickstart. PackageName string `json:"packageName"` // The classname of the SDK to use in code snippets / quickstart. SDKClassname string `json:"sdkClassname"` - // The OpenAPI specification to store. - Spec string `json:"spec"` + // The format of the OpenAPI specification. + Format Format `json:"format"` } -func (o *CreateSchemaStoreItemRequestBody) GetFormat() Format { +func (o *CreateSchemaStoreItemRequest) GetSpec() string { if o == nil { - return Format("") + return "" } - return o.Format + return o.Spec } -func (o *CreateSchemaStoreItemRequestBody) GetPackageName() string { +func (o *CreateSchemaStoreItemRequest) GetPackageName() string { if o == nil { return "" } return o.PackageName } -func (o *CreateSchemaStoreItemRequestBody) GetSDKClassname() string { +func (o *CreateSchemaStoreItemRequest) GetSDKClassname() string { if o == nil { return "" } return o.SDKClassname } -func (o *CreateSchemaStoreItemRequestBody) GetSpec() string { +func (o *CreateSchemaStoreItemRequest) GetFormat() Format { if o == nil { - return "" + return Format("") } - return o.Spec + return o.Format } type CreateSchemaStoreItemResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/createworkspacetoken.go b/tests/mockserver/internal/sdk/models/operations/createworkspacetoken.go index 695c6817..072dd880 100644 --- a/tests/mockserver/internal/sdk/models/operations/createworkspacetoken.go +++ b/tests/mockserver/internal/sdk/models/operations/createworkspacetoken.go @@ -18,23 +18,23 @@ func (o *CreateWorkspaceTokenGlobals) GetWorkspaceID() *string { } type CreateWorkspaceTokenRequest struct { - WorkspaceToken components.WorkspaceToken `request:"mediaType=application/json"` // Unique identifier of the workspace. - WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + Body components.WorkspaceToken `request:"mediaType=application/json"` } -func (o *CreateWorkspaceTokenRequest) GetWorkspaceToken() components.WorkspaceToken { +func (o *CreateWorkspaceTokenRequest) GetWorkspaceID() *string { if o == nil { - return components.WorkspaceToken{} + return nil } - return o.WorkspaceToken + return o.WorkspaceID } -func (o *CreateWorkspaceTokenRequest) GetWorkspaceID() *string { +func (o *CreateWorkspaceTokenRequest) GetBody() components.WorkspaceToken { if o == nil { - return nil + return components.WorkspaceToken{} } - return o.WorkspaceID + return o.Body } type CreateWorkspaceTokenResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/deleteworkspacetoken.go b/tests/mockserver/internal/sdk/models/operations/deleteworkspacetoken.go index 9d882ba9..a4ffb48f 100644 --- a/tests/mockserver/internal/sdk/models/operations/deleteworkspacetoken.go +++ b/tests/mockserver/internal/sdk/models/operations/deleteworkspacetoken.go @@ -18,24 +18,24 @@ func (o *DeleteWorkspaceTokenGlobals) GetWorkspaceID() *string { } type DeleteWorkspaceTokenRequest struct { - // Unique identifier of the token. - TokenID string `pathParam:"style=simple,explode=false,name=tokenID"` // Unique identifier of the workspace. WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + // Unique identifier of the token. + TokenID string `pathParam:"style=simple,explode=false,name=tokenID"` } -func (o *DeleteWorkspaceTokenRequest) GetTokenID() string { +func (o *DeleteWorkspaceTokenRequest) GetWorkspaceID() *string { if o == nil { - return "" + return nil } - return o.TokenID + return o.WorkspaceID } -func (o *DeleteWorkspaceTokenRequest) GetWorkspaceID() *string { +func (o *DeleteWorkspaceTokenRequest) GetTokenID() string { if o == nil { - return nil + return "" } - return o.WorkspaceID + return o.TokenID } type DeleteWorkspaceTokenResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/getaccesstoken.go b/tests/mockserver/internal/sdk/models/operations/getaccesstoken.go index fc0f893e..1759628a 100644 --- a/tests/mockserver/internal/sdk/models/operations/getaccesstoken.go +++ b/tests/mockserver/internal/sdk/models/operations/getaccesstoken.go @@ -19,21 +19,21 @@ func (o *GetAccessTokenRequest) GetWorkspaceID() string { } type GetAccessTokenResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // OK AccessToken *components.AccessToken - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *GetAccessTokenResponse) GetAccessToken() *components.AccessToken { +func (o *GetAccessTokenResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.AccessToken + return o.HTTPMeta } -func (o *GetAccessTokenResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GetAccessTokenResponse) GetAccessToken() *components.AccessToken { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.AccessToken } diff --git a/tests/mockserver/internal/sdk/models/operations/getblob.go b/tests/mockserver/internal/sdk/models/operations/getblob.go index cca33d18..62fb1a1b 100644 --- a/tests/mockserver/internal/sdk/models/operations/getblob.go +++ b/tests/mockserver/internal/sdk/models/operations/getblob.go @@ -8,57 +8,57 @@ import ( ) type GetBlobRequest struct { - Digest string `pathParam:"style=simple,explode=false,name=digest"` - NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` OrganizationSlug string `pathParam:"style=simple,explode=false,name=organization_slug"` WorkspaceSlug string `pathParam:"style=simple,explode=false,name=workspace_slug"` + NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` + Digest string `pathParam:"style=simple,explode=false,name=digest"` } -func (o *GetBlobRequest) GetDigest() string { +func (o *GetBlobRequest) GetOrganizationSlug() string { if o == nil { return "" } - return o.Digest + return o.OrganizationSlug } -func (o *GetBlobRequest) GetNamespaceName() string { +func (o *GetBlobRequest) GetWorkspaceSlug() string { if o == nil { return "" } - return o.NamespaceName + return o.WorkspaceSlug } -func (o *GetBlobRequest) GetOrganizationSlug() string { +func (o *GetBlobRequest) GetNamespaceName() string { if o == nil { return "" } - return o.OrganizationSlug + return o.NamespaceName } -func (o *GetBlobRequest) GetWorkspaceSlug() string { +func (o *GetBlobRequest) GetDigest() string { if o == nil { return "" } - return o.WorkspaceSlug + return o.Digest } type GetBlobResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // OK // The Close method must be called on this field, even if it is not used, to prevent resource leaks. - Blob io.ReadCloser - HTTPMeta components.HTTPMetadata `json:"-"` + Blob io.ReadCloser } -func (o *GetBlobResponse) GetBlob() io.ReadCloser { +func (o *GetBlobResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.Blob + return o.HTTPMeta } -func (o *GetBlobResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GetBlobResponse) GetBlob() io.ReadCloser { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.Blob } diff --git a/tests/mockserver/internal/sdk/models/operations/getcodesamples.go b/tests/mockserver/internal/sdk/models/operations/getcodesamples.go index 6bc08918..ea92c7f4 100644 --- a/tests/mockserver/internal/sdk/models/operations/getcodesamples.go +++ b/tests/mockserver/internal/sdk/models/operations/getcodesamples.go @@ -6,19 +6,19 @@ import ( "mockserver/internal/sdk/models/components" ) -type MethodPaths struct { +type MethodPath struct { Method components.HTTPMethod `queryParam:"name=method"` Path string `queryParam:"name=path"` } -func (o *MethodPaths) GetMethod() components.HTTPMethod { +func (o *MethodPath) GetMethod() components.HTTPMethod { if o == nil { return components.HTTPMethod("") } return o.Method } -func (o *MethodPaths) GetPath() string { +func (o *MethodPath) GetPath() string { if o == nil { return "" } @@ -26,42 +26,42 @@ func (o *MethodPaths) GetPath() string { } type GetCodeSamplesRequest struct { - // The languages to retrieve snippets for. - Languages []string `queryParam:"style=form,explode=true,name=languages"` - // The method paths to retrieve snippets for. - MethodPaths []MethodPaths `queryParam:"style=form,explode=true,name=method_paths"` - // The operation IDs to retrieve snippets for. - OperationIds []string `queryParam:"style=form,explode=true,name=operation_ids"` // The registry URL from which to retrieve the snippets. RegistryURL string `queryParam:"style=form,explode=true,name=registry_url"` + // The operation IDs to retrieve snippets for. + OperationIds []string `queryParam:"style=form,explode=true,name=operation_ids"` + // The method paths to retrieve snippets for. + MethodPaths []MethodPath `queryParam:"style=form,explode=true,name=method_paths"` + // The languages to retrieve snippets for. + Languages []string `queryParam:"style=form,explode=true,name=languages"` } -func (o *GetCodeSamplesRequest) GetLanguages() []string { +func (o *GetCodeSamplesRequest) GetRegistryURL() string { if o == nil { - return nil + return "" } - return o.Languages + return o.RegistryURL } -func (o *GetCodeSamplesRequest) GetMethodPaths() []MethodPaths { +func (o *GetCodeSamplesRequest) GetOperationIds() []string { if o == nil { return nil } - return o.MethodPaths + return o.OperationIds } -func (o *GetCodeSamplesRequest) GetOperationIds() []string { +func (o *GetCodeSamplesRequest) GetMethodPaths() []MethodPath { if o == nil { return nil } - return o.OperationIds + return o.MethodPaths } -func (o *GetCodeSamplesRequest) GetRegistryURL() string { +func (o *GetCodeSamplesRequest) GetLanguages() []string { if o == nil { - return "" + return nil } - return o.RegistryURL + return o.Languages } type GetCodeSamplesResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/getgithubaction.go b/tests/mockserver/internal/sdk/models/operations/getgithubaction.go index d5bbb432..a6e29c3b 100644 --- a/tests/mockserver/internal/sdk/models/operations/getgithubaction.go +++ b/tests/mockserver/internal/sdk/models/operations/getgithubaction.go @@ -7,10 +7,17 @@ import ( ) type GetGitHubActionRequest struct { - Org string `queryParam:"style=form,explode=true,name=org"` - Repo string `queryParam:"style=form,explode=true,name=repo"` // The targetName of the workflow target. TargetName *string `queryParam:"style=form,explode=true,name=targetName"` + Org string `queryParam:"style=form,explode=true,name=org"` + Repo string `queryParam:"style=form,explode=true,name=repo"` +} + +func (o *GetGitHubActionRequest) GetTargetName() *string { + if o == nil { + return nil + } + return o.TargetName } func (o *GetGitHubActionRequest) GetOrg() string { @@ -27,29 +34,22 @@ func (o *GetGitHubActionRequest) GetRepo() string { return o.Repo } -func (o *GetGitHubActionRequest) GetTargetName() *string { - if o == nil { - return nil - } - return o.TargetName -} - type GetGitHubActionResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // OK GithubGetActionResponse *components.GithubGetActionResponse - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *GetGitHubActionResponse) GetGithubGetActionResponse() *components.GithubGetActionResponse { +func (o *GetGitHubActionResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.GithubGetActionResponse + return o.HTTPMeta } -func (o *GetGitHubActionResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GetGitHubActionResponse) GetGithubGetActionResponse() *components.GithubGetActionResponse { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.GithubGetActionResponse } diff --git a/tests/mockserver/internal/sdk/models/operations/getgithubsetupstate.go b/tests/mockserver/internal/sdk/models/operations/getgithubsetupstate.go index a7a7298f..51ffaaed 100644 --- a/tests/mockserver/internal/sdk/models/operations/getgithubsetupstate.go +++ b/tests/mockserver/internal/sdk/models/operations/getgithubsetupstate.go @@ -7,48 +7,48 @@ import ( ) type GetGithubSetupStateRequest struct { - GenerateGenLockID string `queryParam:"style=form,explode=true,name=generate_gen_lock_id"` Org string `queryParam:"style=form,explode=true,name=org"` Repo string `queryParam:"style=form,explode=true,name=repo"` + GenerateGenLockID string `queryParam:"style=form,explode=true,name=generate_gen_lock_id"` } -func (o *GetGithubSetupStateRequest) GetGenerateGenLockID() string { +func (o *GetGithubSetupStateRequest) GetOrg() string { if o == nil { return "" } - return o.GenerateGenLockID + return o.Org } -func (o *GetGithubSetupStateRequest) GetOrg() string { +func (o *GetGithubSetupStateRequest) GetRepo() string { if o == nil { return "" } - return o.Org + return o.Repo } -func (o *GetGithubSetupStateRequest) GetRepo() string { +func (o *GetGithubSetupStateRequest) GetGenerateGenLockID() string { if o == nil { return "" } - return o.Repo + return o.GenerateGenLockID } type GetGithubSetupStateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // github setup state response GithubSetupStateResponse *components.GithubSetupStateResponse - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *GetGithubSetupStateResponse) GetGithubSetupStateResponse() *components.GithubSetupStateResponse { +func (o *GetGithubSetupStateResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.GithubSetupStateResponse + return o.HTTPMeta } -func (o *GetGithubSetupStateResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GetGithubSetupStateResponse) GetGithubSetupStateResponse() *components.GithubSetupStateResponse { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.GithubSetupStateResponse } diff --git a/tests/mockserver/internal/sdk/models/operations/getmanifest.go b/tests/mockserver/internal/sdk/models/operations/getmanifest.go index 5da84bc0..363971fe 100644 --- a/tests/mockserver/internal/sdk/models/operations/getmanifest.go +++ b/tests/mockserver/internal/sdk/models/operations/getmanifest.go @@ -7,39 +7,39 @@ import ( ) type GetManifestRequest struct { - NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` OrganizationSlug string `pathParam:"style=simple,explode=false,name=organization_slug"` + WorkspaceSlug string `pathParam:"style=simple,explode=false,name=workspace_slug"` + NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` // Tag or digest RevisionReference string `pathParam:"style=simple,explode=false,name=revision_reference"` - WorkspaceSlug string `pathParam:"style=simple,explode=false,name=workspace_slug"` } -func (o *GetManifestRequest) GetNamespaceName() string { +func (o *GetManifestRequest) GetOrganizationSlug() string { if o == nil { return "" } - return o.NamespaceName + return o.OrganizationSlug } -func (o *GetManifestRequest) GetOrganizationSlug() string { +func (o *GetManifestRequest) GetWorkspaceSlug() string { if o == nil { return "" } - return o.OrganizationSlug + return o.WorkspaceSlug } -func (o *GetManifestRequest) GetRevisionReference() string { +func (o *GetManifestRequest) GetNamespaceName() string { if o == nil { return "" } - return o.RevisionReference + return o.NamespaceName } -func (o *GetManifestRequest) GetWorkspaceSlug() string { +func (o *GetManifestRequest) GetRevisionReference() string { if o == nil { return "" } - return o.WorkspaceSlug + return o.RevisionReference } type GetManifestResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/getnamespaces.go b/tests/mockserver/internal/sdk/models/operations/getnamespaces.go index b270204f..01b7f581 100644 --- a/tests/mockserver/internal/sdk/models/operations/getnamespaces.go +++ b/tests/mockserver/internal/sdk/models/operations/getnamespaces.go @@ -7,21 +7,21 @@ import ( ) type GetNamespacesResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // OK GetNamespacesResponse *components.GetNamespacesResponse - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *GetNamespacesResponse) GetGetNamespacesResponse() *components.GetNamespacesResponse { +func (o *GetNamespacesResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.GetNamespacesResponse + return o.HTTPMeta } -func (o *GetNamespacesResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GetNamespacesResponse) GetGetNamespacesResponse() *components.GetNamespacesResponse { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.GetNamespacesResponse } diff --git a/tests/mockserver/internal/sdk/models/operations/getpublishingtoken.go b/tests/mockserver/internal/sdk/models/operations/getpublishingtoken.go index 484fc53c..5c2b8e03 100644 --- a/tests/mockserver/internal/sdk/models/operations/getpublishingtoken.go +++ b/tests/mockserver/internal/sdk/models/operations/getpublishingtoken.go @@ -9,7 +9,7 @@ import ( type GetPublishingTokenResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // OK - Classes []components.PublishingToken + PublishingTokens []components.PublishingToken } func (o *GetPublishingTokenResponse) GetHTTPMeta() components.HTTPMetadata { @@ -19,9 +19,9 @@ func (o *GetPublishingTokenResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *GetPublishingTokenResponse) GetClasses() []components.PublishingToken { +func (o *GetPublishingTokenResponse) GetPublishingTokens() []components.PublishingToken { if o == nil { return nil } - return o.Classes + return o.PublishingTokens } diff --git a/tests/mockserver/internal/sdk/models/operations/getpublishingtokenpublicmetadata.go b/tests/mockserver/internal/sdk/models/operations/getpublishingtokenpublicmetadata.go index ae5b823a..f8b7e181 100644 --- a/tests/mockserver/internal/sdk/models/operations/getpublishingtokenpublicmetadata.go +++ b/tests/mockserver/internal/sdk/models/operations/getpublishingtokenpublicmetadata.go @@ -22,11 +22,11 @@ func (o *GetPublishingTokenPublicMetadataRequest) GetTokenID() string { // GetPublishingTokenPublicMetadataResponseBody - OK type GetPublishingTokenPublicMetadataResponseBody struct { - OrganizationID *string `json:"organization_id,omitempty"` TargetID *string `json:"target_id,omitempty"` TargetResource *string `json:"target_resource,omitempty"` - ValidUntil *time.Time `json:"valid_until,omitempty"` WorkspaceID *string `json:"workspace_id,omitempty"` + OrganizationID *string `json:"organization_id,omitempty"` + ValidUntil *time.Time `json:"valid_until,omitempty"` } func (g GetPublishingTokenPublicMetadataResponseBody) MarshalJSON() ([]byte, error) { @@ -34,45 +34,45 @@ func (g GetPublishingTokenPublicMetadataResponseBody) MarshalJSON() ([]byte, err } func (g *GetPublishingTokenPublicMetadataResponseBody) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { return err } return nil } -func (o *GetPublishingTokenPublicMetadataResponseBody) GetOrganizationID() *string { +func (o *GetPublishingTokenPublicMetadataResponseBody) GetTargetID() *string { if o == nil { return nil } - return o.OrganizationID + return o.TargetID } -func (o *GetPublishingTokenPublicMetadataResponseBody) GetTargetID() *string { +func (o *GetPublishingTokenPublicMetadataResponseBody) GetTargetResource() *string { if o == nil { return nil } - return o.TargetID + return o.TargetResource } -func (o *GetPublishingTokenPublicMetadataResponseBody) GetTargetResource() *string { +func (o *GetPublishingTokenPublicMetadataResponseBody) GetWorkspaceID() *string { if o == nil { return nil } - return o.TargetResource + return o.WorkspaceID } -func (o *GetPublishingTokenPublicMetadataResponseBody) GetValidUntil() *time.Time { +func (o *GetPublishingTokenPublicMetadataResponseBody) GetOrganizationID() *string { if o == nil { return nil } - return o.ValidUntil + return o.OrganizationID } -func (o *GetPublishingTokenPublicMetadataResponseBody) GetWorkspaceID() *string { +func (o *GetPublishingTokenPublicMetadataResponseBody) GetValidUntil() *time.Time { if o == nil { return nil } - return o.WorkspaceID + return o.ValidUntil } type GetPublishingTokenPublicMetadataResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/getrevisions.go b/tests/mockserver/internal/sdk/models/operations/getrevisions.go index 93425492..cf8d7b52 100644 --- a/tests/mockserver/internal/sdk/models/operations/getrevisions.go +++ b/tests/mockserver/internal/sdk/models/operations/getrevisions.go @@ -27,21 +27,21 @@ func (o *GetRevisionsRequest) GetNextPageToken() *string { } type GetRevisionsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // OK GetRevisionsResponse *components.GetRevisionsResponse - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *GetRevisionsResponse) GetGetRevisionsResponse() *components.GetRevisionsResponse { +func (o *GetRevisionsResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.GetRevisionsResponse + return o.HTTPMeta } -func (o *GetRevisionsResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GetRevisionsResponse) GetGetRevisionsResponse() *components.GetRevisionsResponse { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.GetRevisionsResponse } diff --git a/tests/mockserver/internal/sdk/models/operations/getschemastoreitem.go b/tests/mockserver/internal/sdk/models/operations/getschemastoreitem.go index aecec532..9e52feb2 100644 --- a/tests/mockserver/internal/sdk/models/operations/getschemastoreitem.go +++ b/tests/mockserver/internal/sdk/models/operations/getschemastoreitem.go @@ -6,11 +6,11 @@ import ( "mockserver/internal/sdk/models/components" ) -type GetSchemaStoreItemRequestBody struct { +type GetSchemaStoreItemRequest struct { ID *string `json:"id,omitempty"` } -func (o *GetSchemaStoreItemRequestBody) GetID() *string { +func (o *GetSchemaStoreItemRequest) GetID() *string { if o == nil { return nil } diff --git a/tests/mockserver/internal/sdk/models/operations/gettags.go b/tests/mockserver/internal/sdk/models/operations/gettags.go index bfbe3841..555fd4c7 100644 --- a/tests/mockserver/internal/sdk/models/operations/gettags.go +++ b/tests/mockserver/internal/sdk/models/operations/gettags.go @@ -18,21 +18,21 @@ func (o *GetTagsRequest) GetNamespaceName() string { } type GetTagsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // OK GetTagsResponse *components.GetTagsResponse - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *GetTagsResponse) GetGetTagsResponse() *components.GetTagsResponse { +func (o *GetTagsResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.GetTagsResponse + return o.HTTPMeta } -func (o *GetTagsResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GetTagsResponse) GetGetTagsResponse() *components.GetTagsResponse { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.GetTagsResponse } diff --git a/tests/mockserver/internal/sdk/models/operations/getworkspaceaccess.go b/tests/mockserver/internal/sdk/models/operations/getworkspaceaccess.go index 53dfcb82..9c3c1d0c 100644 --- a/tests/mockserver/internal/sdk/models/operations/getworkspaceaccess.go +++ b/tests/mockserver/internal/sdk/models/operations/getworkspaceaccess.go @@ -9,10 +9,10 @@ import ( type GetWorkspaceAccessRequest struct { // Unique identifier of the generation target. GenLockID *string `queryParam:"style=form,explode=true,name=genLockId"` - // Skip side-effects like incrementing metrics. - Passive *bool `queryParam:"style=form,explode=true,name=passive"` // The type of the generated target. TargetType *string `queryParam:"style=form,explode=true,name=targetType"` + // Skip side-effects like incrementing metrics. + Passive *bool `queryParam:"style=form,explode=true,name=passive"` } func (o *GetWorkspaceAccessRequest) GetGenLockID() *string { @@ -22,36 +22,36 @@ func (o *GetWorkspaceAccessRequest) GetGenLockID() *string { return o.GenLockID } -func (o *GetWorkspaceAccessRequest) GetPassive() *bool { +func (o *GetWorkspaceAccessRequest) GetTargetType() *string { if o == nil { return nil } - return o.Passive + return o.TargetType } -func (o *GetWorkspaceAccessRequest) GetTargetType() *string { +func (o *GetWorkspaceAccessRequest) GetPassive() *bool { if o == nil { return nil } - return o.TargetType + return o.Passive } type GetWorkspaceAccessResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // OK AccessDetails *components.AccessDetails - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *GetWorkspaceAccessResponse) GetAccessDetails() *components.AccessDetails { +func (o *GetWorkspaceAccessResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.AccessDetails + return o.HTTPMeta } -func (o *GetWorkspaceAccessResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GetWorkspaceAccessResponse) GetAccessDetails() *components.AccessDetails { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.AccessDetails } diff --git a/tests/mockserver/internal/sdk/models/operations/getworkspaceeventsbytarget.go b/tests/mockserver/internal/sdk/models/operations/getworkspaceeventsbytarget.go index 31072a90..56b996f1 100644 --- a/tests/mockserver/internal/sdk/models/operations/getworkspaceeventsbytarget.go +++ b/tests/mockserver/internal/sdk/models/operations/getworkspaceeventsbytarget.go @@ -20,12 +20,12 @@ func (o *GetWorkspaceEventsByTargetGlobals) GetWorkspaceID() *string { } type GetWorkspaceEventsByTargetRequest struct { - // Filter to only return events created after this timestamp - AfterCreatedAt *time.Time `queryParam:"style=form,explode=true,name=after_created_at"` - // Filter to only return events corresponding to a particular gen_lock_id (gen_lock_id uniquely identifies a target) - TargetID string `pathParam:"style=simple,explode=false,name=target_id"` // Unique identifier of the workspace. WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + // Filter to only return events corresponding to a particular gen_lock_id (gen_lock_id uniquely identifies a target) + TargetID string `pathParam:"style=simple,explode=false,name=target_id"` + // Filter to only return events created after this timestamp + AfterCreatedAt *time.Time `queryParam:"style=form,explode=true,name=after_created_at"` } func (g GetWorkspaceEventsByTargetRequest) MarshalJSON() ([]byte, error) { @@ -33,17 +33,17 @@ func (g GetWorkspaceEventsByTargetRequest) MarshalJSON() ([]byte, error) { } func (g *GetWorkspaceEventsByTargetRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &g, "", false, []string{"target_id"}); err != nil { return err } return nil } -func (o *GetWorkspaceEventsByTargetRequest) GetAfterCreatedAt() *time.Time { +func (o *GetWorkspaceEventsByTargetRequest) GetWorkspaceID() *string { if o == nil { return nil } - return o.AfterCreatedAt + return o.WorkspaceID } func (o *GetWorkspaceEventsByTargetRequest) GetTargetID() string { @@ -53,29 +53,29 @@ func (o *GetWorkspaceEventsByTargetRequest) GetTargetID() string { return o.TargetID } -func (o *GetWorkspaceEventsByTargetRequest) GetWorkspaceID() *string { +func (o *GetWorkspaceEventsByTargetRequest) GetAfterCreatedAt() *time.Time { if o == nil { return nil } - return o.WorkspaceID + return o.AfterCreatedAt } type GetWorkspaceEventsByTargetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // Success CliEventBatch []components.CliEvent - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *GetWorkspaceEventsByTargetResponse) GetCliEventBatch() []components.CliEvent { +func (o *GetWorkspaceEventsByTargetResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.CliEventBatch + return o.HTTPMeta } -func (o *GetWorkspaceEventsByTargetResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GetWorkspaceEventsByTargetResponse) GetCliEventBatch() []components.CliEvent { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.CliEventBatch } diff --git a/tests/mockserver/internal/sdk/models/operations/getworkspacetargets.go b/tests/mockserver/internal/sdk/models/operations/getworkspacetargets.go index f3b8025e..2ccdddb3 100644 --- a/tests/mockserver/internal/sdk/models/operations/getworkspacetargets.go +++ b/tests/mockserver/internal/sdk/models/operations/getworkspacetargets.go @@ -18,7 +18,7 @@ func (g GetWorkspaceTargetsRequest) MarshalJSON() ([]byte, error) { } func (g *GetWorkspaceTargetsRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { return err } return nil diff --git a/tests/mockserver/internal/sdk/models/operations/getworkspacetargetsdeprecated.go b/tests/mockserver/internal/sdk/models/operations/getworkspacetargetsdeprecated.go index 1e07d37b..eac3ddd0 100644 --- a/tests/mockserver/internal/sdk/models/operations/getworkspacetargetsdeprecated.go +++ b/tests/mockserver/internal/sdk/models/operations/getworkspacetargetsdeprecated.go @@ -20,10 +20,10 @@ func (o *GetWorkspaceTargetsDeprecatedGlobals) GetWorkspaceID() *string { } type GetWorkspaceTargetsDeprecatedRequest struct { - // Filter to only return targets with events created after this timestamp - AfterLastEventCreatedAt *time.Time `queryParam:"style=form,explode=true,name=after_last_event_created_at"` // Unique identifier of the workspace. WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + // Filter to only return targets with events created after this timestamp + AfterLastEventCreatedAt *time.Time `queryParam:"style=form,explode=true,name=after_last_event_created_at"` } func (g GetWorkspaceTargetsDeprecatedRequest) MarshalJSON() ([]byte, error) { @@ -31,24 +31,24 @@ func (g GetWorkspaceTargetsDeprecatedRequest) MarshalJSON() ([]byte, error) { } func (g *GetWorkspaceTargetsDeprecatedRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { return err } return nil } -func (o *GetWorkspaceTargetsDeprecatedRequest) GetAfterLastEventCreatedAt() *time.Time { +func (o *GetWorkspaceTargetsDeprecatedRequest) GetWorkspaceID() *string { if o == nil { return nil } - return o.AfterLastEventCreatedAt + return o.WorkspaceID } -func (o *GetWorkspaceTargetsDeprecatedRequest) GetWorkspaceID() *string { +func (o *GetWorkspaceTargetsDeprecatedRequest) GetAfterLastEventCreatedAt() *time.Time { if o == nil { return nil } - return o.WorkspaceID + return o.AfterLastEventCreatedAt } type GetWorkspaceTargetsDeprecatedResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/getworkspacetokens.go b/tests/mockserver/internal/sdk/models/operations/getworkspacetokens.go index 4f0a7a7f..7e2cb40e 100644 --- a/tests/mockserver/internal/sdk/models/operations/getworkspacetokens.go +++ b/tests/mockserver/internal/sdk/models/operations/getworkspacetokens.go @@ -32,7 +32,7 @@ func (o *GetWorkspaceTokensRequest) GetWorkspaceID() *string { type GetWorkspaceTokensResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // OK - Classes []components.WorkspaceToken + WorkspaceTokens []components.WorkspaceToken } func (o *GetWorkspaceTokensResponse) GetHTTPMeta() components.HTTPMetadata { @@ -42,9 +42,9 @@ func (o *GetWorkspaceTokensResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *GetWorkspaceTokensResponse) GetClasses() []components.WorkspaceToken { +func (o *GetWorkspaceTokensResponse) GetWorkspaceTokens() []components.WorkspaceToken { if o == nil { return nil } - return o.Classes + return o.WorkspaceTokens } diff --git a/tests/mockserver/internal/sdk/models/operations/githubcheckpublishingprs.go b/tests/mockserver/internal/sdk/models/operations/githubcheckpublishingprs.go index 657bbfbb..123037c9 100644 --- a/tests/mockserver/internal/sdk/models/operations/githubcheckpublishingprs.go +++ b/tests/mockserver/internal/sdk/models/operations/githubcheckpublishingprs.go @@ -34,21 +34,21 @@ func (o *GithubCheckPublishingPRsRequest) GetRepo() string { } type GithubCheckPublishingPRsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // OK GithubPublishingPRResponse *components.GithubPublishingPRResponse - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *GithubCheckPublishingPRsResponse) GetGithubPublishingPRResponse() *components.GithubPublishingPRResponse { +func (o *GithubCheckPublishingPRsResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.GithubPublishingPRResponse + return o.HTTPMeta } -func (o *GithubCheckPublishingPRsResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GithubCheckPublishingPRsResponse) GetGithubPublishingPRResponse() *components.GithubPublishingPRResponse { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.GithubPublishingPRResponse } diff --git a/tests/mockserver/internal/sdk/models/operations/githubcheckpublishingsecrets.go b/tests/mockserver/internal/sdk/models/operations/githubcheckpublishingsecrets.go index e2d29b91..67ad5315 100644 --- a/tests/mockserver/internal/sdk/models/operations/githubcheckpublishingsecrets.go +++ b/tests/mockserver/internal/sdk/models/operations/githubcheckpublishingsecrets.go @@ -18,21 +18,21 @@ func (o *GithubCheckPublishingSecretsRequest) GetGenerateGenLockID() string { } type GithubCheckPublishingSecretsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // OK GithubMissingPublishingSecretsResponse *components.GithubMissingPublishingSecretsResponse - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *GithubCheckPublishingSecretsResponse) GetGithubMissingPublishingSecretsResponse() *components.GithubMissingPublishingSecretsResponse { +func (o *GithubCheckPublishingSecretsResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.GithubMissingPublishingSecretsResponse + return o.HTTPMeta } -func (o *GithubCheckPublishingSecretsResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GithubCheckPublishingSecretsResponse) GetGithubMissingPublishingSecretsResponse() *components.GithubMissingPublishingSecretsResponse { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.GithubMissingPublishingSecretsResponse } diff --git a/tests/mockserver/internal/sdk/models/operations/githubconfigurecodesamples.go b/tests/mockserver/internal/sdk/models/operations/githubconfigurecodesamples.go index f129ed20..6e5b1911 100644 --- a/tests/mockserver/internal/sdk/models/operations/githubconfigurecodesamples.go +++ b/tests/mockserver/internal/sdk/models/operations/githubconfigurecodesamples.go @@ -7,21 +7,21 @@ import ( ) type GithubConfigureCodeSamplesResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // OK GithubConfigureCodeSamplesResponse *components.GithubConfigureCodeSamplesResponse - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *GithubConfigureCodeSamplesResponse) GetGithubConfigureCodeSamplesResponse() *components.GithubConfigureCodeSamplesResponse { +func (o *GithubConfigureCodeSamplesResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.GithubConfigureCodeSamplesResponse + return o.HTTPMeta } -func (o *GithubConfigureCodeSamplesResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *GithubConfigureCodeSamplesResponse) GetGithubConfigureCodeSamplesResponse() *components.GithubConfigureCodeSamplesResponse { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.GithubConfigureCodeSamplesResponse } diff --git a/tests/mockserver/internal/sdk/models/operations/grantuseraccesstoworkspace.go b/tests/mockserver/internal/sdk/models/operations/grantuseraccesstoworkspace.go index 398b8b99..3a3a7ce6 100644 --- a/tests/mockserver/internal/sdk/models/operations/grantuseraccesstoworkspace.go +++ b/tests/mockserver/internal/sdk/models/operations/grantuseraccesstoworkspace.go @@ -18,24 +18,24 @@ func (o *GrantUserAccessToWorkspaceGlobals) GetWorkspaceID() *string { } type GrantUserAccessToWorkspaceRequest struct { - // Email of the user to grant access to. - Email string `pathParam:"style=simple,explode=false,name=email"` // Unique identifier of the workspace. WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + // Email of the user to grant access to. + Email string `pathParam:"style=simple,explode=false,name=email"` } -func (o *GrantUserAccessToWorkspaceRequest) GetEmail() string { +func (o *GrantUserAccessToWorkspaceRequest) GetWorkspaceID() *string { if o == nil { - return "" + return nil } - return o.Email + return o.WorkspaceID } -func (o *GrantUserAccessToWorkspaceRequest) GetWorkspaceID() *string { +func (o *GrantUserAccessToWorkspaceRequest) GetEmail() string { if o == nil { - return nil + return "" } - return o.WorkspaceID + return o.Email } type GrantUserAccessToWorkspaceResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/ignoresubscriptionnamespace.go b/tests/mockserver/internal/sdk/models/operations/ignoresubscriptionnamespace.go index 6ddaa0ef..813d7aea 100644 --- a/tests/mockserver/internal/sdk/models/operations/ignoresubscriptionnamespace.go +++ b/tests/mockserver/internal/sdk/models/operations/ignoresubscriptionnamespace.go @@ -7,24 +7,24 @@ import ( ) type IgnoreSubscriptionNamespaceRequest struct { - // The namespace name - NamespaceName string `pathParam:"style=simple,explode=false,name=namespaceName"` // The existing subscription ID SubscriptionID string `pathParam:"style=simple,explode=false,name=subscriptionID"` + // The namespace name + NamespaceName string `pathParam:"style=simple,explode=false,name=namespaceName"` } -func (o *IgnoreSubscriptionNamespaceRequest) GetNamespaceName() string { +func (o *IgnoreSubscriptionNamespaceRequest) GetSubscriptionID() string { if o == nil { return "" } - return o.NamespaceName + return o.SubscriptionID } -func (o *IgnoreSubscriptionNamespaceRequest) GetSubscriptionID() string { +func (o *IgnoreSubscriptionNamespaceRequest) GetNamespaceName() string { if o == nil { return "" } - return o.SubscriptionID + return o.NamespaceName } type IgnoreSubscriptionNamespaceResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/linkgithubaccess.go b/tests/mockserver/internal/sdk/models/operations/linkgithubaccess.go index fa8547dc..316f796f 100644 --- a/tests/mockserver/internal/sdk/models/operations/linkgithubaccess.go +++ b/tests/mockserver/internal/sdk/models/operations/linkgithubaccess.go @@ -7,16 +7,16 @@ import ( ) type LinkGithubAccessRequest struct { - GithubOidcToken *string `queryParam:"style=form,explode=true,name=github_oidc_token"` - GithubOrg *string `queryParam:"style=form,explode=true,name=github_org"` InstallationID *string `queryParam:"style=form,explode=true,name=installation_id"` + GithubOrg *string `queryParam:"style=form,explode=true,name=github_org"` + GithubOidcToken *string `queryParam:"style=form,explode=true,name=github_oidc_token"` } -func (o *LinkGithubAccessRequest) GetGithubOidcToken() *string { +func (o *LinkGithubAccessRequest) GetInstallationID() *string { if o == nil { return nil } - return o.GithubOidcToken + return o.InstallationID } func (o *LinkGithubAccessRequest) GetGithubOrg() *string { @@ -26,11 +26,11 @@ func (o *LinkGithubAccessRequest) GetGithubOrg() *string { return o.GithubOrg } -func (o *LinkGithubAccessRequest) GetInstallationID() *string { +func (o *LinkGithubAccessRequest) GetGithubOidcToken() *string { if o == nil { return nil } - return o.InstallationID + return o.GithubOidcToken } type LinkGithubAccessResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/posttags.go b/tests/mockserver/internal/sdk/models/operations/posttags.go index 8c2e7b12..41349592 100644 --- a/tests/mockserver/internal/sdk/models/operations/posttags.go +++ b/tests/mockserver/internal/sdk/models/operations/posttags.go @@ -7,23 +7,23 @@ import ( ) type PostTagsRequest struct { + NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` // A JSON representation of the tags to add - AddTags *components.AddTags `request:"mediaType=application/json"` - NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` + Body *components.AddTags `request:"mediaType=application/json"` } -func (o *PostTagsRequest) GetAddTags() *components.AddTags { +func (o *PostTagsRequest) GetNamespaceName() string { if o == nil { - return nil + return "" } - return o.AddTags + return o.NamespaceName } -func (o *PostTagsRequest) GetNamespaceName() string { +func (o *PostTagsRequest) GetBody() *components.AddTags { if o == nil { - return "" + return nil } - return o.NamespaceName + return o.Body } type PostTagsResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/postworkspaceevents.go b/tests/mockserver/internal/sdk/models/operations/postworkspaceevents.go index a7474f66..244136bf 100644 --- a/tests/mockserver/internal/sdk/models/operations/postworkspaceevents.go +++ b/tests/mockserver/internal/sdk/models/operations/postworkspaceevents.go @@ -18,23 +18,23 @@ func (o *PostWorkspaceEventsGlobals) GetWorkspaceID() *string { } type PostWorkspaceEventsRequest struct { - RequestBody []components.CliEvent `request:"mediaType=application/json"` // Unique identifier of the workspace. - WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + Body []components.CliEvent `request:"mediaType=application/json"` } -func (o *PostWorkspaceEventsRequest) GetRequestBody() []components.CliEvent { +func (o *PostWorkspaceEventsRequest) GetWorkspaceID() *string { if o == nil { - return []components.CliEvent{} + return nil } - return o.RequestBody + return o.WorkspaceID } -func (o *PostWorkspaceEventsRequest) GetWorkspaceID() *string { +func (o *PostWorkspaceEventsRequest) GetBody() []components.CliEvent { if o == nil { - return nil + return []components.CliEvent{} } - return o.WorkspaceID + return o.Body } type PostWorkspaceEventsResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/revokeuseraccesstoworkspace.go b/tests/mockserver/internal/sdk/models/operations/revokeuseraccesstoworkspace.go index 58445c6d..34ef9631 100644 --- a/tests/mockserver/internal/sdk/models/operations/revokeuseraccesstoworkspace.go +++ b/tests/mockserver/internal/sdk/models/operations/revokeuseraccesstoworkspace.go @@ -18,24 +18,24 @@ func (o *RevokeUserAccessToWorkspaceGlobals) GetWorkspaceID() *string { } type RevokeUserAccessToWorkspaceRequest struct { - // Unique identifier of the user. - UserID string `pathParam:"style=simple,explode=false,name=userId"` // Unique identifier of the workspace. WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + // Unique identifier of the user. + UserID string `pathParam:"style=simple,explode=false,name=userId"` } -func (o *RevokeUserAccessToWorkspaceRequest) GetUserID() string { +func (o *RevokeUserAccessToWorkspaceRequest) GetWorkspaceID() *string { if o == nil { - return "" + return nil } - return o.UserID + return o.WorkspaceID } -func (o *RevokeUserAccessToWorkspaceRequest) GetWorkspaceID() *string { +func (o *RevokeUserAccessToWorkspaceRequest) GetUserID() string { if o == nil { - return nil + return "" } - return o.WorkspaceID + return o.UserID } type RevokeUserAccessToWorkspaceResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/searchworkspaceevents.go b/tests/mockserver/internal/sdk/models/operations/searchworkspaceevents.go index 1117a0f3..6a4a1274 100644 --- a/tests/mockserver/internal/sdk/models/operations/searchworkspaceevents.go +++ b/tests/mockserver/internal/sdk/models/operations/searchworkspaceevents.go @@ -18,73 +18,73 @@ func (o *SearchWorkspaceEventsGlobals) GetWorkspaceID() *string { } type SearchWorkspaceEventsRequest struct { - // Shared execution ID for cli events across a single action. - ExecutionID *string `queryParam:"style=form,explode=true,name=execution_id"` - // A specific gen lock ID for the events. - GenerateGenLockID *string `queryParam:"style=form,explode=true,name=generate_gen_lock_id"` - // Specified interaction type for events. - InteractionType *components.InteractionType `queryParam:"style=form,explode=true,name=interaction_type"` - // Number of results to return. - Limit *int64 `queryParam:"style=form,explode=true,name=limit"` + // Unique identifier of the workspace. + WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + // Unique identifier of the source revision digest. + SourceRevisionDigest *string `queryParam:"style=form,explode=true,name=source_revision_digest"` // Unique identifier of the lint report digest. LintReportDigest *string `queryParam:"style=form,explode=true,name=lint_report_digest"` // Unique identifier of the openapi diff report digest. OpenapiDiffReportDigest *string `queryParam:"style=form,explode=true,name=openapi_diff_report_digest"` - // Unique identifier of the source revision digest. - SourceRevisionDigest *string `queryParam:"style=form,explode=true,name=source_revision_digest"` + // Specified interaction type for events. + InteractionType *components.InteractionType `queryParam:"style=form,explode=true,name=interaction_type"` + // A specific gen lock ID for the events. + GenerateGenLockID *string `queryParam:"style=form,explode=true,name=generate_gen_lock_id"` + // Shared execution ID for cli events across a single action. + ExecutionID *string `queryParam:"style=form,explode=true,name=execution_id"` // Whether the event was successful or not. Success *bool `queryParam:"style=form,explode=true,name=success"` - // Unique identifier of the workspace. - WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + // Number of results to return. + Limit *int64 `queryParam:"style=form,explode=true,name=limit"` } -func (o *SearchWorkspaceEventsRequest) GetExecutionID() *string { +func (o *SearchWorkspaceEventsRequest) GetWorkspaceID() *string { if o == nil { return nil } - return o.ExecutionID + return o.WorkspaceID } -func (o *SearchWorkspaceEventsRequest) GetGenerateGenLockID() *string { +func (o *SearchWorkspaceEventsRequest) GetSourceRevisionDigest() *string { if o == nil { return nil } - return o.GenerateGenLockID + return o.SourceRevisionDigest } -func (o *SearchWorkspaceEventsRequest) GetInteractionType() *components.InteractionType { +func (o *SearchWorkspaceEventsRequest) GetLintReportDigest() *string { if o == nil { return nil } - return o.InteractionType + return o.LintReportDigest } -func (o *SearchWorkspaceEventsRequest) GetLimit() *int64 { +func (o *SearchWorkspaceEventsRequest) GetOpenapiDiffReportDigest() *string { if o == nil { return nil } - return o.Limit + return o.OpenapiDiffReportDigest } -func (o *SearchWorkspaceEventsRequest) GetLintReportDigest() *string { +func (o *SearchWorkspaceEventsRequest) GetInteractionType() *components.InteractionType { if o == nil { return nil } - return o.LintReportDigest + return o.InteractionType } -func (o *SearchWorkspaceEventsRequest) GetOpenapiDiffReportDigest() *string { +func (o *SearchWorkspaceEventsRequest) GetGenerateGenLockID() *string { if o == nil { return nil } - return o.OpenapiDiffReportDigest + return o.GenerateGenLockID } -func (o *SearchWorkspaceEventsRequest) GetSourceRevisionDigest() *string { +func (o *SearchWorkspaceEventsRequest) GetExecutionID() *string { if o == nil { return nil } - return o.SourceRevisionDigest + return o.ExecutionID } func (o *SearchWorkspaceEventsRequest) GetSuccess() *bool { @@ -94,29 +94,29 @@ func (o *SearchWorkspaceEventsRequest) GetSuccess() *bool { return o.Success } -func (o *SearchWorkspaceEventsRequest) GetWorkspaceID() *string { +func (o *SearchWorkspaceEventsRequest) GetLimit() *int64 { if o == nil { return nil } - return o.WorkspaceID + return o.Limit } type SearchWorkspaceEventsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // Success CliEventBatch []components.CliEvent - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *SearchWorkspaceEventsResponse) GetCliEventBatch() []components.CliEvent { +func (o *SearchWorkspaceEventsResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.CliEventBatch + return o.HTTPMeta } -func (o *SearchWorkspaceEventsResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *SearchWorkspaceEventsResponse) GetCliEventBatch() []components.CliEvent { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.CliEventBatch } diff --git a/tests/mockserver/internal/sdk/models/operations/setvisibility.go b/tests/mockserver/internal/sdk/models/operations/setvisibility.go index 2b54be11..57be5ab3 100644 --- a/tests/mockserver/internal/sdk/models/operations/setvisibility.go +++ b/tests/mockserver/internal/sdk/models/operations/setvisibility.go @@ -19,23 +19,23 @@ func (o *SetVisibilityRequestBody) GetPublic() bool { } type SetVisibilityRequest struct { + NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` // Namespace visibility - RequestBody *SetVisibilityRequestBody `request:"mediaType=application/json"` - NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` + Body *SetVisibilityRequestBody `request:"mediaType=application/json"` } -func (o *SetVisibilityRequest) GetRequestBody() *SetVisibilityRequestBody { +func (o *SetVisibilityRequest) GetNamespaceName() string { if o == nil { - return nil + return "" } - return o.RequestBody + return o.NamespaceName } -func (o *SetVisibilityRequest) GetNamespaceName() string { +func (o *SetVisibilityRequest) GetBody() *SetVisibilityRequestBody { if o == nil { - return "" + return nil } - return o.NamespaceName + return o.Body } type SetVisibilityResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/suggest.go b/tests/mockserver/internal/sdk/models/operations/suggest.go index 9e45d238..b6821a11 100644 --- a/tests/mockserver/internal/sdk/models/operations/suggest.go +++ b/tests/mockserver/internal/sdk/models/operations/suggest.go @@ -8,23 +8,23 @@ import ( ) type SuggestRequest struct { + XSessionID string `header:"style=simple,explode=false,name=x-session-id"` // The OAS summary and diagnostics to use for the suggestion. - SuggestRequestBody components.SuggestRequestBody `request:"mediaType=application/json"` - XSessionID string `header:"style=simple,explode=false,name=x-session-id"` + Body components.SuggestRequestBody `request:"mediaType=application/json"` } -func (o *SuggestRequest) GetSuggestRequestBody() components.SuggestRequestBody { +func (o *SuggestRequest) GetXSessionID() string { if o == nil { - return components.SuggestRequestBody{} + return "" } - return o.SuggestRequestBody + return o.XSessionID } -func (o *SuggestRequest) GetXSessionID() string { +func (o *SuggestRequest) GetBody() components.SuggestRequestBody { if o == nil { - return "" + return components.SuggestRequestBody{} } - return o.XSessionID + return o.Body } type SuggestResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/suggestopenapi.go b/tests/mockserver/internal/sdk/models/operations/suggestopenapi.go index cef76211..8ee956a4 100644 --- a/tests/mockserver/internal/sdk/models/operations/suggestopenapi.go +++ b/tests/mockserver/internal/sdk/models/operations/suggestopenapi.go @@ -8,22 +8,22 @@ import ( ) type Schema struct { - Content io.Reader `multipartForm:"content"` FileName string `multipartForm:"name=fileName"` + Content io.Reader `multipartForm:"content"` } -func (o *Schema) GetContent() io.Reader { +func (o *Schema) GetFileName() string { if o == nil { - return nil + return "" } - return o.Content + return o.FileName } -func (o *Schema) GetFileName() string { +func (o *Schema) GetContent() io.Reader { if o == nil { - return "" + return nil } - return o.FileName + return o.Content } // SuggestOpenAPIRequestBody - The schema file to upload provided as a multipart/form-data file segment. @@ -47,23 +47,23 @@ func (o *SuggestOpenAPIRequestBody) GetSchema() Schema { } type SuggestOpenAPIRequest struct { + XSessionID string `header:"style=simple,explode=false,name=x-session-id"` // The schema file to upload provided as a multipart/form-data file segment. - RequestBody SuggestOpenAPIRequestBody `request:"mediaType=multipart/form-data"` - XSessionID string `header:"style=simple,explode=false,name=x-session-id"` + Body SuggestOpenAPIRequestBody `request:"mediaType=multipart/form-data"` } -func (o *SuggestOpenAPIRequest) GetRequestBody() SuggestOpenAPIRequestBody { +func (o *SuggestOpenAPIRequest) GetXSessionID() string { if o == nil { - return SuggestOpenAPIRequestBody{} + return "" } - return o.RequestBody + return o.XSessionID } -func (o *SuggestOpenAPIRequest) GetXSessionID() string { +func (o *SuggestOpenAPIRequest) GetBody() SuggestOpenAPIRequestBody { if o == nil { - return "" + return SuggestOpenAPIRequestBody{} } - return o.XSessionID + return o.Body } type SuggestOpenAPIResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/suggestopenapiregistry.go b/tests/mockserver/internal/sdk/models/operations/suggestopenapiregistry.go index ede52016..b00aeeaf 100644 --- a/tests/mockserver/internal/sdk/models/operations/suggestopenapiregistry.go +++ b/tests/mockserver/internal/sdk/models/operations/suggestopenapiregistry.go @@ -8,19 +8,19 @@ import ( ) type SuggestOpenAPIRegistryRequest struct { - // Suggest options - SuggestRequestBody *components.SuggestRequestBody `request:"mediaType=application/json"` - NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` + XSessionID string `header:"style=simple,explode=false,name=x-session-id"` + NamespaceName string `pathParam:"style=simple,explode=false,name=namespace_name"` // Tag or digest RevisionReference string `pathParam:"style=simple,explode=false,name=revision_reference"` - XSessionID string `header:"style=simple,explode=false,name=x-session-id"` + // Suggest options + Body *components.SuggestRequestBody `request:"mediaType=application/json"` } -func (o *SuggestOpenAPIRegistryRequest) GetSuggestRequestBody() *components.SuggestRequestBody { +func (o *SuggestOpenAPIRegistryRequest) GetXSessionID() string { if o == nil { - return nil + return "" } - return o.SuggestRequestBody + return o.XSessionID } func (o *SuggestOpenAPIRegistryRequest) GetNamespaceName() string { @@ -37,11 +37,11 @@ func (o *SuggestOpenAPIRegistryRequest) GetRevisionReference() string { return o.RevisionReference } -func (o *SuggestOpenAPIRegistryRequest) GetXSessionID() string { +func (o *SuggestOpenAPIRegistryRequest) GetBody() *components.SuggestRequestBody { if o == nil { - return "" + return nil } - return o.XSessionID + return o.Body } type SuggestOpenAPIRegistryResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/updatepublishingtokenexpiration.go b/tests/mockserver/internal/sdk/models/operations/updatepublishingtokenexpiration.go index f7abcb18..bcad556a 100644 --- a/tests/mockserver/internal/sdk/models/operations/updatepublishingtokenexpiration.go +++ b/tests/mockserver/internal/sdk/models/operations/updatepublishingtokenexpiration.go @@ -10,10 +10,10 @@ import ( // UpdatePublishingTokenExpirationRequestBody - The publishing token to update type UpdatePublishingTokenExpirationRequestBody struct { - // The new name for the publishing token. - TokenName *string `json:"token_name,omitempty"` // The new expiration date for the publishing token. ValidUntil time.Time `json:"valid_until"` + // The new name for the publishing token. + TokenName *string `json:"token_name,omitempty"` } func (u UpdatePublishingTokenExpirationRequestBody) MarshalJSON() ([]byte, error) { @@ -21,45 +21,45 @@ func (u UpdatePublishingTokenExpirationRequestBody) MarshalJSON() ([]byte, error } func (u *UpdatePublishingTokenExpirationRequestBody) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil { + if err := utils.UnmarshalJSON(data, &u, "", false, []string{"valid_until"}); err != nil { return err } return nil } -func (o *UpdatePublishingTokenExpirationRequestBody) GetTokenName() *string { +func (o *UpdatePublishingTokenExpirationRequestBody) GetValidUntil() time.Time { if o == nil { - return nil + return time.Time{} } - return o.TokenName + return o.ValidUntil } -func (o *UpdatePublishingTokenExpirationRequestBody) GetValidUntil() time.Time { +func (o *UpdatePublishingTokenExpirationRequestBody) GetTokenName() *string { if o == nil { - return time.Time{} + return nil } - return o.ValidUntil + return o.TokenName } type UpdatePublishingTokenExpirationRequest struct { - // The publishing token to update - RequestBody *UpdatePublishingTokenExpirationRequestBody `request:"mediaType=application/json"` // Unique identifier of the publishing token. TokenID string `pathParam:"style=simple,explode=false,name=tokenID"` + // The publishing token to update + Body *UpdatePublishingTokenExpirationRequestBody `request:"mediaType=application/json"` } -func (o *UpdatePublishingTokenExpirationRequest) GetRequestBody() *UpdatePublishingTokenExpirationRequestBody { +func (o *UpdatePublishingTokenExpirationRequest) GetTokenID() string { if o == nil { - return nil + return "" } - return o.RequestBody + return o.TokenID } -func (o *UpdatePublishingTokenExpirationRequest) GetTokenID() string { +func (o *UpdatePublishingTokenExpirationRequest) GetBody() *UpdatePublishingTokenExpirationRequestBody { if o == nil { - return "" + return nil } - return o.TokenID + return o.Body } type UpdatePublishingTokenExpirationResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/updateworkspacedetails.go b/tests/mockserver/internal/sdk/models/operations/updateworkspacedetails.go index 92a76a07..c0b9b351 100644 --- a/tests/mockserver/internal/sdk/models/operations/updateworkspacedetails.go +++ b/tests/mockserver/internal/sdk/models/operations/updateworkspacedetails.go @@ -18,24 +18,24 @@ func (o *UpdateWorkspaceDetailsGlobals) GetWorkspaceID() *string { } type UpdateWorkspaceDetailsRequest struct { - // The workspace details to update. - Workspace components.Workspace `request:"mediaType=application/json"` // Unique identifier of the workspace. WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + // The workspace details to update. + Body components.Workspace `request:"mediaType=application/json"` } -func (o *UpdateWorkspaceDetailsRequest) GetWorkspace() components.Workspace { +func (o *UpdateWorkspaceDetailsRequest) GetWorkspaceID() *string { if o == nil { - return components.Workspace{} + return nil } - return o.Workspace + return o.WorkspaceID } -func (o *UpdateWorkspaceDetailsRequest) GetWorkspaceID() *string { +func (o *UpdateWorkspaceDetailsRequest) GetBody() components.Workspace { if o == nil { - return nil + return components.Workspace{} } - return o.WorkspaceID + return o.Body } type UpdateWorkspaceDetailsResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/updateworkspacesettings.go b/tests/mockserver/internal/sdk/models/operations/updateworkspacesettings.go index ac2e382f..8064939c 100644 --- a/tests/mockserver/internal/sdk/models/operations/updateworkspacesettings.go +++ b/tests/mockserver/internal/sdk/models/operations/updateworkspacesettings.go @@ -18,24 +18,24 @@ func (o *UpdateWorkspaceSettingsGlobals) GetWorkspaceID() *string { } type UpdateWorkspaceSettingsRequest struct { - // The workspace settings to update. - WorkspaceSettings components.WorkspaceSettings `request:"mediaType=application/json"` // Unique identifier of the workspace. WorkspaceID *string `pathParam:"style=simple,explode=false,name=workspace_id"` + // The workspace settings to update. + Body components.WorkspaceSettings `request:"mediaType=application/json"` } -func (o *UpdateWorkspaceSettingsRequest) GetWorkspaceSettings() components.WorkspaceSettings { +func (o *UpdateWorkspaceSettingsRequest) GetWorkspaceID() *string { if o == nil { - return components.WorkspaceSettings{} + return nil } - return o.WorkspaceSettings + return o.WorkspaceID } -func (o *UpdateWorkspaceSettingsRequest) GetWorkspaceID() *string { +func (o *UpdateWorkspaceSettingsRequest) GetBody() components.WorkspaceSettings { if o == nil { - return nil + return components.WorkspaceSettings{} } - return o.WorkspaceID + return o.Body } type UpdateWorkspaceSettingsResponse struct { diff --git a/tests/mockserver/internal/sdk/models/operations/uploadreport.go b/tests/mockserver/internal/sdk/models/operations/uploadreport.go index d15a2da0..f7404c66 100644 --- a/tests/mockserver/internal/sdk/models/operations/uploadreport.go +++ b/tests/mockserver/internal/sdk/models/operations/uploadreport.go @@ -8,50 +8,50 @@ import ( ) type File struct { - Content io.Reader `multipartForm:"content"` FileName string `multipartForm:"name=fileName"` + Content io.Reader `multipartForm:"content"` } -func (o *File) GetContent() io.Reader { +func (o *File) GetFileName() string { if o == nil { - return nil + return "" } - return o.Content + return o.FileName } -func (o *File) GetFileName() string { +func (o *File) GetContent() io.Reader { if o == nil { - return "" + return nil } - return o.FileName + return o.Content } -// UploadReportRequestBody - The report file to upload provided as a multipart/form-data file segment. -type UploadReportRequestBody struct { +// UploadReportRequest - The report file to upload provided as a multipart/form-data file segment. +type UploadReportRequest struct { Data components.Report `multipartForm:"name=data,json"` File File `multipartForm:"file"` } -func (o *UploadReportRequestBody) GetData() components.Report { +func (o *UploadReportRequest) GetData() components.Report { if o == nil { return components.Report{} } return o.Data } -func (o *UploadReportRequestBody) GetFile() File { +func (o *UploadReportRequest) GetFile() File { if o == nil { return File{} } return o.File } -// UploadReportUploadedReport - OK -type UploadReportUploadedReport struct { +// UploadedReport - OK +type UploadedReport struct { URL string `json:"url"` } -func (o *UploadReportUploadedReport) GetURL() string { +func (o *UploadedReport) GetURL() string { if o == nil { return "" } @@ -61,7 +61,7 @@ func (o *UploadReportUploadedReport) GetURL() string { type UploadReportResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // OK - UploadedReport *UploadReportUploadedReport + UploadedReport *UploadedReport } func (o *UploadReportResponse) GetHTTPMeta() components.HTTPMetadata { @@ -71,7 +71,7 @@ func (o *UploadReportResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *UploadReportResponse) GetUploadedReport() *UploadReportUploadedReport { +func (o *UploadReportResponse) GetUploadedReport() *UploadedReport { if o == nil { return nil } diff --git a/tests/mockserver/internal/sdk/models/operations/validateapikey.go b/tests/mockserver/internal/sdk/models/operations/validateapikey.go index 1810eeca..4cbda537 100644 --- a/tests/mockserver/internal/sdk/models/operations/validateapikey.go +++ b/tests/mockserver/internal/sdk/models/operations/validateapikey.go @@ -7,21 +7,21 @@ import ( ) type ValidateAPIKeyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` // OK APIKeyDetails *components.APIKeyDetails - HTTPMeta components.HTTPMetadata `json:"-"` } -func (o *ValidateAPIKeyResponse) GetAPIKeyDetails() *components.APIKeyDetails { +func (o *ValidateAPIKeyResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { - return nil + return components.HTTPMetadata{} } - return o.APIKeyDetails + return o.HTTPMeta } -func (o *ValidateAPIKeyResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *ValidateAPIKeyResponse) GetAPIKeyDetails() *components.APIKeyDetails { if o == nil { - return components.HTTPMetadata{} + return nil } - return o.HTTPMeta + return o.APIKeyDetails } diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/error.go b/tests/mockserver/internal/sdk/models/sdkerrors/error.go index a099ffa7..95fefa83 100644 --- a/tests/mockserver/internal/sdk/models/sdkerrors/error.go +++ b/tests/mockserver/internal/sdk/models/sdkerrors/error.go @@ -4,6 +4,7 @@ package sdkerrors import ( "encoding/json" + "mockserver/internal/sdk/models/components" ) // Error - The `Status` type defines a logical error model @@ -11,7 +12,8 @@ type Error struct { // A developer-facing error message. Message string `json:"message"` // The HTTP status code - StatusCode int `json:"status_code"` + StatusCode int `json:"status_code"` + HTTPMeta components.HTTPMetadata `json:"-"` } var _ error = &Error{} diff --git a/tests/mockserver/internal/sdk/utils/json.go b/tests/mockserver/internal/sdk/utils/json.go index f264f1a9..764f6454 100644 --- a/tests/mockserver/internal/sdk/utils/json.go +++ b/tests/mockserver/internal/sdk/utils/json.go @@ -51,7 +51,7 @@ func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, e } } - if isNil(field.Type, fieldVal) && field.Tag.Get("const") == "" { + if (isNil(field.Type, fieldVal) || isEmpty(field.Type, fieldVal)) && field.Tag.Get("const") == "" { if omitEmpty { continue } @@ -114,7 +114,7 @@ func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, e } } -func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool, disallowUnknownFields bool) error { +func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool, requiredFields []string) error { if reflect.TypeOf(v).Kind() != reflect.Ptr { return fmt.Errorf("v must be a pointer") } @@ -124,19 +124,25 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool switch { case isModelType(typ): if topLevel || bytes.Equal(b, []byte("null")) { - d := json.NewDecoder(bytes.NewReader(b)) - if disallowUnknownFields { - d.DisallowUnknownFields() - } - return d.Decode(v) + return json.Unmarshal(b, v) } - var unmarhsaled map[string]json.RawMessage + var unmarshaled map[string]json.RawMessage - if err := json.Unmarshal(b, &unmarhsaled); err != nil { + if err := json.Unmarshal(b, &unmarshaled); err != nil { return err } + missingFields := []string{} + for _, requiredField := range requiredFields { + if _, ok := unmarshaled[requiredField]; !ok { + missingFields = append(missingFields, requiredField) + } + } + if len(missingFields) > 0 { + return fmt.Errorf("missing required fields: %s", strings.Join(missingFields, ", ")) + } + var additionalPropertiesField *reflect.StructField var additionalPropertiesValue *reflect.Value @@ -163,7 +169,7 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool // If we receive a value for a const field ignore it but mark it as unmarshaled if field.Tag.Get("const") != "" { - if r, ok := unmarhsaled[fieldName]; ok { + if r, ok := unmarshaled[fieldName]; ok { val := string(r) if strings.HasPrefix(val, `"`) && strings.HasSuffix(val, `"`) { @@ -178,13 +184,13 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool return fmt.Errorf("const field `%s` does not match expected value `%s` got `%s`", fieldName, constValue, val) } - delete(unmarhsaled, fieldName) + delete(unmarshaled, fieldName) } } else if !field.IsExported() { continue } - value, ok := unmarhsaled[fieldName] + value, ok := unmarshaled[fieldName] if !ok { defaultTag := field.Tag.Get("default") if defaultTag != "" { @@ -192,26 +198,22 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool ok = true } } else { - delete(unmarhsaled, fieldName) + delete(unmarshaled, fieldName) } if ok { - if err := unmarshalValue(value, fieldVal, field.Tag, disallowUnknownFields); err != nil { + if err := unmarshalValue(value, fieldVal, field.Tag); err != nil { return err } } } - keys := make([]string, 0, len(unmarhsaled)) - for k := range unmarhsaled { + keys := make([]string, 0, len(unmarshaled)) + for k := range unmarshaled { keys = append(keys, k) } if len(keys) > 0 { - if disallowUnknownFields && (additionalPropertiesField == nil || additionalPropertiesValue == nil) { - return fmt.Errorf("unknown fields: %v", keys) - } - if additionalPropertiesField != nil && additionalPropertiesValue != nil { typeOfMap := additionalPropertiesField.Type if additionalPropertiesValue.Type().Kind() == reflect.Interface { @@ -222,10 +224,10 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool mapValue := reflect.MakeMap(typeOfMap) - for key, value := range unmarhsaled { + for key, value := range unmarshaled { val := reflect.New(typeOfMap.Elem()) - if err := unmarshalValue(value, val, additionalPropertiesField.Tag, disallowUnknownFields); err != nil { + if err := unmarshalValue(value, val, additionalPropertiesField.Tag); err != nil { return err } @@ -244,7 +246,7 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool } } default: - return unmarshalValue(b, reflect.ValueOf(v), tag, disallowUnknownFields) + return unmarshalValue(b, reflect.ValueOf(v), tag) } return nil @@ -394,7 +396,7 @@ func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.Struc return []byte(tagValue) } -func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTag, disallowUnknownFields bool) error { +func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTag) error { if bytes.Equal(value, []byte("null")) { if v.CanAddr() { return json.Unmarshal(value, v.Addr().Interface()) @@ -466,18 +468,18 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa } } - var unmarhsaled map[string]json.RawMessage + var unmarshaled map[string]json.RawMessage - if err := json.Unmarshal(value, &unmarhsaled); err != nil { + if err := json.Unmarshal(value, &unmarshaled); err != nil { return err } m := reflect.MakeMap(typ) - for k, value := range unmarhsaled { + for k, value := range unmarshaled { itemVal := reflect.New(typ.Elem()) - if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { + if err := unmarshalValue(value, itemVal, tag); err != nil { return err } @@ -498,7 +500,7 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa for index, value := range unmarshaled { itemVal := reflect.New(typ.Elem()) - if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { + if err := unmarshalValue(value, itemVal, tag); err != nil { return err } @@ -616,11 +618,7 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa val = v.Interface() } - d := json.NewDecoder(bytes.NewReader(value)) - if disallowUnknownFields { - d.DisallowUnknownFields() - } - return d.Decode(val) + return json.Unmarshal(value, val) } func dereferencePointers(typ reflect.Type, val reflect.Value) (reflect.Type, reflect.Value) { diff --git a/tests/mockserver/internal/sdk/utils/reflect.go b/tests/mockserver/internal/sdk/utils/reflect.go index cde47c89..255f3dd7 100644 --- a/tests/mockserver/internal/sdk/utils/reflect.go +++ b/tests/mockserver/internal/sdk/utils/reflect.go @@ -22,6 +22,19 @@ func isNil(typ reflect.Type, val reflect.Value) bool { return false } +func isEmpty(typ reflect.Type, val reflect.Value) bool { + if typ == nil { + return true + } + + switch typ.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return val.Len() == 0 + } + + return false +} + func trueReflectValue(val reflect.Value) reflect.Value { kind := val.Type().Kind() for kind == reflect.Interface || kind == reflect.Ptr { diff --git a/tests/organizations_test.go b/tests/organizations_test.go index 92e042a3..061f544a 100644 --- a/tests/organizations_test.go +++ b/tests/organizations_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" @@ -19,11 +19,11 @@ func TestOrganizations_CreateOrganization(t *testing.T) { testHTTPClient := createTestHTTPClient("createOrganization") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -58,11 +58,11 @@ func TestOrganizations_CreateFreeTrial(t *testing.T) { testHTTPClient := createTestHTTPClient("createFreeTrial") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -77,11 +77,11 @@ func TestOrganizations_GetOrganization(t *testing.T) { testHTTPClient := createTestHTTPClient("getOrganization") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -109,11 +109,11 @@ func TestOrganizations_GetOrganizations(t *testing.T) { testHTTPClient := createTestHTTPClient("getOrganizations") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -141,11 +141,11 @@ func TestOrganizations_GetOrganizationUsage(t *testing.T) { testHTTPClient := createTestHTTPClient("getOrganizationUsage") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -210,11 +210,11 @@ func TestOrganizations_CreateBillingAddOns(t *testing.T) { testHTTPClient := createTestHTTPClient("createBillingAddOns") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -235,11 +235,11 @@ func TestOrganizations_DeleteBillingAddOn(t *testing.T) { testHTTPClient := createTestHTTPClient("deleteBillingAddOn") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -256,11 +256,11 @@ func TestOrganizations_GetBillingAddOns(t *testing.T) { testHTTPClient := createTestHTTPClient("getBillingAddOns") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/tests/publishingtokens_test.go b/tests/publishingtokens_test.go index 84fc2108..4163b8a9 100644 --- a/tests/publishingtokens_test.go +++ b/tests/publishingtokens_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/utils" @@ -18,11 +18,11 @@ func TestPublishingtokens_GetPublishingTokenPublicMetadata(t *testing.T) { testHTTPClient := createTestHTTPClient("getPublishingTokenPublicMetadata") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/tests/reports_test.go b/tests/reports_test.go index 70c134b1..b809b4c5 100644 --- a/tests/reports_test.go +++ b/tests/reports_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/utils" @@ -19,11 +19,11 @@ func TestReports_GetChangesReportSignedURL(t *testing.T) { testHTTPClient := createTestHTTPClient("getChangesReportSignedUrl") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -44,11 +44,11 @@ func TestReports_GetLintingReportSignedURL(t *testing.T) { testHTTPClient := createTestHTTPClient("getLintingReportSignedUrl") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -69,21 +69,21 @@ func TestReports_UploadReport(t *testing.T) { testHTTPClient := createTestHTTPClient("uploadReport") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - content, fileErr := os.Open("../.speakeasy/testfiles/example.file") + example, fileErr := os.Open("../.speakeasy/testfiles/example.file") require.NoError(t, fileErr) res, err := s.Reports.UploadReport(ctx, operations.UploadReportRequestBody{ Data: shared.Report{}, File: operations.File{ - Content: content, + Content: example, FileName: "example.file", }, }) diff --git a/tests/schemastore_test.go b/tests/schemastore_test.go index 53a0cdd4..031d7ce8 100644 --- a/tests/schemastore_test.go +++ b/tests/schemastore_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" @@ -19,11 +19,11 @@ func TestSchemastore_CreateSchemaStoreItem(t *testing.T) { testHTTPClient := createTestHTTPClient("createSchemaStoreItem") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -43,11 +43,11 @@ func TestSchemastore_GetSchemaStoreItem(t *testing.T) { testHTTPClient := createTestHTTPClient("getSchemaStoreItem") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/tests/shorturls_test.go b/tests/shorturls_test.go index 13395632..0cd83d11 100644 --- a/tests/shorturls_test.go +++ b/tests/shorturls_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/utils" @@ -18,11 +18,11 @@ func TestShorturls_Create(t *testing.T) { testHTTPClient := createTestHTTPClient("create") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/tests/speakeasy_test.go b/tests/speakeasy_test.go index 2a5bc1cc..ba22a024 100644 --- a/tests/speakeasy_test.go +++ b/tests/speakeasy_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" @@ -20,21 +20,21 @@ func TestSpeakeasy_GenerateCodeSamplePreview(t *testing.T) { testHTTPClient := createTestHTTPClient("generateCodeSamplePreview") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - content, fileErr := os.Open("../.speakeasy/testfiles/example.file") + example, fileErr := os.Open("../.speakeasy/testfiles/example.file") require.NoError(t, fileErr) res, err := s.CodeSamples.GenerateCodeSamplePreview(ctx, shared.CodeSampleSchemaInput{ Language: "", SchemaFile: shared.SchemaFile{ - Content: content, + Content: example, FileName: "example.file", }, }) @@ -48,21 +48,21 @@ func TestSpeakeasy_GenerateCodeSamplePreviewAsync(t *testing.T) { testHTTPClient := createTestHTTPClient("generateCodeSamplePreviewAsync") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) - content, fileErr := os.Open("../.speakeasy/testfiles/example.file") + example, fileErr := os.Open("../.speakeasy/testfiles/example.file") require.NoError(t, fileErr) res, err := s.CodeSamples.GenerateCodeSamplePreviewAsync(ctx, shared.CodeSampleSchemaInput{ Language: "", SchemaFile: shared.SchemaFile{ - Content: content, + Content: example, FileName: "example.file", }, }) @@ -81,11 +81,11 @@ func TestSpeakeasy_GetCodeSamplePreviewAsync(t *testing.T) { testHTTPClient := createTestHTTPClient("getCodeSamplePreviewAsync") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -106,11 +106,11 @@ func TestSpeakeasy_CreatePublishingToken(t *testing.T) { testHTTPClient := createTestHTTPClient("createPublishingToken") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -118,7 +118,7 @@ func TestSpeakeasy_CreatePublishingToken(t *testing.T) { TargetID: "", TargetResource: "", TokenName: "", - ValidUntil: types.MustTimeFromString("2024-12-02T02:12:05.658Z"), + ValidUntil: types.MustTimeFromString("2024-08-20T04:36:26.084Z"), }) require.NoError(t, err) assert.Equal(t, 200, res.StatusCode) @@ -129,10 +129,9 @@ func TestSpeakeasy_CreatePublishingToken(t *testing.T) { ID: "", OrganizationID: "", TargetID: "", - TargetResource: shared.TargetResourceDocument, Token: "", TokenName: "", - ValidUntil: types.MustTimeFromString("2025-08-24T05:20:24.233Z"), + ValidUntil: types.MustTimeFromString("2024-04-09T07:48:57.030Z"), WorkspaceID: "", }, res.PublishingToken) @@ -143,11 +142,11 @@ func TestSpeakeasy_DeletePublishingToken(t *testing.T) { testHTTPClient := createTestHTTPClient("deletePublishingToken") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -164,11 +163,11 @@ func TestSpeakeasy_GetPublishingTokenByID(t *testing.T) { testHTTPClient := createTestHTTPClient("getPublishingTokenByID") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -184,10 +183,9 @@ func TestSpeakeasy_GetPublishingTokenByID(t *testing.T) { ID: "", OrganizationID: "", TargetID: "", - TargetResource: shared.TargetResourceDocument, Token: "", TokenName: "", - ValidUntil: types.MustTimeFromString("2025-06-28T12:30:49.314Z"), + ValidUntil: types.MustTimeFromString("2024-12-08T21:35:55.501Z"), WorkspaceID: "", }, res.PublishingToken) @@ -202,11 +200,11 @@ func TestSpeakeasy_UpdatePublishingTokenExpiration(t *testing.T) { testHTTPClient := createTestHTTPClient("updatePublishingTokenExpiration") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/tests/subscriptions_test.go b/tests/subscriptions_test.go index 14fe7063..a21f7ddd 100644 --- a/tests/subscriptions_test.go +++ b/tests/subscriptions_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/utils" @@ -26,11 +26,11 @@ func TestSubscriptions_ActivateSubscriptionNamespace(t *testing.T) { testHTTPClient := createTestHTTPClient("activateSubscriptionNamespace") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -48,11 +48,11 @@ func TestSubscriptions_IgnoreSubscriptionNamespace(t *testing.T) { testHTTPClient := createTestHTTPClient("ignoreSubscriptionNamespace") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/tests/suggest_test.go b/tests/suggest_test.go index 8856c06b..153cf84f 100644 --- a/tests/suggest_test.go +++ b/tests/suggest_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/utils" "github.com/stretchr/testify/assert" @@ -17,11 +17,11 @@ func TestSuggest_SuggestItems(t *testing.T) { testHTTPClient := createTestHTTPClient("suggestItems") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) diff --git a/tests/testclient.go b/tests/testclient.go index 9dc87892..1fab4b3a 100644 --- a/tests/testclient.go +++ b/tests/testclient.go @@ -5,12 +5,12 @@ package tests import ( "crypto/rand" "fmt" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "net/http" "time" ) -func createTestHTTPClient(testName string) speakeasyclientsdkgo.HTTPClient { +func createTestHTTPClient(testName string) v3.HTTPClient { return &testClient{ client: &http.Client{Timeout: 60 * time.Second}, testName: testName, @@ -24,7 +24,7 @@ type testClient struct { testInstanceID string } -var _ speakeasyclientsdkgo.HTTPClient = &testClient{} +var _ v3.HTTPClient = &testClient{} func (c *testClient) Do(req *http.Request) (*http.Response, error) { req.Header.Set("x-speakeasy-test-name", c.testName) diff --git a/tests/workspaces_test.go b/tests/workspaces_test.go index 37b5045f..0786d53f 100644 --- a/tests/workspaces_test.go +++ b/tests/workspaces_test.go @@ -4,7 +4,7 @@ package tests import ( "context" - speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" @@ -19,11 +19,11 @@ func TestWorkspaces_CreateWorkspace(t *testing.T) { testHTTPClient := createTestHTTPClient("createWorkspace") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -33,7 +33,7 @@ func TestWorkspaces_CreateWorkspace(t *testing.T) { Name: "", OrganizationID: "", Slug: "", - TelemetryDisabled: speakeasyclientsdkgo.Bool(false), + TelemetryDisabled: v3.Pointer(false), UpdatedAt: types.MustTimeFromString("2023-04-03T12:48:32.253Z"), Verified: true, }) @@ -46,7 +46,7 @@ func TestWorkspaces_CreateWorkspace(t *testing.T) { Name: "", OrganizationID: "", Slug: "", - TelemetryDisabled: speakeasyclientsdkgo.Bool(false), + TelemetryDisabled: v3.Pointer(false), UpdatedAt: types.MustTimeFromString("2024-11-08T08:43:39.394Z"), Verified: true, }, res.Workspace) @@ -58,11 +58,11 @@ func TestWorkspaces_GetWorkspaceByContext(t *testing.T) { testHTTPClient := createTestHTTPClient("getWorkspaceByContext") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -87,7 +87,7 @@ func TestWorkspaces_GetWorkspaceByContext(t *testing.T) { Name: "", OrganizationID: "", Slug: "", - TelemetryDisabled: speakeasyclientsdkgo.Bool(true), + TelemetryDisabled: v3.Pointer(true), UpdatedAt: types.MustTimeFromString("2023-05-10T02:28:23.533Z"), Verified: true, }, @@ -100,11 +100,11 @@ func TestWorkspaces_GetWorkspaces(t *testing.T) { testHTTPClient := createTestHTTPClient("getWorkspaces") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -119,7 +119,7 @@ func TestWorkspaces_GetWorkspaces(t *testing.T) { Name: "", OrganizationID: "", Slug: "", - TelemetryDisabled: speakeasyclientsdkgo.Bool(false), + TelemetryDisabled: v3.Pointer(false), UpdatedAt: types.MustTimeFromString("2023-12-15T17:14:28.501Z"), Verified: true, }, @@ -132,16 +132,16 @@ func TestWorkspaces_GetWorkspace(t *testing.T) { testHTTPClient := createTestHTTPClient("getWorkspace") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.GetByID(ctx, operations.GetWorkspaceRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), + WorkspaceID: v3.Pointer(""), }) require.NoError(t, err) assert.Contains(t, []any{200, 201, 202, 203, 204, 205, 206, 207, 208, 226}, res.StatusCode) @@ -152,7 +152,7 @@ func TestWorkspaces_GetWorkspace(t *testing.T) { Name: "", OrganizationID: "", Slug: "", - TelemetryDisabled: speakeasyclientsdkgo.Bool(false), + TelemetryDisabled: v3.Pointer(false), UpdatedAt: types.MustTimeFromString("2024-10-23T07:17:30.329Z"), Verified: false, }, res.Workspace) @@ -164,16 +164,16 @@ func TestWorkspaces_GetWorkspaceFeatureFlags(t *testing.T) { testHTTPClient := createTestHTTPClient("getWorkspaceFeatureFlags") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.GetFeatureFlags(ctx, operations.GetWorkspaceFeatureFlagsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), + WorkspaceID: v3.Pointer(""), }) require.NoError(t, err) assert.Equal(t, 200, res.StatusCode) @@ -185,16 +185,16 @@ func TestWorkspaces_GetWorkspaceSettings(t *testing.T) { testHTTPClient := createTestHTTPClient("getWorkspaceSettings") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) res, err := s.Workspaces.GetSettings(ctx, operations.GetWorkspaceSettingsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), + WorkspaceID: v3.Pointer(""), }) require.NoError(t, err) assert.Contains(t, []any{200, 201, 202, 203, 204, 205, 206, 207, 208, 226}, res.StatusCode) @@ -213,11 +213,11 @@ func TestWorkspaces_UpdateWorkspaceSettings(t *testing.T) { testHTTPClient := createTestHTTPClient("updateWorkspaceSettings") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -228,7 +228,7 @@ func TestWorkspaces_UpdateWorkspaceSettings(t *testing.T) { WebhookURL: "https://grown-pharmacopoeia.net", WorkspaceID: "", }, - WorkspaceID: speakeasyclientsdkgo.String(""), + WorkspaceID: v3.Pointer(""), }) require.NoError(t, err) assert.Equal(t, 200, res.StatusCode) @@ -240,11 +240,11 @@ func TestWorkspaces_SetWorkspaceFeatureFlags(t *testing.T) { testHTTPClient := createTestHTTPClient("setWorkspaceFeatureFlags") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -266,11 +266,11 @@ func TestWorkspaces_GetPublishingToken(t *testing.T) { testHTTPClient := createTestHTTPClient("getPublishingToken") - s := speakeasyclientsdkgo.New( - speakeasyclientsdkgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - speakeasyclientsdkgo.WithClient(testHTTPClient), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + s := v3.New( + v3.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + v3.WithClient(testHTTPClient), + v3.WithSecurity(shared.Security{ + APIKey: v3.Pointer(""), }), ) @@ -285,7 +285,6 @@ func TestWorkspaces_GetPublishingToken(t *testing.T) { ID: "", OrganizationID: "", TargetID: "", - TargetResource: shared.TargetResourceDocument, Token: "", TokenName: "", ValidUntil: types.MustTimeFromString("2024-08-24T11:59:25.466Z"), @@ -297,7 +296,6 @@ func TestWorkspaces_GetPublishingToken(t *testing.T) { ID: "", OrganizationID: "", TargetID: "", - TargetResource: shared.TargetResourceDocument, Token: "", TokenName: "", ValidUntil: types.MustTimeFromString("2025-02-22T20:20:27.935Z"), @@ -309,7 +307,6 @@ func TestWorkspaces_GetPublishingToken(t *testing.T) { ID: "", OrganizationID: "", TargetID: "", - TargetResource: shared.TargetResourceDocument, Token: "", TokenName: "", ValidUntil: types.MustTimeFromString("2024-10-22T15:05:16.239Z"), diff --git a/workspaces.go b/workspaces.go index 6ebfb1b3..21cc6960 100644 --- a/workspaces.go +++ b/workspaces.go @@ -1,11 +1,12 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -package speakeasyclientsdkgo +package v3 import ( "bytes" "context" "fmt" + "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/config" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/internal/hooks" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/sdkerrors" @@ -18,12 +19,16 @@ import ( // Workspaces - REST APIs for managing Workspaces (speakeasy tenancy) type Workspaces struct { - sdkConfiguration sdkConfiguration + rootSDK *Speakeasy + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newWorkspaces(sdkConfig sdkConfiguration) *Workspaces { +func newWorkspaces(rootSDK *Speakeasy, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Workspaces { return &Workspaces{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -54,11 +59,13 @@ func (s *Workspaces) Create(ctx context.Context, request shared.Workspace, opts } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "createWorkspace", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "createWorkspace", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -114,15 +121,17 @@ func (s *Workspaces) Create(ctx context.Context, request shared.Workspace, opts "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -139,7 +148,7 @@ func (s *Workspaces) Create(ctx context.Context, request shared.Workspace, opts err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -147,13 +156,13 @@ func (s *Workspaces) Create(ctx context.Context, request shared.Workspace, opts if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -166,17 +175,17 @@ func (s *Workspaces) Create(ctx context.Context, request shared.Workspace, opts err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -280,11 +289,13 @@ func (s *Workspaces) CreateToken(ctx context.Context, request operations.CreateW } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "createWorkspaceToken", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "createWorkspaceToken", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "WorkspaceToken", "json", `request:"mediaType=application/json"`) if err != nil { @@ -340,15 +351,17 @@ func (s *Workspaces) CreateToken(ctx context.Context, request operations.CreateW "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -365,7 +378,7 @@ func (s *Workspaces) CreateToken(ctx context.Context, request operations.CreateW err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -373,13 +386,13 @@ func (s *Workspaces) CreateToken(ctx context.Context, request operations.CreateW if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -392,17 +405,17 @@ func (s *Workspaces) CreateToken(ctx context.Context, request operations.CreateW err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -486,11 +499,13 @@ func (s *Workspaces) DeleteToken(ctx context.Context, request operations.DeleteW } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "deleteWorkspaceToken", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "deleteWorkspaceToken", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -539,15 +554,17 @@ func (s *Workspaces) DeleteToken(ctx context.Context, request operations.DeleteW "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -564,7 +581,7 @@ func (s *Workspaces) DeleteToken(ctx context.Context, request operations.DeleteW err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -572,13 +589,13 @@ func (s *Workspaces) DeleteToken(ctx context.Context, request operations.DeleteW if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -591,17 +608,17 @@ func (s *Workspaces) DeleteToken(ctx context.Context, request operations.DeleteW err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -682,11 +699,13 @@ func (s *Workspaces) Get(ctx context.Context, opts ...operations.Option) (*opera } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getWorkspaceByContext", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getWorkspaceByContext", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -735,15 +754,17 @@ func (s *Workspaces) Get(ctx context.Context, opts ...operations.Option) (*opera "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -760,7 +781,7 @@ func (s *Workspaces) Get(ctx context.Context, opts ...operations.Option) (*opera err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -768,13 +789,13 @@ func (s *Workspaces) Get(ctx context.Context, opts ...operations.Option) (*opera if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -787,17 +808,17 @@ func (s *Workspaces) Get(ctx context.Context, opts ...operations.Option) (*opera err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -898,11 +919,13 @@ func (s *Workspaces) GetAll(ctx context.Context, opts ...operations.Option) (*op } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getWorkspaces", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getWorkspaces", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -951,15 +974,17 @@ func (s *Workspaces) GetAll(ctx context.Context, opts ...operations.Option) (*op "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -976,7 +1001,7 @@ func (s *Workspaces) GetAll(ctx context.Context, opts ...operations.Option) (*op err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -984,13 +1009,13 @@ func (s *Workspaces) GetAll(ctx context.Context, opts ...operations.Option) (*op if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1003,17 +1028,17 @@ func (s *Workspaces) GetAll(ctx context.Context, opts ...operations.Option) (*op err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1118,11 +1143,13 @@ func (s *Workspaces) GetByID(ctx context.Context, request operations.GetWorkspac } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getWorkspace", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getWorkspace", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1171,15 +1198,17 @@ func (s *Workspaces) GetByID(ctx context.Context, request operations.GetWorkspac "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1196,7 +1225,7 @@ func (s *Workspaces) GetByID(ctx context.Context, request operations.GetWorkspac err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1204,13 +1233,13 @@ func (s *Workspaces) GetByID(ctx context.Context, request operations.GetWorkspac if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1223,17 +1252,17 @@ func (s *Workspaces) GetByID(ctx context.Context, request operations.GetWorkspac err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1337,11 +1366,13 @@ func (s *Workspaces) GetFeatureFlags(ctx context.Context, request operations.Get } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getWorkspaceFeatureFlags", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getWorkspaceFeatureFlags", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1390,15 +1421,17 @@ func (s *Workspaces) GetFeatureFlags(ctx context.Context, request operations.Get "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1415,7 +1448,7 @@ func (s *Workspaces) GetFeatureFlags(ctx context.Context, request operations.Get err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1423,13 +1456,13 @@ func (s *Workspaces) GetFeatureFlags(ctx context.Context, request operations.Get if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1442,17 +1475,17 @@ func (s *Workspaces) GetFeatureFlags(ctx context.Context, request operations.Get err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1557,11 +1590,13 @@ func (s *Workspaces) GetSettings(ctx context.Context, request operations.GetWork } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getWorkspaceSettings", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getWorkspaceSettings", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1610,15 +1645,17 @@ func (s *Workspaces) GetSettings(ctx context.Context, request operations.GetWork "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1635,7 +1672,7 @@ func (s *Workspaces) GetSettings(ctx context.Context, request operations.GetWork err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1643,13 +1680,13 @@ func (s *Workspaces) GetSettings(ctx context.Context, request operations.GetWork if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1662,17 +1699,17 @@ func (s *Workspaces) GetSettings(ctx context.Context, request operations.GetWork err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1776,11 +1813,13 @@ func (s *Workspaces) GetTeam(ctx context.Context, request operations.GetWorkspac } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getWorkspaceTeam", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getWorkspaceTeam", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1829,15 +1868,17 @@ func (s *Workspaces) GetTeam(ctx context.Context, request operations.GetWorkspac "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1854,7 +1895,7 @@ func (s *Workspaces) GetTeam(ctx context.Context, request operations.GetWorkspac err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1862,13 +1903,13 @@ func (s *Workspaces) GetTeam(ctx context.Context, request operations.GetWorkspac if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1881,17 +1922,17 @@ func (s *Workspaces) GetTeam(ctx context.Context, request operations.GetWorkspac err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1995,11 +2036,13 @@ func (s *Workspaces) GetTokens(ctx context.Context, request operations.GetWorksp } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "getWorkspaceTokens", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "getWorkspaceTokens", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2048,15 +2091,17 @@ func (s *Workspaces) GetTokens(ctx context.Context, request operations.GetWorksp "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2073,7 +2118,7 @@ func (s *Workspaces) GetTokens(ctx context.Context, request operations.GetWorksp err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2081,13 +2126,13 @@ func (s *Workspaces) GetTokens(ctx context.Context, request operations.GetWorksp if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2100,17 +2145,17 @@ func (s *Workspaces) GetTokens(ctx context.Context, request operations.GetWorksp err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2214,11 +2259,13 @@ func (s *Workspaces) GrantAccess(ctx context.Context, request operations.GrantUs } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "grantUserAccessToWorkspace", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "grantUserAccessToWorkspace", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2267,15 +2314,17 @@ func (s *Workspaces) GrantAccess(ctx context.Context, request operations.GrantUs "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2292,7 +2341,7 @@ func (s *Workspaces) GrantAccess(ctx context.Context, request operations.GrantUs err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2300,13 +2349,13 @@ func (s *Workspaces) GrantAccess(ctx context.Context, request operations.GrantUs if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2319,17 +2368,17 @@ func (s *Workspaces) GrantAccess(ctx context.Context, request operations.GrantUs err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2433,11 +2482,13 @@ func (s *Workspaces) RevokeAccess(ctx context.Context, request operations.Revoke } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "revokeUserAccessToWorkspace", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "revokeUserAccessToWorkspace", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2486,15 +2537,17 @@ func (s *Workspaces) RevokeAccess(ctx context.Context, request operations.Revoke "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2511,7 +2564,7 @@ func (s *Workspaces) RevokeAccess(ctx context.Context, request operations.Revoke err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2519,13 +2572,13 @@ func (s *Workspaces) RevokeAccess(ctx context.Context, request operations.Revoke if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2538,17 +2591,17 @@ func (s *Workspaces) RevokeAccess(ctx context.Context, request operations.Revoke err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2628,11 +2681,13 @@ func (s *Workspaces) SetFeatureFlags(ctx context.Context, request shared.Workspa } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "setWorkspaceFeatureFlags", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "setWorkspaceFeatureFlags", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2688,15 +2743,17 @@ func (s *Workspaces) SetFeatureFlags(ctx context.Context, request shared.Workspa "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2713,7 +2770,7 @@ func (s *Workspaces) SetFeatureFlags(ctx context.Context, request shared.Workspa err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2721,13 +2778,13 @@ func (s *Workspaces) SetFeatureFlags(ctx context.Context, request shared.Workspa if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2740,17 +2797,17 @@ func (s *Workspaces) SetFeatureFlags(ctx context.Context, request shared.Workspa err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2855,11 +2912,13 @@ func (s *Workspaces) Update(ctx context.Context, request operations.UpdateWorksp } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "updateWorkspaceDetails", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "updateWorkspaceDetails", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Workspace", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2915,15 +2974,17 @@ func (s *Workspaces) Update(ctx context.Context, request operations.UpdateWorksp "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2940,7 +3001,7 @@ func (s *Workspaces) Update(ctx context.Context, request operations.UpdateWorksp err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2948,13 +3009,13 @@ func (s *Workspaces) Update(ctx context.Context, request operations.UpdateWorksp if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2967,17 +3028,17 @@ func (s *Workspaces) Update(ctx context.Context, request operations.UpdateWorksp err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3062,11 +3123,13 @@ func (s *Workspaces) UpdateSettings(ctx context.Context, request operations.Upda } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "updateWorkspaceSettings", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "updateWorkspaceSettings", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "WorkspaceSettings", "json", `request:"mediaType=application/json"`) if err != nil { @@ -3122,15 +3185,17 @@ func (s *Workspaces) UpdateSettings(ctx context.Context, request operations.Upda "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { copyBody, err := req.GetBody() + if err != nil { return nil, err } + req.Body = copyBody } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3147,7 +3212,7 @@ func (s *Workspaces) UpdateSettings(ctx context.Context, request operations.Upda err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3155,13 +3220,13 @@ func (s *Workspaces) UpdateSettings(ctx context.Context, request operations.Upda if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } } } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -3174,17 +3239,17 @@ func (s *Workspaces) UpdateSettings(ctx context.Context, request operations.Upda err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err } else if _httpRes != nil { httpRes = _httpRes } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err }