Skip to content

chore: 🐝 Update SDK - Generate #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,30 @@ id: 463c131b-53b7-4e8c-b4de-cf4f7ff95e4d
management:
docChecksum: f22d50ed7aa4956c14ae35514eb114c1
docVersion: 1.0.0
speakeasyVersion: 1.241.0
generationVersion: 2.300.0
releaseVersion: 4.3.1
configChecksum: 8cc801290c7c0e0dc5bc4c0e07273959
speakeasyVersion: 1.313.1
generationVersion: 2.347.8
releaseVersion: 4.4.0
configChecksum: b52b914035b5c023c16c1f1e5b3c00bd
repoURL: https://github.com/speakeasy-sdks/template-sdk.git
repoSubDirectory: .
installationURL: https://github.com/speakeasy-sdks/template-sdk.git
features:
python:
additionalDependencies: 0.1.0
callbacks: 1.0.0
core: 4.6.3
errors: 2.81.8
core: 4.6.12
errors: 2.81.10
examples: 2.81.3
flattening: 2.81.1
globalSecurity: 2.83.5
globalSecurityCallbacks: 0.1.0
globalServerURLs: 2.82.2
inputOutputModels: 2.83.1
methodSecurity: 2.82.1
methodServerURLs: 2.82.1
responseFormat: 0.1.0
retries: 2.82.1
retries: 2.82.2
sdkHooks: 0.1.0
serverIDs: 2.81.1
webhooks: 1.0.0
generatedFiles:
Expand All @@ -36,13 +39,13 @@ generatedFiles:
- src/speakeasybar/sdk.py
- py.typed
- pylintrc
- scripts/publish.sh
- setup.py
- src/speakeasybar/__init__.py
- src/speakeasybar/utils/__init__.py
- src/speakeasybar/utils/retries.py
- src/speakeasybar/utils/utils.py
- src/speakeasybar/models/errors/sdkerror.py
- tests/helpers.py
- src/speakeasybar/models/operations/login.py
- src/speakeasybar/models/operations/getdrink.py
- src/speakeasybar/models/operations/listdrinks.py
Expand Down
29 changes: 29 additions & 0 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
speakeasyVersion: 1.313.1
sources:
my-source:
sourceNamespace: my-source
sourceRevisionDigest: sha256:b26c23d8cbc993f5ded4f61e07626a7ed8ae3a6ed6b0b1138281306a1ed85a08
sourceBlobDigest: sha256:639db1978db22dbfd275139e5511de46c975b0ddf833ed650d4559b2d1f220a5
tags:
- latest
- main
targets:
python-template:
source: my-source
sourceNamespace: my-source
sourceRevisionDigest: sha256:b26c23d8cbc993f5ded4f61e07626a7ed8ae3a6ed6b0b1138281306a1ed85a08
sourceBlobDigest: sha256:639db1978db22dbfd275139e5511de46c975b0ddf833ed650d4559b2d1f220a5
outLocation: /github/workspace/repo
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
my-source:
inputs:
- location: ./openapi.yaml
registry:
location: registry.speakeasyapi.dev/openapi-example/openapi-example/my-source
targets:
python-template:
target: python
source: my-source
3 changes: 3 additions & 0 deletions .speakeasy/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
my-source:
inputs:
- location: ./openapi.yaml
registry:
location: registry.speakeasyapi.dev/openapi-example/openapi-example/my-source
targets:
python-template:
target: python
Expand Down
48 changes: 21 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ from speakeasybar.models import operations

s = speakeasybar.Speakeasybar()

req = operations.LoginRequestBody(
type=operations.Type.API_KEY,
)

res = s.authentication.login(req, operations.LoginSecurity(
res = s.authentication.login(request=operations.LoginRequestBody(
type=operations.Type.API_KEY,
), security=operations.LoginSecurity(
password="<PASSWORD>",
username="<USERNAME>",
))
Expand Down Expand Up @@ -159,11 +158,10 @@ s = speakeasybar.Speakeasybar(
),
)

req = [
operations.RequestBody(),
]

res = s.config.subscribe_to_webhooks(req)
res = s.config.subscribe_to_webhooks(request=[
operations.RequestBody(),
])

if res is not None:
# handle response
Expand Down Expand Up @@ -216,11 +214,10 @@ s = speakeasybar.Speakeasybar(
),
)

req = [
operations.RequestBody(),
]

res = s.config.subscribe_to_webhooks(req,
res = s.config.subscribe_to_webhooks(request=[
operations.RequestBody(),
],
RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False))

if res is not None:
Expand All @@ -236,17 +233,16 @@ from speakeasybar.models import operations, shared
from speakeasybar.utils import BackoffStrategy, RetryConfig

s = speakeasybar.Speakeasybar(
retry_config=RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False)
retry_config=RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False),
security=shared.Security(
api_key="<YOUR_API_KEY>",
),
)

req = [
operations.RequestBody(),
]

res = s.config.subscribe_to_webhooks(req)
res = s.config.subscribe_to_webhooks(request=[
operations.RequestBody(),
])

if res is not None:
# handle response
Expand Down Expand Up @@ -280,13 +276,12 @@ s = speakeasybar.Speakeasybar(
),
)

req = [
operations.RequestBody(),
]

res = None
try:
res = s.config.subscribe_to_webhooks(req)
res = s.config.subscribe_to_webhooks(request=[
operations.RequestBody(),
])

except errors.BadRequest as e:
# handle exception
raise(e)
Expand Down Expand Up @@ -388,7 +383,7 @@ s = speakeasybar.Speakeasybar(
)


res = s.drinks.list_drinks(server_url="https://speakeasy.bar", drink_type=shared.DrinkType.SPIRIT)
res = s.drinks.list_drinks(drink_type=shared.DrinkType.SPIRIT, server_url="https://speakeasy.bar")

if res.classes is not None:
# handle response
Expand Down Expand Up @@ -460,11 +455,10 @@ from speakeasybar.models import operations

s = speakeasybar.Speakeasybar()

req = operations.LoginRequestBody(
type=operations.Type.API_KEY,
)

res = s.authentication.login(req, operations.LoginSecurity(
res = s.authentication.login(request=operations.LoginRequestBody(
type=operations.Type.API_KEY,
), security=operations.LoginSecurity(
password="<PASSWORD>",
username="<USERNAME>",
))
Expand Down
10 changes: 9 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,12 @@ Based on:
- OpenAPI Doc 1.0.0
- Speakeasy CLI 1.207.1 (2.280.6) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v4.2.1] .
- [python v4.2.1] .

## 2024-06-21 09:36:42
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.313.1 (2.347.8) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v4.4.0] .
14 changes: 6 additions & 8 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ from speakeasybar.models import operations

s = speakeasybar.Speakeasybar()

req = operations.LoginRequestBody(
type=operations.Type.API_KEY,
)

res = s.authentication.login(req, operations.LoginSecurity(
res = s.authentication.login(request=operations.LoginRequestBody(
type=operations.Type.API_KEY,
), security=operations.LoginSecurity(
password="<PASSWORD>",
username="<USERNAME>",
))
Expand Down Expand Up @@ -92,11 +91,10 @@ s = speakeasybar.Speakeasybar(
),
)

req = [
operations.RequestBody(),
]

res = s.config.subscribe_to_webhooks(req)
res = s.config.subscribe_to_webhooks(request=[
operations.RequestBody(),
])

if res is not None:
# handle response
Expand Down
7 changes: 3 additions & 4 deletions docs/sdks/authentication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ from speakeasybar.models import operations

s = speakeasybar.Speakeasybar()

req = operations.LoginRequestBody(
type=operations.Type.API_KEY,
)

res = s.authentication.login(req, operations.LoginSecurity(
res = s.authentication.login(request=operations.LoginRequestBody(
type=operations.Type.API_KEY,
), security=operations.LoginSecurity(
password="<PASSWORD>",
username="<USERNAME>",
))
Expand Down
7 changes: 3 additions & 4 deletions docs/sdks/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ s = speakeasybar.Speakeasybar(
),
)

req = [
operations.RequestBody(),
]

res = s.config.subscribe_to_webhooks(req)
res = s.config.subscribe_to_webhooks(request=[
operations.RequestBody(),
])

if res is not None:
# handle response
Expand Down
4 changes: 3 additions & 1 deletion gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
baseServerURL: ""
telemetryEnabled: false
python:
version: 4.3.1
version: 4.4.0
additionalDependencies:
dependencies: {}
extraDependencies:
Expand All @@ -31,7 +31,9 @@ python:
webhooks: models/webhooks
inputModelSuffix: input
maxMethodParams: 4
methodArguments: require-security-and-request
outputModelSuffix: output
packageName: speakeasybar
projectUrls: {}
responseFormat: envelope
templateVersion: v1
9 changes: 9 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

export TWINE_USERNAME=__token__
export TWINE_PASSWORD=${PYPI_TOKEN}

python -m pip install --upgrade pip
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

setuptools.setup(
name='speakeasybar',
version='4.3.1',
version='4.4.0',
author='Speakeasy',
description='Python Client SDK Generated by Speakeasy',
url='https://github.com/speakeasy-sdks/template-sdk.git',
Expand Down
1 change: 0 additions & 1 deletion src/speakeasybar/_hooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

from .sdkhooks import *
from .types import *
from .registration import *
2 changes: 0 additions & 2 deletions src/speakeasybar/_hooks/sdkhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import requests
from .types import SDKInitHook, BeforeRequestContext, BeforeRequestHook, AfterSuccessContext, AfterSuccessHook, AfterErrorContext, AfterErrorHook, Hooks
from .registration import init_hooks
from typing import List, Optional, Tuple


Expand All @@ -12,7 +11,6 @@ def __init__(self):
self.before_request_hooks: List[BeforeRequestHook] = []
self.after_success_hooks: List[AfterSuccessHook] = []
self.after_error_hooks: List[AfterErrorHook] = []
init_hooks(self)

def register_sdk_init_hook(self, hook: SDKInitHook) -> None:
self.sdk_init_hooks.append(hook)
Expand Down
3 changes: 3 additions & 0 deletions src/speakeasybar/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def login(self, request: operations.LoginRequestBody, security: operations.Login
res = operations.LoginResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)

if http_res.status_code == 200:
# pylint: disable=no-else-return
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.LoginResponseBody])
res.object = out
Expand All @@ -66,13 +67,15 @@ def login(self, request: operations.LoginRequestBody, security: operations.Login
elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 500 and http_res.status_code < 600:
# pylint: disable=no-else-return
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.APIError)
raise out
else:
content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
else:
# pylint: disable=no-else-return
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Error])
res.error = out
Expand Down
Loading