Skip to content

Commit

Permalink
feat(api): adds PrimeRates API (#628)
Browse files Browse the repository at this point in the history
- renames `credit_product_id` to `credit_product_token` for retrieving an ExtendedCredit
  • Loading branch information
stainless-app[bot] committed Nov 14, 2024
1 parent 4c88f37 commit c7aa63d
Show file tree
Hide file tree
Showing 15 changed files with 679 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 148
configured_endpoints: 150
15 changes: 14 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,20 @@ from lithic.types.credit_products import ExtendedCredit

Methods:

- <code title="get /v1/credit_products/{credit_product_id}/extended_credit">client.credit_products.extended_credit.<a href="./src/lithic/resources/credit_products/extended_credit.py">retrieve</a>(credit_product_id) -> <a href="./src/lithic/types/credit_products/extended_credit.py">ExtendedCredit</a></code>
- <code title="get /v1/credit_products/{credit_product_token}/extended_credit">client.credit_products.extended_credit.<a href="./src/lithic/resources/credit_products/extended_credit.py">retrieve</a>(credit_product_token) -> <a href="./src/lithic/types/credit_products/extended_credit.py">ExtendedCredit</a></code>

## PrimeRates

Types:

```python
from lithic.types.credit_products import PrimeRateRetrieveResponse
```

Methods:

- <code title="post /v1/credit_products/{credit_product_token}/prime_rates">client.credit_products.prime_rates.<a href="./src/lithic/resources/credit_products/prime_rates.py">create</a>(credit_product_token, \*\*<a href="src/lithic/types/credit_products/prime_rate_create_params.py">params</a>) -> None</code>
- <code title="get /v1/credit_products/{credit_product_token}/prime_rates">client.credit_products.prime_rates.<a href="./src/lithic/resources/credit_products/prime_rates.py">retrieve</a>(credit_product_token, \*\*<a href="src/lithic/types/credit_products/prime_rate_retrieve_params.py">params</a>) -> <a href="./src/lithic/types/credit_products/prime_rate_retrieve_response.py">PrimeRateRetrieveResponse</a></code>

# ExternalPayments

Expand Down
14 changes: 14 additions & 0 deletions src/lithic/resources/credit_products/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .prime_rates import (
PrimeRates,
AsyncPrimeRates,
PrimeRatesWithRawResponse,
AsyncPrimeRatesWithRawResponse,
PrimeRatesWithStreamingResponse,
AsyncPrimeRatesWithStreamingResponse,
)
from .credit_products import (
CreditProducts,
AsyncCreditProducts,
Expand All @@ -24,6 +32,12 @@
"AsyncExtendedCreditResourceWithRawResponse",
"ExtendedCreditResourceWithStreamingResponse",
"AsyncExtendedCreditResourceWithStreamingResponse",
"PrimeRates",
"AsyncPrimeRates",
"PrimeRatesWithRawResponse",
"AsyncPrimeRatesWithRawResponse",
"PrimeRatesWithStreamingResponse",
"AsyncPrimeRatesWithStreamingResponse",
"CreditProducts",
"AsyncCreditProducts",
"CreditProductsWithRawResponse",
Expand Down
32 changes: 32 additions & 0 deletions src/lithic/resources/credit_products/credit_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from .prime_rates import (
PrimeRates,
AsyncPrimeRates,
PrimeRatesWithRawResponse,
AsyncPrimeRatesWithRawResponse,
PrimeRatesWithStreamingResponse,
AsyncPrimeRatesWithStreamingResponse,
)
from .extended_credit import (
ExtendedCreditResource,
AsyncExtendedCreditResource,
Expand All @@ -21,6 +29,10 @@ class CreditProducts(SyncAPIResource):
def extended_credit(self) -> ExtendedCreditResource:
return ExtendedCreditResource(self._client)

@cached_property
def prime_rates(self) -> PrimeRates:
return PrimeRates(self._client)

@cached_property
def with_raw_response(self) -> CreditProductsWithRawResponse:
"""
Expand All @@ -46,6 +58,10 @@ class AsyncCreditProducts(AsyncAPIResource):
def extended_credit(self) -> AsyncExtendedCreditResource:
return AsyncExtendedCreditResource(self._client)

@cached_property
def prime_rates(self) -> AsyncPrimeRates:
return AsyncPrimeRates(self._client)

@cached_property
def with_raw_response(self) -> AsyncCreditProductsWithRawResponse:
"""
Expand Down Expand Up @@ -74,6 +90,10 @@ def __init__(self, credit_products: CreditProducts) -> None:
def extended_credit(self) -> ExtendedCreditResourceWithRawResponse:
return ExtendedCreditResourceWithRawResponse(self._credit_products.extended_credit)

@cached_property
def prime_rates(self) -> PrimeRatesWithRawResponse:
return PrimeRatesWithRawResponse(self._credit_products.prime_rates)


class AsyncCreditProductsWithRawResponse:
def __init__(self, credit_products: AsyncCreditProducts) -> None:
Expand All @@ -83,6 +103,10 @@ def __init__(self, credit_products: AsyncCreditProducts) -> None:
def extended_credit(self) -> AsyncExtendedCreditResourceWithRawResponse:
return AsyncExtendedCreditResourceWithRawResponse(self._credit_products.extended_credit)

@cached_property
def prime_rates(self) -> AsyncPrimeRatesWithRawResponse:
return AsyncPrimeRatesWithRawResponse(self._credit_products.prime_rates)


class CreditProductsWithStreamingResponse:
def __init__(self, credit_products: CreditProducts) -> None:
Expand All @@ -92,6 +116,10 @@ def __init__(self, credit_products: CreditProducts) -> None:
def extended_credit(self) -> ExtendedCreditResourceWithStreamingResponse:
return ExtendedCreditResourceWithStreamingResponse(self._credit_products.extended_credit)

@cached_property
def prime_rates(self) -> PrimeRatesWithStreamingResponse:
return PrimeRatesWithStreamingResponse(self._credit_products.prime_rates)


class AsyncCreditProductsWithStreamingResponse:
def __init__(self, credit_products: AsyncCreditProducts) -> None:
Expand All @@ -100,3 +128,7 @@ def __init__(self, credit_products: AsyncCreditProducts) -> None:
@cached_property
def extended_credit(self) -> AsyncExtendedCreditResourceWithStreamingResponse:
return AsyncExtendedCreditResourceWithStreamingResponse(self._credit_products.extended_credit)

@cached_property
def prime_rates(self) -> AsyncPrimeRatesWithStreamingResponse:
return AsyncPrimeRatesWithStreamingResponse(self._credit_products.prime_rates)
20 changes: 12 additions & 8 deletions src/lithic/resources/credit_products/extended_credit.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def with_streaming_response(self) -> ExtendedCreditResourceWithStreamingResponse

def retrieve(
self,
credit_product_id: str,
credit_product_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -58,10 +58,12 @@ def retrieve(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not credit_product_id:
raise ValueError(f"Expected a non-empty value for `credit_product_id` but received {credit_product_id!r}")
if not credit_product_token:
raise ValueError(
f"Expected a non-empty value for `credit_product_token` but received {credit_product_token!r}"
)
return self._get(
f"/v1/credit_products/{credit_product_id}/extended_credit",
f"/v1/credit_products/{credit_product_token}/extended_credit",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -91,7 +93,7 @@ def with_streaming_response(self) -> AsyncExtendedCreditResourceWithStreamingRes

async def retrieve(
self,
credit_product_id: str,
credit_product_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -112,10 +114,12 @@ async def retrieve(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not credit_product_id:
raise ValueError(f"Expected a non-empty value for `credit_product_id` but received {credit_product_id!r}")
if not credit_product_token:
raise ValueError(
f"Expected a non-empty value for `credit_product_token` but received {credit_product_token!r}"
)
return await self._get(
f"/v1/credit_products/{credit_product_id}/extended_credit",
f"/v1/credit_products/{credit_product_token}/extended_credit",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down
Loading

0 comments on commit c7aa63d

Please sign in to comment.