{"id":18384212,"url":"https://github.com/speakeasy-sdks/template-sdk","last_synced_at":"2026-04-24T16:02:38.369Z","repository":{"id":71883838,"uuid":"604771680","full_name":"speakeasy-sdks/template-sdk","owner":"speakeasy-sdks","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-10T16:05:11.000Z","size":579,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-10T20:08:45.384Z","etag":null,"topics":["managed-sdk","openapi","openapi3","sdk","speakeasy-api","vendor-extensions"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/speakeasy-sdks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-21T18:56:21.000Z","updated_at":"2025-09-10T16:05:14.000Z","dependencies_parsed_at":"2023-07-22T17:46:24.826Z","dependency_job_id":"5c2b5bb0-04bc-478c-93a7-75c1aa3f61ff","html_url":"https://github.com/speakeasy-sdks/template-sdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/speakeasy-sdks/template-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speakeasy-sdks%2Ftemplate-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speakeasy-sdks%2Ftemplate-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speakeasy-sdks%2Ftemplate-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speakeasy-sdks%2Ftemplate-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/speakeasy-sdks","download_url":"https://codeload.github.com/speakeasy-sdks/template-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speakeasy-sdks%2Ftemplate-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32230421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["managed-sdk","openapi","openapi3","sdk","speakeasy-api","vendor-extensions"],"created_at":"2024-11-06T01:13:56.996Z","updated_at":"2026-04-24T16:02:38.354Z","avatar_url":"https://github.com/speakeasy-sdks.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Template SDK\n\n\u003cdiv align=\"left\"\u003e\n    \u003ca href=\"https://speakeasyapi.dev/\"\u003e\u003cimg src=\"https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge\u0026logoColor=FBE331\u0026logo=speakeasy\u0026labelColor=545454\" /\u003e\u003c/a\u003e   \n\u003c/div\u003e\n\n## How to use this repository\n\n**👀** This template repository is designed to bootstrap a [Speakeasy managed SDK repository](https://speakeasyapi.dev/docs/create-client-sdks/) using Github's repository clone feature. Once this repository is setup it will automatically keep your SDK up to date and published to a package manager. \n\n\n### Creating an SDK\n\n1. To get started, simply clone the repository by clicking on the \"Use template\" button and give it a name.\n   \n![Screenshot 2023-09-06 at 09 20 52](https://github.com/speakeasy-sdks/template-sdk/assets/68016351/b4cf4e43-db4e-455a-9359-0f09f942b997)\n\n2. Configure the Speakeasy workflow to generate the SDK. Go to the [generation workflow file](https://github.com/speakeasy-sdks/template-sdk/blob/main/.github/workflows/speakeasy_sdk_generation.yml) and configure the `language`, `mode` and `location` of your openapi document. For complete documentation on all the available generation configurations, see [here](https://www.speakeasyapi.dev/docs/advanced-setup/sdk-automation). You will also need to add a `SPEAKEASY_API_KEY` as a repository secret. If you don't already have a key you can get one by making a workspace on Speakeasy [here](https://app.speakeasyapi.dev/).\n\n3. Configure the Speakeasy workflow to publish the SDK. Go to the [publishing workflow file](https://github.com/speakeasy-sdks/template-sdk/blob/main/.github/workflows/speakeasy_sdk_publish.yml) and configure any relevant package manager credentials as repository secrets. For complete documentation on all the available publishing configurations, see [here](https://www.speakeasyapi.dev/docs/productionize-sdks/publish-sdks).\n\n4. Configure the generation by editing the `gen.yaml` file in the root of the repo. This file controls the generator and determines various attributes of the SDK like `packageName`, `sdkClassName`, inlining of parameters, and other ergonomics.\n\n5. Finally go to the Actions tab, choose the generation workflow and click \"Force Generate\". This will trigger a new generation of your SDK using the configuration you provided above. Depending on whether you configured `pr` or `direct` mode above your updated SDK will appear in PR or in the main branch.\n\n![Screenshot 2023-09-06 at 10 01 46](https://github.com/speakeasy-sdks/template-sdk/assets/68016351/35828982-c6de-4a5c-84f5-ae2b4224cece)\n\n🚀 You should have a working SDK for your API 🙂 . To check out all the features of the SDK please see our docs [site](https://speakeasyapi.dev/docs/create-client-sdks/).\n\n### Local development\n\nOnce you have the SDK setup you may want to iterate on the SDK. Speakeasy supports OpenAPI vendor extensions that can be added to your spec to customize the SDK ergonomics (method names, namespacing resources etc.) and functionality (adding retries, pagination, multiple server support etc)\n\nTo get started install the Speakeasy CLI.\n\nIn your terminal, run:\n\n```bash\nbrew install speakeasy-api/homebrew-tap/speakeasy\n```\nOnce you annonate your spec with an extension you will want to run `speakeasy validate` to check the spec for correctness and `speakeasy generate` to recreate the SDK locally. More documentation on OpenAPI extensions [here](https://speakeasyapi.dev/docs/customize-sdks/namespaces/). Here's an example of adding a multiple server support to the spec so that your SDK supports production and sandbox versions of your API. \n\n```yaml\ninfo:\n  title: Example\n  version: 0.0.1\nservers:\n  - url: https://prod.example.com # Used as the default URL by the SDK\n    description: Our production environment\n    x-speakeasy-server-id: prod\n  - url: https://sandbox.example.com\n    description: Our sandbox environment\n    x-speakeasy-server-id: sandbox\n```\n\nOnce you're finished iterating and happy with the output push only the latest version of spec into the repo and regenerate the SDK using step 6 above.\n\n\u003c!-- Start SDK Installation [installation] --\u003e\n## SDK Installation\n\n```bash\npip install git+https://github.com/speakeasy-sdks/template-sdk.git\n```\n\u003c!-- End SDK Installation [installation] --\u003e\n\n\u003c!-- Start SDK Example Usage [usage] --\u003e\n## SDK Example Usage\n\n### Sign in\n\nFirst you need to send an authentication request to the API by providing your username and password.\nIn the request body, you should specify the type of token you would like to receive: API key or JSON Web Token.\nIf your credentials are valid, you will receive a token in the response object: `res.object.token: str`.\n\n```python\nimport speakeasybar\nfrom speakeasybar.models import operations\n\ns = speakeasybar.Speakeasybar()\n\nreq = operations.LoginRequestBody(\n    type=operations.Type.API_KEY,\n)\n\nres = s.authentication.login(req, operations.LoginSecurity(\n    password=\"\u003cPASSWORD\u003e\",\n    username=\"\u003cUSERNAME\u003e\",\n))\n\nif res.object is not None:\n    # handle response\n    pass\n\n```\n\n### Browse available drinks\n\nOnce you are authenticated, you can use the token you received for all other authenticated endpoints.\nFor example, you can filter the list of available drinks by type.\n\n```python\nimport speakeasybar\nfrom speakeasybar.models import shared\n\ns = speakeasybar.Speakeasybar(\n    security=shared.Security(\n        api_key=\"\u003cYOUR_API_KEY\u003e\",\n    ),\n)\n\n\nres = s.drinks.list_drinks(drink_type=shared.DrinkType.SPIRIT)\n\nif res.classes is not None:\n    # handle response\n    pass\n\n```\n\n### Create an order\n\nWhen you submit an order, you can include a callback URL along your request.\nThis URL will get called whenever the supplier updates the status of your order.\n\n```python\nimport speakeasybar\nfrom speakeasybar.models import shared\n\ns = speakeasybar.Speakeasybar(\n    security=shared.Security(\n        api_key=\"\u003cYOUR_API_KEY\u003e\",\n    ),\n)\n\n\nres = s.orders.create_order(request_body=[\n    shared.OrderInput(\n        product_code='APM-1F2D3',\n        quantity=26535,\n        type=shared.OrderType.DRINK,\n    ),\n], callback_url='\u003cvalue\u003e')\n\nif res.order is not None:\n    # handle response\n    pass\n\n```\n\n### Subscribe to webhooks to receive stock updates\n\n```python\nimport speakeasybar\nfrom speakeasybar.models import operations, shared\n\ns = speakeasybar.Speakeasybar(\n    security=shared.Security(\n        api_key=\"\u003cYOUR_API_KEY\u003e\",\n    ),\n)\n\nreq = [\n    operations.RequestBody(),\n]\n\nres = s.config.subscribe_to_webhooks(req)\n\nif res is not None:\n    # handle response\n    pass\n\n```\n\u003c!-- End SDK Example Usage [usage] --\u003e\n\n\u003c!-- Start Available Resources and Operations [operations] --\u003e\n## Available Resources and Operations\n\n### [authentication](docs/sdks/authentication/README.md)\n\n* [login](docs/sdks/authentication/README.md#login) - Authenticate with the API by providing a username and password.\n\n### [drinks](docs/sdks/drinks/README.md)\n\n* [get_drink](docs/sdks/drinks/README.md#get_drink) - Get a drink.\n* [list_drinks](docs/sdks/drinks/README.md#list_drinks) - Get a list of drinks.\n\n### [ingredients](docs/sdks/ingredients/README.md)\n\n* [list_ingredients](docs/sdks/ingredients/README.md#list_ingredients) - Get a list of ingredients.\n\n### [orders](docs/sdks/orders/README.md)\n\n* [create_order](docs/sdks/orders/README.md#create_order) - Create an order.\n\n### [config](docs/sdks/config/README.md)\n\n* [subscribe_to_webhooks](docs/sdks/config/README.md#subscribe_to_webhooks) - Subscribe to webhooks.\n\u003c!-- End Available Resources and Operations [operations] --\u003e\n\n\n\n\u003c!-- Start Retries [retries] --\u003e\n## Retries\n\nSome of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.\n\nTo change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:\n```python\nimport speakeasybar\nfrom speakeasybar.models import operations, shared\nfrom speakeasybar.utils import BackoffStrategy, RetryConfig\n\ns = speakeasybar.Speakeasybar(\n    security=shared.Security(\n        api_key=\"\u003cYOUR_API_KEY\u003e\",\n    ),\n)\n\nreq = [\n    operations.RequestBody(),\n]\n\nres = s.config.subscribe_to_webhooks(req,\n    RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False))\n\nif res is not None:\n    # handle response\n    pass\n\n```\n\nIf you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:\n```python\nimport speakeasybar\nfrom speakeasybar.models import operations, shared\nfrom speakeasybar.utils import BackoffStrategy, RetryConfig\n\ns = speakeasybar.Speakeasybar(\n    retry_config=RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False)\n    security=shared.Security(\n        api_key=\"\u003cYOUR_API_KEY\u003e\",\n    ),\n)\n\nreq = [\n    operations.RequestBody(),\n]\n\nres = s.config.subscribe_to_webhooks(req)\n\nif res is not None:\n    # handle response\n    pass\n\n```\n\u003c!-- End Retries [retries] --\u003e\n\n\n\n\u003c!-- Start Error Handling [errors] --\u003e\n## Error Handling\n\nHandling errors in this SDK should largely match your expectations.  All operations return a response object or raise an error.  If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.\n\n| Error Object      | Status Code       | Content Type      |\n| ----------------- | ----------------- | ----------------- |\n| errors.BadRequest | 400               | application/json  |\n| errors.APIError   | 5XX               | application/json  |\n| errors.SDKError   | 4xx-5xx           | */*               |\n\n### Example\n\n```python\nimport speakeasybar\nfrom speakeasybar.models import errors, operations, shared\n\ns = speakeasybar.Speakeasybar(\n    security=shared.Security(\n        api_key=\"\u003cYOUR_API_KEY\u003e\",\n    ),\n)\n\nreq = [\n    operations.RequestBody(),\n]\n\nres = None\ntry:\n    res = s.config.subscribe_to_webhooks(req)\nexcept errors.BadRequest as e:\n    # handle exception\n    raise(e)\nexcept errors.APIError as e:\n    # handle exception\n    raise(e)\nexcept errors.SDKError as e:\n    # handle exception\n    raise(e)\n\nif res is not None:\n    # handle response\n    pass\n\n```\n\u003c!-- End Error Handling [errors] --\u003e\n\n\n\n\u003c!-- Start Server Selection [server] --\u003e\n## Server Selection\n\n### Select Server by Name\n\nYou can override the default server globally by passing a server name to the `server: str` 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:\n\n| Name | Server | Variables |\n| ----- | ------ | --------- |\n| `prod` | `https://speakeasy.bar` | None |\n| `staging` | `https://staging.speakeasy.bar` | None |\n| `customer` | `https://{organization}.{environment}.speakeasy.bar` | `environment` (default is `prod`), `organization` (default is `api`) |\n\n#### Example\n\n```python\nimport speakeasybar\nfrom speakeasybar.models import shared\n\ns = speakeasybar.Speakeasybar(\n    server=\"customer\",\n    security=shared.Security(\n        api_key=\"\u003cYOUR_API_KEY\u003e\",\n    ),\n)\n\n\nres = s.ingredients.list_ingredients(ingredients=[\n    '\u003cvalue\u003e',\n])\n\nif res.classes is not None:\n    # handle response\n    pass\n\n```\n\n#### Variables\n\nSome of the server options above contain variables. If you want to set the values of those variables, the following optional parameters are available when initializing the SDK client instance:\n * `environment: models.ServerEnvironment`\n * `organization: str`\n\n### Override Server URL Per-Client\n\nThe default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:\n```python\nimport speakeasybar\nfrom speakeasybar.models import shared\n\ns = speakeasybar.Speakeasybar(\n    server_url=\"https://speakeasy.bar\",\n    security=shared.Security(\n        api_key=\"\u003cYOUR_API_KEY\u003e\",\n    ),\n)\n\n\nres = s.ingredients.list_ingredients(ingredients=[\n    '\u003cvalue\u003e',\n])\n\nif res.classes is not None:\n    # handle response\n    pass\n\n```\n\n### Override Server URL Per-Operation\n\nThe server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:\n```python\nimport speakeasybar\nfrom speakeasybar.models import shared\n\ns = speakeasybar.Speakeasybar(\n    security=shared.Security(\n        api_key=\"\u003cYOUR_API_KEY\u003e\",\n    ),\n)\n\n\nres = s.drinks.list_drinks(server_url=\"https://speakeasy.bar\", drink_type=shared.DrinkType.SPIRIT)\n\nif res.classes is not None:\n    # handle response\n    pass\n\n```\n\u003c!-- End Server Selection [server] --\u003e\n\n\n\n\u003c!-- Start Custom HTTP Client [http-client] --\u003e\n## Custom HTTP Client\n\nThe Python SDK makes API calls using the [requests](https://pypi.org/project/requests/) HTTP library.  In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `requests.Session` object.\n\nFor example, you could specify a header for every request that this sdk makes as follows:\n```python\nimport speakeasybar\nimport requests\n\nhttp_client = requests.Session()\nhttp_client.headers.update({'x-custom-header': 'someValue'})\ns = speakeasybar.Speakeasybar(client=http_client)\n```\n\u003c!-- End Custom HTTP Client [http-client] --\u003e\n\n\n\n\u003c!-- Start Authentication [security] --\u003e\n## Authentication\n\n### Per-Client Security Schemes\n\nThis SDK supports the following security schemes globally:\n\n| Name          | Type          | Scheme        |\n| ------------- | ------------- | ------------- |\n| `api_key`     | apiKey        | API key       |\n| `bearer_auth` | http          | HTTP Bearer   |\n\nYou can set the security parameters through the `security` optional parameter when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:\n```python\nimport speakeasybar\nfrom speakeasybar.models import shared\n\ns = speakeasybar.Speakeasybar(\n    security=shared.Security(\n        api_key=\"\u003cYOUR_API_KEY\u003e\",\n    ),\n)\n\n\nres = s.ingredients.list_ingredients(ingredients=[\n    '\u003cvalue\u003e',\n])\n\nif res.classes is not None:\n    # handle response\n    pass\n\n```\n\n### Per-Operation Security Schemes\n\nSome operations in this SDK require the security scheme to be specified at the request level. For example:\n```python\nimport speakeasybar\nfrom speakeasybar.models import operations\n\ns = speakeasybar.Speakeasybar()\n\nreq = operations.LoginRequestBody(\n    type=operations.Type.API_KEY,\n)\n\nres = s.authentication.login(req, operations.LoginSecurity(\n    password=\"\u003cPASSWORD\u003e\",\n    username=\"\u003cUSERNAME\u003e\",\n))\n\nif res.object is not None:\n    # handle response\n    pass\n\n```\n\u003c!-- End Authentication [security] --\u003e\n\n\u003c!-- Placeholder for Future Speakeasy SDK Sections --\u003e\n\n\n\n### Maturity\n\nThis SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage\nto a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally\nlooking for the latest version.\n\n### Contributions\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically.\nFeel 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 !\n\n### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspeakeasy-sdks%2Ftemplate-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspeakeasy-sdks%2Ftemplate-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspeakeasy-sdks%2Ftemplate-sdk/lists"}