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/.speakeasy/gen.lock b/.speakeasy/gen.lock index b2dc322b..c90b0719 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.605.0 + generationVersion: 2.684.0 + releaseVersion: 3.27.0 + configChecksum: d8462fe06790fb6d2a1287bce9b2b3f6 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.9.3 deepObjectParams: 0.1.1 defaultEnabledRetries: 0.2.0 deprecations: 2.81.3 @@ -25,18 +25,18 @@ features: getRequestBodies: 2.81.1 globalSecurity: 2.82.11 globalSecurityCallbacks: 0.1.0 - globalServerURLs: 2.82.2 + globalServerURLs: 2.82.3 globals: 2.82.2 intellisenseMarkdownSupport: 0.1.0 - mockServer: 0.1.0 + mockServer: 0.1.1 nameOverrides: 2.81.2 nullables: 0.1.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.1 uploadStreams: 0.1.0 generatedFiles: - .devcontainer/README.md @@ -461,6 +461,7 @@ generatedFiles: - events.go - github.go - go.mod + - internal/config/sdkconfiguration.go - internal/globals/globals.go - internal/hooks/hooks.go - organizations.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-08-17T22:07:57Z" + getCodeSamples-default: "2025-08-17T22:07:57Z" + getCodeSamplePreviewAsync-default: "2025-08-17T22:07:57Z" 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..264d2d59 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.542.3 +speakeasyVersion: 1.605.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:bd25d834e9c2e37153e63f4f7e5fafba31c0ee604740716000b99747a6191c4b workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 36c05714..a13a1448 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.String(""), }), ) @@ -236,7 +236,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 +245,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.String(""), }), ) @@ -291,7 +291,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 +299,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.String(""), }), ) @@ -325,7 +325,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 +333,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.String(""), }), ) @@ -371,12 +371,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 +405,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 +413,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.String(""), }), ) @@ -453,7 +454,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 +462,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 +491,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 +501,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.String(""), }), ) @@ -531,7 +534,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 +543,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 +555,8 @@ func main() { }, RetryConnectionErrors: false, }), - speakeasyclientsdkgo.WithSecurity(shared.Security{ - APIKey: speakeasyclientsdkgo.String(""), + v3.WithSecurity(shared.Security{ + APIKey: v3.String(""), }), ) diff --git a/RELEASES.md b/RELEASES.md index 014a3def..986f6c51 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-08-17 22:07:42 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.605.0 (2.684.0) 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..b2a1a973 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.String(""), }), ) diff --git a/artifacts.go b/artifacts.go index cc49a122..a428719d 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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..05eaa5ae 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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..921b0b33 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -13,7 +13,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/shared" "log" ) @@ -21,9 +21,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.String(""), }), ) @@ -45,7 +45,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/shared" "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.String(""), }), ) @@ -80,7 +80,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/shared" "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.String(""), }), ) @@ -115,7 +115,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/shared" "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.String(""), }), ) @@ -150,7 +150,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/shared" "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.String(""), }), ) @@ -185,7 +185,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/shared" "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.String(""), }), ) @@ -220,7 +220,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/shared" "log" ) @@ -228,9 +228,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.String(""), }), ) @@ -252,7 +252,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/shared" "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.String(""), }), ) @@ -287,7 +287,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/shared" "log" ) @@ -295,9 +295,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.String(""), }), ) @@ -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,7 +349,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/shared" "log" ) @@ -357,9 +357,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.String(""), }), ) @@ -381,7 +381,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/shared" "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.String(""), }), ) 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,7 +435,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/shared" "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.String(""), }), ) - 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,7 +479,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/shared" "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.String(""), }), ) - 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,7 +523,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/shared" "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.String(""), }), ) @@ -554,7 +558,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/shared" "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.String(""), }), ) @@ -590,7 +594,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/shared" "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.String(""), }), ) @@ -626,7 +630,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/shared" "log" ) @@ -634,9 +638,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.String(""), }), ) @@ -662,7 +666,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/shared" "log" ) @@ -670,9 +674,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.String(""), }), ) @@ -681,7 +685,7 @@ actions: Repo: "", Input: "", Overlays: []string{ - "", + "", }, }) if err != nil { @@ -701,7 +705,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/shared" "log" ) @@ -709,9 +713,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.String(""), }), ) @@ -736,7 +740,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/shared" "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.String(""), }), ) @@ -769,7 +773,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/shared" "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.String(""), }), ) @@ -806,7 +810,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/shared" "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.String(""), }), ) @@ -841,7 +845,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/shared" "log" ) @@ -849,9 +853,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.String(""), }), ) @@ -875,7 +879,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/shared" "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.String(""), }), ) @@ -912,7 +916,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/shared" "log" ) @@ -920,9 +924,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.String(""), }), ) @@ -948,7 +952,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/shared" "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.String(""), }), ) @@ -986,7 +990,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/shared" "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.String(""), }), ) @@ -1024,7 +1028,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/shared" "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.String(""), }), ) @@ -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,7 +1070,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/shared" "log" ) @@ -1074,9 +1078,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.String(""), }), ) @@ -1098,7 +1102,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/shared" "log" ) @@ -1106,17 +1110,15 @@ 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.String(""), }), ) res, err := s.Organizations.CreateBillingAddOns(ctx, shared.OrganizationBillingAddOnRequest{ AddOns: []shared.BillingAddOn{ shared.BillingAddOnCustomCodeRegions, - shared.BillingAddOnCustomCodeRegions, - shared.BillingAddOnSDKTesting, }, }) if err != nil { @@ -1136,7 +1138,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/shared" "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.String(""), }), ) res, err := s.Organizations.DeleteBillingAddOn(ctx, operations.DeleteBillingAddOnRequest{ - AddOn: shared.BillingAddOnSnippetAi, + AddOn: shared.BillingAddOnSDKTesting, }) if err != nil { log.Fatal(err) @@ -1171,7 +1173,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/shared" "log" ) @@ -1179,9 +1181,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.String(""), }), ) @@ -1203,7 +1205,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/shared" "log" ) @@ -1211,9 +1213,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.String(""), }), ) @@ -1235,7 +1237,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/shared" "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.String(""), }), ) @@ -1270,7 +1272,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/shared" "log" ) @@ -1278,9 +1280,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.String(""), }), ) @@ -1302,7 +1304,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/shared" "log" ) @@ -1310,9 +1312,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.String(""), }), ) @@ -1334,7 +1336,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/shared" "log" ) @@ -1342,9 +1344,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.String(""), }), ) @@ -1366,7 +1368,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/shared" "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.String(""), }), ) @@ -1401,7 +1403,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/shared" "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.String(""), }), ) @@ -1436,7 +1438,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/shared" "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.String(""), }), ) @@ -1471,7 +1473,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/shared" "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.String(""), }), ) @@ -1506,7 +1508,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/shared" "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.String(""), }), ) @@ -1541,7 +1543,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/shared" "os" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) - 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,7 +1588,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/shared" "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.String(""), }), ) @@ -1622,7 +1623,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/shared" "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.String(""), }), ) @@ -1657,7 +1658,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/shared" "log" ) @@ -1665,9 +1666,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.String(""), }), ) @@ -1689,7 +1690,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/shared" "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.String(""), }), ) @@ -1727,7 +1728,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/shared" "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.String(""), }), ) 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,7 +1763,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/shared" "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.String(""), }), ) @@ -1798,7 +1799,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/shared" "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.String(""), }), ) @@ -1834,7 +1835,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/shared" "log" ) @@ -1842,15 +1843,17 @@ 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.String(""), }), ) res, err := s.Suggest.SuggestItems(ctx, shared.SuggestItemsRequestBody{ Prompt: "", - Items: []string{}, + Items: []string{ + "", + }, }) if err != nil { log.Fatal(err) @@ -1869,7 +1872,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/shared" "os" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) - 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,7 +1919,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/shared" "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.String(""), }), ) @@ -1954,7 +1956,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/shared" "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.String(""), }), ) @@ -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,7 +2005,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/shared" "log" ) @@ -2011,9 +2013,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.String(""), }), ) @@ -2035,7 +2037,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/shared" "log" ) @@ -2043,9 +2045,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.String(""), }), ) @@ -2067,7 +2069,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/shared" "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.String(""), }), ) 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,7 +2110,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/shared" "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.String(""), }), ) @@ -2141,7 +2143,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/shared" "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.String(""), }), ) @@ -2174,7 +2176,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/shared" "log" ) @@ -2182,17 +2184,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.String(""), }), ) 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,7 +2210,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/shared" "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.String(""), }), ) - 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,7 +2244,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/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) 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,7 +2289,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/shared" "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.String(""), }), ) - 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,7 +2323,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/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) 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,7 +2372,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/shared" "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.String(""), }), ) - 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,7 +2406,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/shared" "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.String(""), }), ) res, err := s.Events.GetEventsByTarget(ctx, operations.GetWorkspaceEventsByTargetRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), TargetID: "", }) if err != nil { @@ -2446,7 +2442,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/shared" "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.String(""), }), ) - 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,7 +2476,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/shared" "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.String(""), }), ) - 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,7 +2510,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/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) 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,7 +2552,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/shared" "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.String(""), }), ) - 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,7 +2586,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/shared" "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.String(""), }), ) 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,7 +2622,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/shared" "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.String(""), }), ) res, err := s.Workspaces.RevokeAccess(ctx, operations.RevokeUserAccessToWorkspaceRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), UserID: "", }) if err != nil { @@ -2665,7 +2658,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/shared" "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.String(""), }), ) - 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,7 +2692,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/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) 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,7 +2736,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/shared" "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.String(""), }), ) res, err := s.Workspaces.DeleteToken(ctx, operations.DeleteWorkspaceTokenRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), TokenID: "", }) if err != nil { @@ -2780,7 +2772,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/shared" "log" ) @@ -2788,9 +2780,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.String(""), }), ) diff --git a/codesamples.go b/codesamples.go index f7db3483..9e66eedc 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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..cd8a5b2c 100644 --- a/docs/sdks/artifacts/README.md +++ b/docs/sdks/artifacts/README.md @@ -25,12 +25,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -38,9 +39,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.String(""), }), ) @@ -79,12 +80,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -139,12 +141,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -199,12 +202,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -212,9 +216,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.String(""), }), ) @@ -250,12 +254,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -305,12 +310,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -362,12 +368,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -419,12 +426,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -476,12 +484,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -489,9 +498,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.String(""), }), ) @@ -530,12 +539,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -587,12 +597,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) diff --git a/docs/sdks/auth/README.md b/docs/sdks/auth/README.md index ed038854..d46740a8 100644 --- a/docs/sdks/auth/README.md +++ b/docs/sdks/auth/README.md @@ -18,12 +18,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -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,12 +126,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -137,9 +140,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.String(""), }), ) @@ -177,12 +180,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -190,9 +194,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.String(""), }), ) diff --git a/docs/sdks/codesamples/README.md b/docs/sdks/codesamples/README.md index ede62642..0445e95f 100644 --- a/docs/sdks/codesamples/README.md +++ b/docs/sdks/codesamples/README.md @@ -18,12 +18,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) - 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,12 +85,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) - 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,12 +152,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -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,12 +229,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) diff --git a/docs/sdks/events/README.md b/docs/sdks/events/README.md index 0164f307..17594e64 100644 --- a/docs/sdks/events/README.md +++ b/docs/sdks/events/README.md @@ -19,12 +19,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) res, err := s.Events.GetEventsByTarget(ctx, operations.GetWorkspaceEventsByTargetRequest{ TargetID: "", - WorkspaceID: speakeasyclientsdkgo.String(""), }) if err != nil { log.Fatal(err) @@ -77,12 +78,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -132,12 +134,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) - 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,12 +191,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) 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,12 +263,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) - 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..f2e41a44 100644 --- a/docs/sdks/github/README.md +++ b/docs/sdks/github/README.md @@ -23,12 +23,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -79,12 +80,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -136,12 +138,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -191,12 +194,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -204,9 +208,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.String(""), }), ) @@ -247,12 +251,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -260,9 +265,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.String(""), }), ) @@ -270,7 +275,7 @@ func main() { Input: "", Org: "", Overlays: []string{ - "", + "", }, Repo: "", }) @@ -306,12 +311,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -361,12 +367,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -417,12 +424,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -474,12 +482,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -527,12 +536,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -540,9 +550,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.String(""), }), ) @@ -581,12 +591,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -594,9 +605,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.String(""), }), ) diff --git a/docs/sdks/organizations/README.md b/docs/sdks/organizations/README.md index 33fa0f9f..dbb992aa 100644 --- a/docs/sdks/organizations/README.md +++ b/docs/sdks/organizations/README.md @@ -22,12 +22,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) 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,12 +87,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -99,17 +101,15 @@ 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.String(""), }), ) res, err := s.Organizations.CreateBillingAddOns(ctx, shared.OrganizationBillingAddOnRequest{ AddOns: []shared.BillingAddOn{ - shared.BillingAddOnSDKTesting, - shared.BillingAddOnSDKTesting, - shared.BillingAddOnWebhooks, + shared.BillingAddOnCustomCodeRegions, }, }) if err != nil { @@ -146,12 +146,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -159,9 +160,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.String(""), }), ) @@ -199,12 +200,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) res, err := s.Organizations.DeleteBillingAddOn(ctx, operations.DeleteBillingAddOnRequest{ - AddOn: shared.BillingAddOnCustomCodeRegions, + AddOn: shared.BillingAddOnSDKTesting, }) if err != nil { log.Fatal(err) @@ -256,12 +258,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -313,12 +316,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -326,9 +330,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.String(""), }), ) @@ -366,12 +370,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -379,9 +384,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.String(""), }), ) @@ -419,12 +424,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -432,9 +438,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.String(""), }), ) diff --git a/docs/sdks/publishingtokens/README.md b/docs/sdks/publishingtokens/README.md index 8486a891..31a621dd 100644 --- a/docs/sdks/publishingtokens/README.md +++ b/docs/sdks/publishingtokens/README.md @@ -19,12 +19,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) 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,12 +81,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -137,12 +139,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -194,12 +197,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -207,9 +211,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.String(""), }), ) @@ -247,12 +251,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -304,12 +309,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -361,12 +367,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) diff --git a/docs/sdks/reports/README.md b/docs/sdks/reports/README.md index c90fa3e9..8ee4ff4d 100644 --- a/docs/sdks/reports/README.md +++ b/docs/sdks/reports/README.md @@ -17,12 +17,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -73,12 +74,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -129,12 +131,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "os" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) - 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..4713f70c 100644 --- a/docs/sdks/schemastore/README.md +++ b/docs/sdks/schemastore/README.md @@ -14,12 +14,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -74,12 +75,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) diff --git a/docs/sdks/shorturls/README.md b/docs/sdks/shorturls/README.md index 7dd181d9..df31279a 100644 --- a/docs/sdks/shorturls/README.md +++ b/docs/sdks/shorturls/README.md @@ -15,12 +15,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) 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/subscriptions/README.md b/docs/sdks/subscriptions/README.md index 4936d968..c8f8b603 100644 --- a/docs/sdks/subscriptions/README.md +++ b/docs/sdks/subscriptions/README.md @@ -16,12 +16,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -74,12 +75,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) diff --git a/docs/sdks/suggest/README.md b/docs/sdks/suggest/README.md index 0f661e51..b7c6753d 100644 --- a/docs/sdks/suggest/README.md +++ b/docs/sdks/suggest/README.md @@ -18,12 +18,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) @@ -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,12 +108,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -126,14 +122,16 @@ 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.String(""), }), ) res, err := s.Suggest.SuggestItems(ctx, shared.SuggestItemsRequestBody{ - Items: []string{}, + Items: []string{ + "", + }, Prompt: "", }) if err != nil { @@ -169,12 +167,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "os" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) - 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,12 +236,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) diff --git a/docs/sdks/workspaces/README.md b/docs/sdks/workspaces/README.md index db36674a..e42e805c 100644 --- a/docs/sdks/workspaces/README.md +++ b/docs/sdks/workspaces/README.md @@ -29,12 +29,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) 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,12 +93,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) 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,12 +160,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) res, err := s.Workspaces.DeleteToken(ctx, operations.DeleteWorkspaceTokenRequest{ TokenID: "", - WorkspaceID: speakeasyclientsdkgo.String(""), }) if err != nil { log.Fatal(err) @@ -216,12 +219,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -229,9 +233,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.String(""), }), ) @@ -269,12 +273,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -282,9 +287,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.String(""), }), ) @@ -322,12 +327,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) - 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,12 +384,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) - 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,12 +441,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) - 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,12 +498,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) - 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,12 +555,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) - 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,12 +612,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) 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,12 +671,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "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.String(""), }), ) res, err := s.Workspaces.RevokeAccess(ctx, operations.RevokeUserAccessToWorkspaceRequest{ UserID: "", - WorkspaceID: speakeasyclientsdkgo.String(""), }) if err != nil { log.Fatal(err) @@ -723,12 +730,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "log" ) @@ -736,17 +744,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.String(""), }), ) 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,12 +787,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) 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,12 +855,13 @@ 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" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types" "github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations" @@ -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.String(""), }), ) 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..6752a865 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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..6656957b 100644 --- a/gen.yaml +++ b/gen.yaml @@ -6,6 +6,7 @@ generation: sdkClassName: speakeasy usageSnippets: optionalPropertyRendering: withExample + sdkInitStyle: constructor fixes: nameResolutionFeb2025: false parameterOrderingFeb2024: false @@ -18,12 +19,14 @@ generation: 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 @@ -38,6 +41,8 @@ go: inputModelSuffix: input maxMethodParams: 0 methodArguments: require-security-and-request + modulePath: "" outputModelSuffix: output packageName: github.com/speakeasy-api/speakeasy-client-sdk-go responseFormat: envelope + sdkPackageName: "" diff --git a/github.go b/github.go index 46b44e3f..4e1bbee9 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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..37cac157 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ 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 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/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..a5cab543 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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/utils/requestbody.go b/pkg/utils/requestbody.go index 8fe01ad4..8622ec58 100644 --- a/pkg/utils/requestbody.go +++ b/pkg/utils/requestbody.go @@ -7,8 +7,11 @@ import ( "context" "fmt" "io" + "mime" "mime/multipart" + "net/textproto" "net/url" + "path/filepath" "reflect" "regexp" ) @@ -166,9 +169,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 +258,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 +277,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 } 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/publishingtokens.go b/publishingtokens.go index 43e48c50..80295df2 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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..f14438d2 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: []string{}, + 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: []string{}, + 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: []string{}, + 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..a3c807ed 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: []string{}, + 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: []string{}, + 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..6e05749f 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: []string{}, + 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..f7656ff5 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.684.0 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.684.0 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..82d93b8e 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: []string{}, + 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: []string{}, + 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..b786c0b7 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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..a5a3705b 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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String("sha256:5d20c808ce198565ff70b3ed23a991dd49afac45dece63474b27ce6ed036adc6"), + MediaType: v3.String("application/vnd.docker.image.rootfs.diff.tar.gzip"), + Size: v3.Int64(2107098), }, }, - MediaType: speakeasyclientsdkgo.String("application/vnd.docker.distribution.manifest.v2+json"), - SchemaVersion: speakeasyclientsdkgo.Int64(2), + MediaType: v3.String("application/vnd.docker.distribution.manifest.v2+json"), + SchemaVersion: v3.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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) diff --git a/tests/auth_test.go b/tests/auth_test.go index df29582b..4cd4c5c5 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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) diff --git a/tests/codesamples_test.go b/tests/codesamples_test.go index c7b9c47a..edc3520f 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.String(""), }), ) @@ -39,21 +40,185 @@ func TestCodesamples_GetCodeSamples(t *testing.T) { Language: "", Method: "", OperationID: "", - Path: "/usr/bin", + Path: "/opt/share", }, shared.UsageSnippet{ Code: "", Language: "", Method: "", OperationID: "", - Path: "/sys", + Path: "/usr/src", }, shared.UsageSnippet{ Code: "", Language: "", Method: "", OperationID: "", - Path: "/root", + Path: "/var/spool", + }, + }, + }, 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.String(""), + }), + ) + + 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.String(""), + }), + ) + + 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.String(""), + }), + ) + + 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..9fbcb3d6 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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) 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..0dde937e 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: "/root", Method: "", OperationID: "", - Path: "/root", + Language: "", + Code: "", }, components.UsageSnippet{ - Code: "", - Language: "", + Path: "/usr/bin", Method: "", OperationID: "", - Path: "/opt/sbin", + Language: "", + Code: "", }, components.UsageSnippet{ - Code: "", - Language: "", + Path: "/sys", 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..75d8dd6a 100644 --- a/tests/mockserver/internal/handler/pathgetv1codesamplepreviewasyncjobid.go +++ b/tests/mockserver/internal/handler/pathgetv1codesamplepreviewasyncjobid.go @@ -24,6 +24,8 @@ func pathGetV1CodeSamplePreviewAsyncJobID(dir *logging.HTTPFileDirectory, rt *tr switch fmt.Sprintf("%s[%d]", test, count) { case "getCodeSamplePreviewAsync[0]": dir.HandlerFunc("getCodeSamplePreviewAsync", testGetCodeSamplePreviewAsyncGetCodeSamplePreviewAsync0)(w, req) + case "getCodeSamplePreviewAsync-default[0]": + dir.HandlerFunc("getCodeSamplePreviewAsync", testGetCodeSamplePreviewAsyncGetCodeSamplePreviewAsyncDefault0)(w, req) default: http.Error(w, fmt.Sprintf("Unknown test: %s[%d]", test, count), http.StatusBadRequest) } @@ -56,7 +58,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) @@ -73,3 +75,70 @@ func testGetCodeSamplePreviewAsyncGetCodeSamplePreviewAsync0(w http.ResponseWrit w.WriteHeader(http.StatusAccepted) _, _ = w.Write(respBodyBytes) } + +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) +} 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..1dd2594b 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: "", + ValidUntil: types.MustTimeFromString("2025-02-22T20:20:27.935Z"), TokenName: "", - ValidUntil: types.MustTimeFromString("2024-08-24T11:59:25.466Z"), + 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: "", + ValidUntil: types.MustTimeFromString("2024-10-22T15:05:16.239Z"), TokenName: "", - ValidUntil: types.MustTimeFromString("2025-02-22T20:20:27.935Z"), + 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: "", + ValidUntil: types.MustTimeFromString("2024-08-20T04:36:26.084Z"), TokenName: "", - ValidUntil: types.MustTimeFromString("2024-10-22T15:05:16.239Z"), + 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..ee1932ed 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-04-09T07:48:57.030Z"), 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..f0f92bc2 100644 --- a/tests/mockserver/internal/handler/pathpostv1codesamplepreview.go +++ b/tests/mockserver/internal/handler/pathpostv1codesamplepreview.go @@ -23,6 +23,8 @@ func pathPostV1CodeSamplePreview(dir *logging.HTTPFileDirectory, rt *tracking.Re switch fmt.Sprintf("%s[%d]", test, count) { case "generateCodeSamplePreview[0]": dir.HandlerFunc("generateCodeSamplePreview", testGenerateCodeSamplePreviewGenerateCodeSamplePreview0)(w, req) + case "generateCodeSamplePreview-default[0]": + dir.HandlerFunc("generateCodeSamplePreview", testGenerateCodeSamplePreviewGenerateCodeSamplePreviewDefault0)(w, req) default: http.Error(w, fmt.Sprintf("Unknown test: %s[%d]", test, count), http.StatusBadRequest) } @@ -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 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) + 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..65fe2795 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) { @@ -30,18 +30,18 @@ func (a *AccessTokenUser) UnmarshalJSON(data []byte) error { 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, false); 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..4931f8b7 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) { @@ -33,72 +33,72 @@ func (a *APIKeyDetails) UnmarshalJSON(data []byte) error { 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..fb8d4011 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) { @@ -262,207 +262,200 @@ func (c *CliEvent) UnmarshalJSON(data []byte) error { 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/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..f30c2cf5 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) { @@ -34,18 +34,18 @@ func (p *PullRequestMetadata) UnmarshalJSON(data []byte) error { 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..cfd4d006 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) { @@ -53,18 +53,18 @@ func (n *Namespace) UnmarshalJSON(data []byte) error { 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..0cdbbb13 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) { @@ -33,60 +33,60 @@ func (o *Organization) UnmarshalJSON(data []byte) error { 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..00b947e4 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) { @@ -29,11 +29,11 @@ func (o *OrganizationUsageResponse) UnmarshalJSON(data []byte) error { 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..c0abd24b 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"` } @@ -59,32 +59,32 @@ func (p *PublishingToken) UnmarshalJSON(data []byte) error { 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..fee23820 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) { @@ -29,18 +29,11 @@ func (r *Revision) UnmarshalJSON(data []byte) error { 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..7d4b60dc 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) { @@ -73,60 +73,60 @@ func (r *RevisionContentsMetadata) UnmarshalJSON(data []byte) error { 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..7ff017da 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) { @@ -55,25 +55,18 @@ func (s *SchemaStoreItem) UnmarshalJSON(data []byte) error { 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..8861eec8 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) { @@ -111,317 +111,317 @@ func (t *TargetSDK) UnmarshalJSON(data []byte) error { 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..78a07529 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) { @@ -53,32 +53,32 @@ func (u *User) UnmarshalJSON(data []byte) error { 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..aaac51ec 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. @@ -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..5556ac1f 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) { @@ -25,30 +25,30 @@ func (w *WorkspaceSettings) UnmarshalJSON(data []byte) error { 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..fbc34a0d 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) { @@ -33,79 +33,79 @@ func (w *WorkspaceToken) UnmarshalJSON(data []byte) error { 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..9dbb3bac 100644 --- a/tests/mockserver/internal/sdk/models/operations/archivenamespace.go +++ b/tests/mockserver/internal/sdk/models/operations/archivenamespace.go @@ -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"` + RequestBody *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) GetRequestBody() *ArchiveNamespaceRequestBody { if o == nil { - return "" + return nil } - return o.NamespaceName + return o.RequestBody } 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..b864b6d7 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 { +func (c *CreatePublishingTokenRequest) UnmarshalJSON(data []byte) error { if err := utils.UnmarshalJSON(data, &c, "", false, false); 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..f90e91b7 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"` + WorkspaceToken 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) GetWorkspaceToken() components.WorkspaceToken { if o == nil { - return nil + return components.WorkspaceToken{} } - return o.WorkspaceID + return o.WorkspaceToken } 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..c473d96e 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) { @@ -40,39 +40,39 @@ func (g *GetPublishingTokenPublicMetadataResponseBody) UnmarshalJSON(data []byte 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..fa0d0c5b 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) { @@ -39,11 +39,11 @@ func (g *GetWorkspaceEventsByTargetRequest) UnmarshalJSON(data []byte) error { 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/getworkspacetargetsdeprecated.go b/tests/mockserver/internal/sdk/models/operations/getworkspacetargetsdeprecated.go index 1e07d37b..592e341b 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) { @@ -37,18 +37,18 @@ func (g *GetWorkspaceTargetsDeprecatedRequest) UnmarshalJSON(data []byte) error 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..a88dfffe 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"` + AddTags *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) GetAddTags() *components.AddTags { if o == nil { - return "" + return nil } - return o.NamespaceName + return o.AddTags } 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..403d4d4a 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"` + RequestBody []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) GetRequestBody() []components.CliEvent { if o == nil { - return nil + return []components.CliEvent{} } - return o.WorkspaceID + return o.RequestBody } 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..2d5d17c0 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"` + RequestBody *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) GetRequestBody() *SetVisibilityRequestBody { if o == nil { - return "" + return nil } - return o.NamespaceName + return o.RequestBody } 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..574a3fdf 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"` } -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) GetSuggestRequestBody() components.SuggestRequestBody { if o == nil { - return "" + return components.SuggestRequestBody{} } - return o.XSessionID + return o.SuggestRequestBody } 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..3cd90204 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"` } -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) GetRequestBody() SuggestOpenAPIRequestBody { if o == nil { - return "" + return SuggestOpenAPIRequestBody{} } - return o.XSessionID + return o.RequestBody } 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..7c505389 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 + SuggestRequestBody *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) GetSuggestRequestBody() *components.SuggestRequestBody { if o == nil { - return "" + return nil } - return o.XSessionID + return o.SuggestRequestBody } 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..64ededf1 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) { @@ -27,39 +27,39 @@ func (u *UpdatePublishingTokenExpirationRequestBody) UnmarshalJSON(data []byte) 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 + RequestBody *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) GetRequestBody() *UpdatePublishingTokenExpirationRequestBody { if o == nil { - return "" + return nil } - return o.TokenID + return o.RequestBody } 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..e357b725 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. + Workspace 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) GetWorkspace() components.Workspace { if o == nil { - return nil + return components.Workspace{} } - return o.WorkspaceID + return o.Workspace } 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..63e6c6bb 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. + WorkspaceSettings 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) GetWorkspaceSettings() components.WorkspaceSettings { if o == nil { - return nil + return components.WorkspaceSettings{} } - return o.WorkspaceID + return o.WorkspaceSettings } 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..ca93aa5b 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 } 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..5e50ebd4 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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) diff --git a/tests/publishingtokens_test.go b/tests/publishingtokens_test.go index 84fc2108..c1315407 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.String(""), }), ) diff --git a/tests/reports_test.go b/tests/reports_test.go index 70c134b1..d705bca9 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.String(""), }), ) @@ -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.String(""), }), ) @@ -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.String(""), }), ) - 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..5cc046b0 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.String(""), }), ) @@ -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.String(""), }), ) diff --git a/tests/shorturls_test.go b/tests/shorturls_test.go index 13395632..b331252d 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.String(""), }), ) diff --git a/tests/speakeasy_test.go b/tests/speakeasy_test.go index 2a5bc1cc..f34324e2 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.String(""), }), ) - 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.String(""), }), ) - 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.String(""), }), ) @@ -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.String(""), }), ) @@ -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-24T11:59:25.466Z"), }) 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("2025-02-22T20:20:27.935Z"), 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.String(""), }), ) @@ -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.String(""), }), ) @@ -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-10-22T15:05:16.239Z"), 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.String(""), }), ) diff --git a/tests/subscriptions_test.go b/tests/subscriptions_test.go index 14fe7063..36491460 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.String(""), }), ) @@ -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.String(""), }), ) diff --git a/tests/suggest_test.go b/tests/suggest_test.go index 8856c06b..378d9fcf 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.String(""), }), ) 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..9283f6c3 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.String(""), }), ) @@ -33,7 +33,7 @@ func TestWorkspaces_CreateWorkspace(t *testing.T) { Name: "", OrganizationID: "", Slug: "", - TelemetryDisabled: speakeasyclientsdkgo.Bool(false), + TelemetryDisabled: v3.Bool(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.Bool(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.String(""), }), ) @@ -87,7 +87,7 @@ func TestWorkspaces_GetWorkspaceByContext(t *testing.T) { Name: "", OrganizationID: "", Slug: "", - TelemetryDisabled: speakeasyclientsdkgo.Bool(true), + TelemetryDisabled: v3.Bool(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.String(""), }), ) @@ -119,7 +119,7 @@ func TestWorkspaces_GetWorkspaces(t *testing.T) { Name: "", OrganizationID: "", Slug: "", - TelemetryDisabled: speakeasyclientsdkgo.Bool(false), + TelemetryDisabled: v3.Bool(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.String(""), }), ) res, err := s.Workspaces.GetByID(ctx, operations.GetWorkspaceRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), + WorkspaceID: v3.String(""), }) 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.Bool(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.String(""), }), ) res, err := s.Workspaces.GetFeatureFlags(ctx, operations.GetWorkspaceFeatureFlagsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), + WorkspaceID: v3.String(""), }) 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.String(""), }), ) res, err := s.Workspaces.GetSettings(ctx, operations.GetWorkspaceSettingsRequest{ - WorkspaceID: speakeasyclientsdkgo.String(""), + WorkspaceID: v3.String(""), }) 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.String(""), }), ) @@ -228,7 +228,7 @@ func TestWorkspaces_UpdateWorkspaceSettings(t *testing.T) { WebhookURL: "https://grown-pharmacopoeia.net", WorkspaceID: "", }, - WorkspaceID: speakeasyclientsdkgo.String(""), + WorkspaceID: v3.String(""), }) 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.String(""), }), ) @@ -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.String(""), }), ) @@ -285,10 +285,9 @@ func TestWorkspaces_GetPublishingToken(t *testing.T) { ID: "", OrganizationID: "", TargetID: "", - TargetResource: shared.TargetResourceDocument, Token: "", TokenName: "", - ValidUntil: types.MustTimeFromString("2024-08-24T11:59:25.466Z"), + ValidUntil: types.MustTimeFromString("2024-08-20T04:36:26.084Z"), WorkspaceID: "", }, shared.PublishingToken{ @@ -297,10 +296,9 @@ func TestWorkspaces_GetPublishingToken(t *testing.T) { ID: "", OrganizationID: "", TargetID: "", - TargetResource: shared.TargetResourceDocument, Token: "", TokenName: "", - ValidUntil: types.MustTimeFromString("2025-02-22T20:20:27.935Z"), + ValidUntil: types.MustTimeFromString("2024-04-09T07:48:57.030Z"), WorkspaceID: "", }, shared.PublishingToken{ @@ -309,10 +307,9 @@ func TestWorkspaces_GetPublishingToken(t *testing.T) { ID: "", OrganizationID: "", TargetID: "", - TargetResource: shared.TargetResourceDocument, Token: "", TokenName: "", - ValidUntil: types.MustTimeFromString("2024-10-22T15:05:16.239Z"), + ValidUntil: types.MustTimeFromString("2024-12-08T21:35:55.501Z"), WorkspaceID: "", }, }, res.Classes) diff --git a/workspaces.go b/workspaces.go index 6ebfb1b3..c1059b3a 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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: []string{}, + 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 }