Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/speakeasy-sdks/gogogogo

A csharp SDK for accessing the example API.
https://github.com/speakeasy-sdks/gogogogo

Last synced: 2 days ago
JSON representation

A csharp SDK for accessing the example API.

Awesome Lists containing this project

README

        

# example





## 🏗 **Welcome to your new SDK!** 🏗

It has been generated successfully based on your OpenAPI spec. However, it is not yet ready for production use. Here are some next steps:
- [ ] 🛠 Make your SDK feel handcrafted by [customizing it](https://www.speakeasyapi.dev/docs/customize-sdks)
- [ ] ♻️ Refine your SDK quickly by iterating locally with the [Speakeasy CLI](https://github.com/speakeasy-api/speakeasy)
- [ ] 🎁 Publish your SDK to package managers by [configuring automatic publishing](https://www.speakeasyapi.dev/docs/productionize-sdks/publish-sdks)
- [ ] ✨ When ready to productionize, delete this section from the README

## SDK Installation

### Nuget

```bash
dotnet add package example
```

## SDK Example Usage

### Example

```csharp
using Example;
using Example.Models.Shared;

var sdk = new ExampleSDK();

Pet req = new Pet() {
Id = 596804,
Name = "",
};

var res = await sdk.Pets.CreatePetsAsync(req);

// handle response
```

## Available Resources and Operations

### [Pets](docs/sdks/pets/README.md)

* [CreatePets](docs/sdks/pets/README.md#createpets) - Create a pet
* [ListPets](docs/sdks/pets/README.md#listpets) - List all pets
* [ShowPetById](docs/sdks/pets/README.md#showpetbyid) - Info for a specific pet

## Server Selection

### Select Server by Index

You can override the default server globally by passing a server index to the `serverIndex: number` 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 indexes associated with the available servers:

| # | Server | Variables |
| - | ------ | --------- |
| 0 | `http://petstore.swagger.io/v1` | None |

### Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the `serverUrl: str` optional parameter when initializing the SDK client instance. For example:

## Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or thow an exception. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate type.

| Error Object | Status Code | Content Type |
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
| Example.Models.Errors.SDKException | 4xx-5xx | */* |

### Example

```csharp
using Example;
using System;
using Example.Models.Errors;
using Example.Models.Shared;

var sdk = new ExampleSDK();

Pet req = new Pet() {
Id = 596804,
Name = "",
};

try
{
var res = await sdk.Pets.CreatePetsAsync(req);
// handle response
}
catch (Exception ex)
{
}
else if (ex is Example.Models.Errors.SDKException)
{
// handle exception
}
}

```

# Development

## Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
looking for the latest version.

## Contributions

While we value open-source contributions to this SDK, this library is generated programmatically.
Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!

### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)