diff --git a/.gitignore b/.gitignore index 10179e56..9189c1d9 100755 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ +.DS_Store +**/.speakeasy/temp/ +**/.speakeasy/logs/ +.env +.env.local obj/ bin/ debug/ -.idea/ \ No newline at end of file +.idea/ diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 64277a85..ae804373 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,31 +1,34 @@ lockVersion: 2.0.0 id: f73d2126-985b-4d69-88ee-b7c69254d8bf management: - docChecksum: 52df6f1f34dfe76968f8ed009cc2bfd3 + docChecksum: 17226457b23fc2563102eb22d263bc30 docVersion: 0.4.0 - speakeasyVersion: 1.468.2 - generationVersion: 2.493.4 - releaseVersion: 5.12.0 - configChecksum: 4ac5f7ce74e22b4b8247f447fc0fc3c9 + speakeasyVersion: 1.635.1 + generationVersion: 2.722.2 + releaseVersion: 5.13.0 + configChecksum: a8441fec9cd287a38e86be0f059950dd repoURL: https://github.com/speakeasy-api/speakeasy-client-sdk-csharp.git repoSubDirectory: . published: true features: csharp: additionalDependencies: 0.1.0 - core: 3.10.10 + constsAndDefaults: 0.0.1 + core: 3.13.0 deprecations: 2.81.2 - globalSecurity: 2.83.6 + getRequestBodies: 2.81.1 + globalSecurity: 2.83.8 globalSecurityCallbacks: 0.1.0 - globalServerURLs: 2.82.3 + globalServerURLs: 2.82.4 globals: 2.82.1 intellisenseMarkdownSupport: 0.1.0 - methodArguments: 0.2.0 + methodArguments: 0.2.1 nameOverrides: 2.81.2 - nullables: 0.1.0 + nullables: 0.1.1 + openEnums: 0.1.1 responseFormat: 0.0.4 retries: 0.0.1 - sdkHooks: 0.1.0 + sdkHooks: 0.2.0 serverIDs: 2.82.1 generatedFiles: - .gitattributes @@ -35,24 +38,38 @@ generatedFiles: - docs/Models/Errors/Error.md - docs/Models/Operations/ActivateSubscriptionNamespaceRequest.md - docs/Models/Operations/ActivateSubscriptionNamespaceResponse.md + - docs/Models/Operations/ArchiveNamespaceRequest.md + - docs/Models/Operations/ArchiveNamespaceRequestBody.md + - docs/Models/Operations/ArchiveNamespaceResponse.md - docs/Models/Operations/CheckGithubAccessRequest.md - docs/Models/Operations/CheckGithubAccessResponse.md + - docs/Models/Operations/CreateBillingAddOnsResponse.md - docs/Models/Operations/CreateFreeTrialResponse.md - docs/Models/Operations/CreateOrganizationResponse.md + - docs/Models/Operations/CreatePublishingTokenRequestBody.md + - docs/Models/Operations/CreatePublishingTokenResponse.md - docs/Models/Operations/CreateRemoteSourceResponse.md - docs/Models/Operations/CreateRequestBody.md - docs/Models/Operations/CreateResponse.md + - docs/Models/Operations/CreateSchemaStoreItemRequestBody.md + - docs/Models/Operations/CreateSchemaStoreItemResponse.md - docs/Models/Operations/CreateWorkspaceResponse.md - docs/Models/Operations/CreateWorkspaceTokenRequest.md - docs/Models/Operations/CreateWorkspaceTokenResponse.md + - docs/Models/Operations/DeleteBillingAddOnRequest.md + - docs/Models/Operations/DeleteBillingAddOnResponse.md + - docs/Models/Operations/DeletePublishingTokenRequest.md + - docs/Models/Operations/DeletePublishingTokenResponse.md - docs/Models/Operations/DeleteWorkspaceTokenRequest.md - docs/Models/Operations/DeleteWorkspaceTokenResponse.md - docs/Models/Operations/File.md + - docs/Models/Operations/Format.md - docs/Models/Operations/GenerateCodeSamplePreviewAsyncResponse.md - docs/Models/Operations/GenerateCodeSamplePreviewAsyncResponseBody.md - docs/Models/Operations/GenerateCodeSamplePreviewResponse.md - docs/Models/Operations/GetAccessTokenRequest.md - docs/Models/Operations/GetAccessTokenResponse.md + - docs/Models/Operations/GetBillingAddOnsResponse.md - docs/Models/Operations/GetBlobRequest.md - docs/Models/Operations/GetBlobResponse.md - docs/Models/Operations/GetChangesReportSignedUrlRequest.md @@ -61,8 +78,6 @@ generatedFiles: - docs/Models/Operations/GetCodeSamplePreviewAsyncRequest.md - docs/Models/Operations/GetCodeSamplePreviewAsyncResponse.md - docs/Models/Operations/GetCodeSamplePreviewAsyncResponseBody.md - - docs/Models/Operations/GetCodeSamplesRequest.md - - docs/Models/Operations/GetCodeSamplesResponse.md - docs/Models/Operations/GetGitHubActionRequest.md - docs/Models/Operations/GetGitHubActionResponse.md - docs/Models/Operations/GetGithubSetupStateRequest.md @@ -77,8 +92,18 @@ generatedFiles: - docs/Models/Operations/GetOrganizationResponse.md - docs/Models/Operations/GetOrganizationUsageResponse.md - docs/Models/Operations/GetOrganizationsResponse.md + - docs/Models/Operations/GetPublishingTokenByIDRequest.md + - docs/Models/Operations/GetPublishingTokenByIDResponse.md + - docs/Models/Operations/GetPublishingTokenPublicMetadataRequest.md + - docs/Models/Operations/GetPublishingTokenPublicMetadataResponse.md + - docs/Models/Operations/GetPublishingTokenPublicMetadataResponseBody.md + - docs/Models/Operations/GetPublishingTokenResponse.md + - docs/Models/Operations/GetPublishingTokenTargetByIDRequest.md + - docs/Models/Operations/GetPublishingTokenTargetByIDResponse.md - docs/Models/Operations/GetRevisionsRequest.md - docs/Models/Operations/GetRevisionsResponse.md + - docs/Models/Operations/GetSchemaStoreItemRequestBody.md + - docs/Models/Operations/GetSchemaStoreItemResponse.md - docs/Models/Operations/GetTagsRequest.md - docs/Models/Operations/GetTagsResponse.md - docs/Models/Operations/GetUserResponse.md @@ -141,6 +166,9 @@ generatedFiles: - docs/Models/Operations/SuggestOpenAPIResponse.md - docs/Models/Operations/SuggestRequest.md - docs/Models/Operations/SuggestResponse.md + - docs/Models/Operations/UpdatePublishingTokenExpirationRequest.md + - docs/Models/Operations/UpdatePublishingTokenExpirationRequestBody.md + - docs/Models/Operations/UpdatePublishingTokenExpirationResponse.md - docs/Models/Operations/UpdateWorkspaceDetailsRequest.md - docs/Models/Operations/UpdateWorkspaceDetailsResponse.md - docs/Models/Operations/UpdateWorkspaceSettingsRequest.md @@ -158,6 +186,7 @@ generatedFiles: - docs/Models/Shared/Annotations.md - docs/Models/Shared/ApiKeyDetails.md - docs/Models/Shared/Auth.md + - docs/Models/Shared/BillingAddOn.md - docs/Models/Shared/Claims.md - docs/Models/Shared/CliEvent.md - docs/Models/Shared/CodeSampleSchemaInput.md @@ -165,6 +194,7 @@ generatedFiles: - docs/Models/Shared/CompositeSpecMetadata.md - docs/Models/Shared/Diagnostic.md - docs/Models/Shared/FeatureFlag.md + - docs/Models/Shared/Format.md - docs/Models/Shared/GenerateBumpType.md - docs/Models/Shared/GetNamespacesResponse.md - docs/Models/Shared/GetRevisionsResponse.md @@ -189,10 +219,13 @@ generatedFiles: - docs/Models/Shared/OASSummary.md - docs/Models/Shared/OpenapiDiffBumpType.md - docs/Models/Shared/Organization.md + - docs/Models/Shared/OrganizationBillingAddOnRequest.md + - docs/Models/Shared/OrganizationBillingAddOnResponse.md - docs/Models/Shared/OrganizationUsage.md - docs/Models/Shared/OrganizationUsageResponse.md - docs/Models/Shared/PreflightRequest.md - docs/Models/Shared/PreflightToken.md + - docs/Models/Shared/PublishingToken.md - docs/Models/Shared/PullRequestMetadata.md - docs/Models/Shared/Relationship.md - docs/Models/Shared/RemoteDocument.md @@ -200,8 +233,11 @@ generatedFiles: - docs/Models/Shared/RemoteSourceSubscriptionSettings.md - docs/Models/Shared/Report.md - docs/Models/Shared/Revision.md + - docs/Models/Shared/RevisionContentsMetadata.md + - docs/Models/Shared/RevisionContentsMetadataType.md - docs/Models/Shared/SSOMetadata.md - docs/Models/Shared/SchemaFile.md + - docs/Models/Shared/SchemaStoreItem.md - docs/Models/Shared/Secrets.md - docs/Models/Shared/Security.md - docs/Models/Shared/ShortURL.md @@ -211,6 +247,7 @@ generatedFiles: - docs/Models/Shared/SuggestRequestBodySuggestionType.md - docs/Models/Shared/SuggestionType.md - docs/Models/Shared/Tag.md + - docs/Models/Shared/TargetResource.md - docs/Models/Shared/TargetSDK.md - docs/Models/Shared/Type.md - docs/Models/Shared/UsageSnippet.md @@ -234,7 +271,9 @@ generatedFiles: - docs/sdks/events/README.md - docs/sdks/github/README.md - docs/sdks/organizations/README.md + - docs/sdks/publishingtokens/README.md - docs/sdks/reports/README.md + - docs/sdks/schemastore/README.md - docs/sdks/sdk/README.md - docs/sdks/shorturls/README.md - docs/sdks/subscriptions/README.md @@ -249,27 +288,43 @@ generatedFiles: - src/SpeakeasySDK/Hooks/HookTypes.cs - src/SpeakeasySDK/Hooks/SDKHooks.cs - src/SpeakeasySDK/Models/Errors/Error.cs + - src/SpeakeasySDK/Models/Errors/ResponseValidationException.cs + - src/SpeakeasySDK/Models/Errors/SDKBaseException.cs - src/SpeakeasySDK/Models/Errors/SDKException.cs - src/SpeakeasySDK/Models/Operations/ActivateSubscriptionNamespaceRequest.cs - src/SpeakeasySDK/Models/Operations/ActivateSubscriptionNamespaceResponse.cs + - src/SpeakeasySDK/Models/Operations/ArchiveNamespaceRequest.cs + - src/SpeakeasySDK/Models/Operations/ArchiveNamespaceRequestBody.cs + - src/SpeakeasySDK/Models/Operations/ArchiveNamespaceResponse.cs - src/SpeakeasySDK/Models/Operations/CheckGithubAccessRequest.cs - src/SpeakeasySDK/Models/Operations/CheckGithubAccessResponse.cs + - src/SpeakeasySDK/Models/Operations/CreateBillingAddOnsResponse.cs - src/SpeakeasySDK/Models/Operations/CreateFreeTrialResponse.cs - src/SpeakeasySDK/Models/Operations/CreateOrganizationResponse.cs + - src/SpeakeasySDK/Models/Operations/CreatePublishingTokenRequestBody.cs + - src/SpeakeasySDK/Models/Operations/CreatePublishingTokenResponse.cs - src/SpeakeasySDK/Models/Operations/CreateRemoteSourceResponse.cs - src/SpeakeasySDK/Models/Operations/CreateRequestBody.cs - src/SpeakeasySDK/Models/Operations/CreateResponse.cs + - src/SpeakeasySDK/Models/Operations/CreateSchemaStoreItemRequestBody.cs + - src/SpeakeasySDK/Models/Operations/CreateSchemaStoreItemResponse.cs - src/SpeakeasySDK/Models/Operations/CreateWorkspaceResponse.cs - src/SpeakeasySDK/Models/Operations/CreateWorkspaceTokenRequest.cs - src/SpeakeasySDK/Models/Operations/CreateWorkspaceTokenResponse.cs + - src/SpeakeasySDK/Models/Operations/DeleteBillingAddOnRequest.cs + - src/SpeakeasySDK/Models/Operations/DeleteBillingAddOnResponse.cs + - src/SpeakeasySDK/Models/Operations/DeletePublishingTokenRequest.cs + - src/SpeakeasySDK/Models/Operations/DeletePublishingTokenResponse.cs - src/SpeakeasySDK/Models/Operations/DeleteWorkspaceTokenRequest.cs - src/SpeakeasySDK/Models/Operations/DeleteWorkspaceTokenResponse.cs - src/SpeakeasySDK/Models/Operations/File.cs + - src/SpeakeasySDK/Models/Operations/Format.cs - src/SpeakeasySDK/Models/Operations/GenerateCodeSamplePreviewAsyncResponse.cs - src/SpeakeasySDK/Models/Operations/GenerateCodeSamplePreviewAsyncResponseBody.cs - src/SpeakeasySDK/Models/Operations/GenerateCodeSamplePreviewResponse.cs - src/SpeakeasySDK/Models/Operations/GetAccessTokenRequest.cs - src/SpeakeasySDK/Models/Operations/GetAccessTokenResponse.cs + - src/SpeakeasySDK/Models/Operations/GetBillingAddOnsResponse.cs - src/SpeakeasySDK/Models/Operations/GetBlobRequest.cs - src/SpeakeasySDK/Models/Operations/GetBlobResponse.cs - src/SpeakeasySDK/Models/Operations/GetChangesReportSignedUrlRequest.cs @@ -278,8 +333,6 @@ generatedFiles: - src/SpeakeasySDK/Models/Operations/GetCodeSamplePreviewAsyncRequest.cs - src/SpeakeasySDK/Models/Operations/GetCodeSamplePreviewAsyncResponse.cs - src/SpeakeasySDK/Models/Operations/GetCodeSamplePreviewAsyncResponseBody.cs - - src/SpeakeasySDK/Models/Operations/GetCodeSamplesRequest.cs - - src/SpeakeasySDK/Models/Operations/GetCodeSamplesResponse.cs - src/SpeakeasySDK/Models/Operations/GetGitHubActionRequest.cs - src/SpeakeasySDK/Models/Operations/GetGitHubActionResponse.cs - src/SpeakeasySDK/Models/Operations/GetGithubSetupStateRequest.cs @@ -294,8 +347,18 @@ generatedFiles: - src/SpeakeasySDK/Models/Operations/GetOrganizationResponse.cs - src/SpeakeasySDK/Models/Operations/GetOrganizationUsageResponse.cs - src/SpeakeasySDK/Models/Operations/GetOrganizationsResponse.cs + - src/SpeakeasySDK/Models/Operations/GetPublishingTokenByIDRequest.cs + - src/SpeakeasySDK/Models/Operations/GetPublishingTokenByIDResponse.cs + - src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataRequest.cs + - src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataResponse.cs + - src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataResponseBody.cs + - src/SpeakeasySDK/Models/Operations/GetPublishingTokenResponse.cs + - src/SpeakeasySDK/Models/Operations/GetPublishingTokenTargetByIDRequest.cs + - src/SpeakeasySDK/Models/Operations/GetPublishingTokenTargetByIDResponse.cs - src/SpeakeasySDK/Models/Operations/GetRevisionsRequest.cs - src/SpeakeasySDK/Models/Operations/GetRevisionsResponse.cs + - src/SpeakeasySDK/Models/Operations/GetSchemaStoreItemRequestBody.cs + - src/SpeakeasySDK/Models/Operations/GetSchemaStoreItemResponse.cs - src/SpeakeasySDK/Models/Operations/GetTagsRequest.cs - src/SpeakeasySDK/Models/Operations/GetTagsResponse.cs - src/SpeakeasySDK/Models/Operations/GetUserResponse.cs @@ -358,6 +421,9 @@ generatedFiles: - src/SpeakeasySDK/Models/Operations/SuggestOpenAPIResponse.cs - src/SpeakeasySDK/Models/Operations/SuggestRequest.cs - src/SpeakeasySDK/Models/Operations/SuggestResponse.cs + - src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationRequest.cs + - src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationRequestBody.cs + - src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationResponse.cs - src/SpeakeasySDK/Models/Operations/UpdateWorkspaceDetailsRequest.cs - src/SpeakeasySDK/Models/Operations/UpdateWorkspaceDetailsResponse.cs - src/SpeakeasySDK/Models/Operations/UpdateWorkspaceSettingsRequest.cs @@ -375,6 +441,7 @@ generatedFiles: - src/SpeakeasySDK/Models/Shared/Annotations.cs - src/SpeakeasySDK/Models/Shared/ApiKeyDetails.cs - src/SpeakeasySDK/Models/Shared/Auth.cs + - src/SpeakeasySDK/Models/Shared/BillingAddOn.cs - src/SpeakeasySDK/Models/Shared/Claims.cs - src/SpeakeasySDK/Models/Shared/CliEvent.cs - src/SpeakeasySDK/Models/Shared/CodeSampleSchemaInput.cs @@ -382,6 +449,7 @@ generatedFiles: - src/SpeakeasySDK/Models/Shared/CompositeSpecMetadata.cs - src/SpeakeasySDK/Models/Shared/Diagnostic.cs - src/SpeakeasySDK/Models/Shared/FeatureFlag.cs + - src/SpeakeasySDK/Models/Shared/Format.cs - src/SpeakeasySDK/Models/Shared/GenerateBumpType.cs - src/SpeakeasySDK/Models/Shared/GetNamespacesResponse.cs - src/SpeakeasySDK/Models/Shared/GetRevisionsResponse.cs @@ -406,10 +474,13 @@ generatedFiles: - src/SpeakeasySDK/Models/Shared/OASSummary.cs - src/SpeakeasySDK/Models/Shared/OpenapiDiffBumpType.cs - src/SpeakeasySDK/Models/Shared/Organization.cs + - src/SpeakeasySDK/Models/Shared/OrganizationBillingAddOnRequest.cs + - src/SpeakeasySDK/Models/Shared/OrganizationBillingAddOnResponse.cs - src/SpeakeasySDK/Models/Shared/OrganizationUsage.cs - src/SpeakeasySDK/Models/Shared/OrganizationUsageResponse.cs - src/SpeakeasySDK/Models/Shared/PreflightRequest.cs - src/SpeakeasySDK/Models/Shared/PreflightToken.cs + - src/SpeakeasySDK/Models/Shared/PublishingToken.cs - src/SpeakeasySDK/Models/Shared/PullRequestMetadata.cs - src/SpeakeasySDK/Models/Shared/Relationship.cs - src/SpeakeasySDK/Models/Shared/RemoteDocument.cs @@ -417,8 +488,11 @@ generatedFiles: - src/SpeakeasySDK/Models/Shared/RemoteSourceSubscriptionSettings.cs - src/SpeakeasySDK/Models/Shared/Report.cs - src/SpeakeasySDK/Models/Shared/Revision.cs + - src/SpeakeasySDK/Models/Shared/RevisionContentsMetadata.cs + - src/SpeakeasySDK/Models/Shared/RevisionContentsMetadataType.cs - src/SpeakeasySDK/Models/Shared/SSOMetadata.cs - src/SpeakeasySDK/Models/Shared/SchemaFile.cs + - src/SpeakeasySDK/Models/Shared/SchemaStoreItem.cs - src/SpeakeasySDK/Models/Shared/Secrets.cs - src/SpeakeasySDK/Models/Shared/Security.cs - src/SpeakeasySDK/Models/Shared/ShortURL.cs @@ -428,6 +502,7 @@ generatedFiles: - src/SpeakeasySDK/Models/Shared/SuggestRequestBodySuggestionType.cs - src/SpeakeasySDK/Models/Shared/SuggestionType.cs - src/SpeakeasySDK/Models/Shared/Tag.cs + - src/SpeakeasySDK/Models/Shared/TargetResource.cs - src/SpeakeasySDK/Models/Shared/TargetSDK.cs - src/SpeakeasySDK/Models/Shared/Type.cs - src/SpeakeasySDK/Models/Shared/UsageSnippet.cs @@ -446,8 +521,11 @@ generatedFiles: - src/SpeakeasySDK/Models/Shared/WorkspaceToken.cs - src/SpeakeasySDK/Models/Shared/Workspaces.cs - src/SpeakeasySDK/Organizations.cs + - src/SpeakeasySDK/PublishingTokens.cs - src/SpeakeasySDK/Reports.cs - src/SpeakeasySDK/SDK.cs + - src/SpeakeasySDK/SDKConfig.cs + - src/SpeakeasySDK/SchemaStore.cs - src/SpeakeasySDK/ShortURLs.cs - src/SpeakeasySDK/SpeakeasySDK.csproj - src/SpeakeasySDK/Subscriptions.cs @@ -459,6 +537,7 @@ generatedFiles: - src/SpeakeasySDK/Utils/FlexibleObjectDeserializer.cs - src/SpeakeasySDK/Utils/HeaderSerializer.cs - src/SpeakeasySDK/Utils/IsoDateTimeSerializer.cs + - src/SpeakeasySDK/Utils/OpenEnumConverter.cs - src/SpeakeasySDK/Utils/RequestBodySerializer.cs - src/SpeakeasySDK/Utils/ResponseBodyDeserializer.cs - src/SpeakeasySDK/Utils/Retries/BackoffStrategy.cs @@ -471,288 +550,11 @@ generatedFiles: - src/SpeakeasySDK/Utils/Utilities.cs - src/SpeakeasySDK/Workspaces.cs examples: - deleteApi: - speakeasy-default-delete-api: - parameters: - path: - apiID: "" - versionID: "" - responses: - default: - application/json: {"message": "", "status_code": 875451} - generateOpenApiSpec: - speakeasy-default-generate-open-api-spec: - parameters: - path: - apiID: "" - versionID: "" - responses: - "200": - application/json: {"current_schema": "", "new_schema": ""} - default: - application/json: {"message": "", "status_code": 871055} - generatePostmanCollection: - speakeasy-default-generate-postman-collection: - parameters: - path: - apiID: "" - versionID: "" - responses: - "200": - application/octet-stream: "0xd6Be621e7F" - default: - application/json: {"message": "", "status_code": 697008} - getAllApiVersions: - speakeasy-default-get-all-api-versions: - parameters: - path: - apiID: "" - query: {} - responses: - "200": - application/json: [] - default: - application/json: {"message": "", "status_code": 784529} - getApis: - speakeasy-default-get-apis: - responses: - "200": - application/json: [] - default: - application/json: {"message": "", "status_code": 11490} - upsertApi: - speakeasy-default-upsert-api: - parameters: - path: - apiID: "" - requestBody: - application/json: {"api_id": "", "description": "Synchronised 5th generation knowledge user", "version_id": ""} - responses: - "200": - application/json: {"api_id": "", "created_at": "2022-11-30T03:11:22.096Z", "description": "Visionary 4th generation focus group", "updated_at": "2022-03-06T16:10:22.154Z", "version_id": "", "workspace_id": ""} - default: - application/json: {"message": "", "status_code": 17590} - deleteApiEndpoint: - speakeasy-default-delete-api-endpoint: - parameters: - path: - apiID: "" - versionID: "" - apiEndpointID: "" - responses: - default: - application/json: {"message": "", "status_code": 788324} - findApiEndpoint: - speakeasy-default-find-api-endpoint: - parameters: - path: - apiID: "" - versionID: "" - displayName: "Don.Strosin" - responses: - "200": - application/json: {"api_endpoint_id": "", "api_id": "", "created_at": "2023-05-01T15:36:31.538Z", "description": "Programmable uniform adapter", "display_name": "Gracie23", "method": "", "path": "/srv", "updated_at": "2024-01-26T05:16:49.540Z", "version_id": "", "workspace_id": ""} - default: - application/json: {"message": "", "status_code": 398024} - generateOpenApiSpecForApiEndpoint: - speakeasy-default-generate-open-api-spec-for-api-endpoint: - parameters: - path: - apiID: "" - versionID: "" - apiEndpointID: "" - responses: - "200": - application/json: {"current_schema": "", "new_schema": ""} - default: - application/json: {"message": "", "status_code": 833540} - generatePostmanCollectionForApiEndpoint: - speakeasy-default-generate-postman-collection-for-api-endpoint: - parameters: - path: - apiID: "" - versionID: "" - apiEndpointID: "" - responses: - "200": - application/octet-stream: "0xBBF5e24c4D" - default: - application/json: {"message": "", "status_code": 870898} - getAllApiEndpoints: - speakeasy-default-get-all-api-endpoints: - parameters: - path: - apiID: "" - responses: - "200": - application/json: [] - default: - application/json: {"message": "", "status_code": 909400} - getAllForVersionApiEndpoints: - speakeasy-default-get-all-for-version-api-endpoints: - parameters: - path: - apiID: "" - versionID: "" - responses: - "200": - application/json: [] - default: - application/json: {"message": "", "status_code": 908203} - getApiEndpoint: - speakeasy-default-get-api-endpoint: - parameters: - path: - apiID: "" - versionID: "" - apiEndpointID: "" - responses: - "200": - application/json: {"api_endpoint_id": "", "api_id": "", "created_at": "2024-12-16T12:54:49.054Z", "description": "Grass-roots interactive orchestration", "display_name": "Mylene_Kozey58", "method": "", "path": "/rescue", "updated_at": "2024-07-01T02:49:47.888Z", "version_id": "", "workspace_id": ""} - default: - application/json: {"message": "", "status_code": 572524} - upsertApiEndpoint: - speakeasy-default-upsert-api-endpoint: - parameters: - path: - apiID: "" - versionID: "" - apiEndpointID: "" - requestBody: - application/json: {"api_endpoint_id": "", "description": "Public-key systematic attitude", "display_name": "Camille.Schaefer11", "method": "", "path": "/Library", "version_id": ""} - responses: - "200": - application/json: {"api_endpoint_id": "", "api_id": "", "created_at": "2023-05-11T02:25:34.515Z", "description": "Triple-buffered optimal methodology", "display_name": "Nolan_Corwin58", "method": "", "path": "/home/user", "updated_at": "2022-04-29T18:24:21.535Z", "version_id": "", "workspace_id": ""} - default: - application/json: {"message": "", "status_code": 462700} - deleteVersionMetadata: - speakeasy-default-delete-version-metadata: - parameters: - path: - apiID: "" - versionID: "" - metaKey: "" - metaValue: "" - responses: - default: - application/json: {"message": "", "status_code": 730807} - getVersionMetadata: - speakeasy-default-get-version-metadata: - parameters: - path: - apiID: "" - versionID: "" - responses: - "200": - application/json: [] - default: - application/json: {"message": "", "status_code": 269133} - insertVersionMetadata: - speakeasy-default-insert-version-metadata: - parameters: - path: - apiID: "" - versionID: "" - requestBody: - application/json: {"meta_key": "", "meta_value": ""} - responses: - "200": - application/json: {"api_id": "", "created_at": "2022-03-18T13:32:09.395Z", "meta_key": "", "meta_value": "", "version_id": "", "workspace_id": ""} - default: - application/json: {"message": "", "status_code": 516378} - deleteSchema: - speakeasy-default-delete-schema: - parameters: - path: - apiID: "" - versionID: "" - revisionID: "" - responses: - default: - application/json: {"message": "", "status_code": 9376} - downloadSchema: - speakeasy-default-download-schema: - parameters: - path: - apiID: "" - versionID: "" - responses: - "200": - application/json: "0xaf6D2e8557" - application/x-yaml: "0x5EFea906ee" - default: - application/json: {"message": "", "status_code": 375177} - downloadSchemaRevision: - speakeasy-default-download-schema-revision: - parameters: - path: - apiID: "" - versionID: "" - revisionID: "" - responses: - "200": - application/json: "0xC11b2bbEC4" - application/x-yaml: "0xE04B837904" - default: - application/json: {"message": "", "status_code": 298817} - getSchema: - speakeasy-default-get-schema: - parameters: - path: - apiID: "" - versionID: "" - responses: - "200": - application/json: {"api_id": "", "created_at": "2022-09-09T00:58:17.303Z", "description": "Quality-focused scalable superstructure", "revision_id": "", "version_id": "", "workspace_id": ""} - default: - application/json: {"message": "", "status_code": 983881} - getSchemaDiff: - speakeasy-default-get-schema-diff: - parameters: - path: - apiID: "" - versionID: "" - baseRevisionID: "" - targetRevisionID: "" - responses: - "200": - application/json: {"additions": [], "deletions": [], "modifications": {}} - default: - application/json: {"message": "", "status_code": 201370} - getSchemaRevision: - speakeasy-default-get-schema-revision: - parameters: - path: - apiID: "" - versionID: "" - revisionID: "" - responses: - "200": - application/json: {"api_id": "", "created_at": "2022-01-23T10:21:45.287Z", "description": "Managed intermediate flexibility", "revision_id": "", "version_id": "", "workspace_id": ""} - default: - application/json: {"message": "", "status_code": 941905} - getSchemas: - speakeasy-default-get-schemas: - parameters: - path: - apiID: "" - versionID: "" - responses: - "200": - application/json: [] - default: - application/json: {"message": "", "status_code": 170115} - registerSchema: - speakeasy-default-register-schema: - parameters: - path: - apiID: "" - versionID: "" - requestBody: - multipart/form-data: {"file": {"": "example.file"}} + createRemoteSource: + speakeasy-default-create-remote-source: responses: - default: - application/json: {"message": "", "status_code": 867990} + 4XX: + application/json: {"message": "", "status_code": 314779} getBlob: speakeasy-default-get-blob: parameters: @@ -762,14 +564,10 @@ examples: namespace_name: "" digest: "" responses: - "200": - application/octet-stream: "0x211ECBAE5E" - default: - application/json: {"message": "", "status_code": 279725} 2XX: - application/octet-stream: "0x21CA56a82d" + application/octet-stream: "0xdf01BE863D" 4XX: - application/json: {"message": "", "status_code": 940661} + application/json: {"message": "", "status_code": 803552} getManifest: speakeasy-default-get-manifest: parameters: @@ -779,497 +577,133 @@ examples: namespace_name: "" revision_reference: "" responses: - "200": - 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} - default: - application/json: {"message": "", "status_code": 707258} 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: - "200": - application/json: {"items": []} - default: - application/json: {"message": "", "status_code": 917991} 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} - getOASSummary: - speakeasy-default-get-OAS-summary: - parameters: - path: - namespace_name: "" - revision_reference: "" - responses: - "200": - application/json: {"info": {"description": "Fully-configurable neutral software", "summary": "", "title": "", "version": ""}, "operations": []} - default: - application/json: {"message": "", "status_code": 963960} + application/json: {"message": "", "status_code": 442334} getRevisions: speakeasy-default-get-revisions: parameters: path: namespace_name: "" - query: {} responses: - "200": - application/json: {"items": [], "next_page_token": ""} - default: - application/json: {"message": "", "status_code": 284614} 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: path: namespace_name: "" responses: - "200": - application/json: {"items": []} - default: - application/json: {"message": "", "status_code": 136548} 2XX: - application/json: {"items": []} - 4XX: - application/json: {"message": "", "status_code": 50428} - postTags: - speakeasy-default-post-tags: - parameters: - path: - namespace_name: "" - responses: - default: - application/json: {"message": "", "status_code": 581484} + application/json: {"items": [{"id": "", "name": "", "namespace_name": "", "revision_digest": ""}]} 4XX: - application/json: {"message": "", "status_code": 581484} - preflight: - speakeasy-default-preflight: - responses: - default: - application/json: {"message": "", "status_code": 820828} - "200": {} - 2XX: - application/json: {} - 4XX: - application/json: {"message": "", "status_code": 820828} - getAccessToken: - speakeasy-default-get-access-token: - parameters: - query: - workspace_id: "" - responses: - "200": - application/json: {"access_token": ""} - default: - application/json: {"message": "", "status_code": 299050} - 2XX: - application/json: {"access_token": ""} - 4XX: - application/json: {"message": "", "status_code": 299050} - getUser: - speakeasy-default-get-user: - responses: - "200": - application/json: {"admin": true, "confirmed": false, "created_at": "2022-06-27T09:27:02.992Z", "display_name": "Kendrick92", "email": "Kirstin.Kautzer61@yahoo.com", "email_verified": false, "id": "", "last_login_at": "2023-04-23T00:14:06.093Z", "updated_at": "2023-07-11T14:17:50.684Z", "whitelisted": false} - default: - application/json: {"message": "", "status_code": 502060} - 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} - 4XX: - application/json: {"message": "", "status_code": 237845} - getWorkspaceAccess: - speakeasy-default-get-workspace-access: - responses: - "200": - application/json: {"generation_allowed": false, "message": ""} - 2XX: - application/json: {"generation_allowed": true, "message": ""} - validateApiKey: - speakeasy-default-validate-api-key: - responses: - "200": - application/json: {"account_type_v2": "enterprise", "enabled_features": [], "org_slug": "", "telemetry_disabled": true, "workspace_id": "", "workspace_slug": ""} - default: - application/json: {"message": "", "status_code": 858745} - 2XX: - application/json: {"account_type_v2": "enterprise", "enabled_features": ["", "", ""], "org_slug": "", "telemetry_disabled": true, "workspace_created_at": "2024-02-05T22:57:49.657Z", "workspace_id": "", "workspace_slug": ""} - 4XX: - application/json: {"message": "", "status_code": 150892} - generateRequestPostmanCollection: - speakeasy-default-generate-request-postman-collection: - parameters: - path: - requestID: "" - responses: - "200": - application/octet-stream: "0xe9bfc5350A" - default: - application/json: {"message": "", "status_code": 319220} - getRequestFromEventLog: - speakeasy-default-get-request-from-event-log: - parameters: - path: - requestID: "" - responses: - "200": - application/json: {"created_at": "2024-07-06T20:33:24.663Z", "har": "", "har_size_bytes": 205280, "request_id": "", "workspace_id": ""} - default: - application/json: {"message": "", "status_code": 659422} - queryEventLog: - speakeasy-default-query-event-log: - responses: - "200": - application/json: [] - default: - application/json: {"message": "", "status_code": 241978} - checkAccess: - speakeasy-default-check-access: - parameters: - query: - org: "" - repo: "" - responses: - default: - application/json: {"message": "", "status_code": 74604} - configureCodeSamples: - speakeasy-default-configure-code-samples: - requestBody: - application/json: {"org": "", "repo": "", "targetName": ""} - responses: - "200": - application/json: {"codeSampleOverlayRegistryURL": "", "source": {"location": ""}} - default: - application/json: {"message": "", "status_code": 968093} - configureMintlifyRepo: - speakeasy-default-configure-mintlify-repo: - requestBody: - application/json: {"input": "", "org": "", "overlays": [], "repo": ""} - responses: - default: - application/json: {"message": "", "status_code": 310607} - configureTarget: - speakeasy-default-configure-target: - requestBody: - application/json: {"org": "", "repo_name": ""} - responses: - default: - application/json: {"message": "", "status_code": 210299} - fetchPublishingPRs: - speakeasy-default-fetch-publishing-P-rs: - parameters: - query: - generate_gen_lock_id: "" - org: "" - repo: "" - responses: - default: - application/json: {"message": "", "status_code": 192607} - "200": {} - getAction: - speakeasy-default-get-action: - parameters: - query: - org: "" - repo: "" - responses: - default: - application/json: {"message": "", "status_code": 252330} - "200": {} - githubCheckPublishingSecrets: - speakeasy-default-github-check-publishing-secrets: + application/json: {"message": "", "status_code": 293534} + listRemoteSources: + speakeasy-default-list-remote-sources: parameters: query: - generate_gen_lock_id: "" - responses: - default: - application/json: {"message": "", "status_code": 445560} - "200": {} - 2XX: - application/json: {} - 4XX: - application/json: {"message": "", "status_code": 749379} - githubStorePublishingSecrets: - speakeasy-default-github-store-publishing-secrets: - requestBody: - application/json: {"generate_gen_lock_id": ""} - responses: - default: - application/json: {"message": "", "status_code": 802162} - 4XX: - application/json: {"message": "", "status_code": 444361} - triggerAction: - speakeasy-default-trigger-action: - requestBody: - application/json: {"gen_lock_id": "", "org": "", "repo_name": ""} - responses: - default: - application/json: {"message": "", "status_code": 689611} - createFreeTrial: - speakeasy-default-create-free-trial: - responses: - default: - application/json: {"message": "", "status_code": 728627} - 4XX: - application/json: {"message": "", "status_code": 728627} - getOrganization: - speakeasy-default-get-organization: - parameters: - path: - organizationID: "" - responses: - "200": - application/json: {"account_type": "scale-up", "id": "", "name": "", "telemetry_disabled": true} - default: - application/json: {"message": "", "status_code": 492205} - 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"} - 4XX: - application/json: {"message": "", "status_code": 458049} - getOrganizationUsage: - speakeasy-default-get-organization-usage: - responses: - "200": - application/json: {"allowed_languages": [], "total_allowed_languages": 85188, "usage": []} - default: - application/json: {"message": "", "status_code": 689787} - 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": []}]} - 4XX: - application/json: {"message": "", "status_code": 804495} - getOrganizations: - speakeasy-default-get-organizations: + namespace_name: "" responses: - "200": - application/json: [] - default: - application/json: {"message": "", "status_code": 952344} 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"}] + application/json: {"inputs": [], "output": {"registry_url": "https://happy-substitution.com"}} 4XX: - application/json: {"message": "", "status_code": 621425} - getChangesReportSignedUrl: - speakeasy-default-get-changes-report-signed-url: - parameters: - path: - documentChecksum: "" - responses: - "200": - application/json: {"url": "http://precious-pressure.biz"} - 2XX: - application/json: {"url": "https://rosy-masterpiece.biz/"} - getLintingReportSignedUrl: - speakeasy-default-get-linting-report-signed-url: - parameters: - path: - documentChecksum: "" - responses: - "200": - application/json: {"url": "https://overdue-maybe.net"} - 2XX: - application/json: {"url": "https://negligible-merit.info"} - uploadReport: - speakeasy-default-upload-report: - requestBody: - multipart/form-data: {"file": {"": "example.file"}} - responses: - "200": - application/json: {"url": "http://earnest-upgrade.com"} - 2XX: - application/json: {"url": "https://cluttered-stall.info"} - create: - speakeasy-default-create: - requestBody: - application/json: {"url": "http://limp-pastry.org"} - responses: - "200": - application/json: {"full_url": "", "short_url": ""} - 2XX: - application/json: {"full_url": "https://probable-heating.com/", "short_url": "https://standard-utilization.com/"} - suggest: - speakeasy-default-suggest: - parameters: - header: - x-session-id: "" - requestBody: - application/json: {"diagnostics": [], "oas_summary": {"info": {"description": "Operative impactful monitoring", "summary": "", "title": "", "version": ""}, "operations": []}, "suggestion_type": "diagnostics-only"} - responses: - "200": - application/json: "0x8D9A3DCDEa" - 2XX: - application/json: "0xbe893CEca6" - suggestOpenAPI: - speakeasy-default-suggest-open-API: - parameters: - header: - x-session-id: "" - requestBody: - multipart/form-data: {"schema": {"": "example.file"}} - responses: - "200": - application/json: "0xB470c0FE6E" - 2XX: - application/json: "0x0beEcB7cF6" - suggestOpenAPIRegistry: - speakeasy-default-suggest-open-API-registry: + application/json: {"message": "", "status_code": 672449} + postTags: + speakeasy-default-post-tags: parameters: path: namespace_name: "" - revision_reference: "" - header: - x-session-id: "" - responses: - "200": - application/json: "0x94DFDbB4df" - 2XX: - application/json: "0x9DDBdD905F" - getEmbedAccessToken: - speakeasy-default-get-embed-access-token: - responses: - "200": - application/json: {"access_token": ""} - default: - application/json: {"message": "", "status_code": 964408} - getValidEmbedAccessTokens: - speakeasy-default-get-valid-embed-access-tokens: - responses: - "200": - application/json: [] - default: - application/json: {"message": "", "status_code": 806352} - revokeEmbedAccessToken: - speakeasy-default-revoke-embed-access-token: - parameters: - path: - tokenID: "" - responses: - default: - application/json: {"message": "", "status_code": 217594} - getWorkspace: - speakeasy-default-get-workspace: - parameters: - path: - workspace_id: "" responses: - "200": - application/json: {"created_at": "2024-06-17T21:39:51.489Z", "id": "", "name": "", "organization_id": "", "slug": "", "telemetry_disabled": true, "updated_at": "2022-01-05T09:55:04.665Z", "verified": false} - default: - application/json: {"message": "", "status_code": 488095} - 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: - parameters: - path: - workspace_id: "" + application/json: {"message": "", "status_code": 418537} + preflight: + speakeasy-default-preflight: responses: - 5XX: - application/json: {"message": "", "status_code": 365854} - "200": + 2XX: application/json: {} - getWorkspaceEventsByTarget: - speakeasy-default-get-workspace-events-by-target: - parameters: - path: - targetID: "" - target_id: "" - workspace_id: "" - query: {} - responses: - "200": - application/json: [] - 5XX: - application/json: {"message": "", "status_code": 749240} - getWorkspaceTargets: - speakeasy-default-get-workspace-targets: - responses: - "200": - application/json: [] - 5XX: - application/json: {"message": "", "status_code": 966013} - postWorkspaceEvents: - speakeasy-default-post-workspace-events: + 4XX: + application/json: {"message": "", "status_code": 626529} + archiveNamespace: + speakeasy-default-archive-namespace: parameters: path: - workspace_id: "" - requestBody: - application/json: [] + namespace_name: "" responses: - 5XX: - application/json: {"message": "", "status_code": 962857} - searchWorkspaceEvents: - speakeasy-default-search-workspace-events: + 4XX: + application/json: {"message": "", "status_code": 726683} + setVisibility: + speakeasy-default-set-visibility: parameters: path: + namespace_name: "" + responses: + 4XX: + application/json: {"message": "", "status_code": 669253} + getWorkspaceAccess: + speakeasy-default-get-workspace-access: + responses: + 2XX: + application/json: {"generation_allowed": false, "message": ""} + getAccessToken: + speakeasy-default-get-access-token: + parameters: + query: workspace_id: "" - query: {} responses: - "200": - application/json: [] - 5XX: - application/json: {"message": "", "status_code": 750032} + 2XX: + application/json: {"access_token": "", "claims": {}, "user": {}} + 4XX: + application/json: {"message": "", "status_code": 646748} + getUser: + speakeasy-default-get-user: + responses: + 2XX: + 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": 527542} + validateApiKey: + speakeasy-default-validate-api-key: + responses: + 2XX: + 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": 532463} generateCodeSamplePreview: - speakeasy-default-generate-code-sample-preview: + default: requestBody: - multipart/form-data: {"languages": ["", ""], "schema_file": {"": "example.file"}} + multipart/form-data: {"language": "", "schema_file": "x-file: example.file"} responses: - "200": - application/json: "0x28e0E3f5d1" - application/x-yaml: "0xfA011e0be4" - 4XX: - application/json: {"message": "", "status_code": 396101} + 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: {"languages": ["", "", ""], "schema_file": {"": "example.file"}} + multipart/form-data: {"language": "", "schema_file": "x-file: example.file"} responses: "202": application/json: {"job_id": "", "status": "pending"} 4XX: - application/json: {"message": "", "status_code": 394086} + application/json: {"message": "", "status_code": 431188} + 5XX: + application/json: {"message": "", "status_code": 431188} getCodeSamplePreviewAsync: - speakeasy-default-get-code-sample-preview-async: + default: parameters: path: jobID: "" - responses: - "200": - application/json: "0x2090d4E1A7" - application/x-yaml: "0x14456CbEbA" - "202": - application/json: {"status": "running"} - 4XX: - application/json: {"message": "", "status_code": 462062} - createRemoteSource: - speakeasy-default-create-remote-source: - responses: - 4XX: - application/json: {"message": "", "status_code": 580557} - listRemoteSources: - speakeasy-default-list-remote-sources: - parameters: - query: - 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"}} - 4XX: - application/json: {"message": "", "status_code": 754391} - setVisibility: - speakeasy-default-set-visibility: - parameters: - path: - namespace_name: "" - responses: - 4XX: - application/json: {"message": "", "status_code": 651364} + 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}"}]} checkGithubAccess: speakeasy-default-check-github-access: parameters: @@ -1278,7 +712,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: @@ -1290,30 +724,40 @@ 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: + query: + generate_gen_lock_id: "" + responses: + 2XX: + application/json: {} + 4XX: + 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: @@ -1324,7 +768,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: @@ -1334,30 +778,196 @@ 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": 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": "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": 634641} + createBillingAddOns: + speakeasy-default-create-billing-add-ons: + requestBody: + application/json: {"add_ons": ["custom_code_regions"]} + responses: + "200": + application/json: {"add_ons": []} + 5XX: + application/json: {"message": "", "status_code": 501320} + createFreeTrial: + speakeasy-default-create-free-trial: + responses: + 4XX: + application/json: {"message": "", "status_code": 822669} + deleteBillingAddOn: + speakeasy-default-delete-billing-add-on: + parameters: + path: + add_on: "sdk_testing" + responses: + 5XX: + application/json: {"message": "", "status_code": 844353} + getOrganization: + speakeasy-default-get-organization: + parameters: + path: + organizationID: "" + responses: + 2XX: + 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": 924479} + getOrganizations: + speakeasy-default-get-organizations: + responses: + 2XX: + 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": 367315} + getBillingAddOns: + speakeasy-default-get-billing-add-ons: + responses: + "200": + application/json: {"add_ons": ["snippet_ai"]} + 5XX: + application/json: {"message": "", "status_code": 576599} + getOrganizationUsage: + speakeasy-default-get-organization-usage: + responses: + 2XX: + application/json: {"allowed_languages": ["", ""], "total_allowed_languages": 68444, "usage": []} + 4XX: + 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": 956440} + deletePublishingToken: + speakeasy-default-delete-publishing-token: + parameters: + path: + tokenID: "" + responses: + 4XX: + application/json: {"message": "", "status_code": 411698} + getPublishingTokenByID: + speakeasy-default-get-publishing-token-by-ID: + parameters: + path: + tokenID: "" + responses: + "200": + 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": "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": 464289} + getPublishingTokenPublicMetadata: + speakeasy-default-get-publishing-token-public-metadata: + parameters: + path: + tokenID: "" + responses: + "200": + application/json: {} + 4XX: + application/json: {"message": "", "status_code": 833471} + getPublishingTokenTargetByID: + speakeasy-default-get-publishing-token-target-by-ID: + parameters: + path: + tokenID: "" + responses: + "200": + text/plain: "" + 4XX: + application/json: {"message": "", "status_code": 690090} + updatePublishingTokenExpiration: + speakeasy-default-update-publishing-token-expiration: + parameters: + path: + tokenID: "" + responses: + 4XX: + application/json: {"message": "", "status_code": 324979} + getChangesReportSignedUrl: + speakeasy-default-get-changes-report-signed-url: + parameters: + path: + documentChecksum: "" + responses: + 2XX: + application/json: {"url": "https://babyish-foodstuffs.info/"} + getLintingReportSignedUrl: + speakeasy-default-get-linting-report-signed-url: + parameters: + path: + documentChecksum: "" + responses: + 2XX: + application/json: {"url": "https://somber-lashes.org/"} + uploadReport: + speakeasy-default-upload-report: + requestBody: + multipart/form-data: {"data": {}, "file": "x-file: example.file"} + responses: + 2XX: + 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": "2023-06-13T18:33:55.488Z", "format": "json", "id": "", "packageName": "", "sdkClassname": "", "spec": ""} + 4XX: + application/json: {"message": "", "status_code": 865252} + getSchemaStoreItem: + speakeasy-default-get-schema-store-item: 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: {"created_at": "2024-08-18T15:04:44.601Z", "format": "yaml", "id": "", "packageName": "", "sdkClassname": "", "spec": ""} 4XX: - application/json: {"message": "", "status_code": 792620} + application/json: {"message": "", "status_code": 59948} + create: + speakeasy-default-create: + requestBody: + application/json: {"url": "https://exalted-heroine.org/"} + responses: + 2XX: + application/json: {"full_url": "https://merry-luck.info", "short_url": "https://stable-tomb.biz/"} activateSubscriptionNamespace: speakeasy-default-activate-subscription-namespace: parameters: @@ -1366,7 +976,7 @@ examples: namespaceName: "" responses: 4XX: - application/json: {"message": "", "status_code": 566510} + application/json: {"message": "", "status_code": 496630} ignoreSubscriptionNamespace: speakeasy-default-ignore-subscription-namespace: parameters: @@ -1375,56 +985,107 @@ 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": ["/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: "0xC68Fcf8d14" suggestItems: speakeasy-default-suggest-items: requestBody: - application/json: {"items": [], "prompt": ""} + application/json: {"items": [""], "prompt": ""} + responses: + 2XX: + application/json: ["", ""] + suggestOpenAPI: + speakeasy-default-suggest-open-API: + parameters: + header: + x-session-id: "" + requestBody: + multipart/form-data: {"schema": "x-file: example.file"} + responses: + 2XX: + application/json: "0x01aCDEb8da" + suggestOpenAPIRegistry: + speakeasy-default-suggest-open-API-registry: + parameters: + path: + namespace_name: "" + revision_reference: "" + header: + x-session-id: "" responses: 2XX: - application/json: ["", ""] + application/json: "0x8AEEbCebEa" 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} + 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-05-28T06:20:22.766Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2023-03-17T15:39:20.911Z", "verified": false} + 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": 951062} + application/json: {"message": "", "status_code": 373179} 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: {"alg": "", "created_at": "2024-10-04T10:23:04.522Z", "id": "", "key": "", "name": "", "workspace_id": ""} responses: 4XX: - application/json: {"message": "", "status_code": 966454} + application/json: {"message": "", "status_code": 869423} deleteWorkspaceToken: speakeasy-default-delete-workspace-token: parameters: path: - tokenID: "" workspace_id: "" + tokenID: "" responses: 4XX: - application/json: {"message": "", "status_code": 120260} + application/json: {"message": "", "status_code": 478706} 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}} + 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": 213457} + application/json: {"message": "", "status_code": 305240} 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}] + 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": 16308} + 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: @@ -1432,9 +1093,9 @@ examples: 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": ""} + 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": 864485} + application/json: {"message": "", "status_code": 88356} getWorkspaceTeam: speakeasy-default-get-workspace-team: parameters: @@ -1444,7 +1105,7 @@ examples: 2XX: application/json: {"users": []} 4XX: - application/json: {"message": "", "status_code": 194974} + application/json: {"message": "", "status_code": 227320} getWorkspaceTokens: speakeasy-default-get-workspace-tokens: parameters: @@ -1452,77 +1113,106 @@ examples: 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": ""}] + application/json: [{"alg": "", "created_at": "2024-09-13T14:17:43.018Z", "id": "", "key": "", "name": "", "workspace_id": ""}] 4XX: - application/json: {"message": "", "status_code": 858647} + application/json: {"message": "", "status_code": 306057} grantUserAccessToWorkspace: speakeasy-default-grant-user-access-to-workspace: parameters: path: - email: "Lucinda.Batz8@hotmail.com" workspace_id: "" + email: "Idella24@gmail.com" responses: "200": application/json: {"relationship": {"user_id": "", "workspace_id": ""}} 4XX: - application/json: {"message": "", "status_code": 621540} + application/json: {"message": "", "status_code": 146190} revokeUserAccessToWorkspace: speakeasy-default-revoke-user-access-to-workspace: parameters: path: - userId: "" workspace_id: "" + userId: "" responses: 4XX: - application/json: {"message": "", "status_code": 243814} + 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": "2025-07-28T19:04:48.565Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2024-10-16T10:52:42.015Z", "verified": true} + 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": 991464} + application/json: {"message": "", "status_code": 708653} updateWorkspaceSettings: speakeasy-default-update-workspace-settings: 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": ""} + 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": 54657} + application/json: {"message": "", "status_code": 911456} + getWorkspaceEventsByTarget: + speakeasy-default-get-workspace-events-by-target: + parameters: + path: + workspace_id: "" + target_id: "" + responses: + "200": + 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": 224805} + getWorkspaceTargets: + speakeasy-default-get-workspace-targets: + responses: + "200": + 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": 869083} getWorkspaceTargetsDeprecated: speakeasy-default-get-workspace-targets-deprecated: parameters: path: workspace_id: "" - query: {} responses: "200": - application/json: [] + 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": 255923} - getCodeSamples: - speakeasy-default-get-code-samples: + application/json: {"message": "", "status_code": 397013} + postWorkspaceEvents: + speakeasy-default-post-workspace-events: parameters: - query: - registry_url: "https://normal-making.name" - responses: - 2XX: - application/json: {"snippets": [{"code": "", "language": "", "operationId": ""}, {"code": "", "language": "", "operationId": ""}, {"code": "", "language": "", "operationId": ""}]} - 4XX: - application/json: {"message": "", "status_code": 458049} - setWorkspaceFeatureFlags: - speakeasy-default-set-workspace-feature-flags: + path: + workspace_id: "" requestBody: - application/json: {"feature_flags": ["skip_schema_registry", "webhooks"]} + 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": 104921} + searchWorkspaceEvents: + speakeasy-default-search-workspace-events: + parameters: + path: + workspace_id: "" responses: "200": - application/json: {} + 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": 264889} + application/json: {"message": "", "status_code": 436496} +examplesVersion: 1.0.2 generatedTests: {} +releaseNotes: "## Csharp SDK Changes Detected:\n* `Sdk.CodeSamples.GenerateCodeSamplePreview()`: \n * `request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `Sdk.CodeSamples.GetCodeSamplePreviewAsync()`: `response` **Changed** **Breaking** :warning:\n* `Sdk.CodeSamples.GenerateCodeSamplePreviewAsync()`: `request` **Changed** **Breaking** :warning:\n* `Sdk.PublishingTokens.Get()`: **Added**\n* `Sdk.Artifacts.GetNamespaces()`: `response.items.[]` **Changed**\n* `Sdk.PublishingTokens.Delete()`: **Added**\n* `Sdk.Artifacts.SetArchived()`: **Added**\n* `Sdk.PublishingTokens.List()`: **Added**\n* `Sdk.PublishingTokens.ResolveMetadata()`: **Added**\n* `Sdk.PublishingTokens.ResolveTarget()`: **Added**\n* `Sdk.PublishingTokens.Update()`: **Added**\n* `Sdk.SchemaStore.CreateSchemaStoreItem()`: **Added**\n* `Sdk.SchemaStore.GetSchemaStoreItem()`: **Added**\n* `Sdk.CodeSamples.Get()`: **Deleted** **Breaking** :warning:\n* `Sdk.PublishingTokens.Create()`: **Added**\n* `Sdk.Artifacts.GetRevisions()`: `response.items.[].ContentsMetadata` **Added**\n* `Sdk.Auth.GetUser()`: `response` **Changed**\n* `Sdk.Auth.ValidateApiKey()`: `response.billingAddOns` **Added**\n* `Sdk.Organizations.GetBillingAddOns()`: **Added**\n* `Sdk.Organizations.DeleteBillingAddOn()`: **Added**\n* `Sdk.Organizations.CreateBillingAddOns()`: **Added**\n* `Sdk.Workspaces.CreateToken()`: \n * `request.WorkspaceToken` **Changed**\n* `Sdk.Workspaces.GetTeam()`: `response.users.[]` **Changed**\n* `Sdk.Workspaces.GetTokens()`: `response.[]` **Changed**\n* `Sdk.Events.GetEventsByTarget()`: `response.[].TestReportRaw` **Added**\n* `Sdk.Events.Post()`: \n * `request.RequestBody.[].TestReportRaw` **Added**\n* `Sdk.Events.Search()`: \n * `request.InteractionType` **Changed**\n * `response.[].TestReportRaw` **Added**\n" diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d3a7000c..bb0f640b 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,21 +1,21 @@ -speakeasyVersion: 1.468.2 +speakeasyVersion: 1.635.1 sources: speakeasy: sourceNamespace: speakeasy - sourceRevisionDigest: sha256:8af7ebde12785185cdbd700c1b3b6b8848b43d34f1fe8c06fff5ae4af471faf2 - sourceBlobDigest: sha256:952a58da1511e3191ea8e470c7f01a4e3785d11d9152f490a3e5a7173c8542e7 + sourceRevisionDigest: sha256:9128c3df436950ca04fec9dfc74e769e8b492d434b115b197d68da656ae17d23 + sourceBlobDigest: sha256:6eb8a6e215c36d3e11d86fc67d5ce7af499bdb934e0f7fbad17efcdde9bffd73 tags: - latest - - speakeasy-sdk-regen-1735949986 + - speakeasy-sdk-regen-1758759731 - 0.4.0 targets: speakeasy-client-sdk-csharp: source: speakeasy sourceNamespace: speakeasy - sourceRevisionDigest: sha256:8af7ebde12785185cdbd700c1b3b6b8848b43d34f1fe8c06fff5ae4af471faf2 - sourceBlobDigest: sha256:952a58da1511e3191ea8e470c7f01a4e3785d11d9152f490a3e5a7173c8542e7 + sourceRevisionDigest: sha256:9128c3df436950ca04fec9dfc74e769e8b492d434b115b197d68da656ae17d23 + sourceBlobDigest: sha256:6eb8a6e215c36d3e11d86fc67d5ce7af499bdb934e0f7fbad17efcdde9bffd73 codeSamplesNamespace: code-samples-csharp-speakeasy-client-sdk-csharp - codeSamplesRevisionDigest: sha256:aacf508e82244f7628670bda7c73bdda3a36059c4143c3566f2b4d4935251ec8 + codeSamplesRevisionDigest: sha256:73a1bd33625310d6f545cf922b4c33b1c22d12d614dc0346b9446b6ceac30c8e workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..d585717f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing to This Repository + +Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements. + +## How to Report Issues + +If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes: + +- A clear and descriptive title +- Steps to reproduce the issue +- Expected and actual behavior +- Any relevant logs, screenshots, or error messages +- Information about your environment (e.g., operating system, software versions) + - For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed + +## Issue Triage and Upstream Fixes + +We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code. + +## Contact + +If you have any questions or need further assistance, please feel free to reach out by opening an issue. + +Thank you for your understanding and cooperation! + +The Maintainers diff --git a/NUGET.md b/NUGET.md index 711d23aa..3c593b76 100644 --- a/NUGET.md +++ b/NUGET.md @@ -9,22 +9,12 @@ ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", }); -RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, -}; +RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); @@ -49,22 +39,12 @@ You can set the security parameters through the `security` optional parameter wh ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", }); -RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, -}; +RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); @@ -94,7 +74,7 @@ The following global parameter is available. using SpeakeasySDK; using SpeakeasySDK.Models.Operations; -var sdk = new SDK(); +var sdk = new SDK(workspaceId: ""); GetAccessTokenRequest req = new GetAccessTokenRequest() { WorkspaceId = "", @@ -121,7 +101,7 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -GetWorkspaceAccessRequest req = new GetWorkspaceAccessRequest() {}; +GetWorkspaceAccessRequest? req = null; var res = await sdk.Auth.GetAccessAsync( retryConfig: new RetryConfig( @@ -162,7 +142,7 @@ var sdk = new SDK( } ); -GetWorkspaceAccessRequest req = new GetWorkspaceAccessRequest() {}; +GetWorkspaceAccessRequest? req = null; var res = await sdk.Auth.GetAccessAsync(req); @@ -173,23 +153,18 @@ var res = await sdk.Auth.GetAccessAsync(req); ## Error Handling -Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception. - -By default, an API error will raise a `SpeakeasySDK.Models.Errors.SDKException` exception, which has the following properties: +[`SDKBaseException`](./src/SpeakeasySDK/Models/Errors/SDKBaseException.cs) is the base exception class for all HTTP error responses. It has the following properties: | Property | Type | Description | |---------------|-----------------------|-----------------------| -| `Message` | *string* | The error message | -| `StatusCode` | *int* | The HTTP status code | -| `RawResponse` | *HttpResponseMessage* | The raw HTTP response | -| `Body` | *string* | The response content | +| `Message` | *string* | Error message | +| `StatusCode` | *int* | HTTP status code | +| `Headers` | *HttpResponseHeaders* | HTTP headers | +| `ContentType` | *string?* | HTTP content type | +| `RawResponse` | *HttpResponseMessage* | HTTP response object | +| `Body` | *string* | HTTP response body | -When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `CreateRemoteSourceAsync` method throws the following exceptions: - -| Error Type | Status Code | Content Type | -| --------------------------------------- | ----------- | ---------------- | -| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | -| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | +Some exceptions in this SDK include an additional `Payload` field, which will contain deserialized custom error data when present. Possible exceptions are listed in the [Error Classes](#error-classes) section. ### Example @@ -197,7 +172,6 @@ When custom error responses are specified for an operation, the SDK may also thr using SpeakeasySDK; using SpeakeasySDK.Models.Errors; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", @@ -205,35 +179,59 @@ var sdk = new SDK(security: new Security() { try { - RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, - }; + RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response } -catch (Exception ex) +catch (SDKBaseException ex) // all SDK exceptions inherit from SDKBaseException { - if (ex is Error) + // ex.ToString() provides a detailed error message + System.Console.WriteLine(ex); + + // Base exception fields + HttpResponseMessage rawResponse = ex.RawResponse; + HttpResponseHeaders headers = ex.Headers; + int statusCode = ex.StatusCode; + string? contentType = ex.ContentType; + var responseBody = ex.Body; + + if (ex is Error) // different exceptions may be thrown depending on the method { - // Handle exception data - throw; + // Check error data fields + ErrorPayload payload = ex.Payload; + string Message = payload.Message; + int StatusCode = payload.StatusCode; } - else if (ex is SpeakeasySDK.Models.Errors.SDKException) + + // An underlying cause may be provided + if (ex.InnerException != null) { - // Handle default exception - throw; + Exception cause = ex.InnerException; } } +catch (System.Net.Http.HttpRequestException ex) +{ + // Check ex.InnerException for Network connectivity errors +} ``` + +### Error Classes + +**Primary exceptions:** +* [`SDKBaseException`](./src/SpeakeasySDK/Models/Errors/SDKBaseException.cs): The base class for HTTP error responses. + * [`Error`](./src/SpeakeasySDK/Models/Errors/Error.cs): The `Status` type defines a logical error model. * + +
Less common exceptions (2) + +* [`System.Net.Http.HttpRequestException`](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httprequestexception): Network connectivity error. For more details about the underlying cause, inspect the `ex.InnerException`. + +* Inheriting from [`SDKBaseException`](./src/SpeakeasySDK/Models/Errors/SDKBaseException.cs): + * [`ResponseValidationError`](./src/SpeakeasySDK/Models/Errors/ResponseValidationError.cs): Thrown when the response data could not be deserialized into the expected type. +
+ +\* Refer to the [relevant documentation](#available-resources-and-operations) to determine whether an exception applies to a specific operation. @@ -243,34 +241,24 @@ catch (Exception ex) You can override the default server globally by passing a server name to the `server: string` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers: -| Name | Server | -| ------ | ----------------------------------- | -| `prod` | `https://api.prod.speakeasyapi.dev` | +| Name | Server | Description | +| ------ | -------------------------------- | ----------- | +| `prod` | `https://api.prod.speakeasy.com` | | #### Example ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK( - server: "prod", + server: SDKConfig.Server.Prod, security: new Security() { APIKey = "", } ); -RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, -}; +RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); @@ -283,25 +271,15 @@ The default server can also be overridden globally by passing a URL to the `serv ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK( - serverUrl: "https://api.prod.speakeasyapi.dev", + serverUrl: "https://api.prod.speakeasy.com", security: new Security() { APIKey = "", } ); -RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, -}; +RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); diff --git a/README.md b/README.md index 1b233214..77506fa7 100755 --- a/README.md +++ b/README.md @@ -49,22 +49,12 @@ dotnet add reference src/SpeakeasySDK/SpeakeasySDK.csproj ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", }); -RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, -}; +RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); @@ -89,6 +79,7 @@ var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); * [ListRemoteSources](docs/sdks/artifacts/README.md#listremotesources) - Get remote sources attached to a particular namespace * [PostTags](docs/sdks/artifacts/README.md#posttags) - Add tags to an existing revision * [Preflight](docs/sdks/artifacts/README.md#preflight) - Get access token for communicating with OCI distribution endpoints +* [SetArchived](docs/sdks/artifacts/README.md#setarchived) - Set whether a namespace is archived * [SetVisibility](docs/sdks/artifacts/README.md#setvisibility) - Set visibility of a namespace with an existing metadata entry ### [Auth](docs/sdks/auth/README.md) @@ -102,7 +93,6 @@ var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); * [GenerateCodeSamplePreview](docs/sdks/codesamples/README.md#generatecodesamplepreview) - Generate Code Sample previews from a file and configuration parameters. * [GenerateCodeSamplePreviewAsync](docs/sdks/codesamples/README.md#generatecodesamplepreviewasync) - Initiate asynchronous Code Sample preview generation from a file and configuration parameters, receiving an async JobID response for polling. -* [Get](docs/sdks/codesamples/README.md#get) - Retrieve usage snippets from document stored in the registry * [GetCodeSamplePreviewAsync](docs/sdks/codesamples/README.md#getcodesamplepreviewasync) - Poll for the result of an asynchronous Code Sample preview generation. ### [Events](docs/sdks/events/README.md) @@ -130,17 +120,35 @@ var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); ### [Organizations](docs/sdks/organizations/README.md) * [Create](docs/sdks/organizations/README.md#create) - Create an organization +* [CreateBillingAddOns](docs/sdks/organizations/README.md#createbillingaddons) - Create billing add ons * [CreateFreeTrial](docs/sdks/organizations/README.md#createfreetrial) - Create a free trial for an organization +* [DeleteBillingAddOn](docs/sdks/organizations/README.md#deletebillingaddon) - Delete billing add ons * [Get](docs/sdks/organizations/README.md#get) - Get organization * [GetAll](docs/sdks/organizations/README.md#getall) - Get organizations for a user +* [GetBillingAddOns](docs/sdks/organizations/README.md#getbillingaddons) - Get billing add ons * [GetUsage](docs/sdks/organizations/README.md#getusage) - Get billing usage summary for a particular organization +### [PublishingTokens](docs/sdks/publishingtokens/README.md) + +* [Create](docs/sdks/publishingtokens/README.md#create) - Create a publishing token for a workspace +* [Delete](docs/sdks/publishingtokens/README.md#delete) - Delete a specific publishing token +* [Get](docs/sdks/publishingtokens/README.md#get) - Get a specific publishing token +* [List](docs/sdks/publishingtokens/README.md#list) - Get publishing tokens for a workspace +* [ResolveMetadata](docs/sdks/publishingtokens/README.md#resolvemetadata) - Get metadata about the token +* [ResolveTarget](docs/sdks/publishingtokens/README.md#resolvetarget) - Get a specific publishing token target +* [Update](docs/sdks/publishingtokens/README.md#update) - Updates the validitity period of a publishing token + ### [Reports](docs/sdks/reports/README.md) * [GetChangesReportSignedUrl](docs/sdks/reports/README.md#getchangesreportsignedurl) - Get the signed access url for the change reports for a particular document. * [GetLintingReportSignedUrl](docs/sdks/reports/README.md#getlintingreportsignedurl) - Get the signed access url for the linting reports for a particular document. * [UploadReport](docs/sdks/reports/README.md#uploadreport) - Upload a report. +### [SchemaStore](docs/sdks/schemastore/README.md) + +* [CreateSchemaStoreItem](docs/sdks/schemastore/README.md#createschemastoreitem) - Create a schema in the schema store +* [GetSchemaStoreItem](docs/sdks/schemastore/README.md#getschemastoreitem) - Get a OAS schema from the schema store + ### [ShortURLs](docs/sdks/shorturls/README.md) @@ -188,34 +196,24 @@ var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); You can override the default server globally by passing a server name to the `server: string` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers: -| Name | Server | -| ------ | ----------------------------------- | -| `prod` | `https://api.prod.speakeasyapi.dev` | +| Name | Server | Description | +| ------ | -------------------------------- | ----------- | +| `prod` | `https://api.prod.speakeasy.com` | | #### Example ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK( - server: "prod", + server: SDKConfig.Server.Prod, security: new Security() { APIKey = "", } ); -RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, -}; +RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); @@ -228,25 +226,15 @@ The default server can also be overridden globally by passing a URL to the `serv ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK( - serverUrl: "https://api.prod.speakeasyapi.dev", + serverUrl: "https://api.prod.speakeasy.com", security: new Security() { APIKey = "", } ); -RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, -}; +RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); @@ -271,22 +259,12 @@ You can set the security parameters through the `security` optional parameter wh ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", }); -RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, -}; +RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); @@ -316,7 +294,7 @@ The following global parameter is available. using SpeakeasySDK; using SpeakeasySDK.Models.Operations; -var sdk = new SDK(); +var sdk = new SDK(workspaceId: ""); GetAccessTokenRequest req = new GetAccessTokenRequest() { WorkspaceId = "", @@ -331,23 +309,18 @@ var res = await sdk.Auth.GetAccessTokenAsync(req); ## Error Handling -Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception. - -By default, an API error will raise a `SpeakeasySDK.Models.Errors.SDKException` exception, which has the following properties: +[`SDKBaseException`](./src/SpeakeasySDK/Models/Errors/SDKBaseException.cs) is the base exception class for all HTTP error responses. It has the following properties: | Property | Type | Description | |---------------|-----------------------|-----------------------| -| `Message` | *string* | The error message | -| `StatusCode` | *int* | The HTTP status code | -| `RawResponse` | *HttpResponseMessage* | The raw HTTP response | -| `Body` | *string* | The response content | +| `Message` | *string* | Error message | +| `StatusCode` | *int* | HTTP status code | +| `Headers` | *HttpResponseHeaders* | HTTP headers | +| `ContentType` | *string?* | HTTP content type | +| `RawResponse` | *HttpResponseMessage* | HTTP response object | +| `Body` | *string* | HTTP response body | -When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `CreateRemoteSourceAsync` method throws the following exceptions: - -| Error Type | Status Code | Content Type | -| --------------------------------------- | ----------- | ---------------- | -| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | -| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | +Some exceptions in this SDK include an additional `Payload` field, which will contain deserialized custom error data when present. Possible exceptions are listed in the [Error Classes](#error-classes) section. ### Example @@ -355,7 +328,6 @@ When custom error responses are specified for an operation, the SDK may also thr using SpeakeasySDK; using SpeakeasySDK.Models.Errors; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", @@ -363,35 +335,59 @@ var sdk = new SDK(security: new Security() { try { - RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, - }; + RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response } -catch (Exception ex) +catch (SDKBaseException ex) // all SDK exceptions inherit from SDKBaseException { - if (ex is Error) + // ex.ToString() provides a detailed error message + System.Console.WriteLine(ex); + + // Base exception fields + HttpResponseMessage rawResponse = ex.RawResponse; + HttpResponseHeaders headers = ex.Headers; + int statusCode = ex.StatusCode; + string? contentType = ex.ContentType; + var responseBody = ex.Body; + + if (ex is Error) // different exceptions may be thrown depending on the method { - // Handle exception data - throw; + // Check error data fields + ErrorPayload payload = ex.Payload; + string Message = payload.Message; + int StatusCode = payload.StatusCode; } - else if (ex is SpeakeasySDK.Models.Errors.SDKException) + + // An underlying cause may be provided + if (ex.InnerException != null) { - // Handle default exception - throw; + Exception cause = ex.InnerException; } } +catch (System.Net.Http.HttpRequestException ex) +{ + // Check ex.InnerException for Network connectivity errors +} ``` + +### Error Classes + +**Primary exceptions:** +* [`SDKBaseException`](./src/SpeakeasySDK/Models/Errors/SDKBaseException.cs): The base class for HTTP error responses. + * [`Error`](./src/SpeakeasySDK/Models/Errors/Error.cs): The `Status` type defines a logical error model. * + +
Less common exceptions (2) + +* [`System.Net.Http.HttpRequestException`](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httprequestexception): Network connectivity error. For more details about the underlying cause, inspect the `ex.InnerException`. + +* Inheriting from [`SDKBaseException`](./src/SpeakeasySDK/Models/Errors/SDKBaseException.cs): + * [`ResponseValidationError`](./src/SpeakeasySDK/Models/Errors/ResponseValidationError.cs): Thrown when the response data could not be deserialized into the expected type. +
+ +\* Refer to the [relevant documentation](#available-resources-and-operations) to determine whether an exception applies to a specific operation. @@ -409,7 +405,7 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -GetWorkspaceAccessRequest req = new GetWorkspaceAccessRequest() {}; +GetWorkspaceAccessRequest? req = null; var res = await sdk.Auth.GetAccessAsync( retryConfig: new RetryConfig( @@ -450,7 +446,7 @@ var sdk = new SDK( } ); -GetWorkspaceAccessRequest req = new GetWorkspaceAccessRequest() {}; +GetWorkspaceAccessRequest? req = null; var res = await sdk.Auth.GetAccessAsync(req); diff --git a/RELEASES.md b/RELEASES.md index 4df5c678..da33cd1f 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -949,4 +949,14 @@ Based on: ### Generated - [csharp v5.12.0] . ### Releases -- [NuGet v5.12.0] https://www.nuget.org/packages/SpeakeasySDK/5.12.0 - . \ No newline at end of file +- [NuGet v5.12.0] https://www.nuget.org/packages/SpeakeasySDK/5.12.0 - . + +## 2025-10-07 00:21:56 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.635.1 (2.722.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [csharp v5.13.0] . +### Releases +- [NuGet v5.13.0] https://www.nuget.org/packages/SpeakeasySDK/5.13.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 1c71495d..8e875991 100644 --- a/USAGE.md +++ b/USAGE.md @@ -2,22 +2,12 @@ ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", }); -RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, -}; +RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); diff --git a/codeSamples.yaml b/codeSamples.yaml index 6ded62a4..78846cd2 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -18,6 +18,27 @@ actions: var res = await sdk.Artifacts.GetNamespacesAsync(); + // handle response + - target: $["paths"]["/v1/artifacts/namespaces/{namespace_name}/archive"]["post"] + update: + x-codeSamples: + - lang: csharp + label: archiveNamespace + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + ArchiveNamespaceRequest req = new ArchiveNamespaceRequest() { + NamespaceName = "", + }; + + var res = await sdk.Artifacts.SetArchivedAsync(req); + // handle response - target: $["paths"]["/v1/artifacts/namespaces/{namespace_name}/revisions"]["get"] update: @@ -116,9 +137,7 @@ actions: APIKey = "", }); - PreflightRequest req = new PreflightRequest() { - NamespaceName = "", - }; + PreflightRequest? req = null; var res = await sdk.Artifacts.PreflightAsync(req); @@ -152,22 +171,12 @@ actions: source: |- using SpeakeasySDK; using SpeakeasySDK.Models.Shared; - using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", }); - RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, - }; + RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); @@ -205,27 +214,6 @@ actions: var res = await sdk.Auth.ValidateApiKeyAsync(); - // handle response - - target: $["paths"]["/v1/code_sample"]["get"] - update: - x-codeSamples: - - lang: csharp - label: getCodeSamples - source: |- - using SpeakeasySDK; - using SpeakeasySDK.Models.Operations; - using SpeakeasySDK.Models.Shared; - - var sdk = new SDK(security: new Security() { - APIKey = "", - }); - - GetCodeSamplesRequest req = new GetCodeSamplesRequest() { - RegistryUrl = "https://normal-making.name", - }; - - var res = await sdk.CodeSamples.GetAsync(req); - // handle response - target: $["paths"]["/v1/code_sample/preview"]["post"] update: @@ -235,20 +223,16 @@ actions: source: |- using SpeakeasySDK; using SpeakeasySDK.Models.Shared; - using System; - using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", }); CodeSampleSchemaInput req = new CodeSampleSchemaInput() { - Languages = new List() { - "", - }, + Language = "", SchemaFile = new SchemaFile() { FileName = "example.file", - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), + Content = System.IO.File.ReadAllBytes("example.file"), }, }; @@ -263,20 +247,16 @@ actions: source: |- using SpeakeasySDK; using SpeakeasySDK.Models.Shared; - using System; - using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", }); CodeSampleSchemaInput req = new CodeSampleSchemaInput() { - Languages = new List() { - "", - }, + Language = "", SchemaFile = new SchemaFile() { FileName = "example.file", - Content = System.Text.Encoding.UTF8.GetBytes("0xED5CDd177E"), + Content = System.IO.File.ReadAllBytes("example.file"), }, }; @@ -389,7 +369,7 @@ actions: Repo = "", Input = "", Overlays = new List() { - "", + "", }, }; @@ -431,7 +411,7 @@ actions: APIKey = "", }); - LinkGithubAccessRequest req = new LinkGithubAccessRequest() {}; + LinkGithubAccessRequest? req = null; var res = await sdk.Github.LinkGithubAsync(req); @@ -613,13 +593,73 @@ actions: Slug = "", AccountType = AccountType.ScaleUp, TelemetryDisabled = false, - CreatedAt = System.DateTime.Parse("2024-11-30T17:06:07.804Z"), - UpdatedAt = System.DateTime.Parse("2024-04-02T12:48:32.253Z"), - SsoActivated = false, + CreatedAt = System.DateTime.Parse("2025-12-17T21:02:28.497Z"), + UpdatedAt = System.DateTime.Parse("2025-07-22T00:26:10.078Z"), + SsoActivated = true, }; var res = await sdk.Organizations.CreateAsync(req); + // handle response + - target: $["paths"]["/v1/organization/add_ons"]["get"] + update: + x-codeSamples: + - lang: csharp + label: getBillingAddOns + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + var res = await sdk.Organizations.GetBillingAddOnsAsync(); + + // handle response + - target: $["paths"]["/v1/organization/add_ons"]["post"] + update: + x-codeSamples: + - lang: csharp + label: createBillingAddOns + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Shared; + using System.Collections.Generic; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + OrganizationBillingAddOnRequest req = new OrganizationBillingAddOnRequest() { + AddOns = new List() { + BillingAddOn.CustomCodeRegions, + }, + }; + + var res = await sdk.Organizations.CreateBillingAddOnsAsync(req); + + // handle response + - target: $["paths"]["/v1/organization/add_ons/{add_on}"]["delete"] + update: + x-codeSamples: + - lang: csharp + label: deleteBillingAddOn + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + DeleteBillingAddOnRequest req = new DeleteBillingAddOnRequest() { + AddOn = BillingAddOn.SDKTesting, + }; + + var res = await sdk.Organizations.DeleteBillingAddOnAsync(req); + // handle response - target: $["paths"]["/v1/organization/free_trial"]["post"] update: @@ -689,6 +729,146 @@ actions: var res = await sdk.Organizations.GetAllAsync(); + // handle response + - target: $["paths"]["/v1/publishing-tokens"]["get"] + update: + x-codeSamples: + - lang: csharp + label: getPublishingToken + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + var res = await sdk.PublishingTokens.ListAsync(); + + // handle response + - target: $["paths"]["/v1/publishing-tokens"]["post"] + update: + x-codeSamples: + - lang: csharp + label: createPublishingToken + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + CreatePublishingTokenRequestBody? req = null; + + var res = await sdk.PublishingTokens.CreateAsync(req); + + // handle response + - target: $["paths"]["/v1/publishing-tokens/{tokenID}"]["delete"] + update: + x-codeSamples: + - lang: csharp + label: deletePublishingToken + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + DeletePublishingTokenRequest req = new DeletePublishingTokenRequest() { + TokenID = "", + }; + + var res = await sdk.PublishingTokens.DeleteAsync(req); + + // handle response + - target: $["paths"]["/v1/publishing-tokens/{tokenID}"]["get"] + update: + x-codeSamples: + - lang: csharp + label: getPublishingTokenByID + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + GetPublishingTokenByIDRequest req = new GetPublishingTokenByIDRequest() { + TokenID = "", + }; + + var res = await sdk.PublishingTokens.GetAsync(req); + + // handle response + - target: $["paths"]["/v1/publishing-tokens/{tokenID}"]["put"] + update: + x-codeSamples: + - lang: csharp + label: updatePublishingTokenExpiration + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + UpdatePublishingTokenExpirationRequest req = new UpdatePublishingTokenExpirationRequest() { + TokenID = "", + }; + + var res = await sdk.PublishingTokens.UpdateAsync(req); + + // handle response + - target: $["paths"]["/v1/publishing-tokens/{tokenID}/metadata"]["get"] + update: + x-codeSamples: + - lang: csharp + label: getPublishingTokenPublicMetadata + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + GetPublishingTokenPublicMetadataRequest req = new GetPublishingTokenPublicMetadataRequest() { + TokenID = "", + }; + + var res = await sdk.PublishingTokens.ResolveMetadataAsync(req); + + // handle response + - target: $["paths"]["/v1/publishing-tokens/{tokenID}/target"]["get"] + update: + x-codeSamples: + - lang: csharp + label: getPublishingTokenTargetByID + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + GetPublishingTokenTargetByIDRequest req = new GetPublishingTokenTargetByIDRequest() { + TokenID = "", + }; + + var res = await sdk.PublishingTokens.ResolveTargetAsync(req); + // handle response - target: $["paths"]["/v1/reports"]["post"] update: @@ -699,7 +879,6 @@ actions: using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - using System; var sdk = new SDK(security: new Security() { APIKey = "", @@ -707,9 +886,9 @@ actions: UploadReportRequestBody req = new UploadReportRequestBody() { Data = new Report() {}, - File = new File() { + File = new SpeakeasySDK.Models.Operations.File() { FileName = "example.file", - Content = System.Text.Encoding.UTF8.GetBytes("0xA2Ca85EFA5"), + Content = System.IO.File.ReadAllBytes("example.file"), }, }; @@ -757,6 +936,49 @@ actions: var res = await sdk.Reports.GetLintingReportSignedUrlAsync(req); + // handle response + - target: $["paths"]["/v1/schema_store"]["get"] + update: + x-codeSamples: + - lang: csharp + label: getSchemaStoreItem + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + GetSchemaStoreItemRequestBody? req = null; + + var res = await sdk.SchemaStore.GetSchemaStoreItemAsync(req); + + // handle response + - target: $["paths"]["/v1/schema_store"]["post"] + update: + x-codeSamples: + - lang: csharp + label: createSchemaStoreItem + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + CreateSchemaStoreItemRequestBody req = new CreateSchemaStoreItemRequestBody() { + Spec = "", + PackageName = "", + SDKClassname = "", + Format = SpeakeasySDK.Models.Operations.Format.Yaml, + }; + + var res = await sdk.SchemaStore.CreateSchemaStoreItemAsync(req); + // handle response - target: $["paths"]["/v1/short_urls"]["post"] update: @@ -773,7 +995,7 @@ actions: }); CreateRequestBody req = new CreateRequestBody() { - Url = "https://probable-heating.com/", + Url = "https://exalted-heroine.org/", }; var res = await sdk.ShortURLs.CreateAsync(req); @@ -840,7 +1062,7 @@ actions: SuggestItemsRequestBody req = new SuggestItemsRequestBody() { Prompt = "", Items = new List() { - "", + "", }, }; @@ -856,7 +1078,6 @@ actions: using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - using System; var sdk = new SDK(security: new Security() { APIKey = "", @@ -867,7 +1088,7 @@ actions: RequestBody = new SuggestOpenAPIRequestBody() { Schema = new Schema() { FileName = "example.file", - Content = System.Text.Encoding.UTF8.GetBytes("0x0beEcB7cF6"), + Content = System.IO.File.ReadAllBytes("example.file"), }, }, }; @@ -920,32 +1141,14 @@ actions: Info = new OASInfo() { Title = "", Summary = "", - Description = "ugh which garrote ashamed sarong fiddle really", + Description = "strictly shyly who and than majority unit boohoo", Version = "", License = new License() {}, }, - Operations = new List() { - new OASOperation() { - Method = "", - Path = "/etc/ppp", - OperationId = "", - Description = "meanwhile via apparatus gray whether opposite what down blah", - Tags = new List() { - "", - }, - }, - }, + Operations = new List() {}, }, SuggestionType = SuggestRequestBodySuggestionType.MethodNames, - Diagnostics = new List() { - new Diagnostic() { - Message = "", - Path = new List() { - "/etc/mail", - }, - Type = "", - }, - }, + Diagnostics = new List() {}, }, }; @@ -999,13 +1202,13 @@ actions: }); Workspace req = new Workspace() { - CreatedAt = System.DateTime.Parse("2024-06-17T07:14:55.338Z"), + CreatedAt = System.DateTime.Parse("2023-11-18T13:41:10.525Z"), Id = "", Name = "", OrganizationId = "", Slug = "", - UpdatedAt = System.DateTime.Parse("2024-11-30T17:06:07.804Z"), - Verified = false, + UpdatedAt = System.DateTime.Parse("2024-11-21T08:36:32.740Z"), + Verified = true, }; var res = await sdk.Workspaces.CreateAsync(req); @@ -1025,7 +1228,7 @@ actions: APIKey = "", }); - GetWorkspaceAccessRequest req = new GetWorkspaceAccessRequest() {}; + GetWorkspaceAccessRequest? req = null; var res = await sdk.Auth.GetAccessAsync(req); @@ -1044,7 +1247,7 @@ actions: APIKey = "", }); - GetWorkspaceTargetsRequest req = new GetWorkspaceTargetsRequest() {}; + GetWorkspaceTargetsRequest? req = null; var res = await sdk.Events.GetTargetsAsync(req); @@ -1064,9 +1267,7 @@ actions: }); WorkspaceFeatureFlagRequest req = new WorkspaceFeatureFlagRequest() { - FeatureFlags = new List() { - WorkspaceFeatureFlag.SkipSchemaRegistry, - }, + FeatureFlags = new List() {}, }; var res = await sdk.Workspaces.SetFeatureFlagsAsync(req); @@ -1082,13 +1283,14 @@ actions: using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); - GetWorkspaceRequest req = new GetWorkspaceRequest() { - WorkspaceId = "", - }; + GetWorkspaceRequest req = new GetWorkspaceRequest() {}; var res = await sdk.Workspaces.GetByIDAsync(req); @@ -1104,20 +1306,22 @@ actions: using SpeakeasySDK.Models.Shared; using System; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); UpdateWorkspaceDetailsRequest req = new UpdateWorkspaceDetailsRequest() { - WorkspaceId = "", Workspace = new Workspace() { - CreatedAt = System.DateTime.Parse("2025-07-28T19:04:48.565Z"), + CreatedAt = System.DateTime.Parse("2023-08-02T22:30:24.264Z"), Id = "", Name = "", OrganizationId = "", Slug = "", - UpdatedAt = System.DateTime.Parse("2024-10-16T10:52:42.015Z"), - Verified = false, + UpdatedAt = System.DateTime.Parse("2025-01-24T03:53:13.581Z"), + Verified = true, }, }; @@ -1134,13 +1338,14 @@ actions: using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); - SearchWorkspaceEventsRequest req = new SearchWorkspaceEventsRequest() { - WorkspaceId = "", - }; + SearchWorkspaceEventsRequest req = new SearchWorkspaceEventsRequest() {}; var res = await sdk.Events.SearchAsync(req); @@ -1157,23 +1362,25 @@ actions: using System; using System.Collections.Generic; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); PostWorkspaceEventsRequest req = new PostWorkspaceEventsRequest() { - WorkspaceId = "", RequestBody = new List() { new CliEvent() { Id = "", ExecutionId = "", WorkspaceId = "", SpeakeasyApiKeyName = "", - InteractionType = InteractionType.TargetGenerate, - LocalStartedAt = System.DateTime.Parse("2025-03-02T10:07:28.113Z"), - CreatedAt = System.DateTime.Parse("2024-09-08T05:59:33.876Z"), + InteractionType = InteractionType.CiExec, + LocalStartedAt = System.DateTime.Parse("2024-12-22T21:01:06.740Z"), + CreatedAt = System.DateTime.Parse("2024-01-24T01:13:51.002Z"), SpeakeasyVersion = "", - Success = false, + Success = true, }, }, }; @@ -1191,13 +1398,14 @@ actions: using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); - GetWorkspaceTargetsDeprecatedRequest req = new GetWorkspaceTargetsDeprecatedRequest() { - WorkspaceId = "", - }; + GetWorkspaceTargetsDeprecatedRequest req = new GetWorkspaceTargetsDeprecatedRequest() {}; var res = await sdk.Events.GetTargetsDeprecatedAsync(req); @@ -1212,12 +1420,14 @@ actions: using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); GetWorkspaceEventsByTargetRequest req = new GetWorkspaceEventsByTargetRequest() { - WorkspaceId = "", TargetId = "", }; @@ -1234,13 +1444,14 @@ actions: using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); - GetWorkspaceFeatureFlagsRequest req = new GetWorkspaceFeatureFlagsRequest() { - WorkspaceId = "", - }; + GetWorkspaceFeatureFlagsRequest req = new GetWorkspaceFeatureFlagsRequest() {}; var res = await sdk.Workspaces.GetFeatureFlagsAsync(req); @@ -1255,13 +1466,14 @@ actions: using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); - GetWorkspaceSettingsRequest req = new GetWorkspaceSettingsRequest() { - WorkspaceId = "", - }; + GetWorkspaceSettingsRequest req = new GetWorkspaceSettingsRequest() {}; var res = await sdk.Workspaces.GetSettingsAsync(req); @@ -1277,17 +1489,19 @@ actions: using SpeakeasySDK.Models.Shared; using System; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); UpdateWorkspaceSettingsRequest req = new UpdateWorkspaceSettingsRequest() { - WorkspaceId = "", WorkspaceSettings = new WorkspaceSettings() { WorkspaceId = "", - WebhookUrl = "https://last-suspension.info/", - CreatedAt = System.DateTime.Parse("2024-12-28T06:46:35.807Z"), - UpdatedAt = System.DateTime.Parse("2025-02-03T10:37:56.725Z"), + WebhookUrl = "https://wicked-reboot.org", + CreatedAt = System.DateTime.Parse("2024-07-27T10:14:11.397Z"), + UpdatedAt = System.DateTime.Parse("2025-12-12T17:54:28.990Z"), }, }; @@ -1304,13 +1518,14 @@ actions: using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); - GetWorkspaceTeamRequest req = new GetWorkspaceTeamRequest() { - WorkspaceId = "", - }; + GetWorkspaceTeamRequest req = new GetWorkspaceTeamRequest() {}; var res = await sdk.Workspaces.GetTeamAsync(req); @@ -1325,13 +1540,15 @@ actions: using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); GrantUserAccessToWorkspaceRequest req = new GrantUserAccessToWorkspaceRequest() { - WorkspaceId = "", - Email = "Lucinda.Batz8@hotmail.com", + Email = "Idella24@gmail.com", }; var res = await sdk.Workspaces.GrantAccessAsync(req); @@ -1347,12 +1564,14 @@ actions: using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); RevokeUserAccessToWorkspaceRequest req = new RevokeUserAccessToWorkspaceRequest() { - WorkspaceId = "", UserId = "", }; @@ -1369,13 +1588,14 @@ actions: using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); - GetWorkspaceTokensRequest req = new GetWorkspaceTokensRequest() { - WorkspaceId = "", - }; + GetWorkspaceTokensRequest req = new GetWorkspaceTokensRequest() {}; var res = await sdk.Workspaces.GetTokensAsync(req); @@ -1391,19 +1611,21 @@ actions: using SpeakeasySDK.Models.Shared; using System; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); CreateWorkspaceTokenRequest req = new CreateWorkspaceTokenRequest() { - WorkspaceId = "", WorkspaceToken = new WorkspaceToken() { Id = "", Name = "", WorkspaceId = "", Alg = "", Key = "", - CreatedAt = System.DateTime.Parse("2023-08-16T02:33:00.784Z"), + CreatedAt = System.DateTime.Parse("2024-10-04T10:23:04.522Z"), }, }; @@ -1420,12 +1642,14 @@ actions: using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; - var sdk = new SDK(security: new Security() { - APIKey = "", - }); + var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } + ); DeleteWorkspaceTokenRequest req = new DeleteWorkspaceTokenRequest() { - WorkspaceId = "", TokenID = "", }; diff --git a/docs/Models/Operations/ArchiveNamespaceRequest.md b/docs/Models/Operations/ArchiveNamespaceRequest.md new file mode 100644 index 00000000..e631a8a9 --- /dev/null +++ b/docs/Models/Operations/ArchiveNamespaceRequest.md @@ -0,0 +1,9 @@ +# ArchiveNamespaceRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `RequestBody` | [ArchiveNamespaceRequestBody](../../Models/Operations/ArchiveNamespaceRequestBody.md) | :heavy_minus_sign: | Archived status | +| `NamespaceName` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Operations/ArchiveNamespaceRequestBody.md b/docs/Models/Operations/ArchiveNamespaceRequestBody.md new file mode 100644 index 00000000..79e11679 --- /dev/null +++ b/docs/Models/Operations/ArchiveNamespaceRequestBody.md @@ -0,0 +1,10 @@ +# ArchiveNamespaceRequestBody + +Archived status + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Archived` | *bool* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/Models/Operations/ArchiveNamespaceResponse.md b/docs/Models/Operations/ArchiveNamespaceResponse.md new file mode 100644 index 00000000..0588677a --- /dev/null +++ b/docs/Models/Operations/ArchiveNamespaceResponse.md @@ -0,0 +1,10 @@ +# ArchiveNamespaceResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/CreateBillingAddOnsResponse.md b/docs/Models/Operations/CreateBillingAddOnsResponse.md new file mode 100644 index 00000000..904b25d2 --- /dev/null +++ b/docs/Models/Operations/CreateBillingAddOnsResponse.md @@ -0,0 +1,11 @@ +# CreateBillingAddOnsResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `OrganizationBillingAddOnResponse` | [OrganizationBillingAddOnResponse](../../Models/Shared/OrganizationBillingAddOnResponse.md) | :heavy_minus_sign: | Success | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/CreatePublishingTokenRequestBody.md b/docs/Models/Operations/CreatePublishingTokenRequestBody.md new file mode 100644 index 00000000..1b8cf980 --- /dev/null +++ b/docs/Models/Operations/CreatePublishingTokenRequestBody.md @@ -0,0 +1,13 @@ +# CreatePublishingTokenRequestBody + +The publishing token to create + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `TargetId` | *string* | :heavy_check_mark: | N/A | +| `TargetResource` | *string* | :heavy_check_mark: | N/A | +| `TokenName` | *string* | :heavy_check_mark: | N/A | +| `ValidUntil` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Operations/CreatePublishingTokenResponse.md b/docs/Models/Operations/CreatePublishingTokenResponse.md new file mode 100644 index 00000000..ef8d18e1 --- /dev/null +++ b/docs/Models/Operations/CreatePublishingTokenResponse.md @@ -0,0 +1,11 @@ +# CreatePublishingTokenResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `PublishingToken` | [PublishingToken](../../Models/Shared/PublishingToken.md) | :heavy_minus_sign: | OK | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/CreateSchemaStoreItemRequestBody.md b/docs/Models/Operations/CreateSchemaStoreItemRequestBody.md new file mode 100644 index 00000000..fb894351 --- /dev/null +++ b/docs/Models/Operations/CreateSchemaStoreItemRequestBody.md @@ -0,0 +1,11 @@ +# CreateSchemaStoreItemRequestBody + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `Format` | [Models.Operations.Format](../../Models/Operations/Format.md) | :heavy_check_mark: | The format of the OpenAPI specification. | +| `PackageName` | *string* | :heavy_check_mark: | The package name to use in code snippets / quickstart. | +| `SDKClassname` | *string* | :heavy_check_mark: | The classname of the SDK to use in code snippets / quickstart. | +| `Spec` | *string* | :heavy_check_mark: | The OpenAPI specification to store. | \ No newline at end of file diff --git a/docs/Models/Operations/CreateSchemaStoreItemResponse.md b/docs/Models/Operations/CreateSchemaStoreItemResponse.md new file mode 100644 index 00000000..169f2fa7 --- /dev/null +++ b/docs/Models/Operations/CreateSchemaStoreItemResponse.md @@ -0,0 +1,11 @@ +# CreateSchemaStoreItemResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `SchemaStoreItem` | [SchemaStoreItem](../../Models/Shared/SchemaStoreItem.md) | :heavy_minus_sign: | OK | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/DeleteBillingAddOnRequest.md b/docs/Models/Operations/DeleteBillingAddOnRequest.md new file mode 100644 index 00000000..c57b957d --- /dev/null +++ b/docs/Models/Operations/DeleteBillingAddOnRequest.md @@ -0,0 +1,8 @@ +# DeleteBillingAddOnRequest + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | +| `AddOn` | [BillingAddOn](../../Models/Shared/BillingAddOn.md) | :heavy_check_mark: | The specific add-on to delete. | \ No newline at end of file diff --git a/docs/Models/Operations/DeleteBillingAddOnResponse.md b/docs/Models/Operations/DeleteBillingAddOnResponse.md new file mode 100644 index 00000000..82cbd9df --- /dev/null +++ b/docs/Models/Operations/DeleteBillingAddOnResponse.md @@ -0,0 +1,10 @@ +# DeleteBillingAddOnResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/DeletePublishingTokenRequest.md b/docs/Models/Operations/DeletePublishingTokenRequest.md new file mode 100644 index 00000000..2269b729 --- /dev/null +++ b/docs/Models/Operations/DeletePublishingTokenRequest.md @@ -0,0 +1,8 @@ +# DeletePublishingTokenRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `TokenID` | *string* | :heavy_check_mark: | Unique identifier of the publishing token. | \ No newline at end of file diff --git a/docs/Models/Operations/DeletePublishingTokenResponse.md b/docs/Models/Operations/DeletePublishingTokenResponse.md new file mode 100644 index 00000000..54cb5247 --- /dev/null +++ b/docs/Models/Operations/DeletePublishingTokenResponse.md @@ -0,0 +1,10 @@ +# DeletePublishingTokenResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/Format.md b/docs/Models/Operations/Format.md new file mode 100644 index 00000000..ddbf6464 --- /dev/null +++ b/docs/Models/Operations/Format.md @@ -0,0 +1,11 @@ +# Format + +The format of the OpenAPI specification. + + +## Values + +| Name | Value | +| ------ | ------ | +| `Json` | json | +| `Yaml` | yaml | \ No newline at end of file diff --git a/docs/Models/Operations/GenerateCodeSamplePreviewResponse.md b/docs/Models/Operations/GenerateCodeSamplePreviewResponse.md index d4cbe9b5..a22ef0d4 100644 --- a/docs/Models/Operations/GenerateCodeSamplePreviewResponse.md +++ b/docs/Models/Operations/GenerateCodeSamplePreviewResponse.md @@ -5,8 +5,7 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `TwoHundredApplicationJsonBytes` | *byte[]* | :heavy_minus_sign: | Successfully returned codeSample overlay file | -| `TwoHundredApplicationXYamlBytes` | *byte[]* | :heavy_minus_sign: | Successfully returned codeSample overlay file | | `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `UsageSnippets` | [UsageSnippets](../../Models/Shared/UsageSnippets.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/docs/Models/Operations/GetBillingAddOnsResponse.md b/docs/Models/Operations/GetBillingAddOnsResponse.md new file mode 100644 index 00000000..8484eb31 --- /dev/null +++ b/docs/Models/Operations/GetBillingAddOnsResponse.md @@ -0,0 +1,11 @@ +# GetBillingAddOnsResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `OrganizationBillingAddOnResponse` | [OrganizationBillingAddOnResponse](../../Models/Shared/OrganizationBillingAddOnResponse.md) | :heavy_minus_sign: | Success | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/GetCodeSamplePreviewAsyncResponse.md b/docs/Models/Operations/GetCodeSamplePreviewAsyncResponse.md index b967f295..e72dab96 100644 --- a/docs/Models/Operations/GetCodeSamplePreviewAsyncResponse.md +++ b/docs/Models/Operations/GetCodeSamplePreviewAsyncResponse.md @@ -5,9 +5,8 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `TwoHundredApplicationJsonBytes` | *byte[]* | :heavy_minus_sign: | Successfully returned codeSample overlay file | -| `TwoHundredApplicationXYamlBytes` | *byte[]* | :heavy_minus_sign: | Successfully returned codeSample overlay file | -| `TwoHundredAndTwoApplicationJsonObject` | [GetCodeSamplePreviewAsyncResponseBody](../../Models/Operations/GetCodeSamplePreviewAsyncResponseBody.md) | :heavy_minus_sign: | Job is still in progress | | `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `UsageSnippets` | [UsageSnippets](../../Models/Shared/UsageSnippets.md) | :heavy_minus_sign: | OK | +| `Object` | [GetCodeSamplePreviewAsyncResponseBody](../../Models/Operations/GetCodeSamplePreviewAsyncResponseBody.md) | :heavy_minus_sign: | Job is still in progress | \ No newline at end of file diff --git a/docs/Models/Operations/GetCodeSamplesRequest.md b/docs/Models/Operations/GetCodeSamplesRequest.md deleted file mode 100644 index 679b5b87..00000000 --- a/docs/Models/Operations/GetCodeSamplesRequest.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetCodeSamplesRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | -| `RegistryUrl` | *string* | :heavy_check_mark: | The registry URL from which to retrieve the snippets. E.g. https://spec.speakeasy.com/org/ws/my-source | -| `Languages` | List<*string*> | :heavy_minus_sign: | N/A | -| `OperationIds` | List<*string*> | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/Models/Operations/GetNamespacesResponse.md b/docs/Models/Operations/GetNamespacesResponse.md index 21a2f83f..5430285f 100644 --- a/docs/Models/Operations/GetNamespacesResponse.md +++ b/docs/Models/Operations/GetNamespacesResponse.md @@ -6,6 +6,6 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | | `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `GetNamespacesResponse` | [Models.Shared.GetNamespacesResponse](../../Models/Shared/GetNamespacesResponse.md) | :heavy_minus_sign: | OK | +| `GetNamespacesResponseValue` | [Models.Shared.GetNamespacesResponse](../../Models/Shared/GetNamespacesResponse.md) | :heavy_minus_sign: | OK | | `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/GetPublishingTokenByIDRequest.md b/docs/Models/Operations/GetPublishingTokenByIDRequest.md new file mode 100644 index 00000000..04349e8f --- /dev/null +++ b/docs/Models/Operations/GetPublishingTokenByIDRequest.md @@ -0,0 +1,8 @@ +# GetPublishingTokenByIDRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `TokenID` | *string* | :heavy_check_mark: | Unique identifier of the publishing token. | \ No newline at end of file diff --git a/docs/Models/Operations/GetPublishingTokenByIDResponse.md b/docs/Models/Operations/GetPublishingTokenByIDResponse.md new file mode 100644 index 00000000..8be1113f --- /dev/null +++ b/docs/Models/Operations/GetPublishingTokenByIDResponse.md @@ -0,0 +1,11 @@ +# GetPublishingTokenByIDResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `PublishingToken` | [PublishingToken](../../Models/Shared/PublishingToken.md) | :heavy_minus_sign: | OK | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/GetPublishingTokenPublicMetadataRequest.md b/docs/Models/Operations/GetPublishingTokenPublicMetadataRequest.md new file mode 100644 index 00000000..2a8ff252 --- /dev/null +++ b/docs/Models/Operations/GetPublishingTokenPublicMetadataRequest.md @@ -0,0 +1,8 @@ +# GetPublishingTokenPublicMetadataRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `TokenID` | *string* | :heavy_check_mark: | Unique identifier of the publishing token. | \ No newline at end of file diff --git a/docs/Models/Operations/GetPublishingTokenPublicMetadataResponse.md b/docs/Models/Operations/GetPublishingTokenPublicMetadataResponse.md new file mode 100644 index 00000000..499ab4f0 --- /dev/null +++ b/docs/Models/Operations/GetPublishingTokenPublicMetadataResponse.md @@ -0,0 +1,11 @@ +# GetPublishingTokenPublicMetadataResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `Object` | [GetPublishingTokenPublicMetadataResponseBody](../../Models/Operations/GetPublishingTokenPublicMetadataResponseBody.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/docs/Models/Operations/GetPublishingTokenPublicMetadataResponseBody.md b/docs/Models/Operations/GetPublishingTokenPublicMetadataResponseBody.md new file mode 100644 index 00000000..b7326464 --- /dev/null +++ b/docs/Models/Operations/GetPublishingTokenPublicMetadataResponseBody.md @@ -0,0 +1,14 @@ +# GetPublishingTokenPublicMetadataResponseBody + +OK + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `OrganizationId` | *string* | :heavy_minus_sign: | N/A | +| `TargetId` | *string* | :heavy_minus_sign: | N/A | +| `TargetResource` | *string* | :heavy_minus_sign: | N/A | +| `ValidUntil` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_minus_sign: | N/A | +| `WorkspaceId` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/Models/Operations/GetCodeSamplesResponse.md b/docs/Models/Operations/GetPublishingTokenResponse.md similarity index 92% rename from docs/Models/Operations/GetCodeSamplesResponse.md rename to docs/Models/Operations/GetPublishingTokenResponse.md index ab675241..d67a1bf3 100644 --- a/docs/Models/Operations/GetCodeSamplesResponse.md +++ b/docs/Models/Operations/GetPublishingTokenResponse.md @@ -1,4 +1,4 @@ -# GetCodeSamplesResponse +# GetPublishingTokenResponse ## Fields @@ -8,4 +8,4 @@ | `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `UsageSnippets` | [UsageSnippets](../../Models/Shared/UsageSnippets.md) | :heavy_minus_sign: | OK | \ No newline at end of file +| `Classes` | List<[PublishingToken](../../Models/Shared/PublishingToken.md)> | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/docs/Models/Operations/GetPublishingTokenTargetByIDRequest.md b/docs/Models/Operations/GetPublishingTokenTargetByIDRequest.md new file mode 100644 index 00000000..ca0835ab --- /dev/null +++ b/docs/Models/Operations/GetPublishingTokenTargetByIDRequest.md @@ -0,0 +1,8 @@ +# GetPublishingTokenTargetByIDRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `TokenID` | *string* | :heavy_check_mark: | Unique identifier of the publishing token. | \ No newline at end of file diff --git a/docs/Models/Operations/GetPublishingTokenTargetByIDResponse.md b/docs/Models/Operations/GetPublishingTokenTargetByIDResponse.md new file mode 100644 index 00000000..ad34969c --- /dev/null +++ b/docs/Models/Operations/GetPublishingTokenTargetByIDResponse.md @@ -0,0 +1,11 @@ +# GetPublishingTokenTargetByIDResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `Res` | *string* | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/docs/Models/Operations/GetRevisionsResponse.md b/docs/Models/Operations/GetRevisionsResponse.md index b6cbe3b9..a5a0adb5 100644 --- a/docs/Models/Operations/GetRevisionsResponse.md +++ b/docs/Models/Operations/GetRevisionsResponse.md @@ -6,6 +6,6 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | | `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `GetRevisionsResponse` | [Models.Shared.GetRevisionsResponse](../../Models/Shared/GetRevisionsResponse.md) | :heavy_minus_sign: | OK | +| `GetRevisionsResponseValue` | [Models.Shared.GetRevisionsResponse](../../Models/Shared/GetRevisionsResponse.md) | :heavy_minus_sign: | OK | | `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/GetSchemaStoreItemRequestBody.md b/docs/Models/Operations/GetSchemaStoreItemRequestBody.md new file mode 100644 index 00000000..657adc49 --- /dev/null +++ b/docs/Models/Operations/GetSchemaStoreItemRequestBody.md @@ -0,0 +1,8 @@ +# GetSchemaStoreItemRequestBody + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Id` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/Models/Operations/GetSchemaStoreItemResponse.md b/docs/Models/Operations/GetSchemaStoreItemResponse.md new file mode 100644 index 00000000..87b51c25 --- /dev/null +++ b/docs/Models/Operations/GetSchemaStoreItemResponse.md @@ -0,0 +1,11 @@ +# GetSchemaStoreItemResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `SchemaStoreItem` | [SchemaStoreItem](../../Models/Shared/SchemaStoreItem.md) | :heavy_minus_sign: | OK | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/GetTagsResponse.md b/docs/Models/Operations/GetTagsResponse.md index 554f95cc..9f24735a 100644 --- a/docs/Models/Operations/GetTagsResponse.md +++ b/docs/Models/Operations/GetTagsResponse.md @@ -6,6 +6,6 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | | `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `GetTagsResponse` | [Models.Shared.GetTagsResponse](../../Models/Shared/GetTagsResponse.md) | :heavy_minus_sign: | OK | +| `GetTagsResponseValue` | [Models.Shared.GetTagsResponse](../../Models/Shared/GetTagsResponse.md) | :heavy_minus_sign: | OK | | `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/GetWorkspaceEventsByTargetRequest.md b/docs/Models/Operations/GetWorkspaceEventsByTargetRequest.md index 1d5583fc..eb0cbd6b 100644 --- a/docs/Models/Operations/GetWorkspaceEventsByTargetRequest.md +++ b/docs/Models/Operations/GetWorkspaceEventsByTargetRequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | -| `TargetId` | *string* | :heavy_check_mark: | Filter to only return events corresponding to a particular gen_lock_id (gen_lock_id uniquely identifies a target) | | `AfterCreatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_minus_sign: | Filter to only return events created after this timestamp | +| `TargetId` | *string* | :heavy_check_mark: | Filter to only return events corresponding to a particular gen_lock_id (gen_lock_id uniquely identifies a target) | | `WorkspaceId` | *string* | :heavy_minus_sign: | Unique identifier of the workspace. | \ No newline at end of file diff --git a/docs/Models/Operations/GithubConfigureCodeSamplesResponse.md b/docs/Models/Operations/GithubConfigureCodeSamplesResponse.md index ee7b55bb..349e4c42 100644 --- a/docs/Models/Operations/GithubConfigureCodeSamplesResponse.md +++ b/docs/Models/Operations/GithubConfigureCodeSamplesResponse.md @@ -6,6 +6,6 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | | `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `GithubConfigureCodeSamplesResponse` | [Models.Shared.GithubConfigureCodeSamplesResponse](../../Models/Shared/GithubConfigureCodeSamplesResponse.md) | :heavy_minus_sign: | OK | +| `GithubConfigureCodeSamplesResponseValue` | [Models.Shared.GithubConfigureCodeSamplesResponse](../../Models/Shared/GithubConfigureCodeSamplesResponse.md) | :heavy_minus_sign: | OK | | `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/PostTagsRequest.md b/docs/Models/Operations/PostTagsRequest.md index d5bf446b..b48dd5fc 100644 --- a/docs/Models/Operations/PostTagsRequest.md +++ b/docs/Models/Operations/PostTagsRequest.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | -| `NamespaceName` | *string* | :heavy_check_mark: | N/A | -| `AddTags` | [AddTags](../../Models/Shared/AddTags.md) | :heavy_minus_sign: | A JSON representation of the tags to add | \ No newline at end of file +| `AddTags` | [AddTags](../../Models/Shared/AddTags.md) | :heavy_minus_sign: | A JSON representation of the tags to add | +| `NamespaceName` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Operations/SetVisibilityRequest.md b/docs/Models/Operations/SetVisibilityRequest.md index dc728016..3ad763ce 100644 --- a/docs/Models/Operations/SetVisibilityRequest.md +++ b/docs/Models/Operations/SetVisibilityRequest.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `NamespaceName` | *string* | :heavy_check_mark: | N/A | -| `RequestBody` | [SetVisibilityRequestBody](../../Models/Operations/SetVisibilityRequestBody.md) | :heavy_minus_sign: | Namespace visibility | \ No newline at end of file +| `RequestBody` | [SetVisibilityRequestBody](../../Models/Operations/SetVisibilityRequestBody.md) | :heavy_minus_sign: | Namespace visibility | +| `NamespaceName` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Operations/SuggestOpenAPIRegistryRequest.md b/docs/Models/Operations/SuggestOpenAPIRegistryRequest.md index 97212eeb..bb9a33e2 100644 --- a/docs/Models/Operations/SuggestOpenAPIRegistryRequest.md +++ b/docs/Models/Operations/SuggestOpenAPIRegistryRequest.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `SuggestRequestBody` | [SuggestRequestBody](../../Models/Shared/SuggestRequestBody.md) | :heavy_minus_sign: | Suggest options | | `NamespaceName` | *string* | :heavy_check_mark: | N/A | | `RevisionReference` | *string* | :heavy_check_mark: | Tag or digest | -| `XSessionId` | *string* | :heavy_check_mark: | N/A | -| `SuggestRequestBody` | [SuggestRequestBody](../../Models/Shared/SuggestRequestBody.md) | :heavy_minus_sign: | Suggest options | \ No newline at end of file +| `XSessionId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Operations/UpdatePublishingTokenExpirationRequest.md b/docs/Models/Operations/UpdatePublishingTokenExpirationRequest.md new file mode 100644 index 00000000..dd630299 --- /dev/null +++ b/docs/Models/Operations/UpdatePublishingTokenExpirationRequest.md @@ -0,0 +1,9 @@ +# UpdatePublishingTokenExpirationRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| `RequestBody` | [UpdatePublishingTokenExpirationRequestBody](../../Models/Operations/UpdatePublishingTokenExpirationRequestBody.md) | :heavy_minus_sign: | The publishing token to update | +| `TokenID` | *string* | :heavy_check_mark: | Unique identifier of the publishing token. | \ No newline at end of file diff --git a/docs/Models/Operations/UpdatePublishingTokenExpirationRequestBody.md b/docs/Models/Operations/UpdatePublishingTokenExpirationRequestBody.md new file mode 100644 index 00000000..69a52196 --- /dev/null +++ b/docs/Models/Operations/UpdatePublishingTokenExpirationRequestBody.md @@ -0,0 +1,11 @@ +# UpdatePublishingTokenExpirationRequestBody + +The publishing token to update + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `TokenName` | *string* | :heavy_minus_sign: | The new name for the publishing token. | +| `ValidUntil` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | The new expiration date for the publishing token. | \ No newline at end of file diff --git a/docs/Models/Operations/UpdatePublishingTokenExpirationResponse.md b/docs/Models/Operations/UpdatePublishingTokenExpirationResponse.md new file mode 100644 index 00000000..9bb34299 --- /dev/null +++ b/docs/Models/Operations/UpdatePublishingTokenExpirationResponse.md @@ -0,0 +1,10 @@ +# UpdatePublishingTokenExpirationResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-5.0) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/Models/Operations/UploadReportRequestBody.md b/docs/Models/Operations/UploadReportRequestBody.md index 45479f4c..fead3cfe 100644 --- a/docs/Models/Operations/UploadReportRequestBody.md +++ b/docs/Models/Operations/UploadReportRequestBody.md @@ -5,7 +5,7 @@ The report file to upload provided as a multipart/form-data file segment. ## Fields -| Field | Type | Required | Description | -| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | -| `Data` | [Report](../../Models/Shared/Report.md) | :heavy_check_mark: | N/A | -| `File` | [File](../../Models/Operations/File.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | +| `Data` | [Report](../../Models/Shared/Report.md) | :heavy_check_mark: | N/A | +| `File` | [Models.Operations.File](../../Models/Operations/File.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Shared/AccessToken.md b/docs/Models/Shared/AccessToken.md index bd71a9a9..22a3d963 100644 --- a/docs/Models/Shared/AccessToken.md +++ b/docs/Models/Shared/AccessToken.md @@ -7,7 +7,7 @@ An AccessToken is a token that can be used to authenticate with the Speakeasy AP | Field | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `AccessToken` | *string* | :heavy_check_mark: | N/A | +| `AccessTokenValue` | *string* | :heavy_check_mark: | N/A | | `Claims` | [Claims](../../Models/Shared/Claims.md) | :heavy_check_mark: | N/A | | `FeatureFlags` | List<[FeatureFlag](../../Models/Shared/FeatureFlag.md)> | :heavy_minus_sign: | N/A | | `User` | [AccessTokenUser](../../Models/Shared/AccessTokenUser.md) | :heavy_check_mark: | N/A | diff --git a/docs/Models/Shared/ApiKeyDetails.md b/docs/Models/Shared/ApiKeyDetails.md index 8ea0e489..e5c0b01d 100644 --- a/docs/Models/Shared/ApiKeyDetails.md +++ b/docs/Models/Shared/ApiKeyDetails.md @@ -6,6 +6,7 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | `AccountTypeV2` | [AccountType](../../Models/Shared/AccountType.md) | :heavy_check_mark: | N/A | +| `BillingAddOns` | List<[BillingAddOn](../../Models/Shared/BillingAddOn.md)> | :heavy_check_mark: | N/A | | `EnabledFeatures` | List<*string*> | :heavy_check_mark: | N/A | | ~~`FeatureFlags`~~ | List<*string*> | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | | `GenerationAccessUnlimited` | *bool* | :heavy_minus_sign: | N/A | diff --git a/docs/Models/Shared/BillingAddOn.md b/docs/Models/Shared/BillingAddOn.md new file mode 100644 index 00000000..f02a5990 --- /dev/null +++ b/docs/Models/Shared/BillingAddOn.md @@ -0,0 +1,11 @@ +# BillingAddOn + + +## Values + +| Name | Value | +| ------------------- | ------------------- | +| `Webhooks` | webhooks | +| `SDKTesting` | sdk_testing | +| `CustomCodeRegions` | custom_code_regions | +| `SnippetAi` | snippet_ai | \ No newline at end of file diff --git a/docs/Models/Shared/CliEvent.md b/docs/Models/Shared/CliEvent.md index 59461fb5..3698ca07 100644 --- a/docs/Models/Shared/CliEvent.md +++ b/docs/Models/Shared/CliEvent.md @@ -81,6 +81,7 @@ | `SpeakeasyApiKeyName` | *string* | :heavy_check_mark: | Identifier of the Speakeasy API key. | | `SpeakeasyVersion` | *string* | :heavy_check_mark: | Version of the Speakeasy CLI. | | `Success` | *bool* | :heavy_check_mark: | Indicates whether the event was successful. | +| `TestReportRaw` | *string* | :heavy_minus_sign: | The raw test report xml | | `WorkflowLockPostRaw` | *string* | :heavy_minus_sign: | Workflow lock file (post execution) | | `WorkflowLockPreRaw` | *string* | :heavy_minus_sign: | Workflow lock file (prior to execution) | | `WorkflowPostRaw` | *string* | :heavy_minus_sign: | Workflow file (post execution) | diff --git a/docs/Models/Shared/CodeSampleSchemaInput.md b/docs/Models/Shared/CodeSampleSchemaInput.md index 0253e80c..c29710b5 100644 --- a/docs/Models/Shared/CodeSampleSchemaInput.md +++ b/docs/Models/Shared/CodeSampleSchemaInput.md @@ -3,9 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `Languages` | List<*string*> | :heavy_check_mark: | A list of languages to generate code samples for | -| `SchemaFile` | [SchemaFile](../../Models/Shared/SchemaFile.md) | :heavy_check_mark: | The OpenAPI file to be uploaded | -| `PackageName` | *string* | :heavy_minus_sign: | The name of the package | -| `SDKClassName` | *string* | :heavy_minus_sign: | The SDK class name | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `Language` | *string* | :heavy_check_mark: | The language to generate code samples for | +| `OperationIds` | List<*string*> | :heavy_minus_sign: | A list of operations IDs to generate code samples for | +| `PackageName` | *string* | :heavy_minus_sign: | The name of the package | +| `SchemaFile` | [SchemaFile](../../Models/Shared/SchemaFile.md) | :heavy_check_mark: | The OpenAPI file to be uploaded | +| `SDKClassName` | *string* | :heavy_minus_sign: | The SDK class name | \ No newline at end of file diff --git a/docs/Models/Shared/FeatureFlag.md b/docs/Models/Shared/FeatureFlag.md index 465ea60b..a3c7307a 100644 --- a/docs/Models/Shared/FeatureFlag.md +++ b/docs/Models/Shared/FeatureFlag.md @@ -7,5 +7,5 @@ A feature flag is a key-value pair that can be used to enable or disable feature | Field | Type | Required | Description | | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -| `FeatureFlag` | [WorkspaceFeatureFlag](../../Models/Shared/WorkspaceFeatureFlag.md) | :heavy_check_mark: | enum value workspace feature flag | +| `FeatureFlagValue` | [WorkspaceFeatureFlag](../../Models/Shared/WorkspaceFeatureFlag.md) | :heavy_check_mark: | enum value workspace feature flag | | `TrialEndsAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/Models/Shared/Format.md b/docs/Models/Shared/Format.md new file mode 100644 index 00000000..dc66a53a --- /dev/null +++ b/docs/Models/Shared/Format.md @@ -0,0 +1,9 @@ +# Format + + +## Values + +| Name | Value | +| ------ | ------ | +| `Json` | json | +| `Yaml` | yaml | \ No newline at end of file diff --git a/docs/Models/Shared/GithubTriggerActionRequest.md b/docs/Models/Shared/GithubTriggerActionRequest.md index 72feb339..86844565 100644 --- a/docs/Models/Shared/GithubTriggerActionRequest.md +++ b/docs/Models/Shared/GithubTriggerActionRequest.md @@ -7,9 +7,9 @@ A request to trigger an action on a GitHub target | Field | Type | Required | Description | | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| `Force` | *bool* | :heavy_minus_sign: | Force an SDK generation | | `GenLockId` | *string* | :heavy_check_mark: | The generation lock ID | | `Org` | *string* | :heavy_check_mark: | The GitHub organization name | | `RepoName` | *string* | :heavy_check_mark: | The GitHub repository name | -| `Force` | *bool* | :heavy_minus_sign: | Force an SDK generation | | `SetVersion` | *string* | :heavy_minus_sign: | A version to override the SDK too in workflow dispatch | | `TargetName` | *string* | :heavy_minus_sign: | The target name for the action | \ No newline at end of file diff --git a/docs/Models/Shared/InteractionType.md b/docs/Models/Shared/InteractionType.md index 8acd51a2..1f503a9f 100644 --- a/docs/Models/Shared/InteractionType.md +++ b/docs/Models/Shared/InteractionType.md @@ -17,4 +17,5 @@ Type of interaction. | `Quickstart` | QUICKSTART | | `Run` | RUN | | `Configure` | CONFIGURE | -| `Publish` | PUBLISH | \ No newline at end of file +| `Publish` | PUBLISH | +| `Test` | TEST | \ No newline at end of file diff --git a/docs/Models/Shared/Namespace.md b/docs/Models/Shared/Namespace.md index 1741b841..b42d60ec 100644 --- a/docs/Models/Shared/Namespace.md +++ b/docs/Models/Shared/Namespace.md @@ -7,9 +7,11 @@ A namespace contains many revisions. | Field | Type | Required | Description | | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `ArchivedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_minus_sign: | N/A | | `CompositeSpecMetadata` | [CompositeSpecMetadata](../../Models/Shared/CompositeSpecMetadata.md) | :heavy_minus_sign: | N/A | | `CreatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | | `Id` | *string* | :heavy_check_mark: | {organization_slug}/{workspace_slug}/{namespace_name} | +| `LatestRevisionMetadata` | [RevisionContentsMetadata](../../Models/Shared/RevisionContentsMetadata.md) | :heavy_minus_sign: | N/A | | `Name` | *string* | :heavy_check_mark: | A human-readable name for the namespace. | | `Public` | *bool* | :heavy_minus_sign: | Indicates whether the namespace is publicly accessible | | `UpdatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Shared/Organization.md b/docs/Models/Shared/Organization.md index d981ebad..68a8f7b4 100644 --- a/docs/Models/Shared/Organization.md +++ b/docs/Models/Shared/Organization.md @@ -9,12 +9,12 @@ A speakeasy organization | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `AccountType` | [AccountType](../../Models/Shared/AccountType.md) | :heavy_check_mark: | N/A | | `CreatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | +| `FreeTrialExpiry` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_minus_sign: | N/A | | `Id` | *string* | :heavy_check_mark: | N/A | +| `Internal` | *bool* | :heavy_minus_sign: | N/A | | `Name` | *string* | :heavy_check_mark: | N/A | | `Slug` | *string* | :heavy_check_mark: | N/A | | `SsoActivated` | *bool* | :heavy_check_mark: | N/A | +| `SsoConnectionId` | *string* | :heavy_minus_sign: | N/A | | `TelemetryDisabled` | *bool* | :heavy_check_mark: | N/A | -| `UpdatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | -| `FreeTrialExpiry` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_minus_sign: | N/A | -| `Internal` | *bool* | :heavy_minus_sign: | N/A | -| `SsoConnectionId` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `UpdatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Shared/OrganizationBillingAddOnRequest.md b/docs/Models/Shared/OrganizationBillingAddOnRequest.md new file mode 100644 index 00000000..4cb7e621 --- /dev/null +++ b/docs/Models/Shared/OrganizationBillingAddOnRequest.md @@ -0,0 +1,10 @@ +# OrganizationBillingAddOnRequest + +A request to add billing add ons + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | +| `AddOns` | List<[BillingAddOn](../../Models/Shared/BillingAddOn.md)> | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Shared/OrganizationBillingAddOnResponse.md b/docs/Models/Shared/OrganizationBillingAddOnResponse.md new file mode 100644 index 00000000..d51fcf17 --- /dev/null +++ b/docs/Models/Shared/OrganizationBillingAddOnResponse.md @@ -0,0 +1,10 @@ +# OrganizationBillingAddOnResponse + +Billing add on response + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | +| `AddOns` | List<[BillingAddOn](../../Models/Shared/BillingAddOn.md)> | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Shared/PublishingToken.md b/docs/Models/Shared/PublishingToken.md new file mode 100644 index 00000000..fcc9a1e5 --- /dev/null +++ b/docs/Models/Shared/PublishingToken.md @@ -0,0 +1,21 @@ +# PublishingToken + +A token used to publish to a target + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `CreatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | +| `CreatedBy` | *string* | :heavy_check_mark: | N/A | +| `Id` | *string* | :heavy_check_mark: | N/A | +| `OrganizationId` | *string* | :heavy_check_mark: | N/A | +| `TargetId` | *string* | :heavy_check_mark: | N/A | +| `TargetResource` | [TargetResource](../../Models/Shared/TargetResource.md) | :heavy_check_mark: | N/A | +| `Token` | *string* | :heavy_check_mark: | N/A | +| `TokenName` | *string* | :heavy_check_mark: | N/A | +| `UpdatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_minus_sign: | N/A | +| `UpdatedBy` | *string* | :heavy_minus_sign: | N/A | +| `ValidUntil` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | +| `WorkspaceId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Shared/Revision.md b/docs/Models/Shared/Revision.md index adeb8407..030fd435 100644 --- a/docs/Models/Shared/Revision.md +++ b/docs/Models/Shared/Revision.md @@ -5,6 +5,7 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `ContentsMetadata` | [RevisionContentsMetadata](../../Models/Shared/RevisionContentsMetadata.md) | :heavy_minus_sign: | N/A | | | `CreatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | | | `Digest` | *string* | :heavy_check_mark: | N/A | sha256:6d1ef012b5674ad8a127ecfa9b5e6f5178d171b90ee462846974177fd9bdd39f | | `Id` | *string* | :heavy_check_mark: | Format {namespace_id}/{revision_digest} | | diff --git a/docs/Models/Shared/RevisionContentsMetadata.md b/docs/Models/Shared/RevisionContentsMetadata.md new file mode 100644 index 00000000..2169b106 --- /dev/null +++ b/docs/Models/Shared/RevisionContentsMetadata.md @@ -0,0 +1,20 @@ +# RevisionContentsMetadata + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ContainsCodeSamples` | *bool* | :heavy_check_mark: | Whether the OAS contains code samples. | +| `CreatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | +| `Description` | *string* | :heavy_check_mark: | The OAS description | +| `Hash` | *string* | :heavy_check_mark: | The hash of the contents | +| `Namespace` | *string* | :heavy_check_mark: | The fully qualified namespace | +| `NumOverlayActions` | *long* | :heavy_check_mark: | The number of overlay actions in the OAS. Will be 0 if the OAS is not an overlay. | +| `OperationIds` | List<*string*> | :heavy_check_mark: | The operation IDs contained in the OAS. Will be empty if the OAS is an overlay. | +| `RevisionDigest` | *string* | :heavy_check_mark: | The digest of the parent bundle | +| `Tags` | List<*string*> | :heavy_check_mark: | The tags contained in the OAS -- NOT the OCI tags. Will be empty if the OAS is an overlay. | +| `Title` | *string* | :heavy_check_mark: | The OAS title | +| `Type` | [RevisionContentsMetadataType](../../Models/Shared/RevisionContentsMetadataType.md) | :heavy_check_mark: | N/A | +| `Version` | *string* | :heavy_check_mark: | The OAS version | +| `WorkspaceId` | *string* | :heavy_check_mark: | The workspace ID | \ No newline at end of file diff --git a/docs/Models/Shared/RevisionContentsMetadataType.md b/docs/Models/Shared/RevisionContentsMetadataType.md new file mode 100644 index 00000000..1b3b6020 --- /dev/null +++ b/docs/Models/Shared/RevisionContentsMetadataType.md @@ -0,0 +1,9 @@ +# RevisionContentsMetadataType + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `OpenapiBundle` | OPENAPI_BUNDLE | +| `OpenapiOverlay` | OPENAPI_OVERLAY | \ No newline at end of file diff --git a/docs/Models/Shared/SchemaStoreItem.md b/docs/Models/Shared/SchemaStoreItem.md new file mode 100644 index 00000000..443f13e8 --- /dev/null +++ b/docs/Models/Shared/SchemaStoreItem.md @@ -0,0 +1,13 @@ +# SchemaStoreItem + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `CreatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | +| `Format` | [Models.Shared.Format](../../Models/Shared/Format.md) | :heavy_check_mark: | N/A | +| `Id` | *string* | :heavy_check_mark: | N/A | +| `PackageName` | *string* | :heavy_check_mark: | N/A | +| `SDKClassname` | *string* | :heavy_check_mark: | N/A | +| `Spec` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Shared/TargetResource.md b/docs/Models/Shared/TargetResource.md new file mode 100644 index 00000000..c0e0116c --- /dev/null +++ b/docs/Models/Shared/TargetResource.md @@ -0,0 +1,8 @@ +# TargetResource + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `Document` | document | \ No newline at end of file diff --git a/docs/Models/Shared/UsageSnippet.md b/docs/Models/Shared/UsageSnippet.md index c75a9015..3acfd939 100644 --- a/docs/Models/Shared/UsageSnippet.md +++ b/docs/Models/Shared/UsageSnippet.md @@ -7,4 +7,6 @@ | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | | `Code` | *string* | :heavy_check_mark: | The code snippet | | `Language` | *string* | :heavy_check_mark: | The language of the snippet | -| `OperationId` | *string* | :heavy_check_mark: | The operation ID for the snippet | \ No newline at end of file +| `Method` | *object* | :heavy_check_mark: | The HTTP method of the operation | +| `OperationId` | *string* | :heavy_check_mark: | The operation ID for the snippet | +| `Path` | *string* | :heavy_check_mark: | The path of the operation | \ No newline at end of file diff --git a/docs/Models/Shared/User.md b/docs/Models/Shared/User.md index 0f8eb716..56257cea 100644 --- a/docs/Models/Shared/User.md +++ b/docs/Models/Shared/User.md @@ -13,9 +13,11 @@ | `Email` | *string* | :heavy_check_mark: | Email address of the user. | | `EmailVerified` | *bool* | :heavy_check_mark: | Indicates whether the email address has been verified. | | `GithubHandle` | *string* | :heavy_minus_sign: | GitHub handle of the user. | +| `HasCreatedApiKey` | *bool* | :heavy_minus_sign: | Indicates whether the user has created an API key. Not always populated | | `Id` | *string* | :heavy_check_mark: | Unique identifier for the user. | | `Internal` | *bool* | :heavy_minus_sign: | Indicates whether the user is internal. | | `LastLoginAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_minus_sign: | Timestamp of the last login. | | `PhotoUrl` | *string* | :heavy_minus_sign: | URL of the user's photo. | +| `PylonIdentityHash` | *string* | :heavy_minus_sign: | Hash used for pylon identity verification returned on v1/user. | | `UpdatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | Timestamp of the user's last update. | | `Whitelisted` | *bool* | :heavy_check_mark: | Indicates whether the user has been whitelisted. | \ No newline at end of file diff --git a/docs/Models/Shared/Workspace.md b/docs/Models/Shared/Workspace.md index fd474e40..5e9f6ba6 100644 --- a/docs/Models/Shared/Workspace.md +++ b/docs/Models/Shared/Workspace.md @@ -9,10 +9,10 @@ A speakeasy workspace | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CreatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | | `Id` | *string* | :heavy_check_mark: | N/A | +| `Inactive` | *bool* | :heavy_minus_sign: | N/A | | `Name` | *string* | :heavy_check_mark: | N/A | | `OrganizationId` | *string* | :heavy_check_mark: | N/A | | `Slug` | *string* | :heavy_check_mark: | N/A | +| ~~`TelemetryDisabled`~~ | *bool* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use organization.telemetry_disabled instead. | | `UpdatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | -| `Verified` | *bool* | :heavy_check_mark: | N/A | -| `Inactive` | *bool* | :heavy_minus_sign: | N/A | -| ~~`TelemetryDisabled`~~ | *bool* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use organization.telemetry_disabled instead. | \ No newline at end of file +| `Verified` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Shared/WorkspaceToken.md b/docs/Models/Shared/WorkspaceToken.md index f4748c81..2562449c 100644 --- a/docs/Models/Shared/WorkspaceToken.md +++ b/docs/Models/Shared/WorkspaceToken.md @@ -10,6 +10,8 @@ A workspace token | `Alg` | *string* | :heavy_check_mark: | N/A | | `CreatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | N/A | | `CreatedBy` | *string* | :heavy_minus_sign: | N/A | +| `CreatedByName` | *string* | :heavy_minus_sign: | N/A | +| `CreatedByPhotoUrl` | *string* | :heavy_minus_sign: | N/A | | `Email` | *string* | :heavy_minus_sign: | N/A | | `Id` | *string* | :heavy_check_mark: | N/A | | `Key` | *string* | :heavy_check_mark: | N/A | diff --git a/docs/sdks/artifacts/README.md b/docs/sdks/artifacts/README.md index 9291801c..132f7fe7 100644 --- a/docs/sdks/artifacts/README.md +++ b/docs/sdks/artifacts/README.md @@ -16,6 +16,7 @@ REST APIs for working with Registry artifacts * [ListRemoteSources](#listremotesources) - Get remote sources attached to a particular namespace * [PostTags](#posttags) - Add tags to an existing revision * [Preflight](#preflight) - Get access token for communicating with OCI distribution endpoints +* [SetArchived](#setarchived) - Set whether a namespace is archived * [SetVisibility](#setvisibility) - Set visibility of a namespace with an existing metadata entry ## CreateRemoteSource @@ -24,25 +25,16 @@ Configure a new remote source ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", }); -RemoteSource req = new RemoteSource() { - Inputs = new List() { - new RemoteDocument() { - RegistryUrl = "https://productive-swine.net", - }, - }, - Output = new RemoteDocument() { - RegistryUrl = "https://spiteful-apricot.info", - }, -}; +RemoteSource? req = null; var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); @@ -72,6 +64,7 @@ Get blob for a particular digest ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -116,6 +109,7 @@ Get manifest for a particular reference ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -160,6 +154,7 @@ Each namespace contains many revisions. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -188,6 +183,7 @@ var res = await sdk.Artifacts.GetNamespacesAsync(); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -227,6 +223,7 @@ var res = await sdk.Artifacts.GetRevisionsAsync(req); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -268,6 +265,7 @@ Get remote sources attached to a particular namespace ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -309,6 +307,7 @@ Add tags to an existing revision ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -350,6 +349,7 @@ Get access token for communicating with OCI distribution endpoints ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -358,9 +358,7 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -PreflightRequest req = new PreflightRequest() { - NamespaceName = "", -}; +PreflightRequest? req = null; var res = await sdk.Artifacts.PreflightAsync(req); @@ -384,12 +382,55 @@ var res = await sdk.Artifacts.PreflightAsync(req); | SpeakeasySDK.Models.Errors.Error | 4XX | application/json | | SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | +## SetArchived + +Set whether a namespace is archived + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Operations; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +ArchiveNamespaceRequest req = new ArchiveNamespaceRequest() { + NamespaceName = "", +}; + +var res = await sdk.Artifacts.SetArchivedAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `request` | [ArchiveNamespaceRequest](../../Models/Operations/ArchiveNamespaceRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[ArchiveNamespaceResponse](../../Models/Operations/ArchiveNamespaceResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | + ## SetVisibility Set visibility of a namespace with an existing metadata entry ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; diff --git a/docs/sdks/auth/README.md b/docs/sdks/auth/README.md index edbde9f6..a6d16142 100644 --- a/docs/sdks/auth/README.md +++ b/docs/sdks/auth/README.md @@ -18,6 +18,7 @@ Checks if generation is permitted for a particular run of the CLI ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -27,7 +28,7 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -GetWorkspaceAccessRequest req = new GetWorkspaceAccessRequest() {}; +GetWorkspaceAccessRequest? req = null; var res = await sdk.Auth.GetAccessAsync(req); @@ -56,6 +57,7 @@ Get or refresh an access token for the current workspace. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -94,6 +96,7 @@ Get information about the current user. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -124,6 +127,7 @@ Validate the current api key. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; diff --git a/docs/sdks/codesamples/README.md b/docs/sdks/codesamples/README.md index f814ab3a..d67e4f21 100644 --- a/docs/sdks/codesamples/README.md +++ b/docs/sdks/codesamples/README.md @@ -9,7 +9,6 @@ REST APIs for retrieving Code Samples * [GenerateCodeSamplePreview](#generatecodesamplepreview) - Generate Code Sample previews from a file and configuration parameters. * [GenerateCodeSamplePreviewAsync](#generatecodesamplepreviewasync) - Initiate asynchronous Code Sample preview generation from a file and configuration parameters, receiving an async JobID response for polling. -* [Get](#get) - Retrieve usage snippets from document stored in the registry * [GetCodeSamplePreviewAsync](#getcodesamplepreviewasync) - Poll for the result of an asynchronous Code Sample preview generation. ## GenerateCodeSamplePreview @@ -18,22 +17,19 @@ This endpoint generates Code Sample previews from a file and configuration param ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System; -using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", }); CodeSampleSchemaInput req = new CodeSampleSchemaInput() { - Languages = new List() { - "", - }, + Language = "", SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), + Content = System.IO.File.ReadAllBytes("example.file"), FileName = "example.file", }, }; @@ -57,7 +53,8 @@ var res = await sdk.CodeSamples.GenerateCodeSamplePreviewAsync(req); | Error Type | Status Code | Content Type | | -------------------------------- | -------------------------------- | -------------------------------- | -| SpeakeasySDK.Models.Errors.Error | 4XX, 5XX | application/json | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.Error | 5XX | application/json | ## GenerateCodeSamplePreviewAsync @@ -65,22 +62,19 @@ This endpoint generates Code Sample previews from a file and configuration param ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System; -using System.Collections.Generic; var sdk = new SDK(security: new Security() { APIKey = "", }); CodeSampleSchemaInput req = new CodeSampleSchemaInput() { - Languages = new List() { - "", - }, + Language = "", SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xED5CDd177E"), + Content = System.IO.File.ReadAllBytes("example.file"), FileName = "example.file", }, }; @@ -104,48 +98,8 @@ var res = await sdk.CodeSamples.GenerateCodeSamplePreviewAsyncAsync(req); | Error Type | Status Code | Content Type | | -------------------------------- | -------------------------------- | -------------------------------- | -| SpeakeasySDK.Models.Errors.Error | 4XX, 5XX | application/json | - -## Get - -Retrieve usage snippets from document stored in the registry. Supports filtering by language and operation ID. - -### Example Usage - -```csharp -using SpeakeasySDK; -using SpeakeasySDK.Models.Operations; -using SpeakeasySDK.Models.Shared; - -var sdk = new SDK(security: new Security() { - APIKey = "", -}); - -GetCodeSamplesRequest req = new GetCodeSamplesRequest() { - RegistryUrl = "https://normal-making.name", -}; - -var res = await sdk.CodeSamples.GetAsync(req); - -// handle response -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `request` | [GetCodeSamplesRequest](../../Models/Operations/GetCodeSamplesRequest.md) | :heavy_check_mark: | The request object to use for the request. | - -### Response - -**[GetCodeSamplesResponse](../../Models/Operations/GetCodeSamplesResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| --------------------------------------- | --------------------------------------- | --------------------------------------- | -| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | -| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.Error | 5XX | application/json | ## GetCodeSamplePreviewAsync @@ -153,6 +107,7 @@ Poll for the result of an asynchronous Code Sample preview generation. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -185,4 +140,5 @@ var res = await sdk.CodeSamples.GetCodeSamplePreviewAsyncAsync(req); | Error Type | Status Code | Content Type | | -------------------------------- | -------------------------------- | -------------------------------- | -| SpeakeasySDK.Models.Errors.Error | 4XX, 5XX | application/json | \ No newline at end of file +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.Error | 5XX | application/json | \ No newline at end of file diff --git a/docs/sdks/events/README.md b/docs/sdks/events/README.md index b0945553..787b0227 100644 --- a/docs/sdks/events/README.md +++ b/docs/sdks/events/README.md @@ -19,18 +19,21 @@ Load recent events for a particular workspace ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); GetWorkspaceEventsByTargetRequest req = new GetWorkspaceEventsByTargetRequest() { TargetId = "", - WorkspaceId = "", }; var res = await sdk.Events.GetEventsByTargetAsync(req); @@ -61,6 +64,7 @@ Load targets for a particular workspace ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -70,7 +74,7 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -GetWorkspaceTargetsRequest req = new GetWorkspaceTargetsRequest() {}; +GetWorkspaceTargetsRequest? req = null; var res = await sdk.Events.GetTargetsAsync(req); @@ -100,18 +104,20 @@ Load targets for a particular workspace ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); -GetWorkspaceTargetsDeprecatedRequest req = new GetWorkspaceTargetsDeprecatedRequest() { - WorkspaceId = "", -}; +GetWorkspaceTargetsDeprecatedRequest req = new GetWorkspaceTargetsDeprecatedRequest() {}; var res = await sdk.Events.GetTargetsDeprecatedAsync(req); @@ -141,6 +147,7 @@ Sends an array of events to be stored for a particular workspace. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -148,25 +155,27 @@ using SpeakeasySDK.Models.Shared; using System; using System.Collections.Generic; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); PostWorkspaceEventsRequest req = new PostWorkspaceEventsRequest() { RequestBody = new List() { new CliEvent() { - CreatedAt = System.DateTime.Parse("2024-05-07T03:24:39.583Z"), + CreatedAt = System.DateTime.Parse("2023-02-16T09:12:42.397Z"), ExecutionId = "", Id = "", InteractionType = InteractionType.Quickstart, - LocalStartedAt = System.DateTime.Parse("2024-09-08T05:59:33.876Z"), + LocalStartedAt = System.DateTime.Parse("2024-01-24T01:13:51.002Z"), SpeakeasyApiKeyName = "", SpeakeasyVersion = "", - Success = false, + Success = true, WorkspaceId = "", }, }, - WorkspaceId = "", }; var res = await sdk.Events.PostAsync(req); @@ -197,18 +206,20 @@ Search events for a particular workspace by any field ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); -SearchWorkspaceEventsRequest req = new SearchWorkspaceEventsRequest() { - WorkspaceId = "", -}; +SearchWorkspaceEventsRequest req = new SearchWorkspaceEventsRequest() {}; var res = await sdk.Events.SearchAsync(req); diff --git a/docs/sdks/github/README.md b/docs/sdks/github/README.md index 44955281..f17c7334 100644 --- a/docs/sdks/github/README.md +++ b/docs/sdks/github/README.md @@ -23,6 +23,7 @@ REST APIs for managing the github integration ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -63,6 +64,7 @@ var res = await sdk.Github.CheckAccessAsync(req); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -104,6 +106,7 @@ var res = await sdk.Github.CheckPublishingPRsAsync(req); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -143,6 +146,7 @@ var res = await sdk.Github.CheckPublishingSecretsAsync(req); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -183,6 +187,7 @@ var res = await sdk.Github.ConfigureCodeSamplesAsync(req); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -196,7 +201,7 @@ GithubConfigureMintlifyRepoRequest req = new GithubConfigureMintlifyRepoRequest( Input = "", Org = "", Overlays = new List() { - "", + "", }, Repo = "", }; @@ -227,6 +232,7 @@ var res = await sdk.Github.ConfigureMintlifyRepoAsync(req); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -266,6 +272,7 @@ var res = await sdk.Github.ConfigureTargetAsync(req); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -306,6 +313,7 @@ var res = await sdk.Github.GetActionAsync(req); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -347,6 +355,7 @@ var res = await sdk.Github.GetSetupAsync(req); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -356,7 +365,7 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -LinkGithubAccessRequest req = new LinkGithubAccessRequest() {}; +LinkGithubAccessRequest? req = null; var res = await sdk.Github.LinkGithubAsync(req); @@ -384,6 +393,7 @@ var res = await sdk.Github.LinkGithubAsync(req); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -422,6 +432,7 @@ var res = await sdk.Github.StorePublishingSecretsAsync(req); ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; diff --git a/docs/sdks/organizations/README.md b/docs/sdks/organizations/README.md index d5394d19..de053c8a 100644 --- a/docs/sdks/organizations/README.md +++ b/docs/sdks/organizations/README.md @@ -8,9 +8,12 @@ REST APIs for managing Organizations (speakeasy L1 Tenancy construct) ### Available Operations * [Create](#create) - Create an organization +* [CreateBillingAddOns](#createbillingaddons) - Create billing add ons * [CreateFreeTrial](#createfreetrial) - Create a free trial for an organization +* [DeleteBillingAddOn](#deletebillingaddon) - Delete billing add ons * [Get](#get) - Get organization * [GetAll](#getall) - Get organizations for a user +* [GetBillingAddOns](#getbillingaddons) - Get billing add ons * [GetUsage](#getusage) - Get billing usage summary for a particular organization ## Create @@ -19,6 +22,7 @@ Creates an organization ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -30,13 +34,13 @@ var sdk = new SDK(security: new Security() { Organization req = new Organization() { AccountType = AccountType.ScaleUp, - CreatedAt = System.DateTime.Parse("2024-11-30T17:06:07.804Z"), + CreatedAt = System.DateTime.Parse("2025-10-26T09:05:00.560Z"), Id = "", Name = "", Slug = "", SsoActivated = false, TelemetryDisabled = false, - UpdatedAt = System.DateTime.Parse("2024-04-02T12:48:32.253Z"), + UpdatedAt = System.DateTime.Parse("2023-12-23T08:00:51.380Z"), }; var res = await sdk.Organizations.CreateAsync(req); @@ -61,12 +65,57 @@ var res = await sdk.Organizations.CreateAsync(req); | SpeakeasySDK.Models.Errors.Error | 4XX | application/json | | SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | +## CreateBillingAddOns + +Create billing add ons + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Shared; +using System.Collections.Generic; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +OrganizationBillingAddOnRequest req = new OrganizationBillingAddOnRequest() { + AddOns = new List() { + BillingAddOn.CustomCodeRegions, + }, +}; + +var res = await sdk.Organizations.CreateBillingAddOnsAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `request` | [OrganizationBillingAddOnRequest](../../Models/Shared/OrganizationBillingAddOnRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[CreateBillingAddOnsResponse](../../Models/Operations/CreateBillingAddOnsResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 5XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 4XX | \*/\* | + ## CreateFreeTrial Creates a free trial for an organization ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -91,12 +140,55 @@ var res = await sdk.Organizations.CreateFreeTrialAsync(); | SpeakeasySDK.Models.Errors.Error | 4XX | application/json | | SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | +## DeleteBillingAddOn + +Delete billing add ons + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Operations; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +DeleteBillingAddOnRequest req = new DeleteBillingAddOnRequest() { + AddOn = BillingAddOn.SDKTesting, +}; + +var res = await sdk.Organizations.DeleteBillingAddOnAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `request` | [DeleteBillingAddOnRequest](../../Models/Operations/DeleteBillingAddOnRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[DeleteBillingAddOnResponse](../../Models/Operations/DeleteBillingAddOnResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 5XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 4XX | \*/\* | + ## Get Get information about a particular organization. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -138,6 +230,7 @@ Returns a list of organizations a user has access too ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -162,12 +255,44 @@ var res = await sdk.Organizations.GetAllAsync(); | SpeakeasySDK.Models.Errors.Error | 4XX | application/json | | SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | +## GetBillingAddOns + +Get billing add ons + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +var res = await sdk.Organizations.GetBillingAddOnsAsync(); + +// handle response +``` + +### Response + +**[GetBillingAddOnsResponse](../../Models/Operations/GetBillingAddOnsResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 5XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 4XX | \*/\* | + ## GetUsage Returns a billing usage summary by target languages for a particular organization ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; diff --git a/docs/sdks/publishingtokens/README.md b/docs/sdks/publishingtokens/README.md new file mode 100644 index 00000000..13c3a623 --- /dev/null +++ b/docs/sdks/publishingtokens/README.md @@ -0,0 +1,295 @@ +# PublishingTokens +(*PublishingTokens*) + +## Overview + +### Available Operations + +* [Create](#create) - Create a publishing token for a workspace +* [Delete](#delete) - Delete a specific publishing token +* [Get](#get) - Get a specific publishing token +* [List](#list) - Get publishing tokens for a workspace +* [ResolveMetadata](#resolvemetadata) - Get metadata about the token +* [ResolveTarget](#resolvetarget) - Get a specific publishing token target +* [Update](#update) - Updates the validitity period of a publishing token + +## Create + +Creates a publishing token for the current workspace + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Operations; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +CreatePublishingTokenRequestBody? req = null; + +var res = await sdk.PublishingTokens.CreateAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `request` | [CreatePublishingTokenRequestBody](../../Models/Operations/CreatePublishingTokenRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[CreatePublishingTokenResponse](../../Models/Operations/CreatePublishingTokenResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | + +## Delete + +Delete a particular publishing token. + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Operations; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +DeletePublishingTokenRequest req = new DeletePublishingTokenRequest() { + TokenID = "", +}; + +var res = await sdk.PublishingTokens.DeleteAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `request` | [DeletePublishingTokenRequest](../../Models/Operations/DeletePublishingTokenRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[DeletePublishingTokenResponse](../../Models/Operations/DeletePublishingTokenResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | + +## Get + +Get information about a particular publishing token. + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Operations; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +GetPublishingTokenByIDRequest req = new GetPublishingTokenByIDRequest() { + TokenID = "", +}; + +var res = await sdk.PublishingTokens.GetAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `request` | [GetPublishingTokenByIDRequest](../../Models/Operations/GetPublishingTokenByIDRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[GetPublishingTokenByIDResponse](../../Models/Operations/GetPublishingTokenByIDResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | + +## List + +Returns a publishing token for the current workspace + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +var res = await sdk.PublishingTokens.ListAsync(); + +// handle response +``` + +### Response + +**[GetPublishingTokenResponse](../../Models/Operations/GetPublishingTokenResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | + +## ResolveMetadata + +Get information about a particular publishing token. + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Operations; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +GetPublishingTokenPublicMetadataRequest req = new GetPublishingTokenPublicMetadataRequest() { + TokenID = "", +}; + +var res = await sdk.PublishingTokens.ResolveMetadataAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | +| `request` | [GetPublishingTokenPublicMetadataRequest](../../Models/Operations/GetPublishingTokenPublicMetadataRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[GetPublishingTokenPublicMetadataResponse](../../Models/Operations/GetPublishingTokenPublicMetadataResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | + +## ResolveTarget + +Get information about a particular publishing token target. + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Operations; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +GetPublishingTokenTargetByIDRequest req = new GetPublishingTokenTargetByIDRequest() { + TokenID = "", +}; + +var res = await sdk.PublishingTokens.ResolveTargetAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `request` | [GetPublishingTokenTargetByIDRequest](../../Models/Operations/GetPublishingTokenTargetByIDRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[GetPublishingTokenTargetByIDResponse](../../Models/Operations/GetPublishingTokenTargetByIDResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | + +## Update + +Updates the validity period of a particular publishing token. + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Operations; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +UpdatePublishingTokenExpirationRequest req = new UpdatePublishingTokenExpirationRequest() { + TokenID = "", +}; + +var res = await sdk.PublishingTokens.UpdateAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `request` | [UpdatePublishingTokenExpirationRequest](../../Models/Operations/UpdatePublishingTokenExpirationRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[UpdatePublishingTokenExpirationResponse](../../Models/Operations/UpdatePublishingTokenExpirationResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/reports/README.md b/docs/sdks/reports/README.md index 8100b46c..f549950e 100644 --- a/docs/sdks/reports/README.md +++ b/docs/sdks/reports/README.md @@ -17,6 +17,7 @@ Get the signed access url for the change reports for a particular document. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -57,6 +58,7 @@ Get the signed access url for the linting reports for a particular document. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -97,11 +99,11 @@ Upload a report. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -using System; var sdk = new SDK(security: new Security() { APIKey = "", @@ -109,8 +111,8 @@ var sdk = new SDK(security: new Security() { UploadReportRequestBody req = new UploadReportRequestBody() { Data = new Report() {}, - File = new File() { - Content = System.Text.Encoding.UTF8.GetBytes("0xA2Ca85EFA5"), + File = new SpeakeasySDK.Models.Operations.File() { + Content = System.IO.File.ReadAllBytes("example.file"), FileName = "example.file", }, }; diff --git a/docs/sdks/schemastore/README.md b/docs/sdks/schemastore/README.md new file mode 100644 index 00000000..7504b6d5 --- /dev/null +++ b/docs/sdks/schemastore/README.md @@ -0,0 +1,94 @@ +# SchemaStore +(*SchemaStore*) + +## Overview + +### Available Operations + +* [CreateSchemaStoreItem](#createschemastoreitem) - Create a schema in the schema store +* [GetSchemaStoreItem](#getschemastoreitem) - Get a OAS schema from the schema store + +## CreateSchemaStoreItem + +Create a schema in the schema store + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Operations; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +CreateSchemaStoreItemRequestBody req = new CreateSchemaStoreItemRequestBody() { + Format = SpeakeasySDK.Models.Operations.Format.Yaml, + PackageName = "", + SDKClassname = "", + Spec = "", +}; + +var res = await sdk.SchemaStore.CreateSchemaStoreItemAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `request` | [CreateSchemaStoreItemRequestBody](../../Models/Operations/CreateSchemaStoreItemRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[CreateSchemaStoreItemResponse](../../Models/Operations/CreateSchemaStoreItemResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | + +## GetSchemaStoreItem + +Get a OAS schema from the schema store + +### Example Usage + + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Operations; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +GetSchemaStoreItemRequestBody? req = null; + +var res = await sdk.SchemaStore.GetSchemaStoreItemAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `request` | [GetSchemaStoreItemRequestBody](../../Models/Operations/GetSchemaStoreItemRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[GetSchemaStoreItemResponse](../../Models/Operations/GetSchemaStoreItemResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/shorturls/README.md b/docs/sdks/shorturls/README.md index 5ae572ca..578c5495 100644 --- a/docs/sdks/shorturls/README.md +++ b/docs/sdks/shorturls/README.md @@ -15,6 +15,7 @@ Shorten a URL. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -25,7 +26,7 @@ var sdk = new SDK(security: new Security() { }); CreateRequestBody req = new CreateRequestBody() { - Url = "https://probable-heating.com/", + Url = "https://exalted-heroine.org/", }; var res = await sdk.ShortURLs.CreateAsync(req); diff --git a/docs/sdks/subscriptions/README.md b/docs/sdks/subscriptions/README.md index 6bc31df0..fec9fc76 100644 --- a/docs/sdks/subscriptions/README.md +++ b/docs/sdks/subscriptions/README.md @@ -16,6 +16,7 @@ Activate an ignored namespace for a subscription ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -58,6 +59,7 @@ Ignored a namespace for a subscription ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; diff --git a/docs/sdks/suggest/README.md b/docs/sdks/suggest/README.md index 78a3731c..f38c1528 100644 --- a/docs/sdks/suggest/README.md +++ b/docs/sdks/suggest/README.md @@ -18,6 +18,7 @@ Get suggestions from an LLM model for improving an OpenAPI document. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; @@ -34,14 +35,14 @@ SuggestRequest req = new SuggestRequest() { new Diagnostic() { Message = "", Path = new List() { - "/rescue", + "/usr/src", }, Type = "", }, }, OasSummary = new OASSummary() { Info = new OASInfo() { - Description = "kielbasa psst stitcher cannon devoted blindly apropos low", + Description = "prioritize bell vainly", License = new License() {}, Summary = "", Title = "", @@ -49,12 +50,13 @@ SuggestRequest req = new SuggestRequest() { }, Operations = new List() { new OASOperation() { - Description = "via apparatus gray whether opposite what", + Description = "though since instead accurate safe unnaturally charming", Method = "", OperationId = "", - Path = "/sys", + Path = "/usr/local/bin", Tags = new List() { - "", + "", + "", }, }, }, @@ -91,6 +93,7 @@ Generate generic suggestions for a list of items. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -102,7 +105,7 @@ var sdk = new SDK(security: new Security() { SuggestItemsRequestBody req = new SuggestItemsRequestBody() { Items = new List() { - "", + "", }, Prompt = "", }; @@ -134,11 +137,11 @@ Get suggestions from an LLM model for improving an OpenAPI document. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -using System; var sdk = new SDK(security: new Security() { APIKey = "", @@ -147,7 +150,7 @@ var sdk = new SDK(security: new Security() { SuggestOpenAPIRequest req = new SuggestOpenAPIRequest() { RequestBody = new SuggestOpenAPIRequestBody() { Schema = new Schema() { - Content = System.Text.Encoding.UTF8.GetBytes("0x0beEcB7cF6"), + Content = System.IO.File.ReadAllBytes("example.file"), FileName = "example.file", }, }, @@ -181,6 +184,7 @@ Get suggestions from an LLM model for improving an OpenAPI document stored in th ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; diff --git a/docs/sdks/workspaces/README.md b/docs/sdks/workspaces/README.md index fabb51c6..204219a8 100644 --- a/docs/sdks/workspaces/README.md +++ b/docs/sdks/workspaces/README.md @@ -29,6 +29,7 @@ Creates a workspace ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -39,13 +40,13 @@ var sdk = new SDK(security: new Security() { }); Workspace req = new Workspace() { - CreatedAt = System.DateTime.Parse("2024-06-17T07:14:55.338Z"), + CreatedAt = System.DateTime.Parse("2023-11-18T13:41:10.525Z"), Id = "", Name = "", OrganizationId = "", Slug = "", - UpdatedAt = System.DateTime.Parse("2024-11-30T17:06:07.804Z"), - Verified = false, + UpdatedAt = System.DateTime.Parse("2024-11-21T08:36:32.740Z"), + Verified = true, }; var res = await sdk.Workspaces.CreateAsync(req); @@ -76,26 +77,29 @@ Create a token for a particular workspace ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; using System; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); CreateWorkspaceTokenRequest req = new CreateWorkspaceTokenRequest() { WorkspaceToken = new WorkspaceToken() { Alg = "", - CreatedAt = System.DateTime.Parse("2023-08-16T02:33:00.784Z"), + CreatedAt = System.DateTime.Parse("2024-10-04T10:23:04.522Z"), Id = "", Key = "", Name = "", WorkspaceId = "", }, - WorkspaceId = "", }; var res = await sdk.Workspaces.CreateTokenAsync(req); @@ -126,18 +130,21 @@ Delete a token for a particular workspace ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); DeleteWorkspaceTokenRequest req = new DeleteWorkspaceTokenRequest() { TokenID = "", - WorkspaceId = "", }; var res = await sdk.Workspaces.DeleteTokenAsync(req); @@ -168,6 +175,7 @@ Get information about a particular workspace by context. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -198,6 +206,7 @@ Returns a list of workspaces a user has access too ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -228,18 +237,20 @@ Get information about a particular workspace. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); -GetWorkspaceRequest req = new GetWorkspaceRequest() { - WorkspaceId = "", -}; +GetWorkspaceRequest req = new GetWorkspaceRequest() {}; var res = await sdk.Workspaces.GetByIDAsync(req); @@ -269,18 +280,20 @@ Get workspace feature flags ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); -GetWorkspaceFeatureFlagsRequest req = new GetWorkspaceFeatureFlagsRequest() { - WorkspaceId = "", -}; +GetWorkspaceFeatureFlagsRequest req = new GetWorkspaceFeatureFlagsRequest() {}; var res = await sdk.Workspaces.GetFeatureFlagsAsync(req); @@ -310,18 +323,20 @@ Get settings about a particular workspace. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); -GetWorkspaceSettingsRequest req = new GetWorkspaceSettingsRequest() { - WorkspaceId = "", -}; +GetWorkspaceSettingsRequest req = new GetWorkspaceSettingsRequest() {}; var res = await sdk.Workspaces.GetSettingsAsync(req); @@ -351,18 +366,20 @@ Get team members for a particular workspace ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); -GetWorkspaceTeamRequest req = new GetWorkspaceTeamRequest() { - WorkspaceId = "", -}; +GetWorkspaceTeamRequest req = new GetWorkspaceTeamRequest() {}; var res = await sdk.Workspaces.GetTeamAsync(req); @@ -392,18 +409,20 @@ Get tokens for a particular workspace ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); -GetWorkspaceTokensRequest req = new GetWorkspaceTokensRequest() { - WorkspaceId = "", -}; +GetWorkspaceTokensRequest req = new GetWorkspaceTokensRequest() {}; var res = await sdk.Workspaces.GetTokensAsync(req); @@ -433,18 +452,21 @@ Grant a user access to a particular workspace ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); GrantUserAccessToWorkspaceRequest req = new GrantUserAccessToWorkspaceRequest() { - Email = "Lucinda.Batz8@hotmail.com", - WorkspaceId = "", + Email = "Idella24@gmail.com", }; var res = await sdk.Workspaces.GrantAccessAsync(req); @@ -475,18 +497,21 @@ Revoke a user's access to a particular workspace ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); RevokeUserAccessToWorkspaceRequest req = new RevokeUserAccessToWorkspaceRequest() { UserId = "", - WorkspaceId = "", }; var res = await sdk.Workspaces.RevokeAccessAsync(req); @@ -517,6 +542,7 @@ Set workspace feature flags ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; @@ -527,9 +553,7 @@ var sdk = new SDK(security: new Security() { }); WorkspaceFeatureFlagRequest req = new WorkspaceFeatureFlagRequest() { - FeatureFlags = new List() { - WorkspaceFeatureFlag.SkipSchemaRegistry, - }, + FeatureFlags = new List() {}, }; var res = await sdk.Workspaces.SetFeatureFlagsAsync(req); @@ -560,27 +584,30 @@ Update information about a particular workspace. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; using System; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); UpdateWorkspaceDetailsRequest req = new UpdateWorkspaceDetailsRequest() { Workspace = new Workspace() { - CreatedAt = System.DateTime.Parse("2025-07-28T19:04:48.565Z"), + CreatedAt = System.DateTime.Parse("2023-08-02T22:30:24.264Z"), Id = "", Name = "", OrganizationId = "", Slug = "", - UpdatedAt = System.DateTime.Parse("2024-10-16T10:52:42.015Z"), - Verified = false, + UpdatedAt = System.DateTime.Parse("2025-01-24T03:53:13.581Z"), + Verified = true, }, - WorkspaceId = "", }; var res = await sdk.Workspaces.UpdateAsync(req); @@ -611,24 +638,27 @@ Update settings about a particular workspace. ### Example Usage + ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Operations; using SpeakeasySDK.Models.Shared; using System; -var sdk = new SDK(security: new Security() { - APIKey = "", -}); +var sdk = new SDK( + workspaceId: "", + security: new Security() { + APIKey = "", + } +); UpdateWorkspaceSettingsRequest req = new UpdateWorkspaceSettingsRequest() { WorkspaceSettings = new WorkspaceSettings() { - CreatedAt = System.DateTime.Parse("2023-07-05T11:43:28.305Z"), - UpdatedAt = System.DateTime.Parse("2024-05-14T05:39:21.874Z"), - WebhookUrl = "https://grown-pharmacopoeia.net", + CreatedAt = System.DateTime.Parse("2025-03-09T15:48:09.330Z"), + UpdatedAt = System.DateTime.Parse("2025-11-24T16:37:53.492Z"), + WebhookUrl = "https://wobbly-lid.org", WorkspaceId = "", }, - WorkspaceId = "", }; var res = await sdk.Workspaces.UpdateSettingsAsync(req); diff --git a/gen.yaml b/gen.yaml index 7d57f2ac..37be5594 100755 --- a/gen.yaml +++ b/gen.yaml @@ -3,24 +3,35 @@ generation: sdkClassName: SDK usageSnippets: optionalPropertyRendering: withExample + sdkInitStyle: constructor fixes: - nameResolutionDec2023: false + nameResolutionFeb2025: false parameterOrderingFeb2024: false requestResponseComponentNamesFeb2024: false + securityFeb2025: false + sharedErrorComponentsApr2025: false auth: oAuth2ClientCredentialsEnabled: false oAuth2PasswordEnabled: false + hoistGlobalSecurity: true + tests: + generateTests: true + generateNewTests: false + skipResponseBodyAssertions: false csharp: - version: 5.12.0 + version: 5.13.0 additionalDependencies: [] author: Speakeasy + baseErrorName: SDKBaseException clientServerStatusCodesAsErrors: true defaultErrorName: SDKException disableNamespacePascalCasingApr2024: false dotnetVersion: net8.0 + enableCancellationToken: false enableSourceLink: true flattenGlobalSecurity: false flatteningOrder: "" + httpClientPrefix: Speakeasy imports: option: openapi paths: @@ -38,3 +49,4 @@ csharp: packageTags: Speakeasy SDK Generation responseFormat: envelope sourceDirectory: src + useNodatime: true diff --git a/src/SpeakeasySDK/Artifacts.cs b/src/SpeakeasySDK/Artifacts.cs index 0b8ea240..5e29ccfd 100644 --- a/src/SpeakeasySDK/Artifacts.cs +++ b/src/SpeakeasySDK/Artifacts.cs @@ -65,6 +65,11 @@ public interface IArtifacts /// Task PreflightAsync(PreflightRequest? request = null); + /// + /// Set whether a namespace is archived + /// + Task SetArchivedAsync(ArchiveNamespaceRequest request); + /// /// Set visibility of a namespace with an existing metadata entry /// @@ -78,19 +83,12 @@ public class Artifacts: IArtifacts { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; - public Artifacts(ISpeakeasyHttpClient client, Func? securitySource, string serverUrl, SDKConfig config) + public Artifacts(SDKConfig config) { - _client = client; - _securitySource = securitySource; - _serverUrl = serverUrl; SDKConfiguration = config; } @@ -101,7 +99,7 @@ public async Task CreateRemoteSourceAsync(RemoteSour var urlString = baseUrl + "/v1/artifacts/remote_sources"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, true); if (serializedBody != null) @@ -109,19 +107,19 @@ public async Task CreateRemoteSourceAsync(RemoteSour httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("createRemoteSource", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "createRemoteSource", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -151,7 +149,7 @@ public async Task CreateRemoteSourceAsync(RemoteSour var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new CreateRemoteSourceResponse() { StatusCode = responseStatusCode, @@ -163,18 +161,28 @@ public async Task CreateRemoteSourceAsync(RemoteSour { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetBlobAsync(GetBlobRequest request) @@ -183,21 +191,21 @@ public async Task GetBlobAsync(GetBlobRequest request) var urlString = URLBuilder.Build(baseUrl, "/v1/oci/v2/{organization_slug}/{workspace_slug}/{namespace_name}/blobs/{digest}", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getBlob", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getBlob", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -240,24 +248,34 @@ public async Task GetBlobAsync(GetBlobRequest request) return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetManifestAsync(GetManifestRequest request) @@ -266,21 +284,21 @@ public async Task GetManifestAsync(GetManifestRequest reque var urlString = URLBuilder.Build(baseUrl, "/v1/oci/v2/{organization_slug}/{workspace_slug}/{namespace_name}/manifests/{revision_reference}", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getManifest", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getManifest", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -313,7 +331,17 @@ public async Task GetManifestAsync(GetManifestRequest reque { if(Utilities.IsContentTypeMatch("application/vnd.oci.image.manifest.v1+json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + Manifest obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into Manifest.", httpResponse, httpResponseBody, ex); + } + var response = new GetManifestResponse() { StatusCode = responseStatusCode, @@ -324,24 +352,34 @@ public async Task GetManifestAsync(GetManifestRequest reque return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetNamespacesAsync() @@ -351,21 +389,21 @@ public async Task GetManifestAsync(GetManifestRequest reque var urlString = baseUrl + "/v1/artifacts/namespaces"; var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getNamespaces", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getNamespaces", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -398,7 +436,17 @@ public async Task GetManifestAsync(GetManifestRequest reque { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + Models.Shared.GetNamespacesResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into Models.Shared.GetNamespacesResponse.", httpResponse, httpResponseBody, ex); + } + var response = new Models.Operations.GetNamespacesResponse() { StatusCode = responseStatusCode, @@ -409,24 +457,34 @@ public async Task GetManifestAsync(GetManifestRequest reque return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetRevisionsAsync(GetRevisionsRequest request) @@ -435,21 +493,21 @@ public async Task GetManifestAsync(GetManifestRequest reque var urlString = URLBuilder.Build(baseUrl, "/v1/artifacts/namespaces/{namespace_name}/revisions", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getRevisions", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getRevisions", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -482,7 +540,17 @@ public async Task GetManifestAsync(GetManifestRequest reque { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + Models.Shared.GetRevisionsResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into Models.Shared.GetRevisionsResponse.", httpResponse, httpResponseBody, ex); + } + var response = new Models.Operations.GetRevisionsResponse() { StatusCode = responseStatusCode, @@ -493,24 +561,34 @@ public async Task GetManifestAsync(GetManifestRequest reque return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetTagsAsync(GetTagsRequest request) @@ -519,21 +597,21 @@ public async Task GetManifestAsync(GetManifestRequest reque var urlString = URLBuilder.Build(baseUrl, "/v1/artifacts/namespaces/{namespace_name}/tags", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getTags", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getTags", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -566,7 +644,17 @@ public async Task GetManifestAsync(GetManifestRequest reque { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + Models.Shared.GetTagsResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into Models.Shared.GetTagsResponse.", httpResponse, httpResponseBody, ex); + } + var response = new Models.Operations.GetTagsResponse() { StatusCode = responseStatusCode, @@ -577,24 +665,34 @@ public async Task GetManifestAsync(GetManifestRequest reque return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task ListRemoteSourcesAsync(ListRemoteSourcesRequest request) @@ -603,21 +701,21 @@ public async Task ListRemoteSourcesAsync(ListRemoteSo var urlString = URLBuilder.Build(baseUrl, "/v1/artifacts/remote_sources", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("listRemoteSources", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "listRemoteSources", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -650,7 +748,17 @@ public async Task ListRemoteSourcesAsync(ListRemoteSo { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + RemoteSource obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into RemoteSource.", httpResponse, httpResponseBody, ex); + } + var response = new ListRemoteSourcesResponse() { StatusCode = responseStatusCode, @@ -661,24 +769,34 @@ public async Task ListRemoteSourcesAsync(ListRemoteSo return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task PostTagsAsync(PostTagsRequest request) @@ -687,7 +805,7 @@ public async Task PostTagsAsync(PostTagsRequest request) var urlString = URLBuilder.Build(baseUrl, "/v1/artifacts/namespaces/{namespace_name}/tags", request); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "AddTags", "json", false, true); if (serializedBody != null) @@ -695,19 +813,19 @@ public async Task PostTagsAsync(PostTagsRequest request) httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("postTags", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "postTags", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -737,7 +855,7 @@ public async Task PostTagsAsync(PostTagsRequest request) var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new PostTagsResponse() { StatusCode = responseStatusCode, @@ -749,18 +867,28 @@ public async Task PostTagsAsync(PostTagsRequest request) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task PreflightAsync(PreflightRequest? request = null) @@ -770,7 +898,7 @@ public async Task PreflightAsync(PreflightRequest? request = var urlString = baseUrl + "/v1/artifacts/preflight"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, true); if (serializedBody != null) @@ -778,19 +906,19 @@ public async Task PreflightAsync(PreflightRequest? request = httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("preflight", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "preflight", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -823,7 +951,17 @@ public async Task PreflightAsync(PreflightRequest? request = { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + PreflightToken obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into PreflightToken.", httpResponse, httpResponseBody, ex); + } + var response = new PreflightResponse() { StatusCode = responseStatusCode, @@ -834,24 +972,126 @@ public async Task PreflightAsync(PreflightRequest? request = return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + public async Task SetArchivedAsync(ArchiveNamespaceRequest request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + var urlString = URLBuilder.Build(baseUrl, "/v1/artifacts/namespaces/{namespace_name}/archive", request); + + var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + var serializedBody = RequestBodySerializer.Serialize(request, "RequestBody", "json", false, true); + if (serializedBody != null) + { + httpRequest.Content = serializedBody; + } + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "archiveNamespace", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode >= 200 && responseStatusCode < 300) + { + return new ArchiveNamespaceResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task SetVisibilityAsync(SetVisibilityRequest request) @@ -860,7 +1100,7 @@ public async Task SetVisibilityAsync(SetVisibilityRequest var urlString = URLBuilder.Build(baseUrl, "/v1/artifacts/namespaces/{namespace_name}/visibility", request); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "RequestBody", "json", false, true); if (serializedBody != null) @@ -868,19 +1108,19 @@ public async Task SetVisibilityAsync(SetVisibilityRequest httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("setVisibility", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "setVisibility", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -910,7 +1150,7 @@ public async Task SetVisibilityAsync(SetVisibilityRequest var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new SetVisibilityResponse() { StatusCode = responseStatusCode, @@ -922,18 +1162,28 @@ public async Task SetVisibilityAsync(SetVisibilityRequest { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Auth.cs b/src/SpeakeasySDK/Auth.cs index 493d69b9..f3ca17e6 100644 --- a/src/SpeakeasySDK/Auth.cs +++ b/src/SpeakeasySDK/Auth.cs @@ -60,19 +60,12 @@ public class Auth: IAuth { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; - public Auth(ISpeakeasyHttpClient client, Func? securitySource, string serverUrl, SDKConfig config) + public Auth(SDKConfig config) { - _client = client; - _securitySource = securitySource; - _serverUrl = serverUrl; SDKConfiguration = config; } @@ -82,14 +75,14 @@ public async Task GetAccessAsync(GetWorkspaceAccessR var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/access", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getWorkspaceAccess", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getWorkspaceAccess", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); if (retryConfig == null) @@ -124,8 +117,8 @@ public async Task GetAccessAsync(GetWorkspaceAccessR Func> retrySend = async () => { - var _httpRequest = await _client.CloneAsync(httpRequest); - return await _client.SendAsync(_httpRequest); + var _httpRequest = await SDKConfiguration.Client.CloneAsync(httpRequest); + return await SDKConfiguration.Client.SendAsync(_httpRequest); }; var retries = new SpeakeasySDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); @@ -165,7 +158,17 @@ public async Task GetAccessAsync(GetWorkspaceAccessR { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + AccessDetails obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into AccessDetails.", httpResponse, httpResponseBody, ex); + } + var response = new GetWorkspaceAccessResponse() { StatusCode = responseStatusCode, @@ -176,14 +179,18 @@ public async Task GetAccessAsync(GetWorkspaceAccessR return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetAccessTokenAsync(GetAccessTokenRequest request) @@ -198,16 +205,16 @@ public async Task GetAccessTokenAsync(GetAccessTokenRequ var urlString = URLBuilder.Build(baseUrl, "/v1/auth/access_token", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - var hookCtx = new HookContext("getAccessToken", null, null); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getAccessToken", new List { }, null); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -240,7 +247,17 @@ public async Task GetAccessTokenAsync(GetAccessTokenRequ { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + AccessToken obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into AccessToken.", httpResponse, httpResponseBody, ex); + } + var response = new GetAccessTokenResponse() { StatusCode = responseStatusCode, @@ -251,24 +268,34 @@ public async Task GetAccessTokenAsync(GetAccessTokenRequ return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetUserAsync() @@ -278,21 +305,21 @@ public async Task GetUserAsync() var urlString = baseUrl + "/v1/user"; var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getUser", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getUser", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -325,7 +352,17 @@ public async Task GetUserAsync() { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + User obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into User.", httpResponse, httpResponseBody, ex); + } + var response = new GetUserResponse() { StatusCode = responseStatusCode, @@ -336,24 +373,34 @@ public async Task GetUserAsync() return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task ValidateApiKeyAsync() @@ -363,21 +410,21 @@ public async Task ValidateApiKeyAsync() var urlString = baseUrl + "/v1/auth/validate"; var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("validateApiKey", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "validateApiKey", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -410,7 +457,17 @@ public async Task ValidateApiKeyAsync() { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ApiKeyDetails obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ApiKeyDetails.", httpResponse, httpResponseBody, ex); + } + var response = new ValidateApiKeyResponse() { StatusCode = responseStatusCode, @@ -421,24 +478,34 @@ public async Task ValidateApiKeyAsync() return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/CodeSamples.cs b/src/SpeakeasySDK/CodeSamples.cs index c1027ec0..ea30b6b4 100644 --- a/src/SpeakeasySDK/CodeSamples.cs +++ b/src/SpeakeasySDK/CodeSamples.cs @@ -46,15 +46,6 @@ public interface ICodeSamples /// Task GenerateCodeSamplePreviewAsyncAsync(CodeSampleSchemaInput request); - /// - /// Retrieve usage snippets from document stored in the registry - /// - /// - /// Retrieve usage snippets from document stored in the registry. Supports filtering by language and operation ID. - /// - /// - Task GetAsync(GetCodeSamplesRequest request); - /// /// Poll for the result of an asynchronous Code Sample preview generation. /// @@ -72,19 +63,12 @@ public class CodeSamples: ICodeSamples { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; - public CodeSamples(ISpeakeasyHttpClient client, Func? securitySource, string serverUrl, SDKConfig config) + public CodeSamples(SDKConfig config) { - _client = client; - _securitySource = securitySource; - _serverUrl = serverUrl; SDKConfiguration = config; } @@ -95,7 +79,7 @@ public async Task GenerateCodeSamplePreviewAs var urlString = baseUrl + "/v1/code_sample/preview"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "multipart", false, false); if (serializedBody != null) @@ -103,19 +87,19 @@ public async Task GenerateCodeSamplePreviewAs httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("generateCodeSamplePreview", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "generateCodeSamplePreview", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -144,45 +128,75 @@ public async Task GenerateCodeSamplePreviewAs var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; - if(responseStatusCode == 200) + if(responseStatusCode >= 200 && responseStatusCode < 300) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + UsageSnippets obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into UsageSnippets.", httpResponse, httpResponseBody, ex); + } + var response = new GenerateCodeSamplePreviewResponse() { StatusCode = responseStatusCode, ContentType = contentType, RawResponse = httpResponse }; - response.TwoHundredApplicationJsonBytes = await httpResponse.Content.ReadAsByteArrayAsync(); + response.UsageSnippets = obj; return response; } - else if(Utilities.IsContentTypeMatch("application/x-yaml", contentType)) + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var response = new GenerateCodeSamplePreviewResponse() + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try { - StatusCode = responseStatusCode, - ContentType = contentType, - RawResponse = httpResponse - }; - response.TwoHundredApplicationXYamlBytes = await httpResponse.Content.ReadAsByteArrayAsync(); - return response; + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 500 && responseStatusCode < 600) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GenerateCodeSamplePreviewAsyncAsync(CodeSampleSchemaInput request) @@ -192,7 +206,7 @@ public async Task GenerateCodeSamplePrev var urlString = baseUrl + "/v1/code_sample/preview/async"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "multipart", false, false); if (serializedBody != null) @@ -200,19 +214,19 @@ public async Task GenerateCodeSamplePrev httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("generateCodeSamplePreviewAsync", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "generateCodeSamplePreviewAsync", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -245,7 +259,17 @@ public async Task GenerateCodeSamplePrev { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GenerateCodeSamplePreviewAsyncResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GenerateCodeSamplePreviewAsyncResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GenerateCodeSamplePreviewAsyncResponse() { StatusCode = responseStatusCode, @@ -256,104 +280,50 @@ public async Task GenerateCodeSamplePrev return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; - } - - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); - } - - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); - } - - public async Task GetAsync(GetCodeSamplesRequest request) - { - string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); - var urlString = URLBuilder.Build(baseUrl, "/v1/code_sample", request); - - var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); - - if (_securitySource != null) - { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); - } - - var hookCtx = new HookContext("getCodeSamples", null, _securitySource); - - httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); - - HttpResponseMessage httpResponse; - try - { - httpResponse = await _client.SendAsync(httpRequest); - int _statusCode = (int)httpResponse.StatusCode; - - if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) - { - var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); - if (_httpResponse != null) + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try { - httpResponse = _httpResponse; + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); } - } - } - catch (Exception error) - { - var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); - if (_httpResponse != null) - { - httpResponse = _httpResponse; - } - else - { - throw; - } - } - - httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); - - var contentType = httpResponse.Content.Headers.ContentType?.MediaType; - int responseStatusCode = (int)httpResponse.StatusCode; - if(responseStatusCode >= 200 && responseStatusCode < 300) - { - if(Utilities.IsContentTypeMatch("application/json", contentType)) - { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - var response = new GetCodeSamplesResponse() + catch (Exception ex) { - StatusCode = responseStatusCode, - ContentType = contentType, - RawResponse = httpResponse - }; - response.UsageSnippets = obj; - return response; + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500) + else if(responseStatusCode >= 500 && responseStatusCode < 600) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); - } - else if(responseStatusCode >= 500 && responseStatusCode < 600) - { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetCodeSamplePreviewAsyncAsync(GetCodeSamplePreviewAsyncRequest request) @@ -362,21 +332,21 @@ public async Task GetCodeSamplePreviewAsyncAs var urlString = URLBuilder.Build(baseUrl, "/v1/code_sample/preview/async/{jobID}", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getCodeSamplePreviewAsync", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getCodeSamplePreviewAsync", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -405,62 +375,102 @@ public async Task GetCodeSamplePreviewAsyncAs var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; - if(responseStatusCode == 200) + if(responseStatusCode == 202) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetCodeSamplePreviewAsyncResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetCodeSamplePreviewAsyncResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetCodeSamplePreviewAsyncResponse() { StatusCode = responseStatusCode, ContentType = contentType, RawResponse = httpResponse }; - response.TwoHundredApplicationJsonBytes = await httpResponse.Content.ReadAsByteArrayAsync(); + response.Object = obj; return response; } - else if(Utilities.IsContentTypeMatch("application/x-yaml", contentType)) + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 200 && responseStatusCode < 300) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + UsageSnippets obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into UsageSnippets.", httpResponse, httpResponseBody, ex); + } + var response = new GetCodeSamplePreviewAsyncResponse() { StatusCode = responseStatusCode, ContentType = contentType, RawResponse = httpResponse }; - response.TwoHundredApplicationXYamlBytes = await httpResponse.Content.ReadAsByteArrayAsync(); + response.UsageSnippets = obj; return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode == 202) + else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - var response = new GetCodeSamplePreviewAsyncResponse() + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try { - StatusCode = responseStatusCode, - ContentType = contentType, - RawResponse = httpResponse - }; - response.TwoHundredAndTwoApplicationJsonObject = obj; - return response; + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 500 && responseStatusCode < 600) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Events.cs b/src/SpeakeasySDK/Events.cs index ff9266b3..96a623f8 100644 --- a/src/SpeakeasySDK/Events.cs +++ b/src/SpeakeasySDK/Events.cs @@ -65,19 +65,12 @@ public class Events: IEvents { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; - public Events(ISpeakeasyHttpClient client, Func? securitySource, string serverUrl, SDKConfig config) + public Events(SDKConfig config) { - _client = client; - _securitySource = securitySource; - _serverUrl = serverUrl; SDKConfiguration = config; } @@ -93,21 +86,21 @@ public async Task GetEventsByTargetAsync(Get var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/events/targets/{target_id}/events", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getWorkspaceEventsByTarget", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getWorkspaceEventsByTarget", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -140,7 +133,17 @@ public async Task GetEventsByTargetAsync(Get { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + var response = new GetWorkspaceEventsByTargetResponse() { StatusCode = responseStatusCode, @@ -151,24 +154,34 @@ public async Task GetEventsByTargetAsync(Get return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetTargetsAsync(GetWorkspaceTargetsRequest? request = null) @@ -177,21 +190,21 @@ public async Task GetTargetsAsync(GetWorkspaceTarge var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/events/targets", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getWorkspaceTargets", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getWorkspaceTargets", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -224,7 +237,17 @@ public async Task GetTargetsAsync(GetWorkspaceTarge { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + var response = new GetWorkspaceTargetsResponse() { StatusCode = responseStatusCode, @@ -235,24 +258,34 @@ public async Task GetTargetsAsync(GetWorkspaceTarge return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetTargetsDeprecatedAsync(GetWorkspaceTargetsDeprecatedRequest? request = null) @@ -263,21 +296,21 @@ public async Task GetTargetsDeprecatedAsy var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/events/targets", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getWorkspaceTargetsDeprecated", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getWorkspaceTargetsDeprecated", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -310,7 +343,17 @@ public async Task GetTargetsDeprecatedAsy { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + var response = new GetWorkspaceTargetsDeprecatedResponse() { StatusCode = responseStatusCode, @@ -321,24 +364,34 @@ public async Task GetTargetsDeprecatedAsy return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task PostAsync(PostWorkspaceEventsRequest request, RetryConfig? retryConfig = null) @@ -353,7 +406,7 @@ public async Task PostAsync(PostWorkspaceEventsRequ var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/events", request); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "RequestBody", "json", false, false); if (serializedBody != null) @@ -361,12 +414,12 @@ public async Task PostAsync(PostWorkspaceEventsRequ httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("postWorkspaceEvents", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "postWorkspaceEvents", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); if (retryConfig == null) @@ -401,8 +454,8 @@ public async Task PostAsync(PostWorkspaceEventsRequ Func> retrySend = async () => { - var _httpRequest = await _client.CloneAsync(httpRequest); - return await _client.SendAsync(_httpRequest); + var _httpRequest = await SDKConfiguration.Client.CloneAsync(httpRequest); + return await SDKConfiguration.Client.SendAsync(_httpRequest); }; var retries = new SpeakeasySDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); @@ -439,7 +492,7 @@ public async Task PostAsync(PostWorkspaceEventsRequ var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new PostWorkspaceEventsResponse() { StatusCode = responseStatusCode, @@ -449,20 +502,30 @@ public async Task PostAsync(PostWorkspaceEventsRequ } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task SearchAsync(SearchWorkspaceEventsRequest? request = null) @@ -473,21 +536,21 @@ public async Task SearchAsync(SearchWorkspaceEven var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/events", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("searchWorkspaceEvents", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "searchWorkspaceEvents", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -520,7 +583,17 @@ public async Task SearchAsync(SearchWorkspaceEven { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + var response = new SearchWorkspaceEventsResponse() { StatusCode = responseStatusCode, @@ -531,24 +604,34 @@ public async Task SearchAsync(SearchWorkspaceEven return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Github.cs b/src/SpeakeasySDK/Github.cs index 6fcd317f..ca421fdd 100644 --- a/src/SpeakeasySDK/Github.cs +++ b/src/SpeakeasySDK/Github.cs @@ -47,19 +47,12 @@ public class Github: IGithub { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; - public Github(ISpeakeasyHttpClient client, Func? securitySource, string serverUrl, SDKConfig config) + public Github(SDKConfig config) { - _client = client; - _securitySource = securitySource; - _serverUrl = serverUrl; SDKConfiguration = config; } @@ -69,21 +62,21 @@ public async Task CheckAccessAsync(CheckGithubAccessR var urlString = URLBuilder.Build(baseUrl, "/v1/github/check_access", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("checkGithubAccess", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "checkGithubAccess", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -113,7 +106,7 @@ public async Task CheckAccessAsync(CheckGithubAccessR var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new CheckGithubAccessResponse() { StatusCode = responseStatusCode, @@ -125,18 +118,28 @@ public async Task CheckAccessAsync(CheckGithubAccessR { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task CheckPublishingPRsAsync(GithubCheckPublishingPRsRequest request) @@ -145,21 +148,21 @@ public async Task CheckPublishingPRsAsync(Gith var urlString = URLBuilder.Build(baseUrl, "/v1/github/publishing_prs", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("githubCheckPublishingPRs", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "githubCheckPublishingPRs", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -192,7 +195,17 @@ public async Task CheckPublishingPRsAsync(Gith { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GithubPublishingPRResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GithubPublishingPRResponse.", httpResponse, httpResponseBody, ex); + } + var response = new GithubCheckPublishingPRsResponse() { StatusCode = responseStatusCode, @@ -203,24 +216,34 @@ public async Task CheckPublishingPRsAsync(Gith return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task CheckPublishingSecretsAsync(GithubCheckPublishingSecretsRequest request) @@ -229,21 +252,21 @@ public async Task CheckPublishingSecretsAs var urlString = URLBuilder.Build(baseUrl, "/v1/github/publishing_secrets", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("githubCheckPublishingSecrets", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "githubCheckPublishingSecrets", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -276,7 +299,17 @@ public async Task CheckPublishingSecretsAs { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GithubMissingPublishingSecretsResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GithubMissingPublishingSecretsResponse.", httpResponse, httpResponseBody, ex); + } + var response = new GithubCheckPublishingSecretsResponse() { StatusCode = responseStatusCode, @@ -287,24 +320,34 @@ public async Task CheckPublishingSecretsAs return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task ConfigureCodeSamplesAsync(GithubConfigureCodeSamplesRequest request) @@ -314,7 +357,7 @@ public async Task CheckPublishingSecretsAs var urlString = baseUrl + "/v1/github/configure_code_samples"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); if (serializedBody != null) @@ -322,19 +365,19 @@ public async Task CheckPublishingSecretsAs httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("githubConfigureCodeSamples", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "githubConfigureCodeSamples", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -367,7 +410,17 @@ public async Task CheckPublishingSecretsAs { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + Models.Shared.GithubConfigureCodeSamplesResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into Models.Shared.GithubConfigureCodeSamplesResponse.", httpResponse, httpResponseBody, ex); + } + var response = new Models.Operations.GithubConfigureCodeSamplesResponse() { StatusCode = responseStatusCode, @@ -378,24 +431,34 @@ public async Task CheckPublishingSecretsAs return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task ConfigureMintlifyRepoAsync(GithubConfigureMintlifyRepoRequest request) @@ -405,7 +468,7 @@ public async Task ConfigureMintlifyRepoAsyn var urlString = baseUrl + "/v1/github/configure_mintlify_repo"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); if (serializedBody != null) @@ -413,19 +476,19 @@ public async Task ConfigureMintlifyRepoAsyn httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("githubConfigureMintlifyRepo", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "githubConfigureMintlifyRepo", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -455,7 +518,7 @@ public async Task ConfigureMintlifyRepoAsyn var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new GithubConfigureMintlifyRepoResponse() { StatusCode = responseStatusCode, @@ -467,18 +530,28 @@ public async Task ConfigureMintlifyRepoAsyn { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task ConfigureTargetAsync(GithubConfigureTargetRequest request) @@ -488,7 +561,7 @@ public async Task ConfigureTargetAsync(GithubConf var urlString = baseUrl + "/v1/github/configure_target"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); if (serializedBody != null) @@ -496,19 +569,19 @@ public async Task ConfigureTargetAsync(GithubConf httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("githubConfigureTarget", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "githubConfigureTarget", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -538,7 +611,7 @@ public async Task ConfigureTargetAsync(GithubConf var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new GithubConfigureTargetResponse() { StatusCode = responseStatusCode, @@ -550,18 +623,28 @@ public async Task ConfigureTargetAsync(GithubConf { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetActionAsync(GetGitHubActionRequest request) @@ -570,21 +653,21 @@ public async Task GetActionAsync(GetGitHubActionRequest var urlString = URLBuilder.Build(baseUrl, "/v1/github/action", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getGitHubAction", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getGitHubAction", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -617,7 +700,17 @@ public async Task GetActionAsync(GetGitHubActionRequest { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GithubGetActionResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GithubGetActionResponse.", httpResponse, httpResponseBody, ex); + } + var response = new GetGitHubActionResponse() { StatusCode = responseStatusCode, @@ -628,24 +721,34 @@ public async Task GetActionAsync(GetGitHubActionRequest return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetSetupAsync(GetGithubSetupStateRequest request) @@ -654,21 +757,21 @@ public async Task GetSetupAsync(GetGithubSetupState var urlString = URLBuilder.Build(baseUrl, "/v1/github/setup", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getGithubSetupState", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getGithubSetupState", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -701,7 +804,17 @@ public async Task GetSetupAsync(GetGithubSetupState { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GithubSetupStateResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GithubSetupStateResponse.", httpResponse, httpResponseBody, ex); + } + var response = new GetGithubSetupStateResponse() { StatusCode = responseStatusCode, @@ -712,24 +825,34 @@ public async Task GetSetupAsync(GetGithubSetupState return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task LinkGithubAsync(LinkGithubAccessRequest? request = null) @@ -738,21 +861,21 @@ public async Task LinkGithubAsync(LinkGithubAccessRequ var urlString = URLBuilder.Build(baseUrl, "/v1/github/link", request); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("linkGithubAccess", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "linkGithubAccess", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -782,7 +905,7 @@ public async Task LinkGithubAsync(LinkGithubAccessRequ var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new LinkGithubAccessResponse() { StatusCode = responseStatusCode, @@ -794,18 +917,28 @@ public async Task LinkGithubAsync(LinkGithubAccessRequ { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task StorePublishingSecretsAsync(GithubStorePublishingSecretsRequest request) @@ -815,7 +948,7 @@ public async Task StorePublishingSecretsAs var urlString = baseUrl + "/v1/github/publishing_secrets"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); if (serializedBody != null) @@ -823,19 +956,19 @@ public async Task StorePublishingSecretsAs httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("githubStorePublishingSecrets", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "githubStorePublishingSecrets", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -865,7 +998,7 @@ public async Task StorePublishingSecretsAs var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new GithubStorePublishingSecretsResponse() { StatusCode = responseStatusCode, @@ -877,18 +1010,28 @@ public async Task StorePublishingSecretsAs { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task TriggerActionAsync(GithubTriggerActionRequest request) @@ -898,7 +1041,7 @@ public async Task TriggerActionAsync(GithubTriggerA var urlString = baseUrl + "/v1/github/trigger_action"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); if (serializedBody != null) @@ -906,19 +1049,19 @@ public async Task TriggerActionAsync(GithubTriggerA httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("githubTriggerAction", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "githubTriggerAction", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -948,7 +1091,7 @@ public async Task TriggerActionAsync(GithubTriggerA var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new GithubTriggerActionResponse() { StatusCode = responseStatusCode, @@ -960,18 +1103,28 @@ public async Task TriggerActionAsync(GithubTriggerA { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Hooks/HookTypes.cs b/src/SpeakeasySDK/Hooks/HookTypes.cs index fca50b8f..55c2ab3e 100644 --- a/src/SpeakeasySDK/Hooks/HookTypes.cs +++ b/src/SpeakeasySDK/Hooks/HookTypes.cs @@ -17,34 +17,47 @@ namespace SpeakeasySDK.Hooks public class HookContext { + public SDKConfig SDKConfiguration { get; set; } + public string BaseURL { get; set; } = ""; public string OperationID { get; set; } public List? Oauth2Scopes { get; set; } public Func? SecuritySource { get; set; } - public HookContext(string operationID, List? oauth2Scopes, Func? securitySource) + public HookContext(SDKConfig config, string baseURL, string operationID, List? oauth2Scopes, Func? securitySource) { + SDKConfiguration = config; + BaseURL = baseURL; OperationID = operationID; Oauth2Scopes = oauth2Scopes; SecuritySource = securitySource; } + + public HookContext(HookContext hookCtx) + { + SDKConfiguration = hookCtx.SDKConfiguration; + BaseURL = hookCtx.BaseURL; + OperationID = hookCtx.OperationID; + Oauth2Scopes = hookCtx.Oauth2Scopes; + SecuritySource = hookCtx.SecuritySource; + } } public class BeforeRequestContext : HookContext { public BeforeRequestContext(HookContext hookCtx) - : base(hookCtx.OperationID, hookCtx.Oauth2Scopes, hookCtx.SecuritySource) { } + : base(hookCtx) { } } public class AfterSuccessContext : HookContext { public AfterSuccessContext(HookContext hookCtx) - : base(hookCtx.OperationID, hookCtx.Oauth2Scopes, hookCtx.SecuritySource) { } + : base(hookCtx) { } } public class AfterErrorContext : HookContext { public AfterErrorContext(HookContext hookCtx) - : base(hookCtx.OperationID, hookCtx.Oauth2Scopes, hookCtx.SecuritySource) { } + : base(hookCtx) { } } /// diff --git a/src/SpeakeasySDK/Hooks/SDKHooks.cs b/src/SpeakeasySDK/Hooks/SDKHooks.cs index 2a35fadc..ae33e311 100644 --- a/src/SpeakeasySDK/Hooks/SDKHooks.cs +++ b/src/SpeakeasySDK/Hooks/SDKHooks.cs @@ -52,7 +52,7 @@ public void RegisterAfterErrorHook(IAfterErrorHook hook) { this.afterErrorHooks.Add(hook); } - + public (string, ISpeakeasyHttpClient) SDKInit(string baseUrl, ISpeakeasyHttpClient client) { var urlAndClient = (baseUrl, client); @@ -68,7 +68,7 @@ public void RegisterAfterErrorHook(IAfterErrorHook hook) } return urlAndClient; } - + public async Task BeforeRequestAsync(BeforeRequestContext hookCtx, HttpRequestMessage request) { foreach (var hook in this.beforeRequestHooks) @@ -76,7 +76,8 @@ public async Task BeforeRequestAsync(BeforeRequestContext ho try { request = await hook.BeforeRequestAsync(hookCtx, request); - } catch (Exception ex) + } + catch (Exception ex) { throw new Exception("An error occurred while calling BeforeRequestAsync hook", ex); } @@ -102,17 +103,18 @@ public async Task AfterSuccessAsync(AfterSuccessContext hoo public async Task AfterErrorAsync(AfterErrorContext hookCtx, HttpResponseMessage? response, Exception? error) { - (HttpResponseMessage?, Exception?) responseAndError = (response, error); foreach (var hook in this.afterErrorHooks) { try { responseAndError = await hook.AfterErrorAsync(hookCtx, responseAndError.Item1, responseAndError.Item2); - } catch (FailEarlyException) + } + catch (FailEarlyException) { throw; - } catch (Exception ex) + } + catch (Exception ex) { throw new Exception("An error occurred while calling AfterErrorAsync hook", ex); } diff --git a/src/SpeakeasySDK/Models/Errors/Error.cs b/src/SpeakeasySDK/Models/Errors/Error.cs index bcc1893e..4e72bd30 100644 --- a/src/SpeakeasySDK/Models/Errors/Error.cs +++ b/src/SpeakeasySDK/Models/Errors/Error.cs @@ -12,19 +12,15 @@ namespace SpeakeasySDK.Models.Errors using Newtonsoft.Json; using SpeakeasySDK.Utils; using System; - - /// - /// The `Status` type defines a logical error model - /// - public class Error : Exception - { + using System.Net.Http; + public class ErrorPayload + { /// /// A developer-facing error message. /// [JsonProperty("message")] - private string? _message { get; set; } - public override string Message { get {return _message ?? "";} } + public string Message { get; set; } = default!; /// /// The HTTP status code @@ -32,4 +28,43 @@ public class Error : Exception [JsonProperty("status_code")] public int StatusCode { get; set; } = default!; } + + /// + /// The `Status` type defines a logical error model + /// + public class Error : SDKBaseException + { + /// + /// The original data that was passed to this exception. + /// + public ErrorPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use Error.Payload.Message instead.")] + private string? _message { get; set; } + + private static string ErrorMessage(ErrorPayload payload, string body) + { + string? message = payload.Message; + if (!string.IsNullOrEmpty(message)) + { + return message; + } + + return "API error occurred"; + } + + public Error( + ErrorPayload payload, + HttpResponseMessage rawResponse, + string body + ): base(ErrorMessage(payload, body), rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + _message = payload.Message; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Errors/ResponseValidationException.cs b/src/SpeakeasySDK/Models/Errors/ResponseValidationException.cs new file mode 100644 index 00000000..f3dc01fd --- /dev/null +++ b/src/SpeakeasySDK/Models/Errors/ResponseValidationException.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +namespace SpeakeasySDK.Models.Errors +{ + using System; + using System.Net.Http; + + /// + /// Raised if the response data could not be deserialized into the expected model. + /// + public class ResponseValidationException : SDKBaseException + { + + public ResponseValidationException( + string message, + HttpResponseMessage rawResponse, + string body, + Exception innerException + ): base(message, rawResponse, body, innerException) {} + } +} diff --git a/src/SpeakeasySDK/Models/Errors/SDKBaseException.cs b/src/SpeakeasySDK/Models/Errors/SDKBaseException.cs new file mode 100644 index 00000000..b545e014 --- /dev/null +++ b/src/SpeakeasySDK/Models/Errors/SDKBaseException.cs @@ -0,0 +1,80 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#nullable enable +namespace SpeakeasySDK.Models.Errors +{ + using System; + using System.Net.Http; + using System.Net.Http.Headers; + + public class SDKBaseException : Exception + { + /// + /// Error Message + /// + public override string Message { get; } + + /// + /// HTTP status code + /// + public int StatusCode { get; } + + /// + /// HTTP headers + /// + public HttpResponseHeaders Headers { get; } + + /// + /// HTTP content type + /// + public string? ContentType { get; } + + /// + /// Raw response + /// + public HttpResponseMessage RawResponse { get; } + + /// + /// HTTP response body + /// + public string Body { get; } + + public SDKBaseException( + string message, + HttpResponseMessage rawResponse, + string body + ) : this(message, rawResponse, body, null) {} + + public SDKBaseException( + string message, + HttpResponseMessage rawResponse, + string body, + Exception? innerException + ) : base(message, innerException) + { + Message = message; + RawResponse = rawResponse; + StatusCode = (int)rawResponse.StatusCode; + Headers = rawResponse.Headers; + ContentType = rawResponse.Content.Headers.ContentType?.MediaType; + Body = body; + } + + /// + /// Detailed Error Message + /// + public override string ToString() + { + var innerMessage = string.IsNullOrEmpty(InnerException?.Message) ? "" : $"\n{InnerException.Message}"; + return $"Status: {StatusCode}. {Message}{innerMessage}"; + } + + } +} diff --git a/src/SpeakeasySDK/Models/Errors/SDKException.cs b/src/SpeakeasySDK/Models/Errors/SDKException.cs index 1b3afcda..2d02aa5e 100644 --- a/src/SpeakeasySDK/Models/Errors/SDKException.cs +++ b/src/SpeakeasySDK/Models/Errors/SDKException.cs @@ -6,36 +6,22 @@ // the code is regenerated. // //------------------------------------------------------------------------------ + #nullable enable namespace SpeakeasySDK.Models.Errors { using System; using System.Net.Http; - public class SDKException : Exception + public class SDKException : SDKBaseException { - - public override string Message { get; } - public int StatusCode { get; set; } - public string Body { get; set; } - public HttpResponseMessage RawResponse { get; set; } = default!; - public SDKException(string message, int statusCode, string body, HttpResponseMessage rawResponse) - { - Message = message; - this.StatusCode = statusCode; - StatusCode = statusCode; - Body = body; - RawResponse = rawResponse; - } - - public override string ToString(){ - var body = ""; - if (Body.Length > 0) - { - body += $"\n{Body}"; - } - return Message + ": Status " + StatusCode + body; - } - + /// + /// Default API exception. + /// + public SDKException( + string message, + HttpResponseMessage rawResponse, + string body + ): base(message, rawResponse, body) {} } } diff --git a/src/SpeakeasySDK/Models/Operations/ArchiveNamespaceRequest.cs b/src/SpeakeasySDK/Models/Operations/ArchiveNamespaceRequest.cs new file mode 100644 index 00000000..61dd3e0c --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/ArchiveNamespaceRequest.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Utils; + + public class ArchiveNamespaceRequest + { + + /// + /// Archived status + /// + [SpeakeasyMetadata("request:mediaType=application/json")] + public ArchiveNamespaceRequestBody? RequestBody { get; set; } + + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=namespace_name")] + public string NamespaceName { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/ArchiveNamespaceRequestBody.cs b/src/SpeakeasySDK/Models/Operations/ArchiveNamespaceRequestBody.cs new file mode 100644 index 00000000..582758b2 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/ArchiveNamespaceRequestBody.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using Newtonsoft.Json; + using SpeakeasySDK.Utils; + + /// + /// Archived status + /// + public class ArchiveNamespaceRequestBody + { + + [JsonProperty("archived")] + public bool? Archived { get; set; } = true; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/ArchiveNamespaceResponse.cs b/src/SpeakeasySDK/Models/Operations/ArchiveNamespaceResponse.cs new file mode 100644 index 00000000..1e2496ba --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/ArchiveNamespaceResponse.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Utils; + using System; + using System.Net.Http; + + public class ArchiveNamespaceResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/CreateBillingAddOnsResponse.cs b/src/SpeakeasySDK/Models/Operations/CreateBillingAddOnsResponse.cs new file mode 100644 index 00000000..f1fd6180 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/CreateBillingAddOnsResponse.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System; + using System.Net.Http; + + public class CreateBillingAddOnsResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// Success + /// + public OrganizationBillingAddOnResponse? OrganizationBillingAddOnResponse { get; set; } + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/CreatePublishingTokenRequestBody.cs b/src/SpeakeasySDK/Models/Operations/CreatePublishingTokenRequestBody.cs new file mode 100644 index 00000000..99c7baaa --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/CreatePublishingTokenRequestBody.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using Newtonsoft.Json; + using SpeakeasySDK.Utils; + using System; + + /// + /// The publishing token to create + /// + public class CreatePublishingTokenRequestBody + { + + [JsonProperty("target_id")] + public string TargetId { get; set; } = default!; + + [JsonProperty("target_resource")] + public string TargetResource { get; set; } = default!; + + [JsonProperty("token_name")] + public string TokenName { get; set; } = default!; + + [JsonProperty("valid_until")] + public DateTime ValidUntil { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/CreatePublishingTokenResponse.cs b/src/SpeakeasySDK/Models/Operations/CreatePublishingTokenResponse.cs new file mode 100644 index 00000000..7d146282 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/CreatePublishingTokenResponse.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System; + using System.Net.Http; + + public class CreatePublishingTokenResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// OK + /// + public PublishingToken? PublishingToken { get; set; } + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/CreateSchemaStoreItemRequestBody.cs b/src/SpeakeasySDK/Models/Operations/CreateSchemaStoreItemRequestBody.cs new file mode 100644 index 00000000..4beb9ecd --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/CreateSchemaStoreItemRequestBody.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using Newtonsoft.Json; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Utils; + + public class CreateSchemaStoreItemRequestBody + { + + /// + /// The format of the OpenAPI specification. + /// + [JsonProperty("format")] + public Models.Operations.Format Format { get; set; } = default!; + + /// + /// The package name to use in code snippets / quickstart. + /// + [JsonProperty("packageName")] + public string PackageName { get; set; } = default!; + + /// + /// The classname of the SDK to use in code snippets / quickstart. + /// + [JsonProperty("sdkClassname")] + public string SDKClassname { get; set; } = default!; + + /// + /// The OpenAPI specification to store. + /// + [JsonProperty("spec")] + public string Spec { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/CreateSchemaStoreItemResponse.cs b/src/SpeakeasySDK/Models/Operations/CreateSchemaStoreItemResponse.cs new file mode 100644 index 00000000..05343888 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/CreateSchemaStoreItemResponse.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System; + using System.Net.Http; + + public class CreateSchemaStoreItemResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// OK + /// + public SchemaStoreItem? SchemaStoreItem { get; set; } + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetCodeSamplesRequest.cs b/src/SpeakeasySDK/Models/Operations/DeleteBillingAddOnRequest.cs similarity index 50% rename from src/SpeakeasySDK/Models/Operations/GetCodeSamplesRequest.cs rename to src/SpeakeasySDK/Models/Operations/DeleteBillingAddOnRequest.cs index c709971c..ac5ccbb6 100644 --- a/src/SpeakeasySDK/Models/Operations/GetCodeSamplesRequest.cs +++ b/src/SpeakeasySDK/Models/Operations/DeleteBillingAddOnRequest.cs @@ -9,22 +9,21 @@ #nullable enable namespace SpeakeasySDK.Models.Operations { + using Newtonsoft.Json; + using SpeakeasySDK.Models.Shared; using SpeakeasySDK.Utils; + using System; + using System.Collections.Concurrent; using System.Collections.Generic; + using System.Linq; - public class GetCodeSamplesRequest + public class DeleteBillingAddOnRequest { /// - /// The registry URL from which to retrieve the snippets. E.g. https://spec.speakeasy.com/org/ws/my-source + /// The specific add-on to delete. /// - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=registry_url")] - public string RegistryUrl { get; set; } = default!; - - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=languages")] - public List? Languages { get; set; } - - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=operation_ids")] - public List? OperationIds { get; set; } + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=add_on")] + public BillingAddOn AddOn { get; set; } = default!; } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/DeleteBillingAddOnResponse.cs b/src/SpeakeasySDK/Models/Operations/DeleteBillingAddOnResponse.cs new file mode 100644 index 00000000..d70442f6 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/DeleteBillingAddOnResponse.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Utils; + using System; + using System.Net.Http; + + public class DeleteBillingAddOnResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/DeletePublishingTokenRequest.cs b/src/SpeakeasySDK/Models/Operations/DeletePublishingTokenRequest.cs new file mode 100644 index 00000000..daf42ebc --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/DeletePublishingTokenRequest.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Utils; + + public class DeletePublishingTokenRequest + { + + /// + /// Unique identifier of the publishing token. + /// + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=tokenID")] + public string TokenID { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/DeletePublishingTokenResponse.cs b/src/SpeakeasySDK/Models/Operations/DeletePublishingTokenResponse.cs new file mode 100644 index 00000000..ea5d65f7 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/DeletePublishingTokenResponse.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Utils; + using System; + using System.Net.Http; + + public class DeletePublishingTokenResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/Format.cs b/src/SpeakeasySDK/Models/Operations/Format.cs new file mode 100644 index 00000000..c265f104 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/Format.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using Newtonsoft.Json; + using SpeakeasySDK.Utils; + using System; + + /// + /// The format of the OpenAPI specification. + /// + public enum Format + { + [JsonProperty("json")] + Json, + [JsonProperty("yaml")] + Yaml, + } + + public static class FormatExtension + { + public static string Value(this Format value) + { + return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString(); + } + + public static Format ToEnum(this string value) + { + foreach(var field in typeof(Format).GetFields()) + { + var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false); + if (attributes.Length == 0) + { + continue; + } + + var attribute = attributes[0] as JsonPropertyAttribute; + if (attribute != null && attribute.PropertyName == value) + { + var enumVal = field.GetValue(null); + + if (enumVal is Format) + { + return (Format)enumVal; + } + } + } + + throw new Exception($"Unknown value {value} for enum Format"); + } + } + +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GenerateCodeSamplePreviewResponse.cs b/src/SpeakeasySDK/Models/Operations/GenerateCodeSamplePreviewResponse.cs index 8bcb0164..10f4b041 100644 --- a/src/SpeakeasySDK/Models/Operations/GenerateCodeSamplePreviewResponse.cs +++ b/src/SpeakeasySDK/Models/Operations/GenerateCodeSamplePreviewResponse.cs @@ -9,6 +9,7 @@ #nullable enable namespace SpeakeasySDK.Models.Operations { + using SpeakeasySDK.Models.Shared; using SpeakeasySDK.Utils; using System; using System.Net.Http; @@ -16,16 +17,6 @@ namespace SpeakeasySDK.Models.Operations public class GenerateCodeSamplePreviewResponse { - /// - /// Successfully returned codeSample overlay file - /// - public byte[]? TwoHundredApplicationJsonBytes { get; set; } - - /// - /// Successfully returned codeSample overlay file - /// - public byte[]? TwoHundredApplicationXYamlBytes { get; set; } - /// /// HTTP response content type for this operation /// @@ -40,5 +31,10 @@ public class GenerateCodeSamplePreviewResponse /// Raw HTTP response; suitable for custom response parsing /// public HttpResponseMessage RawResponse { get; set; } = default!; + + /// + /// OK + /// + public UsageSnippets? UsageSnippets { get; set; } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetBillingAddOnsResponse.cs b/src/SpeakeasySDK/Models/Operations/GetBillingAddOnsResponse.cs new file mode 100644 index 00000000..d96d895c --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetBillingAddOnsResponse.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System; + using System.Net.Http; + + public class GetBillingAddOnsResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// Success + /// + public OrganizationBillingAddOnResponse? OrganizationBillingAddOnResponse { get; set; } + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetCodeSamplePreviewAsyncResponse.cs b/src/SpeakeasySDK/Models/Operations/GetCodeSamplePreviewAsyncResponse.cs index 26c1b3b6..f13ee3ce 100644 --- a/src/SpeakeasySDK/Models/Operations/GetCodeSamplePreviewAsyncResponse.cs +++ b/src/SpeakeasySDK/Models/Operations/GetCodeSamplePreviewAsyncResponse.cs @@ -10,6 +10,7 @@ namespace SpeakeasySDK.Models.Operations { using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; using SpeakeasySDK.Utils; using System; using System.Net.Http; @@ -17,21 +18,6 @@ namespace SpeakeasySDK.Models.Operations public class GetCodeSamplePreviewAsyncResponse { - /// - /// Successfully returned codeSample overlay file - /// - public byte[]? TwoHundredApplicationJsonBytes { get; set; } - - /// - /// Successfully returned codeSample overlay file - /// - public byte[]? TwoHundredApplicationXYamlBytes { get; set; } - - /// - /// Job is still in progress - /// - public GetCodeSamplePreviewAsyncResponseBody? TwoHundredAndTwoApplicationJsonObject { get; set; } - /// /// HTTP response content type for this operation /// @@ -46,5 +32,15 @@ public class GetCodeSamplePreviewAsyncResponse /// Raw HTTP response; suitable for custom response parsing /// public HttpResponseMessage RawResponse { get; set; } = default!; + + /// + /// OK + /// + public UsageSnippets? UsageSnippets { get; set; } + + /// + /// Job is still in progress + /// + public GetCodeSamplePreviewAsyncResponseBody? Object { get; set; } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetPublishingTokenByIDRequest.cs b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenByIDRequest.cs new file mode 100644 index 00000000..744a7fc6 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenByIDRequest.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Utils; + + public class GetPublishingTokenByIDRequest + { + + /// + /// Unique identifier of the publishing token. + /// + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=tokenID")] + public string TokenID { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetPublishingTokenByIDResponse.cs b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenByIDResponse.cs new file mode 100644 index 00000000..9bb3af37 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenByIDResponse.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System; + using System.Net.Http; + + public class GetPublishingTokenByIDResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// OK + /// + public PublishingToken? PublishingToken { get; set; } + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataRequest.cs b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataRequest.cs new file mode 100644 index 00000000..351b097b --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataRequest.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Utils; + + public class GetPublishingTokenPublicMetadataRequest + { + + /// + /// Unique identifier of the publishing token. + /// + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=tokenID")] + public string TokenID { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataResponse.cs b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataResponse.cs new file mode 100644 index 00000000..fb9246d9 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataResponse.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Utils; + using System; + using System.Net.Http; + + public class GetPublishingTokenPublicMetadataResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + + /// + /// OK + /// + public GetPublishingTokenPublicMetadataResponseBody? Object { get; set; } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataResponseBody.cs b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataResponseBody.cs new file mode 100644 index 00000000..7afd3567 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenPublicMetadataResponseBody.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using Newtonsoft.Json; + using SpeakeasySDK.Utils; + using System; + + /// + /// OK + /// + public class GetPublishingTokenPublicMetadataResponseBody + { + + [JsonProperty("organization_id")] + public string? OrganizationId { get; set; } + + [JsonProperty("target_id")] + public string? TargetId { get; set; } + + [JsonProperty("target_resource")] + public string? TargetResource { get; set; } + + [JsonProperty("valid_until")] + public DateTime? ValidUntil { get; set; } + + [JsonProperty("workspace_id")] + public string? WorkspaceId { get; set; } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetPublishingTokenResponse.cs b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenResponse.cs new file mode 100644 index 00000000..1bd46671 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenResponse.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System; + using System.Collections.Generic; + using System.Net.Http; + + public class GetPublishingTokenResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + + /// + /// OK + /// + public List? Classes { get; set; } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetPublishingTokenTargetByIDRequest.cs b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenTargetByIDRequest.cs new file mode 100644 index 00000000..0732f3c6 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenTargetByIDRequest.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Utils; + + public class GetPublishingTokenTargetByIDRequest + { + + /// + /// Unique identifier of the publishing token. + /// + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=tokenID")] + public string TokenID { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetPublishingTokenTargetByIDResponse.cs b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenTargetByIDResponse.cs new file mode 100644 index 00000000..502d4384 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetPublishingTokenTargetByIDResponse.cs @@ -0,0 +1,39 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Utils; + using System; + using System.Net.Http; + + public class GetPublishingTokenTargetByIDResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + + /// + /// OK + /// + public string? Res { get; set; } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetSchemaStoreItemRequestBody.cs b/src/SpeakeasySDK/Models/Operations/GetSchemaStoreItemRequestBody.cs new file mode 100644 index 00000000..e2322e3e --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetSchemaStoreItemRequestBody.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using Newtonsoft.Json; + using SpeakeasySDK.Utils; + + public class GetSchemaStoreItemRequestBody + { + + [JsonProperty("id")] + public string? Id { get; set; } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetCodeSamplesResponse.cs b/src/SpeakeasySDK/Models/Operations/GetSchemaStoreItemResponse.cs similarity index 91% rename from src/SpeakeasySDK/Models/Operations/GetCodeSamplesResponse.cs rename to src/SpeakeasySDK/Models/Operations/GetSchemaStoreItemResponse.cs index 03092bd0..5dbf5f8f 100644 --- a/src/SpeakeasySDK/Models/Operations/GetCodeSamplesResponse.cs +++ b/src/SpeakeasySDK/Models/Operations/GetSchemaStoreItemResponse.cs @@ -14,7 +14,7 @@ namespace SpeakeasySDK.Models.Operations using System; using System.Net.Http; - public class GetCodeSamplesResponse + public class GetSchemaStoreItemResponse { /// @@ -22,6 +22,11 @@ public class GetCodeSamplesResponse /// public string? ContentType { get; set; } = default!; + /// + /// OK + /// + public SchemaStoreItem? SchemaStoreItem { get; set; } + /// /// HTTP response status code for this operation /// @@ -31,10 +36,5 @@ public class GetCodeSamplesResponse /// Raw HTTP response; suitable for custom response parsing /// public HttpResponseMessage RawResponse { get; set; } = default!; - - /// - /// OK - /// - public UsageSnippets? UsageSnippets { get; set; } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetWorkspaceEventsByTargetRequest.cs b/src/SpeakeasySDK/Models/Operations/GetWorkspaceEventsByTargetRequest.cs index f35af538..9bcf6c34 100644 --- a/src/SpeakeasySDK/Models/Operations/GetWorkspaceEventsByTargetRequest.cs +++ b/src/SpeakeasySDK/Models/Operations/GetWorkspaceEventsByTargetRequest.cs @@ -15,18 +15,18 @@ namespace SpeakeasySDK.Models.Operations public class GetWorkspaceEventsByTargetRequest { - /// - /// Filter to only return events corresponding to a particular gen_lock_id (gen_lock_id uniquely identifies a target) - /// - [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=target_id")] - public string TargetId { get; set; } = default!; - /// /// Filter to only return events created after this timestamp /// [SpeakeasyMetadata("queryParam:style=form,explode=true,name=after_created_at")] public DateTime? AfterCreatedAt { get; set; } + /// + /// Filter to only return events corresponding to a particular gen_lock_id (gen_lock_id uniquely identifies a target) + /// + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=target_id")] + public string TargetId { get; set; } = default!; + /// /// Unique identifier of the workspace. /// diff --git a/src/SpeakeasySDK/Models/Operations/PostTagsRequest.cs b/src/SpeakeasySDK/Models/Operations/PostTagsRequest.cs index a270f6b2..e9d5571e 100644 --- a/src/SpeakeasySDK/Models/Operations/PostTagsRequest.cs +++ b/src/SpeakeasySDK/Models/Operations/PostTagsRequest.cs @@ -15,13 +15,13 @@ namespace SpeakeasySDK.Models.Operations public class PostTagsRequest { - [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=namespace_name")] - public string NamespaceName { get; set; } = default!; - /// /// A JSON representation of the tags to add /// [SpeakeasyMetadata("request:mediaType=application/json")] public AddTags? AddTags { get; set; } + + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=namespace_name")] + public string NamespaceName { get; set; } = default!; } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/SetVisibilityRequest.cs b/src/SpeakeasySDK/Models/Operations/SetVisibilityRequest.cs index c1f7fcad..c17e0fa2 100644 --- a/src/SpeakeasySDK/Models/Operations/SetVisibilityRequest.cs +++ b/src/SpeakeasySDK/Models/Operations/SetVisibilityRequest.cs @@ -15,13 +15,13 @@ namespace SpeakeasySDK.Models.Operations public class SetVisibilityRequest { - [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=namespace_name")] - public string NamespaceName { get; set; } = default!; - /// /// Namespace visibility /// [SpeakeasyMetadata("request:mediaType=application/json")] public SetVisibilityRequestBody? RequestBody { get; set; } + + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=namespace_name")] + public string NamespaceName { get; set; } = default!; } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/SuggestOpenAPIRegistryRequest.cs b/src/SpeakeasySDK/Models/Operations/SuggestOpenAPIRegistryRequest.cs index 7a659cca..d9a2a55c 100644 --- a/src/SpeakeasySDK/Models/Operations/SuggestOpenAPIRegistryRequest.cs +++ b/src/SpeakeasySDK/Models/Operations/SuggestOpenAPIRegistryRequest.cs @@ -15,6 +15,12 @@ namespace SpeakeasySDK.Models.Operations public class SuggestOpenAPIRegistryRequest { + /// + /// Suggest options + /// + [SpeakeasyMetadata("request:mediaType=application/json")] + public SuggestRequestBody? SuggestRequestBody { get; set; } + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=namespace_name")] public string NamespaceName { get; set; } = default!; @@ -26,11 +32,5 @@ public class SuggestOpenAPIRegistryRequest [SpeakeasyMetadata("header:style=simple,explode=false,name=x-session-id")] public string XSessionId { get; set; } = default!; - - /// - /// Suggest options - /// - [SpeakeasyMetadata("request:mediaType=application/json")] - public SuggestRequestBody? SuggestRequestBody { get; set; } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationRequest.cs b/src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationRequest.cs new file mode 100644 index 00000000..a85f5b52 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationRequest.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Utils; + + public class UpdatePublishingTokenExpirationRequest + { + + /// + /// The publishing token to update + /// + [SpeakeasyMetadata("request:mediaType=application/json")] + public UpdatePublishingTokenExpirationRequestBody? RequestBody { get; set; } + + /// + /// Unique identifier of the publishing token. + /// + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=tokenID")] + public string TokenID { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationRequestBody.cs b/src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationRequestBody.cs new file mode 100644 index 00000000..b450cc59 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationRequestBody.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using Newtonsoft.Json; + using SpeakeasySDK.Utils; + using System; + + /// + /// The publishing token to update + /// + public class UpdatePublishingTokenExpirationRequestBody + { + + /// + /// The new name for the publishing token. + /// + [JsonProperty("token_name")] + public string? TokenName { get; set; } + + /// + /// The new expiration date for the publishing token. + /// + [JsonProperty("valid_until")] + public DateTime ValidUntil { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationResponse.cs b/src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationResponse.cs new file mode 100644 index 00000000..a6168f9c --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/UpdatePublishingTokenExpirationResponse.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Operations +{ + using SpeakeasySDK.Utils; + using System; + using System.Net.Http; + + public class UpdatePublishingTokenExpirationResponse + { + + /// + /// HTTP response content type for this operation + /// + public string? ContentType { get; set; } = default!; + + /// + /// HTTP response status code for this operation + /// + public int StatusCode { get; set; } = default!; + + /// + /// Raw HTTP response; suitable for custom response parsing + /// + public HttpResponseMessage RawResponse { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/UploadReportRequestBody.cs b/src/SpeakeasySDK/Models/Operations/UploadReportRequestBody.cs index 053a88dd..812f43ff 100644 --- a/src/SpeakeasySDK/Models/Operations/UploadReportRequestBody.cs +++ b/src/SpeakeasySDK/Models/Operations/UploadReportRequestBody.cs @@ -23,6 +23,6 @@ public class UploadReportRequestBody public Report Data { get; set; } = default!; [SpeakeasyMetadata("multipartForm:file,name=file")] - public File File { get; set; } = default!; + public Models.Operations.File File { get; set; } = default!; } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/AccountType.cs b/src/SpeakeasySDK/Models/Shared/AccountType.cs index 92dc2cc3..c7696872 100644 --- a/src/SpeakeasySDK/Models/Shared/AccountType.cs +++ b/src/SpeakeasySDK/Models/Shared/AccountType.cs @@ -12,50 +12,68 @@ namespace SpeakeasySDK.Models.Shared using Newtonsoft.Json; using SpeakeasySDK.Utils; using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; - public enum AccountType + [JsonConverter(typeof(OpenEnumConverter))] + public class AccountType : IEquatable { - [JsonProperty("free")] - Free, - [JsonProperty("scale-up")] - ScaleUp, - [JsonProperty("business")] - Business, - [JsonProperty("enterprise")] - Enterprise, - } + public static readonly AccountType Free = new AccountType("free"); + public static readonly AccountType ScaleUp = new AccountType("scale-up"); + public static readonly AccountType Business = new AccountType("business"); + public static readonly AccountType Enterprise = new AccountType("enterprise"); - public static class AccountTypeExtension - { - public static string Value(this AccountType value) + private static readonly Dictionary _knownValues = + new Dictionary () + { + ["free"] = Free, + ["scale-up"] = ScaleUp, + ["business"] = Business, + ["enterprise"] = Enterprise + }; + + private static readonly ConcurrentDictionary _values = + new ConcurrentDictionary(_knownValues); + + private AccountType(string value) { - return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString(); + if (value == null) throw new ArgumentNullException(nameof(value)); + Value = value; } - public static AccountType ToEnum(this string value) + public string Value { get; } + + public static AccountType Of(string value) { - foreach(var field in typeof(AccountType).GetFields()) - { - var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false); - if (attributes.Length == 0) - { - continue; - } - - var attribute = attributes[0] as JsonPropertyAttribute; - if (attribute != null && attribute.PropertyName == value) - { - var enumVal = field.GetValue(null); - - if (enumVal is AccountType) - { - return (AccountType)enumVal; - } - } - } - - throw new Exception($"Unknown value {value} for enum AccountType"); + return _values.GetOrAdd(value, _ => new AccountType(value)); + } + + public static implicit operator AccountType(string value) => Of(value); + public static implicit operator string(AccountType accounttype) => accounttype.Value; + + public static AccountType[] Values() + { + return _values.Values.ToArray(); + } + + public override string ToString() => Value.ToString(); + + public bool IsKnown() + { + return _knownValues.ContainsKey(Value); } + + public override bool Equals(object? obj) => Equals(obj as AccountType); + + public bool Equals(AccountType? other) + { + if (ReferenceEquals(this, other)) return true; + if (other is null) return false; + return string.Equals(Value, other.Value); + } + + public override int GetHashCode() => Value.GetHashCode(); } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/ApiKeyDetails.cs b/src/SpeakeasySDK/Models/Shared/ApiKeyDetails.cs index 318112a8..36bd6380 100644 --- a/src/SpeakeasySDK/Models/Shared/ApiKeyDetails.cs +++ b/src/SpeakeasySDK/Models/Shared/ApiKeyDetails.cs @@ -13,7 +13,9 @@ namespace SpeakeasySDK.Models.Shared using SpeakeasySDK.Models.Shared; using SpeakeasySDK.Utils; using System; + using System.Collections.Concurrent; using System.Collections.Generic; + using System.Linq; public class ApiKeyDetails { @@ -21,6 +23,9 @@ public class ApiKeyDetails [JsonProperty("account_type_v2")] public AccountType AccountTypeV2 { get; set; } = default!; + [JsonProperty("billing_add_ons")] + public List BillingAddOns { get; set; } = default!; + [JsonProperty("enabled_features")] public List EnabledFeatures { get; set; } = default!; diff --git a/src/SpeakeasySDK/Models/Shared/BillingAddOn.cs b/src/SpeakeasySDK/Models/Shared/BillingAddOn.cs new file mode 100644 index 00000000..d68b301e --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/BillingAddOn.cs @@ -0,0 +1,79 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Shared +{ + using Newtonsoft.Json; + using SpeakeasySDK.Utils; + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; + + [JsonConverter(typeof(OpenEnumConverter))] + public class BillingAddOn : IEquatable + { + public static readonly BillingAddOn Webhooks = new BillingAddOn("webhooks"); + public static readonly BillingAddOn SDKTesting = new BillingAddOn("sdk_testing"); + public static readonly BillingAddOn CustomCodeRegions = new BillingAddOn("custom_code_regions"); + public static readonly BillingAddOn SnippetAi = new BillingAddOn("snippet_ai"); + + private static readonly Dictionary _knownValues = + new Dictionary () + { + ["webhooks"] = Webhooks, + ["sdk_testing"] = SDKTesting, + ["custom_code_regions"] = CustomCodeRegions, + ["snippet_ai"] = SnippetAi + }; + + private static readonly ConcurrentDictionary _values = + new ConcurrentDictionary(_knownValues); + + private BillingAddOn(string value) + { + if (value == null) throw new ArgumentNullException(nameof(value)); + Value = value; + } + + public string Value { get; } + + public static BillingAddOn Of(string value) + { + return _values.GetOrAdd(value, _ => new BillingAddOn(value)); + } + + public static implicit operator BillingAddOn(string value) => Of(value); + public static implicit operator string(BillingAddOn billingaddon) => billingaddon.Value; + + public static BillingAddOn[] Values() + { + return _values.Values.ToArray(); + } + + public override string ToString() => Value.ToString(); + + public bool IsKnown() + { + return _knownValues.ContainsKey(Value); + } + + public override bool Equals(object? obj) => Equals(obj as BillingAddOn); + + public bool Equals(BillingAddOn? other) + { + if (ReferenceEquals(this, other)) return true; + if (other is null) return false; + return string.Equals(Value, other.Value); + } + + public override int GetHashCode() => Value.GetHashCode(); + } + +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/CliEvent.cs b/src/SpeakeasySDK/Models/Shared/CliEvent.cs index ecc30d78..c1182ff6 100644 --- a/src/SpeakeasySDK/Models/Shared/CliEvent.cs +++ b/src/SpeakeasySDK/Models/Shared/CliEvent.cs @@ -473,6 +473,12 @@ public class CliEvent [JsonProperty("success")] public bool Success { get; set; } = default!; + /// + /// The raw test report xml + /// + [JsonProperty("test_report_raw")] + public string? TestReportRaw { get; set; } + /// /// Workflow lock file (post execution) /// diff --git a/src/SpeakeasySDK/Models/Shared/CodeSampleSchemaInput.cs b/src/SpeakeasySDK/Models/Shared/CodeSampleSchemaInput.cs index 8beae2e8..e875fe85 100644 --- a/src/SpeakeasySDK/Models/Shared/CodeSampleSchemaInput.cs +++ b/src/SpeakeasySDK/Models/Shared/CodeSampleSchemaInput.cs @@ -17,16 +17,16 @@ public class CodeSampleSchemaInput { /// - /// A list of languages to generate code samples for + /// The language to generate code samples for /// - [SpeakeasyMetadata("multipartForm:name=languages")] - public List Languages { get; set; } = default!; + [SpeakeasyMetadata("multipartForm:name=language")] + public string Language { get; set; } = default!; /// - /// The OpenAPI file to be uploaded + /// A list of operations IDs to generate code samples for /// - [SpeakeasyMetadata("multipartForm:file,name=schema_file")] - public SchemaFile SchemaFile { get; set; } = default!; + [SpeakeasyMetadata("multipartForm:name=operation_ids")] + public List? OperationIds { get; set; } /// /// The name of the package @@ -34,6 +34,12 @@ public class CodeSampleSchemaInput [SpeakeasyMetadata("multipartForm:name=package_name")] public string? PackageName { get; set; } + /// + /// The OpenAPI file to be uploaded + /// + [SpeakeasyMetadata("multipartForm:file,name=schema_file")] + public SchemaFile SchemaFile { get; set; } = default!; + /// /// The SDK class name /// diff --git a/src/SpeakeasySDK/Models/Shared/FeatureFlag.cs b/src/SpeakeasySDK/Models/Shared/FeatureFlag.cs index 7c75ed01..e305e615 100644 --- a/src/SpeakeasySDK/Models/Shared/FeatureFlag.cs +++ b/src/SpeakeasySDK/Models/Shared/FeatureFlag.cs @@ -13,6 +13,9 @@ namespace SpeakeasySDK.Models.Shared using SpeakeasySDK.Models.Shared; using SpeakeasySDK.Utils; using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; /// /// A feature flag is a key-value pair that can be used to enable or disable features. diff --git a/src/SpeakeasySDK/Models/Shared/Format.cs b/src/SpeakeasySDK/Models/Shared/Format.cs new file mode 100644 index 00000000..9bdaab90 --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/Format.cs @@ -0,0 +1,57 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Shared +{ + using Newtonsoft.Json; + using SpeakeasySDK.Utils; + using System; + + public enum Format + { + [JsonProperty("json")] + Json, + [JsonProperty("yaml")] + Yaml, + } + + public static class FormatExtension + { + public static string Value(this Format value) + { + return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString(); + } + + public static Format ToEnum(this string value) + { + foreach(var field in typeof(Format).GetFields()) + { + var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false); + if (attributes.Length == 0) + { + continue; + } + + var attribute = attributes[0] as JsonPropertyAttribute; + if (attribute != null && attribute.PropertyName == value) + { + var enumVal = field.GetValue(null); + + if (enumVal is Format) + { + return (Format)enumVal; + } + } + } + + throw new Exception($"Unknown value {value} for enum Format"); + } + } + +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/GithubTriggerActionRequest.cs b/src/SpeakeasySDK/Models/Shared/GithubTriggerActionRequest.cs index 8ef9d700..634d6323 100644 --- a/src/SpeakeasySDK/Models/Shared/GithubTriggerActionRequest.cs +++ b/src/SpeakeasySDK/Models/Shared/GithubTriggerActionRequest.cs @@ -18,6 +18,12 @@ namespace SpeakeasySDK.Models.Shared public class GithubTriggerActionRequest { + /// + /// Force an SDK generation + /// + [JsonProperty("force")] + public bool? Force { get; set; } + /// /// The generation lock ID /// @@ -36,12 +42,6 @@ public class GithubTriggerActionRequest [JsonProperty("repo_name")] public string RepoName { get; set; } = default!; - /// - /// Force an SDK generation - /// - [JsonProperty("force")] - public bool? Force { get; set; } - /// /// A version to override the SDK too in workflow dispatch /// diff --git a/src/SpeakeasySDK/Models/Shared/InteractionType.cs b/src/SpeakeasySDK/Models/Shared/InteractionType.cs index 2cd15282..d7b1793e 100644 --- a/src/SpeakeasySDK/Models/Shared/InteractionType.cs +++ b/src/SpeakeasySDK/Models/Shared/InteractionType.cs @@ -40,6 +40,8 @@ public enum InteractionType Configure, [JsonProperty("PUBLISH")] Publish, + [JsonProperty("TEST")] + Test, } public static class InteractionTypeExtension diff --git a/src/SpeakeasySDK/Models/Shared/Namespace.cs b/src/SpeakeasySDK/Models/Shared/Namespace.cs index 5ab49c03..f4c9bdaa 100644 --- a/src/SpeakeasySDK/Models/Shared/Namespace.cs +++ b/src/SpeakeasySDK/Models/Shared/Namespace.cs @@ -20,6 +20,9 @@ namespace SpeakeasySDK.Models.Shared public class Namespace { + [JsonProperty("archived_at")] + public DateTime? ArchivedAt { get; set; } + [JsonProperty("composite_spec_metadata")] public CompositeSpecMetadata? CompositeSpecMetadata { get; set; } @@ -32,6 +35,9 @@ public class Namespace [JsonProperty("id")] public string Id { get; set; } = default!; + [JsonProperty("latest_revision_metadata")] + public RevisionContentsMetadata? LatestRevisionMetadata { get; set; } + /// /// A human-readable name for the namespace. /// diff --git a/src/SpeakeasySDK/Models/Shared/Organization.cs b/src/SpeakeasySDK/Models/Shared/Organization.cs index caf33647..479b9b11 100644 --- a/src/SpeakeasySDK/Models/Shared/Organization.cs +++ b/src/SpeakeasySDK/Models/Shared/Organization.cs @@ -13,6 +13,9 @@ namespace SpeakeasySDK.Models.Shared using SpeakeasySDK.Models.Shared; using SpeakeasySDK.Utils; using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; /// /// A speakeasy organization @@ -26,9 +29,15 @@ public class Organization [JsonProperty("created_at")] public DateTime CreatedAt { get; set; } = default!; + [JsonProperty("free_trial_expiry")] + public DateTime? FreeTrialExpiry { get; set; } = null; + [JsonProperty("id")] public string Id { get; set; } = default!; + [JsonProperty("internal")] + public bool? Internal { get; set; } + [JsonProperty("name")] public string Name { get; set; } = default!; @@ -38,19 +47,13 @@ public class Organization [JsonProperty("sso_activated")] public bool SsoActivated { get; set; } = default!; + [JsonProperty("sso_connection_id")] + public string? SsoConnectionId { get; set; } = null; + [JsonProperty("telemetry_disabled")] public bool TelemetryDisabled { get; set; } = default!; [JsonProperty("updated_at")] public DateTime UpdatedAt { get; set; } = default!; - - [JsonProperty("free_trial_expiry")] - public DateTime? FreeTrialExpiry { get; set; } = null; - - [JsonProperty("internal")] - public bool? Internal { get; set; } - - [JsonProperty("sso_connection_id")] - public string? SsoConnectionId { get; set; } = null; } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/OrganizationBillingAddOnRequest.cs b/src/SpeakeasySDK/Models/Shared/OrganizationBillingAddOnRequest.cs new file mode 100644 index 00000000..eb8fe19b --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/OrganizationBillingAddOnRequest.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Shared +{ + using Newtonsoft.Json; + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; + + /// + /// A request to add billing add ons + /// + public class OrganizationBillingAddOnRequest + { + + [JsonProperty("add_ons")] + public List AddOns { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/OrganizationBillingAddOnResponse.cs b/src/SpeakeasySDK/Models/Shared/OrganizationBillingAddOnResponse.cs new file mode 100644 index 00000000..cb71d076 --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/OrganizationBillingAddOnResponse.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Shared +{ + using Newtonsoft.Json; + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; + + /// + /// Billing add on response + /// + public class OrganizationBillingAddOnResponse + { + + [JsonProperty("add_ons")] + public List AddOns { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/PublishingToken.cs b/src/SpeakeasySDK/Models/Shared/PublishingToken.cs new file mode 100644 index 00000000..67fb9869 --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/PublishingToken.cs @@ -0,0 +1,59 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Shared +{ + using Newtonsoft.Json; + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System; + + /// + /// A token used to publish to a target + /// + public class PublishingToken + { + + [JsonProperty("created_at")] + public DateTime CreatedAt { get; set; } = default!; + + [JsonProperty("created_by")] + public string CreatedBy { get; set; } = default!; + + [JsonProperty("id")] + public string Id { get; set; } = default!; + + [JsonProperty("organization_id")] + public string OrganizationId { get; set; } = default!; + + [JsonProperty("target_id")] + public string TargetId { get; set; } = default!; + + [JsonProperty("target_resource")] + public TargetResource TargetResource { get; set; } = default!; + + [JsonProperty("token")] + public string Token { get; set; } = default!; + + [JsonProperty("token_name")] + public string TokenName { get; set; } = default!; + + [JsonProperty("updated_at")] + public DateTime? UpdatedAt { get; set; } + + [JsonProperty("updated_by")] + public string? UpdatedBy { get; set; } + + [JsonProperty("valid_until")] + public DateTime ValidUntil { get; set; } = default!; + + [JsonProperty("workspace_id")] + public string WorkspaceId { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/Revision.cs b/src/SpeakeasySDK/Models/Shared/Revision.cs index e19a985b..3cda1aa7 100644 --- a/src/SpeakeasySDK/Models/Shared/Revision.cs +++ b/src/SpeakeasySDK/Models/Shared/Revision.cs @@ -10,6 +10,7 @@ namespace SpeakeasySDK.Models.Shared { using Newtonsoft.Json; + using SpeakeasySDK.Models.Shared; using SpeakeasySDK.Utils; using System; using System.Collections.Generic; @@ -17,6 +18,9 @@ namespace SpeakeasySDK.Models.Shared public class Revision { + [JsonProperty("contents_metadata")] + public RevisionContentsMetadata? ContentsMetadata { get; set; } + [JsonProperty("created_at")] public DateTime CreatedAt { get; set; } = default!; diff --git a/src/SpeakeasySDK/Models/Shared/RevisionContentsMetadata.cs b/src/SpeakeasySDK/Models/Shared/RevisionContentsMetadata.cs new file mode 100644 index 00000000..c282b51f --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/RevisionContentsMetadata.cs @@ -0,0 +1,93 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Shared +{ + using Newtonsoft.Json; + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System; + using System.Collections.Generic; + + public class RevisionContentsMetadata + { + + /// + /// Whether the OAS contains code samples. + /// + [JsonProperty("contains_code_samples")] + public bool ContainsCodeSamples { get; set; } = default!; + + [JsonProperty("created_at")] + public DateTime CreatedAt { get; set; } = default!; + + /// + /// The OAS description + /// + [JsonProperty("description")] + public string Description { get; set; } = default!; + + /// + /// The hash of the contents + /// + [JsonProperty("hash")] + public string Hash { get; set; } = default!; + + /// + /// The fully qualified namespace + /// + [JsonProperty("namespace")] + public string Namespace { get; set; } = default!; + + /// + /// The number of overlay actions in the OAS. Will be 0 if the OAS is not an overlay. + /// + [JsonProperty("num_overlay_actions")] + public long NumOverlayActions { get; set; } = default!; + + /// + /// The operation IDs contained in the OAS. Will be empty if the OAS is an overlay. + /// + [JsonProperty("operation_ids")] + public List OperationIds { get; set; } = default!; + + /// + /// The digest of the parent bundle + /// + [JsonProperty("revision_digest")] + public string RevisionDigest { get; set; } = default!; + + /// + /// The tags contained in the OAS -- NOT the OCI tags. Will be empty if the OAS is an overlay. + /// + [JsonProperty("tags")] + public List Tags { get; set; } = default!; + + /// + /// The OAS title + /// + [JsonProperty("title")] + public string Title { get; set; } = default!; + + [JsonProperty("type")] + public RevisionContentsMetadataType Type { get; set; } = default!; + + /// + /// The OAS version + /// + [JsonProperty("version")] + public string Version { get; set; } = default!; + + /// + /// The workspace ID + /// + [JsonProperty("workspace_id")] + public string WorkspaceId { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/RevisionContentsMetadataType.cs b/src/SpeakeasySDK/Models/Shared/RevisionContentsMetadataType.cs new file mode 100644 index 00000000..fe811667 --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/RevisionContentsMetadataType.cs @@ -0,0 +1,57 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Shared +{ + using Newtonsoft.Json; + using SpeakeasySDK.Utils; + using System; + + public enum RevisionContentsMetadataType + { + [JsonProperty("OPENAPI_BUNDLE")] + OpenapiBundle, + [JsonProperty("OPENAPI_OVERLAY")] + OpenapiOverlay, + } + + public static class RevisionContentsMetadataTypeExtension + { + public static string Value(this RevisionContentsMetadataType value) + { + return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString(); + } + + public static RevisionContentsMetadataType ToEnum(this string value) + { + foreach(var field in typeof(RevisionContentsMetadataType).GetFields()) + { + var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false); + if (attributes.Length == 0) + { + continue; + } + + var attribute = attributes[0] as JsonPropertyAttribute; + if (attribute != null && attribute.PropertyName == value) + { + var enumVal = field.GetValue(null); + + if (enumVal is RevisionContentsMetadataType) + { + return (RevisionContentsMetadataType)enumVal; + } + } + } + + throw new Exception($"Unknown value {value} for enum RevisionContentsMetadataType"); + } + } + +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/SchemaStoreItem.cs b/src/SpeakeasySDK/Models/Shared/SchemaStoreItem.cs new file mode 100644 index 00000000..ddd7a4a9 --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/SchemaStoreItem.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Shared +{ + using Newtonsoft.Json; + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System; + + public class SchemaStoreItem + { + + [JsonProperty("created_at")] + public DateTime CreatedAt { get; set; } = default!; + + [JsonProperty("format")] + public Models.Shared.Format Format { get; set; } = default!; + + [JsonProperty("id")] + public string Id { get; set; } = default!; + + [JsonProperty("packageName")] + public string PackageName { get; set; } = default!; + + [JsonProperty("sdkClassname")] + public string SDKClassname { get; set; } = default!; + + [JsonProperty("spec")] + public string Spec { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/TargetResource.cs b/src/SpeakeasySDK/Models/Shared/TargetResource.cs new file mode 100644 index 00000000..f32f08b3 --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/TargetResource.cs @@ -0,0 +1,55 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK.Models.Shared +{ + using Newtonsoft.Json; + using SpeakeasySDK.Utils; + using System; + + public enum TargetResource + { + [JsonProperty("document")] + Document, + } + + public static class TargetResourceExtension + { + public static string Value(this TargetResource value) + { + return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString(); + } + + public static TargetResource ToEnum(this string value) + { + foreach(var field in typeof(TargetResource).GetFields()) + { + var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false); + if (attributes.Length == 0) + { + continue; + } + + var attribute = attributes[0] as JsonPropertyAttribute; + if (attribute != null && attribute.PropertyName == value) + { + var enumVal = field.GetValue(null); + + if (enumVal is TargetResource) + { + return (TargetResource)enumVal; + } + } + } + + throw new Exception($"Unknown value {value} for enum TargetResource"); + } + } + +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/UsageSnippet.cs b/src/SpeakeasySDK/Models/Shared/UsageSnippet.cs index 36e1ab57..4544b1c8 100644 --- a/src/SpeakeasySDK/Models/Shared/UsageSnippet.cs +++ b/src/SpeakeasySDK/Models/Shared/UsageSnippet.cs @@ -27,10 +27,22 @@ public class UsageSnippet [JsonProperty("language")] public string Language { get; set; } = default!; + /// + /// The HTTP method of the operation + /// + [JsonProperty("method")] + public object Method { get; set; } = default!; + /// /// The operation ID for the snippet /// [JsonProperty("operationId")] public string OperationId { get; set; } = default!; + + /// + /// The path of the operation + /// + [JsonProperty("path")] + public string Path { get; set; } = default!; } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/User.cs b/src/SpeakeasySDK/Models/Shared/User.cs index 990b3fb9..62882538 100644 --- a/src/SpeakeasySDK/Models/Shared/User.cs +++ b/src/SpeakeasySDK/Models/Shared/User.cs @@ -64,6 +64,12 @@ public class User [JsonProperty("github_handle")] public string? GithubHandle { get; set; } = null; + /// + /// Indicates whether the user has created an API key. Not always populated + /// + [JsonProperty("has_created_api_key")] + public bool? HasCreatedApiKey { get; set; } + /// /// Unique identifier for the user. /// @@ -88,6 +94,12 @@ public class User [JsonProperty("photo_url")] public string? PhotoUrl { get; set; } = null; + /// + /// Hash used for pylon identity verification returned on v1/user. + /// + [JsonProperty("pylon_identity_hash")] + public string? PylonIdentityHash { get; set; } + /// /// Timestamp of the user's last update. /// diff --git a/src/SpeakeasySDK/Models/Shared/Workspace.cs b/src/SpeakeasySDK/Models/Shared/Workspace.cs index 26b6d1d5..7c28f0f8 100644 --- a/src/SpeakeasySDK/Models/Shared/Workspace.cs +++ b/src/SpeakeasySDK/Models/Shared/Workspace.cs @@ -25,6 +25,9 @@ public class Workspace [JsonProperty("id")] public string Id { get; set; } = default!; + [JsonProperty("inactive")] + public bool? Inactive { get; set; } + [JsonProperty("name")] public string Name { get; set; } = default!; @@ -34,20 +37,17 @@ public class Workspace [JsonProperty("slug")] public string Slug { get; set; } = default!; - [JsonProperty("updated_at")] - public DateTime UpdatedAt { get; set; } = default!; - - [JsonProperty("verified")] - public bool Verified { get; set; } = default!; - - [JsonProperty("inactive")] - public bool? Inactive { get; set; } - /// /// Deprecated. Use organization.telemetry_disabled instead. /// [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible")] [JsonProperty("telemetry_disabled")] public bool? TelemetryDisabled { get; set; } + + [JsonProperty("updated_at")] + public DateTime UpdatedAt { get; set; } = default!; + + [JsonProperty("verified")] + public bool Verified { get; set; } = default!; } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlag.cs b/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlag.cs index 40325487..e8725cc7 100644 --- a/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlag.cs +++ b/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlag.cs @@ -12,53 +12,71 @@ namespace SpeakeasySDK.Models.Shared using Newtonsoft.Json; using SpeakeasySDK.Utils; using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; /// /// enum value workspace feature flag /// - public enum WorkspaceFeatureFlag + [JsonConverter(typeof(OpenEnumConverter))] + public class WorkspaceFeatureFlag : IEquatable { - [JsonProperty("schema_registry")] - SchemaRegistry, - [JsonProperty("changes_report")] - ChangesReport, - [JsonProperty("skip_schema_registry")] - SkipSchemaRegistry, - [JsonProperty("webhooks")] - Webhooks, - } + public static readonly WorkspaceFeatureFlag SchemaRegistry = new WorkspaceFeatureFlag("schema_registry"); + public static readonly WorkspaceFeatureFlag ChangesReport = new WorkspaceFeatureFlag("changes_report"); + public static readonly WorkspaceFeatureFlag SkipSchemaRegistry = new WorkspaceFeatureFlag("skip_schema_registry"); + public static readonly WorkspaceFeatureFlag Webhooks = new WorkspaceFeatureFlag("webhooks"); - public static class WorkspaceFeatureFlagExtension - { - public static string Value(this WorkspaceFeatureFlag value) + private static readonly Dictionary _knownValues = + new Dictionary () + { + ["schema_registry"] = SchemaRegistry, + ["changes_report"] = ChangesReport, + ["skip_schema_registry"] = SkipSchemaRegistry, + ["webhooks"] = Webhooks + }; + + private static readonly ConcurrentDictionary _values = + new ConcurrentDictionary(_knownValues); + + private WorkspaceFeatureFlag(string value) { - return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString(); + if (value == null) throw new ArgumentNullException(nameof(value)); + Value = value; } - public static WorkspaceFeatureFlag ToEnum(this string value) + public string Value { get; } + + public static WorkspaceFeatureFlag Of(string value) { - foreach(var field in typeof(WorkspaceFeatureFlag).GetFields()) - { - var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false); - if (attributes.Length == 0) - { - continue; - } + return _values.GetOrAdd(value, _ => new WorkspaceFeatureFlag(value)); + } - var attribute = attributes[0] as JsonPropertyAttribute; - if (attribute != null && attribute.PropertyName == value) - { - var enumVal = field.GetValue(null); + public static implicit operator WorkspaceFeatureFlag(string value) => Of(value); + public static implicit operator string(WorkspaceFeatureFlag workspacefeatureflag) => workspacefeatureflag.Value; - if (enumVal is WorkspaceFeatureFlag) - { - return (WorkspaceFeatureFlag)enumVal; - } - } - } + public static WorkspaceFeatureFlag[] Values() + { + return _values.Values.ToArray(); + } + + public override string ToString() => Value.ToString(); + + public bool IsKnown() + { + return _knownValues.ContainsKey(Value); + } + + public override bool Equals(object? obj) => Equals(obj as WorkspaceFeatureFlag); - throw new Exception($"Unknown value {value} for enum WorkspaceFeatureFlag"); + public bool Equals(WorkspaceFeatureFlag? other) + { + if (ReferenceEquals(this, other)) return true; + if (other is null) return false; + return string.Equals(Value, other.Value); } + + public override int GetHashCode() => Value.GetHashCode(); } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlagRequest.cs b/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlagRequest.cs index ab959ef9..a2adfce0 100644 --- a/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlagRequest.cs +++ b/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlagRequest.cs @@ -12,7 +12,10 @@ namespace SpeakeasySDK.Models.Shared using Newtonsoft.Json; using SpeakeasySDK.Models.Shared; using SpeakeasySDK.Utils; + using System; + using System.Collections.Concurrent; using System.Collections.Generic; + using System.Linq; /// /// A request to add workspace feature flags diff --git a/src/SpeakeasySDK/Models/Shared/WorkspaceToken.cs b/src/SpeakeasySDK/Models/Shared/WorkspaceToken.cs index 4c6b27ac..7dfc7140 100644 --- a/src/SpeakeasySDK/Models/Shared/WorkspaceToken.cs +++ b/src/SpeakeasySDK/Models/Shared/WorkspaceToken.cs @@ -28,6 +28,12 @@ public class WorkspaceToken [JsonProperty("created_by")] public string? CreatedBy { get; set; } = null; + [JsonProperty("created_by_name")] + public string? CreatedByName { get; set; } = null; + + [JsonProperty("created_by_photo_url")] + public string? CreatedByPhotoUrl { get; set; } = null; + [JsonProperty("email")] public string? Email { get; set; } = null; diff --git a/src/SpeakeasySDK/Models/Shared/Workspaces.cs b/src/SpeakeasySDK/Models/Shared/Workspaces.cs index 624c65f9..9af26a22 100644 --- a/src/SpeakeasySDK/Models/Shared/Workspaces.cs +++ b/src/SpeakeasySDK/Models/Shared/Workspaces.cs @@ -13,6 +13,9 @@ namespace SpeakeasySDK.Models.Shared using SpeakeasySDK.Models.Shared; using SpeakeasySDK.Utils; using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; public class Workspaces { diff --git a/src/SpeakeasySDK/Organizations.cs b/src/SpeakeasySDK/Organizations.cs index e1a3903c..fdbaf616 100644 --- a/src/SpeakeasySDK/Organizations.cs +++ b/src/SpeakeasySDK/Organizations.cs @@ -37,6 +37,11 @@ public interface IOrganizations /// Task CreateAsync(Organization request); + /// + /// Create billing add ons + /// + Task CreateBillingAddOnsAsync(OrganizationBillingAddOnRequest request); + /// /// Create a free trial for an organization /// @@ -46,6 +51,11 @@ public interface IOrganizations /// Task CreateFreeTrialAsync(); + /// + /// Delete billing add ons + /// + Task DeleteBillingAddOnAsync(DeleteBillingAddOnRequest request); + /// /// Get organization /// @@ -64,6 +74,11 @@ public interface IOrganizations /// Task GetAllAsync(); + /// + /// Get billing add ons + /// + Task GetBillingAddOnsAsync(); + /// /// Get billing usage summary for a particular organization /// @@ -81,19 +96,12 @@ public class Organizations: IOrganizations { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; - public Organizations(ISpeakeasyHttpClient client, Func? securitySource, string serverUrl, SDKConfig config) + public Organizations(SDKConfig config) { - _client = client; - _securitySource = securitySource; - _serverUrl = serverUrl; SDKConfiguration = config; } @@ -104,7 +112,7 @@ public async Task CreateAsync(Organization request) var urlString = baseUrl + "/v1/organization"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); if (serializedBody != null) @@ -112,19 +120,19 @@ public async Task CreateAsync(Organization request) httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("createOrganization", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "createOrganization", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -157,7 +165,17 @@ public async Task CreateAsync(Organization request) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + Organization obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into Organization.", httpResponse, httpResponseBody, ex); + } + var response = new CreateOrganizationResponse() { StatusCode = responseStatusCode, @@ -168,24 +186,145 @@ public async Task CreateAsync(Organization request) return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + public async Task CreateBillingAddOnsAsync(OrganizationBillingAddOnRequest request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + + var urlString = baseUrl + "/v1/organization/add_ons"; + + var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); + if (serializedBody != null) + { + httpRequest.Content = serializedBody; + } + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "createBillingAddOns", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode == 200) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + OrganizationBillingAddOnResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into OrganizationBillingAddOnResponse.", httpResponse, httpResponseBody, ex); + } + + var response = new CreateBillingAddOnsResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.OrganizationBillingAddOnResponse = obj; + return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task CreateFreeTrialAsync() @@ -195,21 +334,21 @@ public async Task CreateFreeTrialAsync() var urlString = baseUrl + "/v1/organization/free_trial"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("createFreeTrial", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "createFreeTrial", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -239,7 +378,7 @@ public async Task CreateFreeTrialAsync() var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new CreateFreeTrialResponse() { StatusCode = responseStatusCode, @@ -251,18 +390,114 @@ public async Task CreateFreeTrialAsync() { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + public async Task DeleteBillingAddOnAsync(DeleteBillingAddOnRequest request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + var urlString = URLBuilder.Build(baseUrl, "/v1/organization/add_ons/{add_on}", request); + + var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "deleteBillingAddOn", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode == 200) + { + return new DeleteBillingAddOnResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetAsync(GetOrganizationRequest request) @@ -271,21 +506,21 @@ public async Task GetAsync(GetOrganizationRequest reque var urlString = URLBuilder.Build(baseUrl, "/v1/organization/{organizationID}", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getOrganization", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getOrganization", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -318,7 +553,17 @@ public async Task GetAsync(GetOrganizationRequest reque { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + Organization obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into Organization.", httpResponse, httpResponseBody, ex); + } + var response = new GetOrganizationResponse() { StatusCode = responseStatusCode, @@ -329,24 +574,34 @@ public async Task GetAsync(GetOrganizationRequest reque return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetAllAsync() @@ -356,21 +611,21 @@ public async Task GetAllAsync() var urlString = baseUrl + "/v1/organizations"; var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getOrganizations", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getOrganizations", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -403,7 +658,17 @@ public async Task GetAllAsync() { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + var response = new GetOrganizationsResponse() { StatusCode = responseStatusCode, @@ -414,24 +679,139 @@ public async Task GetAllAsync() return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + public async Task GetBillingAddOnsAsync() + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + + var urlString = baseUrl + "/v1/organization/add_ons"; + + var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getBillingAddOns", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode == 200) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + OrganizationBillingAddOnResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into OrganizationBillingAddOnResponse.", httpResponse, httpResponseBody, ex); + } + + var response = new GetBillingAddOnsResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.OrganizationBillingAddOnResponse = obj; + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetUsageAsync() @@ -441,21 +821,21 @@ public async Task GetUsageAsync() var urlString = baseUrl + "/v1/organization/usage"; var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getOrganizationUsage", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getOrganizationUsage", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -488,7 +868,17 @@ public async Task GetUsageAsync() { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + OrganizationUsageResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into OrganizationUsageResponse.", httpResponse, httpResponseBody, ex); + } + var response = new GetOrganizationUsageResponse() { StatusCode = responseStatusCode, @@ -499,24 +889,34 @@ public async Task GetUsageAsync() return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/PublishingTokens.cs b/src/SpeakeasySDK/PublishingTokens.cs new file mode 100644 index 00000000..0df97fc5 --- /dev/null +++ b/src/SpeakeasySDK/PublishingTokens.cs @@ -0,0 +1,800 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK +{ + using Newtonsoft.Json; + using SpeakeasySDK.Hooks; + using SpeakeasySDK.Models.Errors; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using SpeakeasySDK.Utils.Retries; + using System; + using System.Collections.Generic; + using System.Net.Http; + using System.Net.Http.Headers; + using System.Threading.Tasks; + + public interface IPublishingTokens + { + + /// + /// Create a publishing token for a workspace + /// + /// + /// Creates a publishing token for the current workspace + /// + /// + Task CreateAsync(CreatePublishingTokenRequestBody? request = null); + + /// + /// Delete a specific publishing token + /// + /// + /// Delete a particular publishing token. + /// + /// + Task DeleteAsync(DeletePublishingTokenRequest request); + + /// + /// Get a specific publishing token + /// + /// + /// Get information about a particular publishing token. + /// + /// + Task GetAsync(GetPublishingTokenByIDRequest request); + + /// + /// Get publishing tokens for a workspace + /// + /// + /// Returns a publishing token for the current workspace + /// + /// + Task ListAsync(); + + /// + /// Get metadata about the token + /// + /// + /// Get information about a particular publishing token. + /// + /// + Task ResolveMetadataAsync(GetPublishingTokenPublicMetadataRequest request); + + /// + /// Get a specific publishing token target + /// + /// + /// Get information about a particular publishing token target. + /// + /// + Task ResolveTargetAsync(GetPublishingTokenTargetByIDRequest request); + + /// + /// Updates the validitity period of a publishing token + /// + /// + /// Updates the validity period of a particular publishing token. + /// + /// + Task UpdateAsync(UpdatePublishingTokenExpirationRequest request); + } + + public class PublishingTokens: IPublishingTokens + { + public SDKConfig SDKConfiguration { get; private set; } + private const string _language = "csharp"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; + private const string _openapiDocVersion = "0.4.0"; + + public PublishingTokens(SDKConfig config) + { + SDKConfiguration = config; + } + + public async Task CreateAsync(CreatePublishingTokenRequestBody? request = null) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + + var urlString = baseUrl + "/v1/publishing-tokens"; + + var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, true); + if (serializedBody != null) + { + httpRequest.Content = serializedBody; + } + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "createPublishingToken", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode == 200) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + PublishingToken obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into PublishingToken.", httpResponse, httpResponseBody, ex); + } + + var response = new CreatePublishingTokenResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.PublishingToken = obj; + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + public async Task DeleteAsync(DeletePublishingTokenRequest request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + var urlString = URLBuilder.Build(baseUrl, "/v1/publishing-tokens/{tokenID}", request); + + var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "deletePublishingToken", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode == 200) + { + return new DeletePublishingTokenResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + public async Task GetAsync(GetPublishingTokenByIDRequest request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + var urlString = URLBuilder.Build(baseUrl, "/v1/publishing-tokens/{tokenID}", request); + + var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getPublishingTokenByID", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode == 200) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + PublishingToken obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into PublishingToken.", httpResponse, httpResponseBody, ex); + } + + var response = new GetPublishingTokenByIDResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.PublishingToken = obj; + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + public async Task ListAsync() + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + + var urlString = baseUrl + "/v1/publishing-tokens"; + + var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getPublishingToken", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode == 200) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + + var response = new GetPublishingTokenResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.Classes = obj; + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + public async Task ResolveMetadataAsync(GetPublishingTokenPublicMetadataRequest request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + var urlString = URLBuilder.Build(baseUrl, "/v1/publishing-tokens/{tokenID}/metadata", request); + + var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getPublishingTokenPublicMetadata", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode == 200) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPublishingTokenPublicMetadataResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPublishingTokenPublicMetadataResponseBody.", httpResponse, httpResponseBody, ex); + } + + var response = new GetPublishingTokenPublicMetadataResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.Object = obj; + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + public async Task ResolveTargetAsync(GetPublishingTokenTargetByIDRequest request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + var urlString = URLBuilder.Build(baseUrl, "/v1/publishing-tokens/{tokenID}/target", request); + + var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getPublishingTokenTargetByID", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode == 200) + { + if(Utilities.IsContentTypeMatch("text/plain", contentType)) + { + var response = new GetPublishingTokenTargetByIDResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.Res = await httpResponse.Content.ReadAsStringAsync(); + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + public async Task UpdateAsync(UpdatePublishingTokenExpirationRequest request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + var urlString = URLBuilder.Build(baseUrl, "/v1/publishing-tokens/{tokenID}", request); + + var httpRequest = new HttpRequestMessage(HttpMethod.Put, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + var serializedBody = RequestBodySerializer.Serialize(request, "RequestBody", "json", false, true); + if (serializedBody != null) + { + httpRequest.Content = serializedBody; + } + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "updatePublishingTokenExpiration", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode == 200) + { + return new UpdatePublishingTokenExpirationResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Reports.cs b/src/SpeakeasySDK/Reports.cs index 1f287cac..5cc049d8 100644 --- a/src/SpeakeasySDK/Reports.cs +++ b/src/SpeakeasySDK/Reports.cs @@ -51,19 +51,12 @@ public class Reports: IReports { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; - public Reports(ISpeakeasyHttpClient client, Func? securitySource, string serverUrl, SDKConfig config) + public Reports(SDKConfig config) { - _client = client; - _securitySource = securitySource; - _serverUrl = serverUrl; SDKConfiguration = config; } @@ -73,21 +66,21 @@ public async Task GetChangesReportSignedUrlAs var urlString = URLBuilder.Build(baseUrl, "/v1/reports/changes/{documentChecksum}", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getChangesReportSignedUrl", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getChangesReportSignedUrl", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -120,7 +113,17 @@ public async Task GetChangesReportSignedUrlAs { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetChangesReportSignedUrlSignedAccess obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetChangesReportSignedUrlSignedAccess.", httpResponse, httpResponseBody, ex); + } + var response = new GetChangesReportSignedUrlResponse() { StatusCode = responseStatusCode, @@ -131,14 +134,18 @@ public async Task GetChangesReportSignedUrlAs return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetLintingReportSignedUrlAsync(GetLintingReportSignedUrlRequest request) @@ -147,21 +154,21 @@ public async Task GetLintingReportSignedUrlAs var urlString = URLBuilder.Build(baseUrl, "/v1/reports/linting/{documentChecksum}", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getLintingReportSignedUrl", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getLintingReportSignedUrl", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -194,7 +201,17 @@ public async Task GetLintingReportSignedUrlAs { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLintingReportSignedUrlSignedAccess obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLintingReportSignedUrlSignedAccess.", httpResponse, httpResponseBody, ex); + } + var response = new GetLintingReportSignedUrlResponse() { StatusCode = responseStatusCode, @@ -205,14 +222,18 @@ public async Task GetLintingReportSignedUrlAs return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task UploadReportAsync(UploadReportRequestBody request) @@ -222,7 +243,7 @@ public async Task UploadReportAsync(UploadReportRequestBod var urlString = baseUrl + "/v1/reports"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "multipart", false, false); if (serializedBody != null) @@ -230,19 +251,19 @@ public async Task UploadReportAsync(UploadReportRequestBod httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("uploadReport", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "uploadReport", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -275,7 +296,17 @@ public async Task UploadReportAsync(UploadReportRequestBod { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + UploadReportUploadedReport obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into UploadReportUploadedReport.", httpResponse, httpResponseBody, ex); + } + var response = new UploadReportResponse() { StatusCode = responseStatusCode, @@ -286,14 +317,18 @@ public async Task UploadReportAsync(UploadReportRequestBod return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/SDK.cs b/src/SpeakeasySDK/SDK.cs index a41cac0a..85ced450 100644 --- a/src/SpeakeasySDK/SDK.cs +++ b/src/SpeakeasySDK/SDK.cs @@ -52,11 +52,13 @@ public interface ISDK /// REST APIs for managing Organizations (speakeasy L1 Tenancy construct) /// public IOrganizations Organizations { get; } + public IPublishingTokens PublishingTokens { get; } /// /// REST APIs for managing reports (lint reports, change reports, etc) /// public IReports Reports { get; } + public ISchemaStore SchemaStore { get; } /// /// REST APIs for managing short URLs @@ -84,60 +86,6 @@ public interface ISDK public IEvents Events { get; } } - public class SDKConfig - { - /// - /// Server identifiers available to the SDK. - /// - public enum Server { - Prod, - } - - /// - /// Server URLs available to the SDK. - /// - public static readonly Dictionary ServerMap = new Dictionary() - { - { Server.Prod, "https://api.prod.speakeasyapi.dev" }, - }; - - public string ServerUrl = ""; - public Server? ServerName = null; - public string? WorkspaceId; - public SDKHooks Hooks = new SDKHooks(); - public RetryConfig? RetryConfig = null; - - public string GetTemplatedServerUrl() - { - if (!String.IsNullOrEmpty(this.ServerUrl)) - { - return Utilities.TemplateUrl(Utilities.RemoveSuffix(this.ServerUrl, "/"), new Dictionary()); - } - if (this.ServerName is null) - { - this.ServerName = SDKConfig.Server.Prod; - } - else if (!SDKConfig.ServerMap.ContainsKey(this.ServerName.Value)) - { - throw new Exception($"Invalid server \"{this.ServerName.Value}\""); - } - - Dictionary serverDefault = new Dictionary(); - - return Utilities.TemplateUrl(SDKConfig.ServerMap[this.ServerName.Value], serverDefault); - } - - public ISpeakeasyHttpClient InitHooks(ISpeakeasyHttpClient client) - { - string preHooksUrl = GetTemplatedServerUrl(); - var (postHooksUrl, postHooksClient) = this.Hooks.SDKInit(preHooksUrl, client); - if (preHooksUrl != postHooksUrl) - { - this.ServerUrl = postHooksUrl; - } - return postHooksClient; - } - } /// /// Speakeasy API: The Subscriptions API manages subscriptions for CLI and registry events @@ -149,32 +97,57 @@ public class SDK: ISDK public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private SDKConfig.Server? _server = null; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; public IArtifacts Artifacts { get; private set; } public IAuth Auth { get; private set; } public ICodeSamples CodeSamples { get; private set; } public IGithub Github { get; private set; } public IOrganizations Organizations { get; private set; } + public IPublishingTokens PublishingTokens { get; private set; } public IReports Reports { get; private set; } + public ISchemaStore SchemaStore { get; private set; } public IShortURLs ShortURLs { get; private set; } public ISubscriptions Subscriptions { get; private set; } public ISuggest Suggest { get; private set; } public IWorkspaces Workspaces { get; private set; } public IEvents Events { get; private set; } + public SDK(SDKConfig config) + { + SDKConfiguration = config; + InitHooks(); + + Artifacts = new Artifacts(SDKConfiguration); + + Auth = new Auth(SDKConfiguration); + + CodeSamples = new CodeSamples(SDKConfiguration); + + Github = new Github(SDKConfiguration); + + Organizations = new Organizations(SDKConfiguration); + + PublishingTokens = new PublishingTokens(SDKConfiguration); + + Reports = new Reports(SDKConfiguration); + + SchemaStore = new SchemaStore(SDKConfiguration); + + ShortURLs = new ShortURLs(SDKConfiguration); + + Subscriptions = new Subscriptions(SDKConfiguration); + + Suggest = new Suggest(SDKConfiguration); + + Workspaces = new Workspaces(SDKConfiguration); + + Events = new Events(SDKConfiguration); + } + public SDK(SpeakeasySDK.Models.Shared.Security? security = null, Func? securitySource = null, string? workspaceId = null, SDKConfig.Server? server = null, string? serverUrl = null, Dictionary? urlParams = null, ISpeakeasyHttpClient? client = null, RetryConfig? retryConfig = null) { - if (server != null) - { - _server = server; - } if (serverUrl != null) { @@ -182,10 +155,8 @@ public SDK(SpeakeasySDK.Models.Shared.Security? security = null, Func? _securitySource = null; if(securitySource != null) { @@ -196,48 +167,116 @@ public SDK(SpeakeasySDK.Models.Shared.Security? security = null, Func security; } - SDKConfiguration = new SDKConfig() + SDKConfiguration = new SDKConfig(client) { WorkspaceId = workspaceId, - ServerName = _server, - ServerUrl = _serverUrl, + ServerName = server, + ServerUrl = serverUrl == null ? "" : serverUrl, + SecuritySource = _securitySource, RetryConfig = retryConfig }; - _client = SDKConfiguration.InitHooks(_client); + InitHooks(); + Artifacts = new Artifacts(SDKConfiguration); - Artifacts = new Artifacts(_client, _securitySource, _serverUrl, SDKConfiguration); + Auth = new Auth(SDKConfiguration); + CodeSamples = new CodeSamples(SDKConfiguration); - Auth = new Auth(_client, _securitySource, _serverUrl, SDKConfiguration); + Github = new Github(SDKConfiguration); + Organizations = new Organizations(SDKConfiguration); - CodeSamples = new CodeSamples(_client, _securitySource, _serverUrl, SDKConfiguration); + PublishingTokens = new PublishingTokens(SDKConfiguration); + Reports = new Reports(SDKConfiguration); - Github = new Github(_client, _securitySource, _serverUrl, SDKConfiguration); + SchemaStore = new SchemaStore(SDKConfiguration); + ShortURLs = new ShortURLs(SDKConfiguration); - Organizations = new Organizations(_client, _securitySource, _serverUrl, SDKConfiguration); + Subscriptions = new Subscriptions(SDKConfiguration); + Suggest = new Suggest(SDKConfiguration); - Reports = new Reports(_client, _securitySource, _serverUrl, SDKConfiguration); + Workspaces = new Workspaces(SDKConfiguration); + Events = new Events(SDKConfiguration); + } - ShortURLs = new ShortURLs(_client, _securitySource, _serverUrl, SDKConfiguration); + private void InitHooks() + { + string preHooksUrl = SDKConfiguration.GetTemplatedServerUrl(); + var (postHooksUrl, postHooksClient) = SDKConfiguration.Hooks.SDKInit(preHooksUrl, SDKConfiguration.Client); + var config = SDKConfiguration; + if (preHooksUrl != postHooksUrl) + { + config.ServerUrl = postHooksUrl; + } + config.Client = postHooksClient; + SDKConfiguration = config; + } + public class SDKBuilder + { + private SDKConfig _sdkConfig = new SDKConfig(client: new SpeakeasyHttpClient()); - Subscriptions = new Subscriptions(_client, _securitySource, _serverUrl, SDKConfiguration); + public SDKBuilder() { } + public SDKBuilder WithServer(SDKConfig.Server server) + { + _sdkConfig.ServerName = server; + return this; + } - Suggest = new Suggest(_client, _securitySource, _serverUrl, SDKConfiguration); + public SDKBuilder WithServerUrl(string serverUrl, Dictionary? serverVariables = null) + { + if (serverVariables != null) + { + serverUrl = Utilities.TemplateUrl(serverUrl, serverVariables); + } + _sdkConfig.ServerUrl = serverUrl; + return this; + } + + public SDKBuilder WithWorkspaceId(string workspaceId) + { + _sdkConfig.WorkspaceId = workspaceId; + return this; + } + + public SDKBuilder WithSecuritySource(Func securitySource) + { + _sdkConfig.SecuritySource = securitySource; + return this; + } + + public SDKBuilder WithSecurity(SpeakeasySDK.Models.Shared.Security security) + { + _sdkConfig.SecuritySource = () => security; + return this; + } + public SDKBuilder WithClient(ISpeakeasyHttpClient client) + { + _sdkConfig.Client = client; + return this; + } - Workspaces = new Workspaces(_client, _securitySource, _serverUrl, SDKConfiguration); + public SDKBuilder WithRetryConfig(RetryConfig retryConfig) + { + _sdkConfig.RetryConfig = retryConfig; + return this; + } + public SDK Build() + { + return new SDK(_sdkConfig); + } - Events = new Events(_client, _securitySource, _serverUrl, SDKConfiguration); } + + public static SDKBuilder Builder() => new SDKBuilder(); } } \ No newline at end of file diff --git a/src/SpeakeasySDK/SDKConfig.cs b/src/SpeakeasySDK/SDKConfig.cs new file mode 100644 index 00000000..0273890a --- /dev/null +++ b/src/SpeakeasySDK/SDKConfig.cs @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK +{ + using SpeakeasySDK.Hooks; + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using SpeakeasySDK.Utils.Retries; + using System; + using System.Collections.Generic; + using System.Linq; + + public struct SDKConfig + { + /// + /// Server identifiers available to the SDK. + /// + public enum Server { + Prod, + } + + /// + /// Server URLs available to the SDK. + /// + public static readonly Dictionary ServerMap = new Dictionary() + { + { Server.Prod, "https://api.prod.speakeasy.com" }, + }; + + public ISpeakeasyHttpClient Client; + public string ServerUrl; + public Server? ServerName; + public string? WorkspaceId; + public string UserAgent; + public Func? SecuritySource; + public SDKHooks Hooks; + public RetryConfig? RetryConfig; + + /// + /// Initializes a new instance of the SDKConfig struct with default values. + /// + public SDKConfig(ISpeakeasyHttpClient? client = null) + { + Client = client ?? new SpeakeasyHttpClient(); + ServerUrl = ""; + ServerName = null; + WorkspaceId = null; + UserAgent = "speakeasy-sdk/csharp 5.13.0 2.722.2 0.4.0 SpeakeasySDK"; + SecuritySource = null; + Hooks = new SDKHooks(); + RetryConfig = null; + } + + public string GetTemplatedServerUrl() + { + if (!String.IsNullOrEmpty(this.ServerUrl)) + { + return Utilities.TemplateUrl(Utilities.RemoveSuffix(this.ServerUrl, "/"), new Dictionary()); + } + if (this.ServerName is null) + { + this.ServerName = SDKConfig.Server.Prod; + } + else if (!SDKConfig.ServerMap.ContainsKey(this.ServerName.Value)) + { + throw new Exception($"Invalid server \"{this.ServerName.Value}\""); + } + + Dictionary serverDefault = new Dictionary(); + + return Utilities.TemplateUrl(SDKConfig.ServerMap[this.ServerName.Value], serverDefault); + } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/SchemaStore.cs b/src/SpeakeasySDK/SchemaStore.cs new file mode 100644 index 00000000..b67d9eec --- /dev/null +++ b/src/SpeakeasySDK/SchemaStore.cs @@ -0,0 +1,274 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +namespace SpeakeasySDK +{ + using Newtonsoft.Json; + using SpeakeasySDK.Hooks; + using SpeakeasySDK.Models.Errors; + using SpeakeasySDK.Models.Operations; + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using SpeakeasySDK.Utils.Retries; + using System; + using System.Collections.Generic; + using System.Net.Http; + using System.Net.Http.Headers; + using System.Threading.Tasks; + + public interface ISchemaStore + { + + /// + /// Create a schema in the schema store + /// + Task CreateSchemaStoreItemAsync(CreateSchemaStoreItemRequestBody request); + + /// + /// Get a OAS schema from the schema store + /// + Task GetSchemaStoreItemAsync(GetSchemaStoreItemRequestBody? request = null); + } + + public class SchemaStore: ISchemaStore + { + public SDKConfig SDKConfiguration { get; private set; } + private const string _language = "csharp"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; + private const string _openapiDocVersion = "0.4.0"; + + public SchemaStore(SDKConfig config) + { + SDKConfiguration = config; + } + + public async Task CreateSchemaStoreItemAsync(CreateSchemaStoreItemRequestBody request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + + var urlString = baseUrl + "/v1/schema_store"; + + var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); + if (serializedBody != null) + { + httpRequest.Content = serializedBody; + } + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "createSchemaStoreItem", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode >= 200 && responseStatusCode < 300) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + SchemaStoreItem obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into SchemaStoreItem.", httpResponse, httpResponseBody, ex); + } + + var response = new CreateSchemaStoreItemResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.SchemaStoreItem = obj; + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + public async Task GetSchemaStoreItemAsync(GetSchemaStoreItemRequestBody? request = null) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + + var urlString = baseUrl + "/v1/schema_store"; + + var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); + + var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, true); + if (serializedBody != null) + { + httpRequest.Content = serializedBody; + } + + if (SDKConfiguration.SecuritySource != null) + { + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); + } + + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getSchemaStoreItem", new List { }, SDKConfiguration.SecuritySource); + + httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + + HttpResponseMessage httpResponse; + try + { + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); + int _statusCode = (int)httpResponse.StatusCode; + + if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + } + } + catch (Exception error) + { + var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error); + if (_httpResponse != null) + { + httpResponse = _httpResponse; + } + else + { + throw; + } + } + + httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse); + + var contentType = httpResponse.Content.Headers.ContentType?.MediaType; + int responseStatusCode = (int)httpResponse.StatusCode; + if(responseStatusCode >= 200 && responseStatusCode < 300) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + SchemaStoreItem obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into SchemaStoreItem.", httpResponse, httpResponseBody, ex); + } + + var response = new GetSchemaStoreItemResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.SchemaStoreItem = obj; + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); + } + + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/ShortURLs.cs b/src/SpeakeasySDK/ShortURLs.cs index 65c3f711..43b215b7 100644 --- a/src/SpeakeasySDK/ShortURLs.cs +++ b/src/SpeakeasySDK/ShortURLs.cs @@ -41,19 +41,12 @@ public class ShortURLs: IShortURLs { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; - public ShortURLs(ISpeakeasyHttpClient client, Func? securitySource, string serverUrl, SDKConfig config) + public ShortURLs(SDKConfig config) { - _client = client; - _securitySource = securitySource; - _serverUrl = serverUrl; SDKConfiguration = config; } @@ -64,7 +57,7 @@ public async Task CreateAsync(CreateRequestBody request) var urlString = baseUrl + "/v1/short_urls"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); if (serializedBody != null) @@ -72,19 +65,19 @@ public async Task CreateAsync(CreateRequestBody request) httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("create", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "create", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -117,7 +110,17 @@ public async Task CreateAsync(CreateRequestBody request) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ShortURL obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ShortURL.", httpResponse, httpResponseBody, ex); + } + var response = new CreateResponse() { StatusCode = responseStatusCode, @@ -128,14 +131,18 @@ public async Task CreateAsync(CreateRequestBody request) return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/SpeakeasySDK.csproj b/src/SpeakeasySDK/SpeakeasySDK.csproj index 142f8a2a..bb7026f2 100644 --- a/src/SpeakeasySDK/SpeakeasySDK.csproj +++ b/src/SpeakeasySDK/SpeakeasySDK.csproj @@ -3,7 +3,7 @@ true SpeakeasySDK - 5.12.0 + 5.13.0 net8.0 Speakeasy Copyright (c) Speakeasy 2025 diff --git a/src/SpeakeasySDK/Subscriptions.cs b/src/SpeakeasySDK/Subscriptions.cs index b2dcdbc7..7d7ae89b 100644 --- a/src/SpeakeasySDK/Subscriptions.cs +++ b/src/SpeakeasySDK/Subscriptions.cs @@ -46,19 +46,12 @@ public class Subscriptions: ISubscriptions { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; - public Subscriptions(ISpeakeasyHttpClient client, Func? securitySource, string serverUrl, SDKConfig config) + public Subscriptions(SDKConfig config) { - _client = client; - _securitySource = securitySource; - _serverUrl = serverUrl; SDKConfiguration = config; } @@ -68,21 +61,21 @@ public async Task ActivateSubscriptionNam var urlString = URLBuilder.Build(baseUrl, "/v1/subscriptions/{subscriptionID}/{namespaceName}/activate", request); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("activateSubscriptionNamespace", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "activateSubscriptionNamespace", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -112,7 +105,7 @@ public async Task ActivateSubscriptionNam var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new ActivateSubscriptionNamespaceResponse() { StatusCode = responseStatusCode, @@ -124,18 +117,28 @@ public async Task ActivateSubscriptionNam { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task IgnoreSubscriptionNamespaceAsync(IgnoreSubscriptionNamespaceRequest request) @@ -144,21 +147,21 @@ public async Task IgnoreSubscriptionNamespa var urlString = URLBuilder.Build(baseUrl, "/v1/subscriptions/{subscriptionID}/{namespaceName}/ignore", request); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("ignoreSubscriptionNamespace", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "ignoreSubscriptionNamespace", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -188,7 +191,7 @@ public async Task IgnoreSubscriptionNamespa var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new IgnoreSubscriptionNamespaceResponse() { StatusCode = responseStatusCode, @@ -200,18 +203,28 @@ public async Task IgnoreSubscriptionNamespa { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Suggest.cs b/src/SpeakeasySDK/Suggest.cs index 241b4dfd..f1380334 100644 --- a/src/SpeakeasySDK/Suggest.cs +++ b/src/SpeakeasySDK/Suggest.cs @@ -68,19 +68,12 @@ public class Suggest: ISuggest { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; - public Suggest(ISpeakeasyHttpClient client, Func? securitySource, string serverUrl, SDKConfig config) + public Suggest(SDKConfig config) { - _client = client; - _securitySource = securitySource; - _serverUrl = serverUrl; SDKConfiguration = config; } @@ -91,7 +84,7 @@ public async Task SuggestAsync(SuggestRequest request) var urlString = baseUrl + "/v1/suggest/openapi_from_summary"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); HeaderSerializer.PopulateHeaders(ref httpRequest, request); var serializedBody = RequestBodySerializer.Serialize(request, "SuggestRequestBody", "json", false, false); @@ -100,19 +93,19 @@ public async Task SuggestAsync(SuggestRequest request) httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("suggest", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "suggest", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -155,14 +148,18 @@ public async Task SuggestAsync(SuggestRequest request) return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task SuggestItemsAsync(SuggestItemsRequestBody request) @@ -172,7 +169,7 @@ public async Task SuggestItemsAsync(SuggestItemsRequestBod var urlString = baseUrl + "/v1/suggest/items"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); if (serializedBody != null) @@ -180,19 +177,19 @@ public async Task SuggestItemsAsync(SuggestItemsRequestBod httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("suggestItems", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "suggestItems", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -225,7 +222,17 @@ public async Task SuggestItemsAsync(SuggestItemsRequestBod { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + var response = new SuggestItemsResponse() { StatusCode = responseStatusCode, @@ -236,14 +243,18 @@ public async Task SuggestItemsAsync(SuggestItemsRequestBod return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task SuggestOpenAPIAsync(SuggestOpenAPIRequest request) @@ -253,7 +264,7 @@ public async Task SuggestOpenAPIAsync(SuggestOpenAPIRequ var urlString = baseUrl + "/v1/suggest/openapi"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); HeaderSerializer.PopulateHeaders(ref httpRequest, request); var serializedBody = RequestBodySerializer.Serialize(request, "RequestBody", "multipart", false, false); @@ -262,19 +273,19 @@ public async Task SuggestOpenAPIAsync(SuggestOpenAPIRequ httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("suggestOpenAPI", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "suggestOpenAPI", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -317,14 +328,18 @@ public async Task SuggestOpenAPIAsync(SuggestOpenAPIRequ return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task SuggestOpenAPIRegistryAsync(SuggestOpenAPIRegistryRequest request) @@ -333,7 +348,7 @@ public async Task SuggestOpenAPIRegistryAsync(Su var urlString = URLBuilder.Build(baseUrl, "/v1/suggest/openapi/{namespace_name}/{revision_reference}", request); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); HeaderSerializer.PopulateHeaders(ref httpRequest, request); var serializedBody = RequestBodySerializer.Serialize(request, "SuggestRequestBody", "json", false, true); @@ -342,19 +357,19 @@ public async Task SuggestOpenAPIRegistryAsync(Su httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("suggestOpenAPIRegistry", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "suggestOpenAPIRegistry", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -397,14 +412,18 @@ public async Task SuggestOpenAPIRegistryAsync(Su return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Utils/OpenEnumConverter.cs b/src/SpeakeasySDK/Utils/OpenEnumConverter.cs new file mode 100644 index 00000000..bb6c64b3 --- /dev/null +++ b/src/SpeakeasySDK/Utils/OpenEnumConverter.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// +// Changes to this file may cause incorrect behavior and will be lost when +// the code is regenerated. +// +//------------------------------------------------------------------------------ +#nullable enable +using System; +using Newtonsoft.Json; +namespace SpeakeasySDK.Utils +{ + internal class OpenEnumConverter : JsonConverter + { + public override bool CanConvert(System.Type objectType) + { + return objectType.GetMethod("Of") != null && objectType.GetMethod("ToString") != null; + } + + public override object? ReadJson( + JsonReader reader, + System.Type objectType, + object? existingValue, + JsonSerializer serializer + ) + { + if (reader.Value == null) + { + return null; + } + + var method = objectType.GetMethod("Of"); + if (method == null) + { + throw new Exception($"Unable to find Of method on {objectType}"); + } + try { + return method.Invoke(null, new[] { reader.Value }); + } catch(System.Reflection.TargetInvocationException e) { + throw new Newtonsoft.Json.JsonSerializationException("Unable to convert value to open enum", e); + } + } + + public override void WriteJson(JsonWriter writer, object? obj, JsonSerializer serializer) + { + if (obj == null) + { + writer.WriteValue("null"); + return; + } + + var valueProp = obj.GetType().GetProperty("Value"); + if (valueProp == null) + { + throw new Exception($"{obj.GetType()} does not have a Value property"); + } + + writer.WriteValue(valueProp.GetValue(obj)); + } + } +} diff --git a/src/SpeakeasySDK/Utils/RequestBodySerializer.cs b/src/SpeakeasySDK/Utils/RequestBodySerializer.cs index 9e3f6938..e0599e85 100644 --- a/src/SpeakeasySDK/Utils/RequestBodySerializer.cs +++ b/src/SpeakeasySDK/Utils/RequestBodySerializer.cs @@ -265,48 +265,44 @@ private static HttpContent SerializeMultipart(object request, string mediaType) if (metadata.File) { - if (!Utilities.IsClass(value)) + if (Utilities.IsList(value)) { - throw new Exception( - "Cannot serialize multipart file from type " + value.GetType().Name - ); - } - - var fileProps = value.GetType().GetProperties(); - - byte[]? content = null; - string fileName = ""; - string fieldName = metadata.Name; - - foreach (var fileProp in fileProps) - { - var fileMetadata = fileProp - .GetCustomAttribute() - ?.GetMultipartFormMetadata(); - if ( - fileMetadata == null - || (!fileMetadata.Content && fileMetadata.Name == "") - ) + // Handle array/list of files - similar to how normal lists are handled + foreach (var fileItem in (IList)value) { - continue; - } + if (!Utilities.IsClass(fileItem)) + { + throw new Exception( + "Cannot serialize multipart file from type " + fileItem.GetType().Name + ); + } - if (fileMetadata.Content) - { - content = (byte[]?)fileProp.GetValue(value); - } - else - { - fileName = fileProp.GetValue(value)?.ToString() ?? ""; + var fileProps = fileItem.GetType().GetProperties(); + var (fileName, content) = ExtractFileProperties(fileProps, fileItem); + string fieldName = (metadata.Name ?? prop.Name) + "[]"; + + var fileContent = new ByteArrayContent(content); + fileContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); + formData.Add(fileContent, fieldName, fileName); } } - - if (fileName == "" || content == null) + else if (Utilities.IsClass(value)) { - throw new Exception("Invalid multipart/form-data file"); + // Handle single file + var fileProps = value.GetType().GetProperties(); + var (fileName, content) = ExtractFileProperties(fileProps, value); + string fieldName = metadata.Name; + + var fileContent = new ByteArrayContent(content); + fileContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); + formData.Add(fileContent, fieldName, fileName); + } + else + { + throw new Exception( + "Cannot serialize multipart file from type " + value.GetType().Name + ); } - - formData.Add(new ByteArrayContent(content), fieldName, fileName); } else if (metadata.Json) { @@ -520,6 +516,42 @@ ref Dictionary> form } } + private static (string fileName, byte[] content) ExtractFileProperties(PropertyInfo[] fileProps, object fileObject) + { + byte[]? content = null; + string fileName = ""; + + foreach (var fileProp in fileProps) + { + var fileMetadata = fileProp + .GetCustomAttribute() + ?.GetMultipartFormMetadata(); + if ( + fileMetadata == null + || (!fileMetadata.Content && fileMetadata.Name == "") + ) + { + continue; + } + + if (fileMetadata.Content) + { + content = (byte[]?)fileProp.GetValue(fileObject); + } + else + { + fileName = fileProp.GetValue(fileObject)?.ToString() ?? ""; + } + } + + if (fileName == "" || content == null) + { + throw new Exception("Invalid multipart/form-data file"); + } + + return (fileName, content); + } + private static PropertyInfo? GetPropertyInfo(object value, string propertyName) { try diff --git a/src/SpeakeasySDK/Utils/ResponseBodyDeserializer.cs b/src/SpeakeasySDK/Utils/ResponseBodyDeserializer.cs index eda502a5..4caa59bc 100644 --- a/src/SpeakeasySDK/Utils/ResponseBodyDeserializer.cs +++ b/src/SpeakeasySDK/Utils/ResponseBodyDeserializer.cs @@ -28,6 +28,16 @@ internal class ResponseBodyDeserializer return JsonConvert.DeserializeObject(json, new JsonSerializerSettings(){ NullValueHandling = nullValueHandling, MissingMemberHandling = missingMemberHandling, Converters = Utilities.GetJsonDeserializers(typeof(T))}); } + public static T DeserializeNotNull(string json, NullValueHandling nullValueHandling=NullValueHandling.Ignore, MissingMemberHandling missingMemberHandling=MissingMemberHandling.Ignore) + { + var result = ResponseBodyDeserializer.Deserialize(json, nullValueHandling, missingMemberHandling); + if (result == null) + { + throw new Exception($"Deserialization error: {typeof(T).Name} cannot be null."); + } + return result!; + } + public sealed class MissingMemberException : Exception { public MissingMemberException() : base("Missing member.") { } diff --git a/src/SpeakeasySDK/Utils/SecurityMetadata.cs b/src/SpeakeasySDK/Utils/SecurityMetadata.cs index d6f5982f..dafd3717 100644 --- a/src/SpeakeasySDK/Utils/SecurityMetadata.cs +++ b/src/SpeakeasySDK/Utils/SecurityMetadata.cs @@ -196,6 +196,8 @@ object value case "bearer": headerParams.Add(key, Utilities.PrefixBearer(valStr)); break; + case "custom": + break; default: throw new Exception($"Unknown http subType: {schemeMetadata.SubType}"); } diff --git a/src/SpeakeasySDK/Utils/SpeakeasyHttpClient.cs b/src/SpeakeasySDK/Utils/SpeakeasyHttpClient.cs index 5f33cac7..dd4996c7 100644 --- a/src/SpeakeasySDK/Utils/SpeakeasyHttpClient.cs +++ b/src/SpeakeasySDK/Utils/SpeakeasyHttpClient.cs @@ -19,6 +19,9 @@ public interface ISpeakeasyHttpClient /// /// Sends an HTTP request asynchronously. /// + /// + /// When overriding this method, use HttpCompletionOption.ResponseHeadersRead to support streaming response bodies. + /// /// The HTTP request message to send. /// The value of the TResult parameter contains the HTTP response message. Task SendAsync(HttpRequestMessage request); @@ -46,7 +49,7 @@ public SpeakeasyHttpClient() public virtual async Task SendAsync(HttpRequestMessage request) { - return await httpClient.SendAsync(request); + return await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); } public virtual async Task CloneAsync(HttpRequestMessage request) diff --git a/src/SpeakeasySDK/Utils/URLBuilder.cs b/src/SpeakeasySDK/Utils/URLBuilder.cs index 8c4f39c7..85dd405a 100644 --- a/src/SpeakeasySDK/Utils/URLBuilder.cs +++ b/src/SpeakeasySDK/Utils/URLBuilder.cs @@ -55,7 +55,7 @@ public static string ReplaceParameters(string url, Dictionary pa { foreach (var key in parameters.Keys) { - url = url.Replace($"{{{key}}}", parameters[key]); + url = url.Replace($"{{{key}}}", Uri.EscapeDataString(parameters[key])); } return url; @@ -68,7 +68,7 @@ public static string SerializeQueryParams(Dictionary> query { foreach (var value in queryParams[key]) { - queries.Add($"{key}={value}"); + queries.Add($"{key}={WebUtility.UrlEncode(Utilities.ToString(value))}"); } } @@ -114,7 +114,7 @@ private static Dictionary GetPathParameters(object? request) case "json": parameters.Add( metadata.Name ?? prop.Name, - WebUtility.UrlEncode(Utilities.SerializeJSON(val)) + Utilities.SerializeJSON(val) ); break; default: diff --git a/src/SpeakeasySDK/Workspaces.cs b/src/SpeakeasySDK/Workspaces.cs index e390c6b2..abbf8fda 100644 --- a/src/SpeakeasySDK/Workspaces.cs +++ b/src/SpeakeasySDK/Workspaces.cs @@ -139,19 +139,12 @@ public class Workspaces: IWorkspaces { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.12.0"; - private const string _sdkGenVersion = "2.493.4"; + private const string _sdkVersion = "5.13.0"; + private const string _sdkGenVersion = "2.722.2"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.12.0 2.493.4 0.4.0 SpeakeasySDK"; - private string _serverUrl = ""; - private ISpeakeasyHttpClient _client; - private Func? _securitySource; - public Workspaces(ISpeakeasyHttpClient client, Func? securitySource, string serverUrl, SDKConfig config) + public Workspaces(SDKConfig config) { - _client = client; - _securitySource = securitySource; - _serverUrl = serverUrl; SDKConfiguration = config; } @@ -162,7 +155,7 @@ public async Task CreateAsync(Workspace request) var urlString = baseUrl + "/v1/workspace"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); if (serializedBody != null) @@ -170,19 +163,19 @@ public async Task CreateAsync(Workspace request) httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("createWorkspace", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "createWorkspace", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -215,7 +208,17 @@ public async Task CreateAsync(Workspace request) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + Workspace obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into Workspace.", httpResponse, httpResponseBody, ex); + } + var response = new CreateWorkspaceResponse() { StatusCode = responseStatusCode, @@ -226,24 +229,34 @@ public async Task CreateAsync(Workspace request) return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task CreateTokenAsync(CreateWorkspaceTokenRequest request) @@ -258,7 +271,7 @@ public async Task CreateTokenAsync(CreateWorkspace var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/tokens", request); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "WorkspaceToken", "json", false, false); if (serializedBody != null) @@ -266,19 +279,19 @@ public async Task CreateTokenAsync(CreateWorkspace httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("createWorkspaceToken", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "createWorkspaceToken", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -308,7 +321,7 @@ public async Task CreateTokenAsync(CreateWorkspace var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new CreateWorkspaceTokenResponse() { StatusCode = responseStatusCode, @@ -320,18 +333,28 @@ public async Task CreateTokenAsync(CreateWorkspace { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task DeleteTokenAsync(DeleteWorkspaceTokenRequest request) @@ -346,21 +369,21 @@ public async Task DeleteTokenAsync(DeleteWorkspace var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/tokens/{tokenID}", request); var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("deleteWorkspaceToken", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "deleteWorkspaceToken", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -390,7 +413,7 @@ public async Task DeleteTokenAsync(DeleteWorkspace var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new DeleteWorkspaceTokenResponse() { StatusCode = responseStatusCode, @@ -402,18 +425,28 @@ public async Task DeleteTokenAsync(DeleteWorkspace { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetAsync() @@ -423,21 +456,21 @@ public async Task GetAsync() var urlString = baseUrl + "/v1/workspace"; var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getWorkspaceByContext", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getWorkspaceByContext", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -470,7 +503,17 @@ public async Task GetAsync() { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + WorkspaceAndOrganization obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into WorkspaceAndOrganization.", httpResponse, httpResponseBody, ex); + } + var response = new GetWorkspaceByContextResponse() { StatusCode = responseStatusCode, @@ -481,24 +524,34 @@ public async Task GetAsync() return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetAllAsync() @@ -508,21 +561,21 @@ public async Task GetAllAsync() var urlString = baseUrl + "/v1/workspaces"; var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getWorkspaces", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getWorkspaces", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -555,7 +608,17 @@ public async Task GetAllAsync() { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + var response = new GetWorkspacesResponse() { StatusCode = responseStatusCode, @@ -566,24 +629,34 @@ public async Task GetAllAsync() return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetByIDAsync(GetWorkspaceRequest? request = null) @@ -594,21 +667,21 @@ public async Task GetByIDAsync(GetWorkspaceRequest? reques var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getWorkspace", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getWorkspace", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -641,7 +714,17 @@ public async Task GetByIDAsync(GetWorkspaceRequest? reques { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + Workspace obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into Workspace.", httpResponse, httpResponseBody, ex); + } + var response = new GetWorkspaceResponse() { StatusCode = responseStatusCode, @@ -652,24 +735,34 @@ public async Task GetByIDAsync(GetWorkspaceRequest? reques return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetFeatureFlagsAsync(GetWorkspaceFeatureFlagsRequest? request = null) @@ -680,21 +773,21 @@ public async Task GetFeatureFlagsAsync(GetWork var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/feature_flags", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getWorkspaceFeatureFlags", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getWorkspaceFeatureFlags", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -727,7 +820,17 @@ public async Task GetFeatureFlagsAsync(GetWork { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + WorkspaceFeatureFlagResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into WorkspaceFeatureFlagResponse.", httpResponse, httpResponseBody, ex); + } + var response = new GetWorkspaceFeatureFlagsResponse() { StatusCode = responseStatusCode, @@ -738,24 +841,34 @@ public async Task GetFeatureFlagsAsync(GetWork return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetSettingsAsync(GetWorkspaceSettingsRequest? request = null) @@ -766,21 +879,21 @@ public async Task GetSettingsAsync(GetWorkspaceSet var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/settings", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getWorkspaceSettings", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getWorkspaceSettings", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -813,7 +926,17 @@ public async Task GetSettingsAsync(GetWorkspaceSet { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + WorkspaceSettings obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into WorkspaceSettings.", httpResponse, httpResponseBody, ex); + } + var response = new GetWorkspaceSettingsResponse() { StatusCode = responseStatusCode, @@ -824,24 +947,34 @@ public async Task GetSettingsAsync(GetWorkspaceSet return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetTeamAsync(GetWorkspaceTeamRequest? request = null) @@ -852,21 +985,21 @@ public async Task GetTeamAsync(GetWorkspaceTeamRequest var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/team", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getWorkspaceTeam", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getWorkspaceTeam", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -899,7 +1032,17 @@ public async Task GetTeamAsync(GetWorkspaceTeamRequest { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + WorkspaceTeamResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into WorkspaceTeamResponse.", httpResponse, httpResponseBody, ex); + } + var response = new GetWorkspaceTeamResponse() { StatusCode = responseStatusCode, @@ -910,24 +1053,34 @@ public async Task GetTeamAsync(GetWorkspaceTeamRequest return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetTokensAsync(GetWorkspaceTokensRequest? request = null) @@ -938,21 +1091,21 @@ public async Task GetTokensAsync(GetWorkspaceTokensR var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/tokens", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("getWorkspaceTokens", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getWorkspaceTokens", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -985,7 +1138,17 @@ public async Task GetTokensAsync(GetWorkspaceTokensR { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + var response = new GetWorkspaceTokensResponse() { StatusCode = responseStatusCode, @@ -996,24 +1159,34 @@ public async Task GetTokensAsync(GetWorkspaceTokensR return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GrantAccessAsync(GrantUserAccessToWorkspaceRequest request) @@ -1028,21 +1201,21 @@ public async Task GrantAccessAsync(GrantUser var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/team/email/{email}", request); var httpRequest = new HttpRequestMessage(HttpMethod.Put, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("grantUserAccessToWorkspace", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "grantUserAccessToWorkspace", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -1075,7 +1248,17 @@ public async Task GrantAccessAsync(GrantUser { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + WorkspaceInviteResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into WorkspaceInviteResponse.", httpResponse, httpResponseBody, ex); + } + var response = new GrantUserAccessToWorkspaceResponse() { StatusCode = responseStatusCode, @@ -1086,24 +1269,34 @@ public async Task GrantAccessAsync(GrantUser return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task RevokeAccessAsync(RevokeUserAccessToWorkspaceRequest request) @@ -1118,21 +1311,21 @@ public async Task RevokeAccessAsync(RevokeU var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/team/{userId}", request); var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("revokeUserAccessToWorkspace", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "revokeUserAccessToWorkspace", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -1162,7 +1355,7 @@ public async Task RevokeAccessAsync(RevokeU var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new RevokeUserAccessToWorkspaceResponse() { StatusCode = responseStatusCode, @@ -1174,18 +1367,28 @@ public async Task RevokeAccessAsync(RevokeU { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task SetFeatureFlagsAsync(WorkspaceFeatureFlagRequest request) @@ -1195,7 +1398,7 @@ public async Task SetFeatureFlagsAsync(Workspa var urlString = baseUrl + "/v1/workspace/feature_flags"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); if (serializedBody != null) @@ -1203,19 +1406,19 @@ public async Task SetFeatureFlagsAsync(Workspa httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("setWorkspaceFeatureFlags", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "setWorkspaceFeatureFlags", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -1248,7 +1451,17 @@ public async Task SetFeatureFlagsAsync(Workspa { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + WorkspaceFeatureFlagResponse obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into WorkspaceFeatureFlagResponse.", httpResponse, httpResponseBody, ex); + } + var response = new SetWorkspaceFeatureFlagsResponse() { StatusCode = responseStatusCode, @@ -1259,24 +1472,34 @@ public async Task SetFeatureFlagsAsync(Workspa return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task UpdateAsync(UpdateWorkspaceDetailsRequest request) @@ -1291,7 +1514,7 @@ public async Task UpdateAsync(UpdateWorkspaceDet var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/details", request); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "Workspace", "json", false, false); if (serializedBody != null) @@ -1299,19 +1522,19 @@ public async Task UpdateAsync(UpdateWorkspaceDet httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("updateWorkspaceDetails", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "updateWorkspaceDetails", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -1341,7 +1564,7 @@ public async Task UpdateAsync(UpdateWorkspaceDet var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new UpdateWorkspaceDetailsResponse() { StatusCode = responseStatusCode, @@ -1353,18 +1576,28 @@ public async Task UpdateAsync(UpdateWorkspaceDet { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task UpdateSettingsAsync(UpdateWorkspaceSettingsRequest request) @@ -1379,7 +1612,7 @@ public async Task UpdateSettingsAsync(UpdateWor var urlString = URLBuilder.Build(baseUrl, "/v1/workspace/{workspace_id}/settings", request); var httpRequest = new HttpRequestMessage(HttpMethod.Put, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); + httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent); var serializedBody = RequestBodySerializer.Serialize(request, "WorkspaceSettings", "json", false, false); if (serializedBody != null) @@ -1387,19 +1620,19 @@ public async Task UpdateSettingsAsync(UpdateWor httpRequest.Content = serializedBody; } - if (_securitySource != null) + if (SDKConfiguration.SecuritySource != null) { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest); } - var hookCtx = new HookContext("updateWorkspaceSettings", null, _securitySource); + var hookCtx = new HookContext(SDKConfiguration, baseUrl, "updateWorkspaceSettings", new List { }, SDKConfiguration.SecuritySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -1429,7 +1662,7 @@ public async Task UpdateSettingsAsync(UpdateWor var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode >= 200 && responseStatusCode < 300) - { + { return new UpdateWorkspaceSettingsResponse() { StatusCode = responseStatusCode, @@ -1441,18 +1674,28 @@ public async Task UpdateSettingsAsync(UpdateWor { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ErrorPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ErrorPayload.", httpResponse, httpResponseBody, ex); + } + + throw new Error(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file