diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 944e9b0d..64277a85 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: f73d2126-985b-4d69-88ee-b7c69254d8bf management: - docChecksum: 17684e14e65fca2909aaf49de5c6b935 + docChecksum: 52df6f1f34dfe76968f8ed009cc2bfd3 docVersion: 0.4.0 - speakeasyVersion: 1.460.3 - generationVersion: 2.484.0 - releaseVersion: 5.11.0 - configChecksum: ff6b845197ae681d026b0af12cd2d0de + speakeasyVersion: 1.468.2 + generationVersion: 2.493.4 + releaseVersion: 5.12.0 + configChecksum: 4ac5f7ce74e22b4b8247f447fc0fc3c9 repoURL: https://github.com/speakeasy-api/speakeasy-client-sdk-csharp.git repoSubDirectory: . published: true @@ -20,7 +20,7 @@ features: globalServerURLs: 2.82.3 globals: 2.82.1 intellisenseMarkdownSupport: 0.1.0 - methodArguments: 0.1.0 + methodArguments: 0.2.0 nameOverrides: 2.81.2 nullables: 0.1.0 responseFormat: 0.0.4 @@ -29,7 +29,6 @@ features: serverIDs: 2.82.1 generatedFiles: - .gitattributes - - CONTRIBUTING.md - NUGET.md - SpeakeasySDK.sln - USAGE.md @@ -62,6 +61,8 @@ 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 @@ -131,6 +132,7 @@ generatedFiles: - docs/Models/Operations/SetVisibilityRequest.md - docs/Models/Operations/SetVisibilityRequestBody.md - docs/Models/Operations/SetVisibilityResponse.md + - docs/Models/Operations/SetWorkspaceFeatureFlagsResponse.md - docs/Models/Operations/SuggestItemsResponse.md - docs/Models/Operations/SuggestOpenAPIRegistryRequest.md - docs/Models/Operations/SuggestOpenAPIRegistryResponse.md @@ -191,6 +193,7 @@ generatedFiles: - docs/Models/Shared/OrganizationUsageResponse.md - docs/Models/Shared/PreflightRequest.md - docs/Models/Shared/PreflightToken.md + - docs/Models/Shared/PullRequestMetadata.md - docs/Models/Shared/Relationship.md - docs/Models/Shared/RemoteDocument.md - docs/Models/Shared/RemoteSource.md @@ -210,11 +213,15 @@ generatedFiles: - docs/Models/Shared/Tag.md - docs/Models/Shared/TargetSDK.md - docs/Models/Shared/Type.md + - docs/Models/Shared/UsageSnippet.md + - docs/Models/Shared/UsageSnippets.md - docs/Models/Shared/User.md - docs/Models/Shared/V2Descriptor.md - docs/Models/Shared/WorkflowDocument.md - docs/Models/Shared/Workspace.md - docs/Models/Shared/WorkspaceAndOrganization.md + - docs/Models/Shared/WorkspaceFeatureFlag.md + - docs/Models/Shared/WorkspaceFeatureFlagRequest.md - docs/Models/Shared/WorkspaceFeatureFlagResponse.md - docs/Models/Shared/WorkspaceInviteResponse.md - docs/Models/Shared/WorkspaceSettings.md @@ -223,6 +230,7 @@ generatedFiles: - docs/Models/Shared/Workspaces.md - docs/sdks/artifacts/README.md - docs/sdks/auth/README.md + - docs/sdks/codesamples/README.md - docs/sdks/events/README.md - docs/sdks/github/README.md - docs/sdks/organizations/README.md @@ -235,6 +243,7 @@ generatedFiles: - global.json - src/SpeakeasySDK/Artifacts.cs - src/SpeakeasySDK/Auth.cs + - src/SpeakeasySDK/CodeSamples.cs - src/SpeakeasySDK/Events.cs - src/SpeakeasySDK/Github.cs - src/SpeakeasySDK/Hooks/HookTypes.cs @@ -269,6 +278,8 @@ 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 @@ -338,6 +349,7 @@ generatedFiles: - src/SpeakeasySDK/Models/Operations/SetVisibilityRequest.cs - src/SpeakeasySDK/Models/Operations/SetVisibilityRequestBody.cs - src/SpeakeasySDK/Models/Operations/SetVisibilityResponse.cs + - src/SpeakeasySDK/Models/Operations/SetWorkspaceFeatureFlagsResponse.cs - src/SpeakeasySDK/Models/Operations/SuggestItemsResponse.cs - src/SpeakeasySDK/Models/Operations/SuggestOpenAPIRegistryRequest.cs - src/SpeakeasySDK/Models/Operations/SuggestOpenAPIRegistryResponse.cs @@ -398,6 +410,7 @@ generatedFiles: - src/SpeakeasySDK/Models/Shared/OrganizationUsageResponse.cs - src/SpeakeasySDK/Models/Shared/PreflightRequest.cs - src/SpeakeasySDK/Models/Shared/PreflightToken.cs + - src/SpeakeasySDK/Models/Shared/PullRequestMetadata.cs - src/SpeakeasySDK/Models/Shared/Relationship.cs - src/SpeakeasySDK/Models/Shared/RemoteDocument.cs - src/SpeakeasySDK/Models/Shared/RemoteSource.cs @@ -417,11 +430,15 @@ generatedFiles: - src/SpeakeasySDK/Models/Shared/Tag.cs - src/SpeakeasySDK/Models/Shared/TargetSDK.cs - src/SpeakeasySDK/Models/Shared/Type.cs + - src/SpeakeasySDK/Models/Shared/UsageSnippet.cs + - src/SpeakeasySDK/Models/Shared/UsageSnippets.cs - src/SpeakeasySDK/Models/Shared/User.cs - src/SpeakeasySDK/Models/Shared/V2Descriptor.cs - src/SpeakeasySDK/Models/Shared/WorkflowDocument.cs - src/SpeakeasySDK/Models/Shared/Workspace.cs - src/SpeakeasySDK/Models/Shared/WorkspaceAndOrganization.cs + - src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlag.cs + - src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlagRequest.cs - src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlagResponse.cs - src/SpeakeasySDK/Models/Shared/WorkspaceInviteResponse.cs - src/SpeakeasySDK/Models/Shared/WorkspaceSettings.cs @@ -1135,6 +1152,9 @@ examples: 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} @@ -1146,6 +1166,9 @@ examples: application/json: {"message": "", "status_code": 868924} getWorkspaceFeatureFlags: speakeasy-default-get-workspace-feature-flags: + parameters: + path: + workspace_id: "" responses: 5XX: application/json: {"message": "", "status_code": 365854} @@ -1157,6 +1180,7 @@ examples: path: targetID: "" target_id: "" + workspace_id: "" query: {} responses: "200": @@ -1172,6 +1196,9 @@ examples: application/json: {"message": "", "status_code": 966013} postWorkspaceEvents: speakeasy-default-post-workspace-events: + parameters: + path: + workspace_id: "" requestBody: application/json: [] responses: @@ -1179,6 +1206,10 @@ examples: application/json: {"message": "", "status_code": 962857} searchWorkspaceEvents: speakeasy-default-search-workspace-events: + parameters: + path: + workspace_id: "" + query: {} responses: "200": application/json: [] @@ -1363,6 +1394,9 @@ examples: application/json: {"message": "", "status_code": 951062} createWorkspaceToken: speakeasy-default-create-workspace-token: + parameters: + path: + workspace_id: "" requestBody: application/json: {"alg": "", "created_at": "2023-08-16T02:33:00.784Z", "id": "", "key": "", "name": "", "workspace_id": ""} responses: @@ -1373,6 +1407,7 @@ examples: parameters: path: tokenID: "" + workspace_id: "" responses: 4XX: application/json: {"message": "", "status_code": 120260} @@ -1392,6 +1427,9 @@ examples: application/json: {"message": "", "status_code": 16308} getWorkspaceSettings: speakeasy-default-get-workspace-settings: + parameters: + path: + workspace_id: "" responses: 2XX: application/json: {"created_at": "2025-05-29T22:34:47.605Z", "updated_at": "2024-02-24T21:50:01.663Z", "webhook_url": "https://different-amendment.com/", "workspace_id": ""} @@ -1399,6 +1437,9 @@ examples: application/json: {"message": "", "status_code": 864485} getWorkspaceTeam: speakeasy-default-get-workspace-team: + parameters: + path: + workspace_id: "" responses: 2XX: application/json: {"users": []} @@ -1406,6 +1447,9 @@ examples: application/json: {"message": "", "status_code": 194974} getWorkspaceTokens: speakeasy-default-get-workspace-tokens: + parameters: + path: + workspace_id: "" responses: 2XX: application/json: [{"alg": "", "created_at": "2024-06-30T03:05:24.969Z", "id": "", "key": "", "name": "", "workspace_id": ""}, {"alg": "", "created_at": "2024-11-09T11:33:52.654Z", "id": "", "key": "", "name": "", "workspace_id": ""}, {"alg": "", "created_at": "2024-11-05T09:03:46.133Z", "id": "", "key": "", "name": "", "workspace_id": ""}] @@ -1416,6 +1460,7 @@ examples: parameters: path: email: "Lucinda.Batz8@hotmail.com" + workspace_id: "" responses: "200": application/json: {"relationship": {"user_id": "", "workspace_id": ""}} @@ -1426,11 +1471,15 @@ examples: parameters: path: userId: "" + workspace_id: "" responses: 4XX: application/json: {"message": "", "status_code": 243814} updateWorkspaceDetails: speakeasy-default-update-workspace-details: + parameters: + path: + workspace_id: "" requestBody: application/json: {"created_at": "2025-07-28T19:04:48.565Z", "id": "", "name": "", "organization_id": "", "slug": "", "updated_at": "2024-10-16T10:52:42.015Z", "verified": true} responses: @@ -1438,6 +1487,9 @@ examples: application/json: {"message": "", "status_code": 991464} 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": ""} responses: @@ -1445,9 +1497,32 @@ examples: application/json: {"message": "", "status_code": 54657} getWorkspaceTargetsDeprecated: speakeasy-default-get-workspace-targets-deprecated: + parameters: + path: + workspace_id: "" + query: {} responses: "200": application/json: [] 5XX: application/json: {"message": "", "status_code": 255923} + getCodeSamples: + speakeasy-default-get-code-samples: + 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: + requestBody: + application/json: {"feature_flags": ["skip_schema_registry", "webhooks"]} + responses: + "200": + application/json: {} + 5XX: + application/json: {"message": "", "status_code": 264889} generatedTests: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 12b6f760..d3a7000c 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,21 +1,21 @@ -speakeasyVersion: 1.460.3 +speakeasyVersion: 1.468.2 sources: speakeasy: sourceNamespace: speakeasy - sourceRevisionDigest: sha256:b01713c2d0f7d6cb0e47e321616c4b091bcd5576d7b2c62f955b835328df57f5 - sourceBlobDigest: sha256:2b1030ee3c1d82bb205f4230146d4632dcd59cc07c2eb266d5f294390b1188c3 + sourceRevisionDigest: sha256:8af7ebde12785185cdbd700c1b3b6b8848b43d34f1fe8c06fff5ae4af471faf2 + sourceBlobDigest: sha256:952a58da1511e3191ea8e470c7f01a4e3785d11d9152f490a3e5a7173c8542e7 tags: - latest - - speakeasy-sdk-regen-1727137180 + - speakeasy-sdk-regen-1735949986 - 0.4.0 targets: speakeasy-client-sdk-csharp: source: speakeasy sourceNamespace: speakeasy - sourceRevisionDigest: sha256:b01713c2d0f7d6cb0e47e321616c4b091bcd5576d7b2c62f955b835328df57f5 - sourceBlobDigest: sha256:2b1030ee3c1d82bb205f4230146d4632dcd59cc07c2eb266d5f294390b1188c3 + sourceRevisionDigest: sha256:8af7ebde12785185cdbd700c1b3b6b8848b43d34f1fe8c06fff5ae4af471faf2 + sourceBlobDigest: sha256:952a58da1511e3191ea8e470c7f01a4e3785d11d9152f490a3e5a7173c8542e7 codeSamplesNamespace: code-samples-csharp-speakeasy-client-sdk-csharp - codeSamplesRevisionDigest: sha256:e3459fb0f108d6f6ada42a1292ba28d87d3cdf1ff569ac7b526019a65feb98c8 + codeSamplesRevisionDigest: sha256:aacf508e82244f7628670bda7c73bdda3a36059c4143c3566f2b4d4935251ec8 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index d585717f..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,26 +0,0 @@ -# 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 1959006c..711d23aa 100644 --- a/NUGET.md +++ b/NUGET.md @@ -9,24 +9,24 @@ ```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() { - "", +RemoteSource req = new RemoteSource() { + Inputs = new List() { + new RemoteDocument() { + RegistryUrl = "https://productive-swine.net", + }, }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", + Output = new RemoteDocument() { + RegistryUrl = "https://spiteful-apricot.info", }, }; -var res = await sdk.GenerateCodeSamplePreviewAsync(req); +var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response ``` @@ -49,24 +49,24 @@ You can set the security parameters through the `security` optional parameter wh ```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() { - "", +RemoteSource req = new RemoteSource() { + Inputs = new List() { + new RemoteDocument() { + RegistryUrl = "https://productive-swine.net", + }, }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", + Output = new RemoteDocument() { + RegistryUrl = "https://spiteful-apricot.info", }, }; -var res = await sdk.GenerateCodeSamplePreviewAsync(req); +var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response ``` @@ -184,11 +184,12 @@ By default, an API error will raise a `SpeakeasySDK.Models.Errors.SDKException` | `RawResponse` | *HttpResponseMessage* | The raw HTTP response | | `Body` | *string* | The response content | -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 `GenerateCodeSamplePreviewAsync` method throws the following exceptions: +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, 5XX | application/json | +| Error Type | Status Code | Content Type | +| --------------------------------------- | ----------- | ---------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | ### Example @@ -196,7 +197,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; using System.Collections.Generic; var sdk = new SDK(security: new Security() { @@ -205,17 +205,18 @@ var sdk = new SDK(security: new Security() { try { - CodeSampleSchemaInput req = new CodeSampleSchemaInput() { - Languages = new List() { - "", + RemoteSource req = new RemoteSource() { + Inputs = new List() { + new RemoteDocument() { + RegistryUrl = "https://productive-swine.net", + }, }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", + Output = new RemoteDocument() { + RegistryUrl = "https://spiteful-apricot.info", }, }; - var res = await sdk.GenerateCodeSamplePreviewAsync(req); + var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response } @@ -251,7 +252,6 @@ You can override the default server globally by passing a server name to the `se ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System; using System.Collections.Generic; var sdk = new SDK( @@ -261,17 +261,18 @@ var sdk = new SDK( } ); -CodeSampleSchemaInput req = new CodeSampleSchemaInput() { - Languages = new List() { - "", +RemoteSource req = new RemoteSource() { + Inputs = new List() { + new RemoteDocument() { + RegistryUrl = "https://productive-swine.net", + }, }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", + Output = new RemoteDocument() { + RegistryUrl = "https://spiteful-apricot.info", }, }; -var res = await sdk.GenerateCodeSamplePreviewAsync(req); +var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response ``` @@ -282,7 +283,6 @@ The default server can also be overridden globally by passing a URL to the `serv ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System; using System.Collections.Generic; var sdk = new SDK( @@ -292,17 +292,18 @@ var sdk = new SDK( } ); -CodeSampleSchemaInput req = new CodeSampleSchemaInput() { - Languages = new List() { - "", +RemoteSource req = new RemoteSource() { + Inputs = new List() { + new RemoteDocument() { + RegistryUrl = "https://productive-swine.net", + }, }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", + Output = new RemoteDocument() { + RegistryUrl = "https://spiteful-apricot.info", }, }; -var res = await sdk.GenerateCodeSamplePreviewAsync(req); +var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response ``` diff --git a/README.md b/README.md index 32235de4..1b233214 100755 --- a/README.md +++ b/README.md @@ -49,24 +49,24 @@ dotnet add reference src/SpeakeasySDK/SpeakeasySDK.csproj ```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() { - "", +RemoteSource req = new RemoteSource() { + Inputs = new List() { + new RemoteDocument() { + RegistryUrl = "https://productive-swine.net", + }, }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", + Output = new RemoteDocument() { + RegistryUrl = "https://spiteful-apricot.info", }, }; -var res = await sdk.GenerateCodeSamplePreviewAsync(req); +var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response ``` @@ -98,6 +98,13 @@ var res = await sdk.GenerateCodeSamplePreviewAsync(req); * [GetUser](docs/sdks/auth/README.md#getuser) - Get information about the current user. * [ValidateApiKey](docs/sdks/auth/README.md#validateapikey) - Validate the current api key. +### [CodeSamples](docs/sdks/codesamples/README.md) + +* [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) * [GetEventsByTarget](docs/sdks/events/README.md#geteventsbytarget) - Load recent events for a particular workspace @@ -134,11 +141,6 @@ var res = await sdk.GenerateCodeSamplePreviewAsync(req); * [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. -### [SDK](docs/sdks/sdk/README.md) - -* [GenerateCodeSamplePreview](docs/sdks/sdk/README.md#generatecodesamplepreview) - Generate Code Sample previews from a file and configuration parameters. -* [GenerateCodeSamplePreviewAsync](docs/sdks/sdk/README.md#generatecodesamplepreviewasync) - Initiate asynchronous Code Sample preview generation from a file and configuration parameters, receiving an async JobID response for polling. -* [GetCodeSamplePreviewAsync](docs/sdks/sdk/README.md#getcodesamplepreviewasync) - Poll for the result of an asynchronous Code Sample preview generation. ### [ShortURLs](docs/sdks/shorturls/README.md) @@ -170,6 +172,7 @@ var res = await sdk.GenerateCodeSamplePreviewAsync(req); * [GetTokens](docs/sdks/workspaces/README.md#gettokens) - Get tokens for a particular workspace * [GrantAccess](docs/sdks/workspaces/README.md#grantaccess) - Grant a user access to a particular workspace * [RevokeAccess](docs/sdks/workspaces/README.md#revokeaccess) - Revoke a user's access to a particular workspace +* [SetFeatureFlags](docs/sdks/workspaces/README.md#setfeatureflags) - Set workspace feature flags * [Update](docs/sdks/workspaces/README.md#update) - Update workspace details * [UpdateSettings](docs/sdks/workspaces/README.md#updatesettings) - Update workspace settings @@ -194,7 +197,6 @@ You can override the default server globally by passing a server name to the `se ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System; using System.Collections.Generic; var sdk = new SDK( @@ -204,17 +206,18 @@ var sdk = new SDK( } ); -CodeSampleSchemaInput req = new CodeSampleSchemaInput() { - Languages = new List() { - "", +RemoteSource req = new RemoteSource() { + Inputs = new List() { + new RemoteDocument() { + RegistryUrl = "https://productive-swine.net", + }, }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", + Output = new RemoteDocument() { + RegistryUrl = "https://spiteful-apricot.info", }, }; -var res = await sdk.GenerateCodeSamplePreviewAsync(req); +var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response ``` @@ -225,7 +228,6 @@ The default server can also be overridden globally by passing a URL to the `serv ```csharp using SpeakeasySDK; using SpeakeasySDK.Models.Shared; -using System; using System.Collections.Generic; var sdk = new SDK( @@ -235,17 +237,18 @@ var sdk = new SDK( } ); -CodeSampleSchemaInput req = new CodeSampleSchemaInput() { - Languages = new List() { - "", +RemoteSource req = new RemoteSource() { + Inputs = new List() { + new RemoteDocument() { + RegistryUrl = "https://productive-swine.net", + }, }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", + Output = new RemoteDocument() { + RegistryUrl = "https://spiteful-apricot.info", }, }; -var res = await sdk.GenerateCodeSamplePreviewAsync(req); +var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response ``` @@ -268,24 +271,24 @@ You can set the security parameters through the `security` optional parameter wh ```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() { - "", +RemoteSource req = new RemoteSource() { + Inputs = new List() { + new RemoteDocument() { + RegistryUrl = "https://productive-swine.net", + }, }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", + Output = new RemoteDocument() { + RegistryUrl = "https://spiteful-apricot.info", }, }; -var res = await sdk.GenerateCodeSamplePreviewAsync(req); +var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response ``` @@ -339,11 +342,12 @@ By default, an API error will raise a `SpeakeasySDK.Models.Errors.SDKException` | `RawResponse` | *HttpResponseMessage* | The raw HTTP response | | `Body` | *string* | The response content | -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 `GenerateCodeSamplePreviewAsync` method throws the following exceptions: +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, 5XX | application/json | +| Error Type | Status Code | Content Type | +| --------------------------------------- | ----------- | ---------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | ### Example @@ -351,7 +355,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; using System.Collections.Generic; var sdk = new SDK(security: new Security() { @@ -360,17 +363,18 @@ var sdk = new SDK(security: new Security() { try { - CodeSampleSchemaInput req = new CodeSampleSchemaInput() { - Languages = new List() { - "", + RemoteSource req = new RemoteSource() { + Inputs = new List() { + new RemoteDocument() { + RegistryUrl = "https://productive-swine.net", + }, }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", + Output = new RemoteDocument() { + RegistryUrl = "https://spiteful-apricot.info", }, }; - var res = await sdk.GenerateCodeSamplePreviewAsync(req); + var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response } diff --git a/RELEASES.md b/RELEASES.md index f7d3573e..4df5c678 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -939,3 +939,14 @@ Based on: - [csharp v5.11.0] . ### Releases - [NuGet v5.11.0] https://www.nuget.org/packages/SpeakeasySDK/5.11.0 - . + + +## 2025-01-13 00:21:55 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.468.2 (2.493.4) https://github.com/speakeasy-api/speakeasy +### 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 diff --git a/USAGE.md b/USAGE.md index 9c24d80a..1c71495d 100644 --- a/USAGE.md +++ b/USAGE.md @@ -2,24 +2,24 @@ ```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() { - "", +RemoteSource req = new RemoteSource() { + Inputs = new List() { + new RemoteDocument() { + RegistryUrl = "https://productive-swine.net", + }, }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", + Output = new RemoteDocument() { + RegistryUrl = "https://spiteful-apricot.info", }, }; -var res = await sdk.GenerateCodeSamplePreviewAsync(req); +var res = await sdk.Artifacts.CreateRemoteSourceAsync(req); // handle response ``` diff --git a/codeSamples.yaml b/codeSamples.yaml index e58d5879..6ded62a4 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -205,6 +205,27 @@ 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: @@ -231,7 +252,7 @@ actions: }, }; - var res = await sdk.GenerateCodeSamplePreviewAsync(req); + var res = await sdk.CodeSamples.GenerateCodeSamplePreviewAsync(req); // handle response - target: $["paths"]["/v1/code_sample/preview/async"]["post"] @@ -259,7 +280,7 @@ actions: }, }; - var res = await sdk.GenerateCodeSamplePreviewAsyncAsync(req); + var res = await sdk.CodeSamples.GenerateCodeSamplePreviewAsyncAsync(req); // handle response - target: $["paths"]["/v1/code_sample/preview/async/{jobID}"]["get"] @@ -280,7 +301,7 @@ actions: JobID = "", }; - var res = await sdk.GetCodeSamplePreviewAsyncAsync(req); + var res = await sdk.CodeSamples.GetCodeSamplePreviewAsyncAsync(req); // handle response - target: $["paths"]["/v1/github/action"]["get"] @@ -1027,6 +1048,29 @@ actions: var res = await sdk.Events.GetTargetsAsync(req); + // handle response + - target: $["paths"]["/v1/workspace/feature_flags"]["post"] + update: + x-codeSamples: + - lang: csharp + label: setWorkspaceFeatureFlags + source: |- + using SpeakeasySDK; + using SpeakeasySDK.Models.Shared; + using System.Collections.Generic; + + var sdk = new SDK(security: new Security() { + APIKey = "", + }); + + WorkspaceFeatureFlagRequest req = new WorkspaceFeatureFlagRequest() { + FeatureFlags = new List() { + WorkspaceFeatureFlag.SkipSchemaRegistry, + }, + }; + + var res = await sdk.Workspaces.SetFeatureFlagsAsync(req); + // handle response - target: $["paths"]["/v1/workspace/{workspace_id}"]["get"] update: @@ -1042,7 +1086,9 @@ actions: APIKey = "", }); - GetWorkspaceRequest req = new GetWorkspaceRequest() {}; + GetWorkspaceRequest req = new GetWorkspaceRequest() { + WorkspaceId = "", + }; var res = await sdk.Workspaces.GetByIDAsync(req); @@ -1063,6 +1109,7 @@ actions: }); UpdateWorkspaceDetailsRequest req = new UpdateWorkspaceDetailsRequest() { + WorkspaceId = "", Workspace = new Workspace() { CreatedAt = System.DateTime.Parse("2025-07-28T19:04:48.565Z"), Id = "", @@ -1091,7 +1138,9 @@ actions: APIKey = "", }); - SearchWorkspaceEventsRequest req = new SearchWorkspaceEventsRequest() {}; + SearchWorkspaceEventsRequest req = new SearchWorkspaceEventsRequest() { + WorkspaceId = "", + }; var res = await sdk.Events.SearchAsync(req); @@ -1113,6 +1162,7 @@ actions: }); PostWorkspaceEventsRequest req = new PostWorkspaceEventsRequest() { + WorkspaceId = "", RequestBody = new List() { new CliEvent() { Id = "", @@ -1145,7 +1195,9 @@ actions: APIKey = "", }); - GetWorkspaceTargetsDeprecatedRequest req = new GetWorkspaceTargetsDeprecatedRequest() {}; + GetWorkspaceTargetsDeprecatedRequest req = new GetWorkspaceTargetsDeprecatedRequest() { + WorkspaceId = "", + }; var res = await sdk.Events.GetTargetsDeprecatedAsync(req); @@ -1165,6 +1217,7 @@ actions: }); GetWorkspaceEventsByTargetRequest req = new GetWorkspaceEventsByTargetRequest() { + WorkspaceId = "", TargetId = "", }; @@ -1185,7 +1238,9 @@ actions: APIKey = "", }); - GetWorkspaceFeatureFlagsRequest req = new GetWorkspaceFeatureFlagsRequest() {}; + GetWorkspaceFeatureFlagsRequest req = new GetWorkspaceFeatureFlagsRequest() { + WorkspaceId = "", + }; var res = await sdk.Workspaces.GetFeatureFlagsAsync(req); @@ -1204,7 +1259,9 @@ actions: APIKey = "", }); - GetWorkspaceSettingsRequest req = new GetWorkspaceSettingsRequest() {}; + GetWorkspaceSettingsRequest req = new GetWorkspaceSettingsRequest() { + WorkspaceId = "", + }; var res = await sdk.Workspaces.GetSettingsAsync(req); @@ -1225,6 +1282,7 @@ actions: }); UpdateWorkspaceSettingsRequest req = new UpdateWorkspaceSettingsRequest() { + WorkspaceId = "", WorkspaceSettings = new WorkspaceSettings() { WorkspaceId = "", WebhookUrl = "https://last-suspension.info/", @@ -1250,7 +1308,9 @@ actions: APIKey = "", }); - GetWorkspaceTeamRequest req = new GetWorkspaceTeamRequest() {}; + GetWorkspaceTeamRequest req = new GetWorkspaceTeamRequest() { + WorkspaceId = "", + }; var res = await sdk.Workspaces.GetTeamAsync(req); @@ -1270,6 +1330,7 @@ actions: }); GrantUserAccessToWorkspaceRequest req = new GrantUserAccessToWorkspaceRequest() { + WorkspaceId = "", Email = "Lucinda.Batz8@hotmail.com", }; @@ -1291,6 +1352,7 @@ actions: }); RevokeUserAccessToWorkspaceRequest req = new RevokeUserAccessToWorkspaceRequest() { + WorkspaceId = "", UserId = "", }; @@ -1311,7 +1373,9 @@ actions: APIKey = "", }); - GetWorkspaceTokensRequest req = new GetWorkspaceTokensRequest() {}; + GetWorkspaceTokensRequest req = new GetWorkspaceTokensRequest() { + WorkspaceId = "", + }; var res = await sdk.Workspaces.GetTokensAsync(req); @@ -1332,6 +1396,7 @@ actions: }); CreateWorkspaceTokenRequest req = new CreateWorkspaceTokenRequest() { + WorkspaceId = "", WorkspaceToken = new WorkspaceToken() { Id = "", Name = "", @@ -1360,6 +1425,7 @@ actions: }); DeleteWorkspaceTokenRequest req = new DeleteWorkspaceTokenRequest() { + WorkspaceId = "", TokenID = "", }; diff --git a/docs/Models/Operations/GetCodeSamplesRequest.md b/docs/Models/Operations/GetCodeSamplesRequest.md new file mode 100644 index 00000000..679b5b87 --- /dev/null +++ b/docs/Models/Operations/GetCodeSamplesRequest.md @@ -0,0 +1,10 @@ +# 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/GetCodeSamplesResponse.md b/docs/Models/Operations/GetCodeSamplesResponse.md new file mode 100644 index 00000000..ab675241 --- /dev/null +++ b/docs/Models/Operations/GetCodeSamplesResponse.md @@ -0,0 +1,11 @@ +# GetCodeSamplesResponse + + +## 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 | +| `UsageSnippets` | [UsageSnippets](../../Models/Shared/UsageSnippets.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/docs/Models/Operations/SetWorkspaceFeatureFlagsResponse.md b/docs/Models/Operations/SetWorkspaceFeatureFlagsResponse.md new file mode 100644 index 00000000..b064ad7d --- /dev/null +++ b/docs/Models/Operations/SetWorkspaceFeatureFlagsResponse.md @@ -0,0 +1,11 @@ +# SetWorkspaceFeatureFlagsResponse + + +## 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 | +| `WorkspaceFeatureFlagResponse` | [WorkspaceFeatureFlagResponse](../../Models/Shared/WorkspaceFeatureFlagResponse.md) | :heavy_minus_sign: | Success | \ No newline at end of file diff --git a/docs/Models/Shared/FeatureFlag.md b/docs/Models/Shared/FeatureFlag.md index 5cd0f528..465ea60b 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` | *string* | :heavy_check_mark: | N/A | +| `FeatureFlag` | [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/GithubPublishingPRResponse.md b/docs/Models/Shared/GithubPublishingPRResponse.md index 45c267d1..e68094f2 100644 --- a/docs/Models/Shared/GithubPublishingPRResponse.md +++ b/docs/Models/Shared/GithubPublishingPRResponse.md @@ -5,7 +5,8 @@ Open generation PRs pending publishing ## Fields -| Field | Type | Required | Description | -| ----------------------- | ----------------------- | ----------------------- | ----------------------- | -| `GenerationPullRequest` | *string* | :heavy_minus_sign: | N/A | -| `PendingVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `PendingVersion` | *string* | :heavy_minus_sign: | N/A | +| `PullRequest` | *string* | :heavy_minus_sign: | N/A | +| `PullRequestMetadata` | [PullRequestMetadata](../../Models/Shared/PullRequestMetadata.md) | :heavy_minus_sign: | This can only be populated when the github app is installed for a repo | \ No newline at end of file diff --git a/docs/Models/Shared/PullRequestMetadata.md b/docs/Models/Shared/PullRequestMetadata.md new file mode 100644 index 00000000..18485878 --- /dev/null +++ b/docs/Models/Shared/PullRequestMetadata.md @@ -0,0 +1,18 @@ +# PullRequestMetadata + +This can only be populated when the github app is installed for a repo + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `BaseBranch` | *string* | :heavy_minus_sign: | N/A | +| `CanMerge` | *bool* | :heavy_minus_sign: | N/A | +| `CreatedAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_minus_sign: | N/A | +| `Description` | *string* | :heavy_minus_sign: | truncated to first 1000 characters | +| `HeadBranch` | *string* | :heavy_minus_sign: | N/A | +| `Labels` | List<*string*> | :heavy_minus_sign: | List of github labels | +| `RequestedReviewers` | List<*string*> | :heavy_minus_sign: | List of github handles | +| `Status` | *string* | :heavy_minus_sign: | N/A | +| `Title` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/Models/Shared/UsageSnippet.md b/docs/Models/Shared/UsageSnippet.md new file mode 100644 index 00000000..c75a9015 --- /dev/null +++ b/docs/Models/Shared/UsageSnippet.md @@ -0,0 +1,10 @@ +# UsageSnippet + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | +| `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 diff --git a/docs/Models/Shared/UsageSnippets.md b/docs/Models/Shared/UsageSnippets.md new file mode 100644 index 00000000..0ef6bd2d --- /dev/null +++ b/docs/Models/Shared/UsageSnippets.md @@ -0,0 +1,8 @@ +# UsageSnippets + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | +| `Snippets` | List<[UsageSnippet](../../Models/Shared/UsageSnippet.md)> | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/Models/Shared/WorkspaceFeatureFlag.md b/docs/Models/Shared/WorkspaceFeatureFlag.md new file mode 100644 index 00000000..18cfcf79 --- /dev/null +++ b/docs/Models/Shared/WorkspaceFeatureFlag.md @@ -0,0 +1,13 @@ +# WorkspaceFeatureFlag + +enum value workspace feature flag + + +## Values + +| Name | Value | +| -------------------- | -------------------- | +| `SchemaRegistry` | schema_registry | +| `ChangesReport` | changes_report | +| `SkipSchemaRegistry` | skip_schema_registry | +| `Webhooks` | webhooks | \ No newline at end of file diff --git a/docs/Models/Shared/WorkspaceFeatureFlagRequest.md b/docs/Models/Shared/WorkspaceFeatureFlagRequest.md new file mode 100644 index 00000000..c950ac27 --- /dev/null +++ b/docs/Models/Shared/WorkspaceFeatureFlagRequest.md @@ -0,0 +1,10 @@ +# WorkspaceFeatureFlagRequest + +A request to add workspace feature flags + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| `FeatureFlags` | List<[WorkspaceFeatureFlag](../../Models/Shared/WorkspaceFeatureFlag.md)> | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/sdks/codesamples/README.md b/docs/sdks/codesamples/README.md new file mode 100644 index 00000000..f814ab3a --- /dev/null +++ b/docs/sdks/codesamples/README.md @@ -0,0 +1,188 @@ +# CodeSamples +(*CodeSamples*) + +## Overview + +REST APIs for retrieving Code Samples + +### Available Operations + +* [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 + +This endpoint generates Code Sample previews from a file and configuration parameters. + +### 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() { + "", + }, + SchemaFile = new SchemaFile() { + Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), + FileName = "example.file", + }, +}; + +var res = await sdk.CodeSamples.GenerateCodeSamplePreviewAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `request` | [CodeSampleSchemaInput](../../Models/Shared/CodeSampleSchemaInput.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[GenerateCodeSamplePreviewResponse](../../Models/Operations/GenerateCodeSamplePreviewResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------- | -------------------------------- | -------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX, 5XX | application/json | + +## GenerateCodeSamplePreviewAsync + +This endpoint generates Code Sample previews from a file and configuration parameters, receiving an async JobID response for polling. + +### 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() { + "", + }, + SchemaFile = new SchemaFile() { + Content = System.Text.Encoding.UTF8.GetBytes("0xED5CDd177E"), + FileName = "example.file", + }, +}; + +var res = await sdk.CodeSamples.GenerateCodeSamplePreviewAsyncAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `request` | [CodeSampleSchemaInput](../../Models/Shared/CodeSampleSchemaInput.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[GenerateCodeSamplePreviewAsyncResponse](../../Models/Operations/GenerateCodeSamplePreviewAsyncResponse.md)** + +### Errors + +| 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 | \*/\* | + +## GetCodeSamplePreviewAsync + +Poll for the result of an asynchronous Code Sample preview generation. + +### Example Usage + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Operations; +using SpeakeasySDK.Models.Shared; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +GetCodeSamplePreviewAsyncRequest req = new GetCodeSamplePreviewAsyncRequest() { + JobID = "", +}; + +var res = await sdk.CodeSamples.GetCodeSamplePreviewAsyncAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `request` | [GetCodeSamplePreviewAsyncRequest](../../Models/Operations/GetCodeSamplePreviewAsyncRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[GetCodeSamplePreviewAsyncResponse](../../Models/Operations/GetCodeSamplePreviewAsyncResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------- | -------------------------------- | -------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 4XX, 5XX | application/json | \ No newline at end of file diff --git a/docs/sdks/events/README.md b/docs/sdks/events/README.md index 8e53f07c..b0945553 100644 --- a/docs/sdks/events/README.md +++ b/docs/sdks/events/README.md @@ -30,6 +30,7 @@ var sdk = new SDK(security: new Security() { GetWorkspaceEventsByTargetRequest req = new GetWorkspaceEventsByTargetRequest() { TargetId = "", + WorkspaceId = "", }; var res = await sdk.Events.GetEventsByTargetAsync(req); @@ -108,7 +109,9 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -GetWorkspaceTargetsDeprecatedRequest req = new GetWorkspaceTargetsDeprecatedRequest() {}; +GetWorkspaceTargetsDeprecatedRequest req = new GetWorkspaceTargetsDeprecatedRequest() { + WorkspaceId = "", +}; var res = await sdk.Events.GetTargetsDeprecatedAsync(req); @@ -163,6 +166,7 @@ PostWorkspaceEventsRequest req = new PostWorkspaceEventsRequest() { WorkspaceId = "", }, }, + WorkspaceId = "", }; var res = await sdk.Events.PostAsync(req); @@ -202,7 +206,9 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -SearchWorkspaceEventsRequest req = new SearchWorkspaceEventsRequest() {}; +SearchWorkspaceEventsRequest req = new SearchWorkspaceEventsRequest() { + WorkspaceId = "", +}; var res = await sdk.Events.SearchAsync(req); diff --git a/docs/sdks/sdk/README.md b/docs/sdks/sdk/README.md index 15ae807d..74a4cee0 100644 --- a/docs/sdks/sdk/README.md +++ b/docs/sdks/sdk/README.md @@ -8,141 +8,3 @@ The Speakeasy Platform Documentation ### Available Operations - -* [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. -* [GetCodeSamplePreviewAsync](#getcodesamplepreviewasync) - Poll for the result of an asynchronous Code Sample preview generation. - -## GenerateCodeSamplePreview - -This endpoint generates Code Sample previews from a file and configuration parameters. - -### 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() { - "", - }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xc3dD8BfBef"), - FileName = "example.file", - }, -}; - -var res = await sdk.GenerateCodeSamplePreviewAsync(req); - -// handle response -``` - -### Parameters - -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `request` | [CodeSampleSchemaInput](../../Models/Shared/CodeSampleSchemaInput.md) | :heavy_check_mark: | The request object to use for the request. | - -### Response - -**[GenerateCodeSamplePreviewResponse](../../Models/Operations/GenerateCodeSamplePreviewResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| -------------------------------- | -------------------------------- | -------------------------------- | -| SpeakeasySDK.Models.Errors.Error | 4XX, 5XX | application/json | - -## GenerateCodeSamplePreviewAsync - -This endpoint generates Code Sample previews from a file and configuration parameters, receiving an async JobID response for polling. - -### 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() { - "", - }, - SchemaFile = new SchemaFile() { - Content = System.Text.Encoding.UTF8.GetBytes("0xED5CDd177E"), - FileName = "example.file", - }, -}; - -var res = await sdk.GenerateCodeSamplePreviewAsyncAsync(req); - -// handle response -``` - -### Parameters - -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `request` | [CodeSampleSchemaInput](../../Models/Shared/CodeSampleSchemaInput.md) | :heavy_check_mark: | The request object to use for the request. | - -### Response - -**[GenerateCodeSamplePreviewAsyncResponse](../../Models/Operations/GenerateCodeSamplePreviewAsyncResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| -------------------------------- | -------------------------------- | -------------------------------- | -| SpeakeasySDK.Models.Errors.Error | 4XX, 5XX | application/json | - -## GetCodeSamplePreviewAsync - -Poll for the result of an asynchronous Code Sample preview generation. - -### Example Usage - -```csharp -using SpeakeasySDK; -using SpeakeasySDK.Models.Operations; -using SpeakeasySDK.Models.Shared; - -var sdk = new SDK(security: new Security() { - APIKey = "", -}); - -GetCodeSamplePreviewAsyncRequest req = new GetCodeSamplePreviewAsyncRequest() { - JobID = "", -}; - -var res = await sdk.GetCodeSamplePreviewAsyncAsync(req); - -// handle response -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `request` | [GetCodeSamplePreviewAsyncRequest](../../Models/Operations/GetCodeSamplePreviewAsyncRequest.md) | :heavy_check_mark: | The request object to use for the request. | - -### Response - -**[GetCodeSamplePreviewAsyncResponse](../../Models/Operations/GetCodeSamplePreviewAsyncResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| -------------------------------- | -------------------------------- | -------------------------------- | -| SpeakeasySDK.Models.Errors.Error | 4XX, 5XX | application/json | \ No newline at end of file diff --git a/docs/sdks/workspaces/README.md b/docs/sdks/workspaces/README.md index 2c8c5731..fabb51c6 100644 --- a/docs/sdks/workspaces/README.md +++ b/docs/sdks/workspaces/README.md @@ -19,6 +19,7 @@ REST APIs for managing Workspaces (speakeasy tenancy) * [GetTokens](#gettokens) - Get tokens for a particular workspace * [GrantAccess](#grantaccess) - Grant a user access to a particular workspace * [RevokeAccess](#revokeaccess) - Revoke a user's access to a particular workspace +* [SetFeatureFlags](#setfeatureflags) - Set workspace feature flags * [Update](#update) - Update workspace details * [UpdateSettings](#updatesettings) - Update workspace settings @@ -94,6 +95,7 @@ CreateWorkspaceTokenRequest req = new CreateWorkspaceTokenRequest() { Name = "", WorkspaceId = "", }, + WorkspaceId = "", }; var res = await sdk.Workspaces.CreateTokenAsync(req); @@ -135,6 +137,7 @@ var sdk = new SDK(security: new Security() { DeleteWorkspaceTokenRequest req = new DeleteWorkspaceTokenRequest() { TokenID = "", + WorkspaceId = "", }; var res = await sdk.Workspaces.DeleteTokenAsync(req); @@ -234,7 +237,9 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -GetWorkspaceRequest req = new GetWorkspaceRequest() {}; +GetWorkspaceRequest req = new GetWorkspaceRequest() { + WorkspaceId = "", +}; var res = await sdk.Workspaces.GetByIDAsync(req); @@ -273,7 +278,9 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -GetWorkspaceFeatureFlagsRequest req = new GetWorkspaceFeatureFlagsRequest() {}; +GetWorkspaceFeatureFlagsRequest req = new GetWorkspaceFeatureFlagsRequest() { + WorkspaceId = "", +}; var res = await sdk.Workspaces.GetFeatureFlagsAsync(req); @@ -312,7 +319,9 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -GetWorkspaceSettingsRequest req = new GetWorkspaceSettingsRequest() {}; +GetWorkspaceSettingsRequest req = new GetWorkspaceSettingsRequest() { + WorkspaceId = "", +}; var res = await sdk.Workspaces.GetSettingsAsync(req); @@ -351,7 +360,9 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -GetWorkspaceTeamRequest req = new GetWorkspaceTeamRequest() {}; +GetWorkspaceTeamRequest req = new GetWorkspaceTeamRequest() { + WorkspaceId = "", +}; var res = await sdk.Workspaces.GetTeamAsync(req); @@ -390,7 +401,9 @@ var sdk = new SDK(security: new Security() { APIKey = "", }); -GetWorkspaceTokensRequest req = new GetWorkspaceTokensRequest() {}; +GetWorkspaceTokensRequest req = new GetWorkspaceTokensRequest() { + WorkspaceId = "", +}; var res = await sdk.Workspaces.GetTokensAsync(req); @@ -431,6 +444,7 @@ var sdk = new SDK(security: new Security() { GrantUserAccessToWorkspaceRequest req = new GrantUserAccessToWorkspaceRequest() { Email = "Lucinda.Batz8@hotmail.com", + WorkspaceId = "", }; var res = await sdk.Workspaces.GrantAccessAsync(req); @@ -472,6 +486,7 @@ var sdk = new SDK(security: new Security() { RevokeUserAccessToWorkspaceRequest req = new RevokeUserAccessToWorkspaceRequest() { UserId = "", + WorkspaceId = "", }; var res = await sdk.Workspaces.RevokeAccessAsync(req); @@ -496,6 +511,49 @@ var res = await sdk.Workspaces.RevokeAccessAsync(req); | SpeakeasySDK.Models.Errors.Error | 4XX | application/json | | SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* | +## SetFeatureFlags + +Set workspace feature flags + +### Example Usage + +```csharp +using SpeakeasySDK; +using SpeakeasySDK.Models.Shared; +using System.Collections.Generic; + +var sdk = new SDK(security: new Security() { + APIKey = "", +}); + +WorkspaceFeatureFlagRequest req = new WorkspaceFeatureFlagRequest() { + FeatureFlags = new List() { + WorkspaceFeatureFlag.SkipSchemaRegistry, + }, +}; + +var res = await sdk.Workspaces.SetFeatureFlagsAsync(req); + +// handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `request` | [WorkspaceFeatureFlagRequest](../../Models/Shared/WorkspaceFeatureFlagRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[SetWorkspaceFeatureFlagsResponse](../../Models/Operations/SetWorkspaceFeatureFlagsResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| SpeakeasySDK.Models.Errors.Error | 5XX | application/json | +| SpeakeasySDK.Models.Errors.SDKException | 4XX | \*/\* | + ## Update Update information about a particular workspace. @@ -522,6 +580,7 @@ UpdateWorkspaceDetailsRequest req = new UpdateWorkspaceDetailsRequest() { UpdatedAt = System.DateTime.Parse("2024-10-16T10:52:42.015Z"), Verified = false, }, + WorkspaceId = "", }; var res = await sdk.Workspaces.UpdateAsync(req); @@ -569,6 +628,7 @@ UpdateWorkspaceSettingsRequest req = new UpdateWorkspaceSettingsRequest() { WebhookUrl = "https://grown-pharmacopoeia.net", WorkspaceId = "", }, + WorkspaceId = "", }; var res = await sdk.Workspaces.UpdateSettingsAsync(req); diff --git a/gen.yaml b/gen.yaml index d7038352..7d57f2ac 100755 --- a/gen.yaml +++ b/gen.yaml @@ -11,7 +11,7 @@ generation: oAuth2ClientCredentialsEnabled: false oAuth2PasswordEnabled: false csharp: - version: 5.11.0 + version: 5.12.0 additionalDependencies: [] author: Speakeasy clientServerStatusCodesAsErrors: true diff --git a/src/SpeakeasySDK/Artifacts.cs b/src/SpeakeasySDK/Artifacts.cs index e38428b3..0b8ea240 100644 --- a/src/SpeakeasySDK/Artifacts.cs +++ b/src/SpeakeasySDK/Artifacts.cs @@ -78,10 +78,10 @@ public class Artifacts: IArtifacts { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.11.0"; - private const string _sdkGenVersion = "2.484.0"; + private const string _sdkVersion = "5.12.0"; + private const string _sdkGenVersion = "2.493.4"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.11.0 2.484.0 0.4.0 SpeakeasySDK"; + 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; diff --git a/src/SpeakeasySDK/Auth.cs b/src/SpeakeasySDK/Auth.cs index 77a250af..493d69b9 100644 --- a/src/SpeakeasySDK/Auth.cs +++ b/src/SpeakeasySDK/Auth.cs @@ -60,10 +60,10 @@ public class Auth: IAuth { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.11.0"; - private const string _sdkGenVersion = "2.484.0"; + private const string _sdkVersion = "5.12.0"; + private const string _sdkGenVersion = "2.493.4"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.11.0 2.484.0 0.4.0 SpeakeasySDK"; + 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; diff --git a/src/SpeakeasySDK/CodeSamples.cs b/src/SpeakeasySDK/CodeSamples.cs new file mode 100644 index 00000000..c1027ec0 --- /dev/null +++ b/src/SpeakeasySDK/CodeSamples.cs @@ -0,0 +1,466 @@ +//------------------------------------------------------------------------------ +// +// 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; + + /// + /// REST APIs for retrieving Code Samples + /// + public interface ICodeSamples + { + + /// + /// Generate Code Sample previews from a file and configuration parameters. + /// + /// + /// This endpoint generates Code Sample previews from a file and configuration parameters. + /// + /// + Task GenerateCodeSamplePreviewAsync(CodeSampleSchemaInput request); + + /// + /// Initiate asynchronous Code Sample preview generation from a file and configuration parameters, receiving an async JobID response for polling. + /// + /// + /// This endpoint generates Code Sample previews from a file and configuration parameters, receiving an async JobID response for polling. + /// + /// + 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. + /// + /// + /// Poll for the result of an asynchronous Code Sample preview generation. + /// + /// + Task GetCodeSamplePreviewAsyncAsync(GetCodeSamplePreviewAsyncRequest request); + } + + /// + /// REST APIs for retrieving Code Samples + /// + 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 _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) + { + _client = client; + _securitySource = securitySource; + _serverUrl = serverUrl; + SDKConfiguration = config; + } + + public async Task GenerateCodeSamplePreviewAsync(CodeSampleSchemaInput request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + + var urlString = baseUrl + "/v1/code_sample/preview"; + + var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); + httpRequest.Headers.Add("user-agent", _userAgent); + + var serializedBody = RequestBodySerializer.Serialize(request, "Request", "multipart", false, false); + if (serializedBody != null) + { + httpRequest.Content = serializedBody; + } + + if (_securitySource != null) + { + httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + } + + var hookCtx = new HookContext("generateCodeSamplePreview", 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) + { + 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 response = new GenerateCodeSamplePreviewResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.TwoHundredApplicationJsonBytes = await httpResponse.Content.ReadAsByteArrayAsync(); + return response; + } + else if(Utilities.IsContentTypeMatch("application/x-yaml", contentType)) + { + var response = new GenerateCodeSamplePreviewResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.TwoHundredApplicationXYamlBytes = await httpResponse.Content.ReadAsByteArrayAsync(); + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + { + 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 GenerateCodeSamplePreviewAsyncAsync(CodeSampleSchemaInput request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + + var urlString = baseUrl + "/v1/code_sample/preview/async"; + + var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); + httpRequest.Headers.Add("user-agent", _userAgent); + + var serializedBody = RequestBodySerializer.Serialize(request, "Request", "multipart", false, false); + if (serializedBody != null) + { + httpRequest.Content = serializedBody; + } + + if (_securitySource != null) + { + httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + } + + var hookCtx = new HookContext("generateCodeSamplePreviewAsync", 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) + { + 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 == 202) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var response = new GenerateCodeSamplePreviewAsyncResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.Object = obj; + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + { + 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) + { + 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 obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var response = new GetCodeSamplesResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.UsageSnippets = obj; + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + } + 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); + } + 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 status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + } + + public async Task GetCodeSamplePreviewAsyncAsync(GetCodeSamplePreviewAsyncRequest request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + 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); + + if (_securitySource != null) + { + httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + } + + var hookCtx = new HookContext("getCodeSamplePreviewAsync", 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) + { + 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 response = new GetCodeSamplePreviewAsyncResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.TwoHundredApplicationJsonBytes = await httpResponse.Content.ReadAsByteArrayAsync(); + return response; + } + else if(Utilities.IsContentTypeMatch("application/x-yaml", contentType)) + { + var response = new GetCodeSamplePreviewAsyncResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.TwoHundredApplicationXYamlBytes = await httpResponse.Content.ReadAsByteArrayAsync(); + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + } + else if(responseStatusCode == 202) + { + if(Utilities.IsContentTypeMatch("application/json", contentType)) + { + var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var response = new GetCodeSamplePreviewAsyncResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.TwoHundredAndTwoApplicationJsonObject = obj; + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) + { + 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); + } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Events.cs b/src/SpeakeasySDK/Events.cs index 0ea030b2..ff9266b3 100644 --- a/src/SpeakeasySDK/Events.cs +++ b/src/SpeakeasySDK/Events.cs @@ -65,10 +65,10 @@ public class Events: IEvents { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.11.0"; - private const string _sdkGenVersion = "2.484.0"; + private const string _sdkVersion = "5.12.0"; + private const string _sdkGenVersion = "2.493.4"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.11.0 2.484.0 0.4.0 SpeakeasySDK"; + 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; diff --git a/src/SpeakeasySDK/Github.cs b/src/SpeakeasySDK/Github.cs index c9c40a2e..6fcd317f 100644 --- a/src/SpeakeasySDK/Github.cs +++ b/src/SpeakeasySDK/Github.cs @@ -47,10 +47,10 @@ public class Github: IGithub { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.11.0"; - private const string _sdkGenVersion = "2.484.0"; + private const string _sdkVersion = "5.12.0"; + private const string _sdkGenVersion = "2.493.4"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.11.0 2.484.0 0.4.0 SpeakeasySDK"; + 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; diff --git a/src/SpeakeasySDK/Models/Operations/GetCodeSamplesRequest.cs b/src/SpeakeasySDK/Models/Operations/GetCodeSamplesRequest.cs new file mode 100644 index 00000000..c709971c --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetCodeSamplesRequest.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.Utils; + using System.Collections.Generic; + + public class GetCodeSamplesRequest + { + + /// + /// The registry URL from which to retrieve the snippets. E.g. https://spec.speakeasy.com/org/ws/my-source + /// + [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; } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/GetCodeSamplesResponse.cs b/src/SpeakeasySDK/Models/Operations/GetCodeSamplesResponse.cs new file mode 100644 index 00000000..03092bd0 --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/GetCodeSamplesResponse.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 GetCodeSamplesResponse + { + + /// + /// 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 UsageSnippets? UsageSnippets { get; set; } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Operations/SetWorkspaceFeatureFlagsResponse.cs b/src/SpeakeasySDK/Models/Operations/SetWorkspaceFeatureFlagsResponse.cs new file mode 100644 index 00000000..b4b8fb8e --- /dev/null +++ b/src/SpeakeasySDK/Models/Operations/SetWorkspaceFeatureFlagsResponse.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 SetWorkspaceFeatureFlagsResponse + { + + /// + /// 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!; + + /// + /// Success + /// + public WorkspaceFeatureFlagResponse? WorkspaceFeatureFlagResponse { get; set; } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/FeatureFlag.cs b/src/SpeakeasySDK/Models/Shared/FeatureFlag.cs index 4cbb4723..7c75ed01 100644 --- a/src/SpeakeasySDK/Models/Shared/FeatureFlag.cs +++ b/src/SpeakeasySDK/Models/Shared/FeatureFlag.cs @@ -10,6 +10,7 @@ namespace SpeakeasySDK.Models.Shared { using Newtonsoft.Json; + using SpeakeasySDK.Models.Shared; using SpeakeasySDK.Utils; using System; @@ -19,8 +20,11 @@ namespace SpeakeasySDK.Models.Shared public class FeatureFlag { + /// + /// enum value workspace feature flag + /// [JsonProperty("feature_flag")] - public string FeatureFlagValue { get; set; } = default!; + public WorkspaceFeatureFlag FeatureFlagValue { get; set; } = default!; [JsonProperty("trial_ends_at")] public DateTime? TrialEndsAt { get; set; } = null; diff --git a/src/SpeakeasySDK/Models/Shared/GithubPublishingPRResponse.cs b/src/SpeakeasySDK/Models/Shared/GithubPublishingPRResponse.cs index 5b3dcf8f..ed456e3b 100644 --- a/src/SpeakeasySDK/Models/Shared/GithubPublishingPRResponse.cs +++ b/src/SpeakeasySDK/Models/Shared/GithubPublishingPRResponse.cs @@ -10,6 +10,7 @@ namespace SpeakeasySDK.Models.Shared { using Newtonsoft.Json; + using SpeakeasySDK.Models.Shared; using SpeakeasySDK.Utils; /// @@ -18,10 +19,16 @@ namespace SpeakeasySDK.Models.Shared public class GithubPublishingPRResponse { - [JsonProperty("generation_pull_request")] - public string? GenerationPullRequest { get; set; } - [JsonProperty("pending_version")] public string? PendingVersion { get; set; } + + [JsonProperty("pull_request")] + public string? PullRequest { get; set; } + + /// + /// This can only be populated when the github app is installed for a repo + /// + [JsonProperty("pull_request_metadata")] + public PullRequestMetadata? PullRequestMetadata { get; set; } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/PullRequestMetadata.cs b/src/SpeakeasySDK/Models/Shared/PullRequestMetadata.cs new file mode 100644 index 00000000..fc58e95e --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/PullRequestMetadata.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.Utils; + using System; + using System.Collections.Generic; + + /// + /// This can only be populated when the github app is installed for a repo + /// + public class PullRequestMetadata + { + + [JsonProperty("base_branch")] + public string? BaseBranch { get; set; } + + [JsonProperty("can_merge")] + public bool? CanMerge { get; set; } + + [JsonProperty("created_at")] + public DateTime? CreatedAt { get; set; } + + /// + /// truncated to first 1000 characters + /// + [JsonProperty("description")] + public string? Description { get; set; } + + [JsonProperty("head_branch")] + public string? HeadBranch { get; set; } + + /// + /// List of github labels + /// + [JsonProperty("labels")] + public List? Labels { get; set; } + + /// + /// List of github handles + /// + [JsonProperty("requested_reviewers")] + public List? RequestedReviewers { get; set; } + + [JsonProperty("status")] + public string? Status { get; set; } + + [JsonProperty("title")] + public string? Title { get; set; } + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/UsageSnippet.cs b/src/SpeakeasySDK/Models/Shared/UsageSnippet.cs new file mode 100644 index 00000000..36e1ab57 --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/UsageSnippet.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// 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; + + public class UsageSnippet + { + + /// + /// The code snippet + /// + [JsonProperty("code")] + public string Code { get; set; } = default!; + + /// + /// The language of the snippet + /// + [JsonProperty("language")] + public string Language { get; set; } = default!; + + /// + /// The operation ID for the snippet + /// + [JsonProperty("operationId")] + public string OperationId { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/UsageSnippets.cs b/src/SpeakeasySDK/Models/Shared/UsageSnippets.cs new file mode 100644 index 00000000..09b46b74 --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/UsageSnippets.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.Shared +{ + using Newtonsoft.Json; + using SpeakeasySDK.Models.Shared; + using SpeakeasySDK.Utils; + using System.Collections.Generic; + + public class UsageSnippets + { + + [JsonProperty("snippets")] + public List Snippets { 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 new file mode 100644 index 00000000..40325487 --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlag.cs @@ -0,0 +1,64 @@ +//------------------------------------------------------------------------------ +// +// 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; + + /// + /// enum value workspace feature flag + /// + public enum WorkspaceFeatureFlag + { + [JsonProperty("schema_registry")] + SchemaRegistry, + [JsonProperty("changes_report")] + ChangesReport, + [JsonProperty("skip_schema_registry")] + SkipSchemaRegistry, + [JsonProperty("webhooks")] + Webhooks, + } + + public static class WorkspaceFeatureFlagExtension + { + public static string Value(this WorkspaceFeatureFlag value) + { + return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString(); + } + + public static WorkspaceFeatureFlag ToEnum(this string value) + { + foreach(var field in typeof(WorkspaceFeatureFlag).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 WorkspaceFeatureFlag) + { + return (WorkspaceFeatureFlag)enumVal; + } + } + } + + throw new Exception($"Unknown value {value} for enum WorkspaceFeatureFlag"); + } + } + +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlagRequest.cs b/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlagRequest.cs new file mode 100644 index 00000000..ab959ef9 --- /dev/null +++ b/src/SpeakeasySDK/Models/Shared/WorkspaceFeatureFlagRequest.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 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.Collections.Generic; + + /// + /// A request to add workspace feature flags + /// + public class WorkspaceFeatureFlagRequest + { + + [JsonProperty("feature_flags")] + public List FeatureFlags { get; set; } = default!; + } +} \ No newline at end of file diff --git a/src/SpeakeasySDK/Organizations.cs b/src/SpeakeasySDK/Organizations.cs index dda819b9..e1a3903c 100644 --- a/src/SpeakeasySDK/Organizations.cs +++ b/src/SpeakeasySDK/Organizations.cs @@ -81,10 +81,10 @@ public class Organizations: IOrganizations { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.11.0"; - private const string _sdkGenVersion = "2.484.0"; + private const string _sdkVersion = "5.12.0"; + private const string _sdkGenVersion = "2.493.4"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.11.0 2.484.0 0.4.0 SpeakeasySDK"; + 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; diff --git a/src/SpeakeasySDK/Reports.cs b/src/SpeakeasySDK/Reports.cs index ef602611..1f287cac 100644 --- a/src/SpeakeasySDK/Reports.cs +++ b/src/SpeakeasySDK/Reports.cs @@ -51,10 +51,10 @@ public class Reports: IReports { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.11.0"; - private const string _sdkGenVersion = "2.484.0"; + private const string _sdkVersion = "5.12.0"; + private const string _sdkGenVersion = "2.493.4"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.11.0 2.484.0 0.4.0 SpeakeasySDK"; + 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; diff --git a/src/SpeakeasySDK/SDK.cs b/src/SpeakeasySDK/SDK.cs index ff9df034..a41cac0a 100644 --- a/src/SpeakeasySDK/SDK.cs +++ b/src/SpeakeasySDK/SDK.cs @@ -12,14 +12,12 @@ 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; /// @@ -40,6 +38,11 @@ public interface ISDK /// public IAuth Auth { get; } + /// + /// REST APIs for retrieving Code Samples + /// + public ICodeSamples CodeSamples { get; } + /// /// REST APIs for managing the github integration /// @@ -79,33 +82,6 @@ public interface ISDK /// REST APIs for managing events captured by a speakeasy binary (CLI, GitHub Action etc) /// public IEvents Events { get; } - - /// - /// Generate Code Sample previews from a file and configuration parameters. - /// - /// - /// This endpoint generates Code Sample previews from a file and configuration parameters. - /// - /// - Task GenerateCodeSamplePreviewAsync(CodeSampleSchemaInput request); - - /// - /// Initiate asynchronous Code Sample preview generation from a file and configuration parameters, receiving an async JobID response for polling. - /// - /// - /// This endpoint generates Code Sample previews from a file and configuration parameters, receiving an async JobID response for polling. - /// - /// - Task GenerateCodeSamplePreviewAsyncAsync(CodeSampleSchemaInput request); - - /// - /// Poll for the result of an asynchronous Code Sample preview generation. - /// - /// - /// Poll for the result of an asynchronous Code Sample preview generation. - /// - /// - Task GetCodeSamplePreviewAsyncAsync(GetCodeSamplePreviewAsyncRequest request); } public class SDKConfig @@ -173,16 +149,17 @@ public class SDK: ISDK public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.11.0"; - private const string _sdkGenVersion = "2.484.0"; + private const string _sdkVersion = "5.12.0"; + private const string _sdkGenVersion = "2.493.4"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.11.0 2.484.0 0.4.0 SpeakeasySDK"; + 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 IReports Reports { get; private set; } @@ -236,6 +213,9 @@ public SDK(SpeakeasySDK.Models.Shared.Security? security = null, Func GenerateCodeSamplePreviewAsync(CodeSampleSchemaInput request) - { - string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); - - var urlString = baseUrl + "/v1/code_sample/preview"; - - var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); - - var serializedBody = RequestBodySerializer.Serialize(request, "Request", "multipart", false, false); - if (serializedBody != null) - { - httpRequest.Content = serializedBody; - } - - if (_securitySource != null) - { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); - } - - var hookCtx = new HookContext("generateCodeSamplePreview", 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) - { - 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 response = new GenerateCodeSamplePreviewResponse() - { - StatusCode = responseStatusCode, - ContentType = contentType, - RawResponse = httpResponse - }; - response.TwoHundredApplicationJsonBytes = await httpResponse.Content.ReadAsByteArrayAsync(); - return response; - } - else if(Utilities.IsContentTypeMatch("application/x-yaml", contentType)) - { - var response = new GenerateCodeSamplePreviewResponse() - { - StatusCode = responseStatusCode, - ContentType = contentType, - RawResponse = httpResponse - }; - response.TwoHundredApplicationXYamlBytes = await httpResponse.Content.ReadAsByteArrayAsync(); - return response; - } - - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); - } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) - { - 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 GenerateCodeSamplePreviewAsyncAsync(CodeSampleSchemaInput request) - { - string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); - - var urlString = baseUrl + "/v1/code_sample/preview/async"; - - var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); - httpRequest.Headers.Add("user-agent", _userAgent); - - var serializedBody = RequestBodySerializer.Serialize(request, "Request", "multipart", false, false); - if (serializedBody != null) - { - httpRequest.Content = serializedBody; - } - - if (_securitySource != null) - { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); - } - - var hookCtx = new HookContext("generateCodeSamplePreviewAsync", 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) - { - 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 == 202) - { - if(Utilities.IsContentTypeMatch("application/json", contentType)) - { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - var response = new GenerateCodeSamplePreviewAsyncResponse() - { - StatusCode = responseStatusCode, - ContentType = contentType, - RawResponse = httpResponse - }; - response.Object = obj; - return response; - } - - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); - } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) - { - 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 GetCodeSamplePreviewAsyncAsync(GetCodeSamplePreviewAsyncRequest request) - { - string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); - 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); - - if (_securitySource != null) - { - httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); - } - - var hookCtx = new HookContext("getCodeSamplePreviewAsync", 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) - { - 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 response = new GetCodeSamplePreviewAsyncResponse() - { - StatusCode = responseStatusCode, - ContentType = contentType, - RawResponse = httpResponse - }; - response.TwoHundredApplicationJsonBytes = await httpResponse.Content.ReadAsByteArrayAsync(); - return response; - } - else if(Utilities.IsContentTypeMatch("application/x-yaml", contentType)) - { - var response = new GetCodeSamplePreviewAsyncResponse() - { - StatusCode = responseStatusCode, - ContentType = contentType, - RawResponse = httpResponse - }; - response.TwoHundredApplicationXYamlBytes = await httpResponse.Content.ReadAsByteArrayAsync(); - return response; - } - - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); - } - else if(responseStatusCode == 202) - { - if(Utilities.IsContentTypeMatch("application/json", contentType)) - { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - var response = new GetCodeSamplePreviewAsyncResponse() - { - StatusCode = responseStatusCode, - ContentType = contentType, - RawResponse = httpResponse - }; - response.TwoHundredAndTwoApplicationJsonObject = obj; - return response; - } - - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); - } - else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600) - { - 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); - } } } \ No newline at end of file diff --git a/src/SpeakeasySDK/ShortURLs.cs b/src/SpeakeasySDK/ShortURLs.cs index 53916d35..65c3f711 100644 --- a/src/SpeakeasySDK/ShortURLs.cs +++ b/src/SpeakeasySDK/ShortURLs.cs @@ -41,10 +41,10 @@ public class ShortURLs: IShortURLs { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.11.0"; - private const string _sdkGenVersion = "2.484.0"; + private const string _sdkVersion = "5.12.0"; + private const string _sdkGenVersion = "2.493.4"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.11.0 2.484.0 0.4.0 SpeakeasySDK"; + 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; diff --git a/src/SpeakeasySDK/SpeakeasySDK.csproj b/src/SpeakeasySDK/SpeakeasySDK.csproj index 43870ac9..142f8a2a 100644 --- a/src/SpeakeasySDK/SpeakeasySDK.csproj +++ b/src/SpeakeasySDK/SpeakeasySDK.csproj @@ -3,7 +3,7 @@ true SpeakeasySDK - 5.11.0 + 5.12.0 net8.0 Speakeasy Copyright (c) Speakeasy 2025 diff --git a/src/SpeakeasySDK/Subscriptions.cs b/src/SpeakeasySDK/Subscriptions.cs index a81b7976..b2dcdbc7 100644 --- a/src/SpeakeasySDK/Subscriptions.cs +++ b/src/SpeakeasySDK/Subscriptions.cs @@ -46,10 +46,10 @@ public class Subscriptions: ISubscriptions { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.11.0"; - private const string _sdkGenVersion = "2.484.0"; + private const string _sdkVersion = "5.12.0"; + private const string _sdkGenVersion = "2.493.4"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.11.0 2.484.0 0.4.0 SpeakeasySDK"; + 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; diff --git a/src/SpeakeasySDK/Suggest.cs b/src/SpeakeasySDK/Suggest.cs index 147eb21b..241b4dfd 100644 --- a/src/SpeakeasySDK/Suggest.cs +++ b/src/SpeakeasySDK/Suggest.cs @@ -68,10 +68,10 @@ public class Suggest: ISuggest { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.11.0"; - private const string _sdkGenVersion = "2.484.0"; + private const string _sdkVersion = "5.12.0"; + private const string _sdkGenVersion = "2.493.4"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.11.0 2.484.0 0.4.0 SpeakeasySDK"; + 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; diff --git a/src/SpeakeasySDK/Workspaces.cs b/src/SpeakeasySDK/Workspaces.cs index 6edb1d42..e390c6b2 100644 --- a/src/SpeakeasySDK/Workspaces.cs +++ b/src/SpeakeasySDK/Workspaces.cs @@ -108,6 +108,11 @@ public interface IWorkspaces /// Task RevokeAccessAsync(RevokeUserAccessToWorkspaceRequest request); + /// + /// Set workspace feature flags + /// + Task SetFeatureFlagsAsync(WorkspaceFeatureFlagRequest request); + /// /// Update workspace details /// @@ -134,10 +139,10 @@ public class Workspaces: IWorkspaces { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "5.11.0"; - private const string _sdkGenVersion = "2.484.0"; + private const string _sdkVersion = "5.12.0"; + private const string _sdkGenVersion = "2.493.4"; private const string _openapiDocVersion = "0.4.0"; - private const string _userAgent = "speakeasy-sdk/csharp 5.11.0 2.484.0 0.4.0 SpeakeasySDK"; + 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; @@ -1183,6 +1188,97 @@ public async Task RevokeAccessAsync(RevokeU throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } + public async Task SetFeatureFlagsAsync(WorkspaceFeatureFlagRequest request) + { + string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); + + var urlString = baseUrl + "/v1/workspace/feature_flags"; + + var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); + httpRequest.Headers.Add("user-agent", _userAgent); + + var serializedBody = RequestBodySerializer.Serialize(request, "Request", "json", false, false); + if (serializedBody != null) + { + httpRequest.Content = serializedBody; + } + + if (_securitySource != null) + { + httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest); + } + + var hookCtx = new HookContext("setWorkspaceFeatureFlags", 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) + { + 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 obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var response = new SetWorkspaceFeatureFlagsResponse() + { + StatusCode = responseStatusCode, + ContentType = contentType, + RawResponse = httpResponse + }; + response.WorkspaceFeatureFlagResponse = obj; + return response; + } + + throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + } + else if(responseStatusCode >= 400 && responseStatusCode < 500) + { + throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + } + else if(responseStatusCode >= 500 && responseStatusCode < 600) + { + 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 UpdateAsync(UpdateWorkspaceDetailsRequest request) { if (request == null)