Skip to content
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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.9.0"
".": "2.10.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 93
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-af2e129bdcee200185e3fb82837268c03686680beafec3e04b3b17ba32782b48.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-7ae6544b3567d683dd64c5caff02b49ffc0dc4897d0a91738b0162f36a7ddee7.yml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 2.10.0 (2024-11-06)

Full Changelog: [v2.9.0...v2.10.0](https://github.com/orbcorp/orb-python/compare/v2.9.0...v2.10.0)

### Features

* **api:** OpenAPI spec update via Stainless API ([#365](https://github.com/orbcorp/orb-python/issues/365)) ([c83347c](https://github.com/orbcorp/orb-python/commit/c83347cf6b6b6301a3b62c2bd53da44788d08cd9))

## 2.9.0 (2024-08-23)

Full Changelog: [v2.8.0...v2.9.0](https://github.com/orbcorp/orb-python/compare/v2.8.0...v2.9.0)
Expand Down
35 changes: 13 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,12 @@ client = AsyncOrb(
api_key=os.environ.get("ORB_API_KEY"),
)


async def main() -> None:
customer = await client.customers.create(
email="[email protected]",
name="My Customer",
)
print(customer.id)

customer = await client.customers.create(
email="[email protected]",
name="My Customer",
)
print(customer.id)

asyncio.run(main())
```
Expand Down Expand Up @@ -106,15 +104,13 @@ from orb import AsyncOrb

client = AsyncOrb()


async def main() -> None:
all_coupons = []
# Iterate through items across all pages, issuing requests as needed.
async for coupon in client.coupons.list():
all_coupons.append(coupon)
print(all_coupons)


asyncio.run(main())
```

Expand All @@ -135,9 +131,7 @@ Or just work directly with the returned data:
```python
first_page = await client.coupons.list()

print(
f"next page cursor: {first_page.pagination_metadata.next_cursor}"
) # => "next page cursor: ..."
print(f"next page cursor: {first_page.pagination_metadata.next_cursor}") # => "next page cursor: ..."
for coupon in first_page.data:
print(coupon.id)

Expand Down Expand Up @@ -210,7 +204,7 @@ try:
)
except orb.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
print(e.__cause__) # an underlying Exception, likely raised within httpx.
except orb.RateLimitError as e:
print("A 429 status code was received; we should back off a bit.")
except orb.APIStatusError as e:
Expand Down Expand Up @@ -250,7 +244,7 @@ client = Orb(
)

# Or, configure per-request:
client.with_options(max_retries=5).customers.create(
client.with_options(max_retries = 5).customers.create(
email="[email protected]",
name="My Customer",
)
Expand All @@ -276,7 +270,7 @@ client = Orb(
)

# Override per-request:
client.with_options(timeout=5.0).customers.create(
client.with_options(timeout = 5.0).customers.create(
email="[email protected]",
name="My Customer",
)
Expand Down Expand Up @@ -349,11 +343,11 @@ As such, `.with_streaming_response` methods return a different [`APIResponse`](h
with client.customers.with_streaming_response.create(
email="[email protected]",
name="My Customer",
) as response:
print(response.headers.get("X-My-Header"))
) as response :
print(response.headers.get('X-My-Header'))

for line in response.iter_lines():
print(line)
print(line)
```

The context manager is required so that the response will reliably be closed.
Expand Down Expand Up @@ -407,10 +401,7 @@ from orb import Orb, DefaultHttpxClient
client = Orb(
# Or use the `ORB_BASE_URL` env var
base_url="http://my.test.server.example.com:8083",
http_client=DefaultHttpxClient(
proxies="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
http_client=DefaultHttpxClient(proxies="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),
)
```

Expand Down
37 changes: 5 additions & 32 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,7 @@ Methods:
Types:

```python
from orb.types.customers.credits import (
LedgerListResponse,
LedgerCreateEntryResponse,
LedgerCreateEntryByExternalIDResponse,
LedgerListByExternalIDResponse,
)
from orb.types.customers.credits import LedgerListResponse, LedgerCreateEntryResponse, LedgerCreateEntryByExternalIDResponse, LedgerListByExternalIDResponse
```

Methods:
Expand All @@ -119,12 +114,7 @@ Methods:
Types:

```python
from orb.types.customers.credits import (
TopUpCreateResponse,
TopUpListResponse,
TopUpCreateByExternalIDResponse,
TopUpListByExternalIDResponse,
)
from orb.types.customers.credits import TopUpCreateResponse, TopUpListResponse, TopUpCreateByExternalIDResponse, TopUpListByExternalIDResponse
```

Methods:
Expand Down Expand Up @@ -154,12 +144,7 @@ Methods:
Types:

```python
from orb.types import (
EventUpdateResponse,
EventDeprecateResponse,
EventIngestResponse,
EventSearchResponse,
)
from orb.types import EventUpdateResponse, EventDeprecateResponse, EventIngestResponse, EventSearchResponse
```

Methods:
Expand All @@ -174,13 +159,7 @@ Methods:
Types:

```python
from orb.types.events import (
BackfillCreateResponse,
BackfillListResponse,
BackfillCloseResponse,
BackfillFetchResponse,
BackfillRevertResponse,
)
from orb.types.events import BackfillCreateResponse, BackfillListResponse, BackfillCloseResponse, BackfillFetchResponse, BackfillRevertResponse
```

Methods:
Expand Down Expand Up @@ -302,13 +281,7 @@ Methods:
Types:

```python
from orb.types import (
Subscription,
SubscriptionUsage,
Subscriptions,
SubscriptionFetchCostsResponse,
SubscriptionFetchScheduleResponse,
)
from orb.types import Subscription, SubscriptionUsage, Subscriptions, SubscriptionFetchCostsResponse, SubscriptionFetchScheduleResponse
```

Methods:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "orb-billing"
version = "2.9.0"
version = "2.10.0"
description = "The official Python library for the orb API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
52 changes: 26 additions & 26 deletions src/orb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from . import types
from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes
from ._utils import file_from_path
from ._client import Orb, Client, Stream, Timeout, AsyncOrb, Transport, AsyncClient, AsyncStream, RequestOptions
from ._models import BaseModel
from ._version import __title__, __version__
from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse
from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS
from ._version import __version__, __title__
from ._client import Timeout, Transport, RequestOptions, Client, AsyncClient, Stream, AsyncStream, Orb, AsyncOrb
from ._exceptions import (
APIError,
OrbError,
URLNotFound,
ConflictError,
NotFoundError,
APIError,
APIStatusError,
RateLimitError,
APITimeoutError,
BadRequestError,
RequestTooLarge,
TooManyRequests,
ResourceConflict,
ResourceNotFound,
ResourceTooLarge,
APIConnectionError,
APIResponseValidationError,
BadRequestError,
AuthenticationError,
ConstraintViolation,
FeatureNotAvailable,
InternalServerError,
PermissionDeniedError,
OrbAuthenticationError,
OrbInternalServerError,
RequestValidationError,
NotFoundError,
ConflictError,
UnprocessableEntityError,
RateLimitError,
InternalServerError,
ConstraintViolation,
DuplicateResourceCreation,
APIResponseValidationError,
RequestValidationError,
OrbAuthenticationError,
FeatureNotAvailable,
ResourceNotFound,
URLNotFound,
ResourceConflict,
RequestTooLarge,
ResourceTooLarge,
TooManyRequests,
OrbInternalServerError,
)
from ._types import NoneType, Transport, ProxiesTypes, NotGiven, NOT_GIVEN
from ._utils import file_from_path
from ._models import BaseModel
from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
from ._utils._logs import setup_logging as _setup_logging
from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse

__all__ = [
"types",
Expand Down Expand Up @@ -101,7 +101,7 @@
for __name in __all__:
if not __name.startswith("__"):
try:
__locals[__name].__module__ = "orb"
setattr(__locals[__name], "__module__", "orb")
except (TypeError, AttributeError):
# Some of our exported symbols are builtins which we can't set attributes for.
pass
57 changes: 44 additions & 13 deletions src/orb/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,67 @@

from __future__ import annotations

import httpx

import os

from ._streaming import AsyncStream as AsyncStream, Stream as Stream

from ._exceptions import OrbError, APIStatusError

from typing_extensions import override, Self

from typing import Any

from ._utils import is_mapping, get_async_library

from . import _exceptions

import os
from typing import Any, Union, Mapping
from typing_extensions import Self, override
import asyncio
import warnings
from typing import Optional, Union, Dict, Any, Mapping, overload, cast
from typing_extensions import Literal

import httpx

from . import resources, _exceptions
from ._version import __version__
from ._qs import Querystring
from ._utils import (
extract_files,
maybe_transform,
required_args,
deepcopy_minimal,
maybe_coerce_integer,
maybe_coerce_float,
maybe_coerce_boolean,
is_given,
)
from ._types import (
NOT_GIVEN,
Omit,
Timeout,
NotGiven,
Timeout,
Transport,
ProxiesTypes,
RequestOptions,
Headers,
NoneType,
Query,
Body,
NOT_GIVEN,
)
from ._utils import (
is_given,
is_mapping,
get_async_library,
)
from ._version import __version__
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import OrbError, APIStatusError
from ._base_client import (
DEFAULT_CONNECTION_LIMITS,
DEFAULT_TIMEOUT,
DEFAULT_MAX_RETRIES,
ResponseT,
SyncHttpxClientWrapper,
AsyncHttpxClientWrapper,
SyncAPIClient,
AsyncAPIClient,
make_request_options,
)
from . import resources

__all__ = [
"Timeout",
Expand Down
Loading
Loading