Skip to content

Commit 2dc212a

Browse files
committed
## Csharp SDK Changes Detected:
* `Sdk.CodeSamples.GenerateCodeSamplePreview()`: * `request` **Changed** **Breaking** ⚠️ * `response` **Changed** **Breaking** ⚠️ * `Sdk.CodeSamples.GetCodeSamplePreviewAsync()`: `response` **Changed** **Breaking** ⚠️ * `Sdk.CodeSamples.GenerateCodeSamplePreviewAsync()`: `request` **Changed** **Breaking** ⚠️ * `Sdk.PublishingTokens.Get()`: **Added** * `Sdk.Artifacts.GetNamespaces()`: `response.items.[]` **Changed** * `Sdk.PublishingTokens.Delete()`: **Added** * `Sdk.Artifacts.SetArchived()`: **Added** * `Sdk.PublishingTokens.List()`: **Added** * `Sdk.PublishingTokens.ResolveMetadata()`: **Added** * `Sdk.PublishingTokens.ResolveTarget()`: **Added** * `Sdk.PublishingTokens.Update()`: **Added** * `Sdk.SchemaStore.CreateSchemaStoreItem()`: **Added** * `Sdk.SchemaStore.GetSchemaStoreItem()`: **Added** * `Sdk.CodeSamples.Get()`: **Deleted** **Breaking** ⚠️ * `Sdk.PublishingTokens.Create()`: **Added** * `Sdk.Artifacts.GetRevisions()`: `response.items.[].ContentsMetadata` **Added** * `Sdk.Auth.GetUser()`: `response` **Changed** * `Sdk.Auth.ValidateApiKey()`: `response.billingAddOns` **Added** * `Sdk.Organizations.GetBillingAddOns()`: **Added** * `Sdk.Organizations.DeleteBillingAddOn()`: **Added** * `Sdk.Organizations.CreateBillingAddOns()`: **Added** * `Sdk.Workspaces.CreateToken()`: * `request.WorkspaceToken` **Changed** * `Sdk.Workspaces.GetTeam()`: `response.users.[]` **Changed** * `Sdk.Workspaces.GetTokens()`: `response.[]` **Changed** * `Sdk.Events.GetEventsByTarget()`: `response.[].TestReportRaw` **Added** * `Sdk.Events.Post()`: * `request.RequestBody.[].TestReportRaw` **Added** * `Sdk.Events.Search()`: * `request.InteractionType` **Changed** * `response.[].TestReportRaw` **Added**
1 parent d25b67a commit 2dc212a

File tree

173 files changed

+7708
-2645
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+7708
-2645
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
.DS_Store
2+
**/.speakeasy/temp/
3+
**/.speakeasy/logs/
4+
.env
5+
.env.local
16
obj/
27
bin/
38
debug/
4-
.idea/
9+
.idea/

.speakeasy/gen.lock

Lines changed: 484 additions & 794 deletions
Large diffs are not rendered by default.

.speakeasy/workflow.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
speakeasyVersion: 1.468.2
1+
speakeasyVersion: 1.633.1
22
sources:
33
speakeasy:
44
sourceNamespace: speakeasy
5-
sourceRevisionDigest: sha256:8af7ebde12785185cdbd700c1b3b6b8848b43d34f1fe8c06fff5ae4af471faf2
6-
sourceBlobDigest: sha256:952a58da1511e3191ea8e470c7f01a4e3785d11d9152f490a3e5a7173c8542e7
5+
sourceRevisionDigest: sha256:9128c3df436950ca04fec9dfc74e769e8b492d434b115b197d68da656ae17d23
6+
sourceBlobDigest: sha256:6eb8a6e215c36d3e11d86fc67d5ce7af499bdb934e0f7fbad17efcdde9bffd73
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1735949986
9+
- speakeasy-sdk-regen-1758759731
1010
- 0.4.0
1111
targets:
1212
speakeasy-client-sdk-csharp:
1313
source: speakeasy
1414
sourceNamespace: speakeasy
15-
sourceRevisionDigest: sha256:8af7ebde12785185cdbd700c1b3b6b8848b43d34f1fe8c06fff5ae4af471faf2
16-
sourceBlobDigest: sha256:952a58da1511e3191ea8e470c7f01a4e3785d11d9152f490a3e5a7173c8542e7
15+
sourceRevisionDigest: sha256:9128c3df436950ca04fec9dfc74e769e8b492d434b115b197d68da656ae17d23
16+
sourceBlobDigest: sha256:6eb8a6e215c36d3e11d86fc67d5ce7af499bdb934e0f7fbad17efcdde9bffd73
1717
codeSamplesNamespace: code-samples-csharp-speakeasy-client-sdk-csharp
18-
codeSamplesRevisionDigest: sha256:aacf508e82244f7628670bda7c73bdda3a36059c4143c3566f2b4d4935251ec8
18+
codeSamplesRevisionDigest: sha256:73a1bd33625310d6f545cf922b4c33b1c22d12d614dc0346b9446b6ceac30c8e
1919
workflow:
2020
workflowVersion: 1.0.0
2121
speakeasyVersion: latest

CONTRIBUTING.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Contributing to This Repository
2+
3+
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.
4+
5+
## How to Report Issues
6+
7+
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:
8+
9+
- A clear and descriptive title
10+
- Steps to reproduce the issue
11+
- Expected and actual behavior
12+
- Any relevant logs, screenshots, or error messages
13+
- Information about your environment (e.g., operating system, software versions)
14+
- For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed
15+
16+
## Issue Triage and Upstream Fixes
17+
18+
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.
19+
20+
## Contact
21+
22+
If you have any questions or need further assistance, please feel free to reach out by opening an issue.
23+
24+
Thank you for your understanding and cooperation!
25+
26+
The Maintainers

NUGET.md

Lines changed: 61 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,12 @@
99
```csharp
1010
using SpeakeasySDK;
1111
using SpeakeasySDK.Models.Shared;
12-
using System.Collections.Generic;
1312

1413
var sdk = new SDK(security: new Security() {
1514
APIKey = "<YOUR_API_KEY_HERE>",
1615
});
1716

18-
RemoteSource req = new RemoteSource() {
19-
Inputs = new List<RemoteDocument>() {
20-
new RemoteDocument() {
21-
RegistryUrl = "https://productive-swine.net",
22-
},
23-
},
24-
Output = new RemoteDocument() {
25-
RegistryUrl = "https://spiteful-apricot.info",
26-
},
27-
};
17+
RemoteSource? req = null;
2818

2919
var res = await sdk.Artifacts.CreateRemoteSourceAsync(req);
3020

@@ -49,22 +39,12 @@ You can set the security parameters through the `security` optional parameter wh
4939
```csharp
5040
using SpeakeasySDK;
5141
using SpeakeasySDK.Models.Shared;
52-
using System.Collections.Generic;
5342

5443
var sdk = new SDK(security: new Security() {
5544
APIKey = "<YOUR_API_KEY_HERE>",
5645
});
5746

58-
RemoteSource req = new RemoteSource() {
59-
Inputs = new List<RemoteDocument>() {
60-
new RemoteDocument() {
61-
RegistryUrl = "https://productive-swine.net",
62-
},
63-
},
64-
Output = new RemoteDocument() {
65-
RegistryUrl = "https://spiteful-apricot.info",
66-
},
67-
};
47+
RemoteSource? req = null;
6848

6949
var res = await sdk.Artifacts.CreateRemoteSourceAsync(req);
7050

@@ -94,7 +74,7 @@ The following global parameter is available.
9474
using SpeakeasySDK;
9575
using SpeakeasySDK.Models.Operations;
9676

97-
var sdk = new SDK();
77+
var sdk = new SDK(workspaceId: "<id>");
9878

9979
GetAccessTokenRequest req = new GetAccessTokenRequest() {
10080
WorkspaceId = "<id>",
@@ -121,7 +101,7 @@ var sdk = new SDK(security: new Security() {
121101
APIKey = "<YOUR_API_KEY_HERE>",
122102
});
123103

124-
GetWorkspaceAccessRequest req = new GetWorkspaceAccessRequest() {};
104+
GetWorkspaceAccessRequest? req = null;
125105

126106
var res = await sdk.Auth.GetAccessAsync(
127107
retryConfig: new RetryConfig(
@@ -162,7 +142,7 @@ var sdk = new SDK(
162142
}
163143
);
164144

165-
GetWorkspaceAccessRequest req = new GetWorkspaceAccessRequest() {};
145+
GetWorkspaceAccessRequest? req = null;
166146

167147
var res = await sdk.Auth.GetAccessAsync(req);
168148

@@ -173,67 +153,85 @@ var res = await sdk.Auth.GetAccessAsync(req);
173153
<!-- Start Error Handling [errors] -->
174154
## Error Handling
175155

176-
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
177-
178-
By default, an API error will raise a `SpeakeasySDK.Models.Errors.SDKException` exception, which has the following properties:
156+
[`SDKBaseException`](./src/SpeakeasySDK/Models/Errors/SDKBaseException.cs) is the base exception class for all HTTP error responses. It has the following properties:
179157

180158
| Property | Type | Description |
181159
|---------------|-----------------------|-----------------------|
182-
| `Message` | *string* | The error message |
183-
| `StatusCode` | *int* | The HTTP status code |
184-
| `RawResponse` | *HttpResponseMessage* | The raw HTTP response |
185-
| `Body` | *string* | The response content |
160+
| `Message` | *string* | Error message |
161+
| `StatusCode` | *int* | HTTP status code |
162+
| `Headers` | *HttpResponseHeaders* | HTTP headers |
163+
| `ContentType` | *string?* | HTTP content type |
164+
| `RawResponse` | *HttpResponseMessage* | HTTP response object |
165+
| `Body` | *string* | HTTP response body |
186166

187-
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:
188-
189-
| Error Type | Status Code | Content Type |
190-
| --------------------------------------- | ----------- | ---------------- |
191-
| SpeakeasySDK.Models.Errors.Error | 4XX | application/json |
192-
| SpeakeasySDK.Models.Errors.SDKException | 5XX | \*/\* |
167+
Some exceptions in this SDK include an additional `Payload` field, which will contain deserialized custom error data when present. Possible exceptions are listed in the [Error Classes](#error-classes) section.
193168

194169
### Example
195170

196171
```csharp
197172
using SpeakeasySDK;
198173
using SpeakeasySDK.Models.Errors;
199174
using SpeakeasySDK.Models.Shared;
200-
using System.Collections.Generic;
201175

202176
var sdk = new SDK(security: new Security() {
203177
APIKey = "<YOUR_API_KEY_HERE>",
204178
});
205179

206180
try
207181
{
208-
RemoteSource req = new RemoteSource() {
209-
Inputs = new List<RemoteDocument>() {
210-
new RemoteDocument() {
211-
RegistryUrl = "https://productive-swine.net",
212-
},
213-
},
214-
Output = new RemoteDocument() {
215-
RegistryUrl = "https://spiteful-apricot.info",
216-
},
217-
};
182+
RemoteSource? req = null;
218183

219184
var res = await sdk.Artifacts.CreateRemoteSourceAsync(req);
220185

221186
// handle response
222187
}
223-
catch (Exception ex)
188+
catch (SDKBaseException ex) // all SDK exceptions inherit from SDKBaseException
224189
{
225-
if (ex is Error)
190+
// ex.ToString() provides a detailed error message
191+
System.Console.WriteLine(ex);
192+
193+
// Base exception fields
194+
HttpResponseMessage rawResponse = ex.RawResponse;
195+
HttpResponseHeaders headers = ex.Headers;
196+
int statusCode = ex.StatusCode;
197+
string? contentType = ex.ContentType;
198+
var responseBody = ex.Body;
199+
200+
if (ex is Error) // different exceptions may be thrown depending on the method
226201
{
227-
// Handle exception data
228-
throw;
202+
// Check error data fields
203+
ErrorPayload payload = ex.Payload;
204+
string Message = payload.Message;
205+
int StatusCode = payload.StatusCode;
229206
}
230-
else if (ex is SpeakeasySDK.Models.Errors.SDKException)
207+
208+
// An underlying cause may be provided
209+
if (ex.InnerException != null)
231210
{
232-
// Handle default exception
233-
throw;
211+
Exception cause = ex.InnerException;
234212
}
235213
}
214+
catch (System.Net.Http.HttpRequestException ex)
215+
{
216+
// Check ex.InnerException for Network connectivity errors
217+
}
236218
```
219+
220+
### Error Classes
221+
222+
**Primary exceptions:**
223+
* [`SDKBaseException`](./src/SpeakeasySDK/Models/Errors/SDKBaseException.cs): The base class for HTTP error responses.
224+
* [`Error`](./src/SpeakeasySDK/Models/Errors/Error.cs): The `Status` type defines a logical error model. *
225+
226+
<details><summary>Less common exceptions (2)</summary>
227+
228+
* [`System.Net.Http.HttpRequestException`](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httprequestexception): Network connectivity error. For more details about the underlying cause, inspect the `ex.InnerException`.
229+
230+
* Inheriting from [`SDKBaseException`](./src/SpeakeasySDK/Models/Errors/SDKBaseException.cs):
231+
* [`ResponseValidationError`](./src/SpeakeasySDK/Models/Errors/ResponseValidationError.cs): Thrown when the response data could not be deserialized into the expected type.
232+
</details>
233+
234+
\* Refer to the [relevant documentation](#available-resources-and-operations) to determine whether an exception applies to a specific operation.
237235
<!-- End Error Handling [errors] -->
238236

239237
<!-- Start Server Selection [server] -->
@@ -243,34 +241,24 @@ catch (Exception ex)
243241

244242
You can override the default server globally by passing a server name to the `server: string` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:
245243

246-
| Name | Server |
247-
| ------ | ----------------------------------- |
248-
| `prod` | `https://api.prod.speakeasyapi.dev` |
244+
| Name | Server | Description |
245+
| ------ | -------------------------------- | ----------- |
246+
| `prod` | `https://api.prod.speakeasy.com` | |
249247

250248
#### Example
251249

252250
```csharp
253251
using SpeakeasySDK;
254252
using SpeakeasySDK.Models.Shared;
255-
using System.Collections.Generic;
256253

257254
var sdk = new SDK(
258-
server: "prod",
255+
server: SDKConfig.Server.Prod,
259256
security: new Security() {
260257
APIKey = "<YOUR_API_KEY_HERE>",
261258
}
262259
);
263260

264-
RemoteSource req = new RemoteSource() {
265-
Inputs = new List<RemoteDocument>() {
266-
new RemoteDocument() {
267-
RegistryUrl = "https://productive-swine.net",
268-
},
269-
},
270-
Output = new RemoteDocument() {
271-
RegistryUrl = "https://spiteful-apricot.info",
272-
},
273-
};
261+
RemoteSource? req = null;
274262

275263
var res = await sdk.Artifacts.CreateRemoteSourceAsync(req);
276264

@@ -283,25 +271,15 @@ The default server can also be overridden globally by passing a URL to the `serv
283271
```csharp
284272
using SpeakeasySDK;
285273
using SpeakeasySDK.Models.Shared;
286-
using System.Collections.Generic;
287274

288275
var sdk = new SDK(
289-
serverUrl: "https://api.prod.speakeasyapi.dev",
276+
serverUrl: "https://api.prod.speakeasy.com",
290277
security: new Security() {
291278
APIKey = "<YOUR_API_KEY_HERE>",
292279
}
293280
);
294281

295-
RemoteSource req = new RemoteSource() {
296-
Inputs = new List<RemoteDocument>() {
297-
new RemoteDocument() {
298-
RegistryUrl = "https://productive-swine.net",
299-
},
300-
},
301-
Output = new RemoteDocument() {
302-
RegistryUrl = "https://spiteful-apricot.info",
303-
},
304-
};
282+
RemoteSource? req = null;
305283

306284
var res = await sdk.Artifacts.CreateRemoteSourceAsync(req);
307285

0 commit comments

Comments
 (0)