Skip to content

release: 0.12.0 #259

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
Jan 12, 2024
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 @@
{
".": "0.11.0"
".": "0.12.0"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.12.0 (2024-01-12)

Full Changelog: [v0.11.0...v0.12.0](https://github.com/Finch-API/finch-api-python/compare/v0.11.0...v0.12.0)

### Features

* **webhooks:** add types to the `unwrap` method ([#258](https://github.com/Finch-API/finch-api-python/issues/258)) ([9687a1e](https://github.com/Finch-API/finch-api-python/commit/9687a1e19097f89f1d671bac0d8c29496ab9c9f5))


### Documentation

* **readme:** improve api reference ([#260](https://github.com/Finch-API/finch-api-python/issues/260)) ([09ddece](https://github.com/Finch-API/finch-api-python/commit/09ddeceee4622e4f9ac9ac6f8eaa3ac3eb23a9e4))

## 0.11.0 (2024-01-11)

Full Changelog: [v0.10.0...v0.11.0](https://github.com/Finch-API/finch-api-python/compare/v0.10.0...v0.11.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and offers both synchronous and asynchronous clients powered by [httpx](https://

## Documentation

The API documentation can be found [in the Finch Documentation Center](https://developer.tryfinch.com/).
The REST API documentation can be found [in the Finch Documentation Center](https://developer.tryfinch.com/). The full API of this library can be found in [api.md](https://www.github.com/Finch-API/finch-api-python/blob/main/api.md).

## Installation

Expand Down
19 changes: 18 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,26 @@ Methods:

# Webhooks

Types:

```python
from finch.types import (
AccountUpdateEvent,
BaseWebhookEvent,
CompanyEvent,
DirectoryEvent,
EmploymentEvent,
IndividualEvent,
JobCompletionEvent,
PayStatementEvent,
PaymentEvent,
WebhookEvent,
)
```

Methods:

- <code>client.webhooks.<a href="./src/finch/resources/webhooks.py">unwrap</a>(\*args) -> object</code>
- <code>client.webhooks.<a href="./src/finch/resources/webhooks.py">unwrap</a>(\*args) -> WebhookEvent</code>
- <code>client.webhooks.<a href="./src/finch/resources/webhooks.py">verify_signature</a>(\*args) -> None</code>

# RequestForwarding
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 = "finch-api"
version = "0.11.0"
version = "0.12.0"
description = "The official Python library for the Finch API"
readme = "README.md"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/finch/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless.

__title__ = "finch"
__version__ = "0.11.0" # x-release-please-version
__version__ = "0.12.0" # x-release-please-version
23 changes: 19 additions & 4 deletions src/finch/resources/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
import math
import base64
import hashlib
from typing import cast
from datetime import datetime, timezone, timedelta

from ..types import WebhookEvent
from .._types import (
HeadersLike,
)
from .._utils import (
get_required_header,
)
from .._models import construct_type
from .._resource import SyncAPIResource, AsyncAPIResource

__all__ = ["Webhooks", "AsyncWebhooks"]
Expand All @@ -27,10 +30,16 @@ def unwrap(
headers: HeadersLike,
*,
secret: str | None = None,
) -> object:
) -> WebhookEvent:
"""Validates that the given payload was sent by Finch and parses the payload."""
self.verify_signature(payload=payload, headers=headers, secret=secret)
return json.loads(payload)
return cast(
WebhookEvent,
construct_type(
value=json.loads(payload),
type_=WebhookEvent, # type: ignore[arg-type]
),
)

def verify_signature(
self,
Expand Down Expand Up @@ -120,10 +129,16 @@ def unwrap(
headers: HeadersLike,
*,
secret: str | None = None,
) -> object:
) -> WebhookEvent:
"""Validates that the given payload was sent by Finch and parses the payload."""
self.verify_signature(payload=payload, headers=headers, secret=secret)
return json.loads(payload)
return cast(
WebhookEvent,
construct_type(
value=json.loads(payload),
type_=WebhookEvent, # type: ignore[arg-type]
),
)

def verify_signature(
self,
Expand Down
10 changes: 10 additions & 0 deletions src/finch/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,19 @@
from .provider import Provider as Provider
from .money_param import MoneyParam as MoneyParam
from .income_param import IncomeParam as IncomeParam
from .company_event import CompanyEvent as CompanyEvent
from .introspection import Introspection as Introspection
from .payment_event import PaymentEvent as PaymentEvent
from .webhook_event import WebhookEvent as WebhookEvent
from .location_param import LocationParam as LocationParam
from .directory_event import DirectoryEvent as DirectoryEvent
from .employment_event import EmploymentEvent as EmploymentEvent
from .individual_event import IndividualEvent as IndividualEvent
from .base_webhook_event import BaseWebhookEvent as BaseWebhookEvent
from .disconnect_response import DisconnectResponse as DisconnectResponse
from .pay_statement_event import PayStatementEvent as PayStatementEvent
from .account_update_event import AccountUpdateEvent as AccountUpdateEvent
from .job_completion_event import JobCompletionEvent as JobCompletionEvent
from .access_token_create_params import AccessTokenCreateParams as AccessTokenCreateParams
from .create_access_token_response import CreateAccessTokenResponse as CreateAccessTokenResponse
from .request_forwarding_forward_params import RequestForwardingForwardParams as RequestForwardingForwardParams
Expand Down
Loading