Skip to content

chore: 🐝 Update SDK - Generate #14

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

Merged
merged 3 commits into from
Nov 27, 2023
Merged
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
Empty file modified .gitattributes
100755 → 100644
Empty file.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,11 @@ s = unstructured_client.UnstructuredClient(
<!-- No Server Selection -->

<!-- Start Custom HTTP Client -->
# Custom HTTP Client
## Custom HTTP Client

The 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.


For example, you could specify a header for every request that this sdk makes as follows:

```python
import unstructured_client
import requests
Expand Down
32 changes: 31 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,34 @@ Based on:
### Generated
- [python v0.14.0] .
### Releases
- [PyPI v0.14.0] https://pypi.org/project/unstructured-client/0.14.0 - .
- [PyPI v0.14.0] https://pypi.org/project/unstructured-client/0.14.0 - .

## 2023-11-16 00:19:06
### Changes
Based on:
- OpenAPI Doc 0.0.1
- Speakeasy CLI 1.120.3 (2.192.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.14.1] .
### Releases
- [PyPI v0.14.1] https://pypi.org/project/unstructured-client/0.14.1 - .

## 2023-11-18 00:18:40
### Changes
Based on:
- OpenAPI Doc 0.0.1
- Speakeasy CLI 1.121.1 (2.194.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.14.2] .
### Releases
- [PyPI v0.14.2] https://pypi.org/project/unstructured-client/0.14.2 - .

## 2023-11-21 00:19:25
### Changes
Based on:
- OpenAPI Doc 0.0.1
- Speakeasy CLI 1.121.3 (2.195.2) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.14.3] .
### Releases
- [PyPI v0.14.3] https://pypi.org/project/unstructured-client/0.14.3 - .
2 changes: 0 additions & 2 deletions USAGE.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<!-- Start SDK Example Usage -->


```python
import unstructured_client
from unstructured_client.models import shared
Expand Down
2 changes: 1 addition & 1 deletion docs/models/errors/httpvalidationerror.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

| Field | Type | Required | Description |
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| `detail` | List[[errors.ValidationError](../../models/errors/validationerror.md)] | :heavy_minus_sign: | N/A |
| `detail` | List[[shared.ValidationError](../../models/shared/validationerror.md)] | :heavy_minus_sign: | N/A |
2 changes: 1 addition & 1 deletion docs/models/operations/partitionresponse.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation |
| `elements` | List[*Any*] | :heavy_minus_sign: | Successful Response |
| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation |
| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |
| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing |
Empty file modified docs/models/shared/files.md
100755 → 100644
Empty file.
File renamed without changes.
Empty file modified docs/models/shared/partitionparameters.md
100755 → 100644
Empty file.
Empty file modified docs/models/shared/security.md
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion docs/models/errors/validationerror.md → docs/models/shared/validationerror.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

| Field | Type | Required | Description |
| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- |
| `loc` | List[[Union[str, int]](../../models/errors/loc.md)] | :heavy_check_mark: | N/A |
| `loc` | List[[Union[str, int]](../../models/shared/loc.md)] | :heavy_check_mark: | N/A |
| `msg` | *str* | :heavy_check_mark: | N/A |
| `type` | *str* | :heavy_check_mark: | N/A |
Empty file modified docs/models/utils/retryconfig.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/general/README.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/unstructuredclient/README.md
100755 → 100644
Empty file.
7 changes: 4 additions & 3 deletions files.gen
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ src/unstructured_client/utils/__init__.py
src/unstructured_client/utils/retries.py
src/unstructured_client/utils/utils.py
src/unstructured_client/models/errors/sdkerror.py
tests/helpers.py
src/unstructured_client/models/operations/partition.py
src/unstructured_client/models/errors/httpvalidationerror.py
src/unstructured_client/models/errors/validationerror.py
src/unstructured_client/models/shared/validationerror.py
src/unstructured_client/models/shared/partition_parameters.py
src/unstructured_client/models/shared/security.py
src/unstructured_client/models/__init__.py
Expand All @@ -20,8 +21,8 @@ src/unstructured_client/models/shared/__init__.py
USAGE.md
docs/models/operations/partitionresponse.md
docs/models/errors/httpvalidationerror.md
docs/models/errors/loc.md
docs/models/errors/validationerror.md
docs/models/shared/loc.md
docs/models/shared/validationerror.md
docs/models/shared/files.md
docs/models/shared/partitionparameters.md
docs/models/shared/security.md
Expand Down
12 changes: 7 additions & 5 deletions gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ configVersion: 1.0.0
management:
docChecksum: bf57420eebd40f2b1d166092f01e3927
docVersion: 0.0.1
speakeasyVersion: 1.116.0
generationVersion: 2.185.0
speakeasyVersion: 1.121.3
generationVersion: 2.195.2
generation:
comments: {}
sdkClassName: unstructured_client
repoURL: https://github.com/Unstructured-IO/unstructured-python-client.git
usageSnippets:
optionalPropertyRendering: withExample
features:
python:
core: 4.1.2
core: 4.1.5
examples: 2.81.3
globalSecurity: 2.83.0
globalServerURLs: 2.82.0
globalServerURLs: 2.82.1
nameOverrides: 2.81.1
retries: 2.82.0
serverIDs: 2.81.1
python:
version: 0.14.0
version: 0.14.3
author: Unstructured
clientServerStatusCodesAsErrors: true
description: Python Client SDK for Unstructured API
Expand Down
Empty file modified pylintrc
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions setup.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setuptools.setup(
name="unstructured-client",
version="0.14.0",
version="0.14.3",
author="Unstructured",
description="Python Client SDK for Unstructured API",
long_description=long_description,
Expand All @@ -30,7 +30,7 @@
"six>=1.16.0",
"typing-inspect>=0.9.0",
"typing_extensions>=4.7.1",
"urllib3>=2.0.4",
"urllib3>=1.26.18",
],
extras_require={
"dev":["pylint==2.16.2"]
Expand Down
Empty file modified src/unstructured_client/__init__.py
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion src/unstructured_client/general.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def do_request():
'5xx'
]))
content_type = http_res.headers.get('Content-Type')

res = operations.PartitionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)

if http_res.status_code == 200:
Expand Down
Empty file modified src/unstructured_client/models/__init__.py
100755 → 100644
Empty file.
3 changes: 1 addition & 2 deletions src/unstructured_client/models/errors/__init__.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

from .httpvalidationerror import *
from .sdkerror import *
from .validationerror import *

__all__ = ["HTTPValidationError","SDKError","ValidationError"]
__all__ = ["HTTPValidationError","SDKError"]
4 changes: 2 additions & 2 deletions src/unstructured_client/models/errors/httpvalidationerror.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations
import dataclasses
from .validationerror import ValidationError
from ...models.shared import validationerror as shared_validationerror
from dataclasses_json import Undefined, dataclass_json
from typing import List, Optional
from unstructured_client import utils
Expand All @@ -12,7 +12,7 @@

@dataclasses.dataclass
class HTTPValidationError(Exception):
detail: Optional[List[ValidationError]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('detail'), 'exclude': lambda f: f is None }})
detail: Optional[List[shared_validationerror.ValidationError]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('detail'), 'exclude': lambda f: f is None }})


def __str__(self) -> str:
Expand Down
Empty file modified src/unstructured_client/models/errors/sdkerror.py
100755 → 100644
Empty file.
Empty file modified src/unstructured_client/models/operations/__init__.py
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions src/unstructured_client/models/operations/partition.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
class PartitionResponse:
content_type: str = dataclasses.field()
r"""HTTP response content type for this operation"""
raw_response: requests_http.Response = dataclasses.field()
r"""Raw HTTP response; suitable for custom response parsing"""
status_code: int = dataclasses.field()
r"""HTTP response status code for this operation"""
elements: Optional[List[Any]] = dataclasses.field(default=None)
r"""Successful Response"""
raw_response: Optional[requests_http.Response] = dataclasses.field(default=None)
r"""Raw HTTP response; suitable for custom response parsing"""


3 changes: 2 additions & 1 deletion src/unstructured_client/models/shared/__init__.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

from .partition_parameters import *
from .security import *
from .validationerror import *

__all__ = ["Files","PartitionParameters","Security"]
__all__ = ["Files","PartitionParameters","Security","ValidationError"]
Empty file modified src/unstructured_client/models/shared/partition_parameters.py
100755 → 100644
Empty file.
Empty file modified src/unstructured_client/models/shared/security.py
100755 → 100644
Empty file.
File renamed without changes.
Empty file modified src/unstructured_client/sdk.py
100755 → 100644
Empty file.
6 changes: 3 additions & 3 deletions src/unstructured_client/sdkconfiguration.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class SDKConfiguration:
server: str = ''
language: str = 'python'
openapi_doc_version: str = '0.0.1'
sdk_version: str = '0.14.0'
gen_version: str = '2.185.0'
user_agent: str = 'speakeasy-sdk/python 0.14.0 2.185.0 0.0.1 unstructured-client'
sdk_version: str = '0.14.3'
gen_version: str = '2.195.2'
user_agent: str = 'speakeasy-sdk/python 0.14.3 2.195.2 0.0.1 unstructured-client'
retry_config: RetryConfig = None

def get_server_details(self) -> Tuple[str, Dict[str, str]]:
Expand Down
Empty file modified src/unstructured_client/utils/__init__.py
100755 → 100644
Empty file.
Empty file modified src/unstructured_client/utils/retries.py
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion src/unstructured_client/utils/utils.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ def marshal_json(val, encoder=None):

val = json_dict["res"] if encoder is None else encoder(json_dict["res"])

return json.dumps(val)
return json.dumps(val, separators=(',', ':'), sort_keys=True)


def match_content_type(content_type: str, pattern: str) -> boolean:
Expand Down
61 changes: 61 additions & 0 deletions tests/helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""

import re


def sort_query_parameters(url):
parts = url.split("?")

if len(parts) == 1:
return url

query = parts[1]
params = query.split("&")

params.sort(key=lambda x: x.split('=')[0])

return parts[0] + "?" + "&".join(params)


def sort_serialized_maps(inp: any, regex: str, delim: str):

def sort_map(m):
entire_match = m.group(0)

groups = m.groups()

for group in groups:
pairs = []
if '=' in group:
pairs = group.split(delim)

pairs.sort(key=lambda x: x.split('=')[0])
else:
values = group.split(delim)

if len(values) == 1:
pairs = values
else:
pairs = [''] * int(len(values)/2)
# loop though every 2nd item
for i in range(0, len(values), 2):
pairs[int(i/2)] = values[i] + delim + values[i+1]

pairs.sort(key=lambda x: x.split(delim)[0])

entire_match = entire_match.replace(group, delim.join(pairs))

return entire_match

if isinstance(inp, str):
return re.sub(regex, sort_map, inp)
elif isinstance(inp, list):
for i, v in enumerate(inp):
inp[i] = sort_serialized_maps(v, regex, delim)
return inp
elif isinstance(inp, dict):
for k, v in inp.items():
inp[k] = sort_serialized_maps(v, regex, delim)
return inp
else:
raise Exception("Unsupported type")