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
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@ jobs:
- name: Run lints
run: ./scripts/lint

upload:
if: github.repository == 'stainless-sdks/knock-python'
timeout-minutes: 10
name: upload
permissions:
contents: read
id-token: write
runs-on: depot-ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Get GitHub OIDC Token
id: github-oidc
uses: actions/github-script@v6
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
run: ./scripts/utils/upload-artifact.sh

test:
timeout-minutes: 10
name: test
Expand Down
4 changes: 2 additions & 2 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.0.0"
}
".": "1.1.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 89
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-641970ffdc1043cad290c3384d3d9c55b50cb709016a7513c03b2b84cf24fb31.yml
openapi_spec_hash: e10e8093bf0dbde38523b98bec436123
config_hash: 7460c5bd6d1a7041faa274f677789407
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-923618cb1489556307ce0be07853170d15516da8fe450578fed856e560ec361c.yml
openapi_spec_hash: 1406cf9ab287412197a1907f5d66d541
config_hash: 2ae8965d371a03bd30c6a56819c04cf2
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## 1.1.0 (2025-05-16)

Full Changelog: [v1.0.0...v1.1.0](https://github.com/knocklabs/knock-python/compare/v1.0.0...v1.1.0)

### Features

* **api:** api update ([e88471a](https://github.com/knocklabs/knock-python/commit/e88471a8b9c90f68d9ff6438298754f8b63148cc))
* **api:** api update ([07aa7ef](https://github.com/knocklabs/knock-python/commit/07aa7ef945058ad65a8b7586c74dabf156c69cfb))
* **api:** removes duplicate activities section ([5e79f8b](https://github.com/knocklabs/knock-python/commit/5e79f8b6dc84a299099052a204f50c8522671d51))


### Bug Fixes

* **package:** support direct resource imports ([03d835a](https://github.com/knocklabs/knock-python/commit/03d835a305fe7024814c863ed902481ec509b439))


### Chores

* **ci:** fix installation instructions ([aad60e0](https://github.com/knocklabs/knock-python/commit/aad60e07fd672462e4689125a20f4f62a99d18de))
* **ci:** upload sdks to package manager ([6793aeb](https://github.com/knocklabs/knock-python/commit/6793aeb32db67c2f41dc3c721c64b25471031c13))
* **internal:** avoid errors for isinstance checks on proxies ([49ba469](https://github.com/knocklabs/knock-python/commit/49ba46929f05e16a4d134ce201d7a10bbfd09b4b))
* **internal:** version bump ([797719a](https://github.com/knocklabs/knock-python/commit/797719ac713c52ac1abae12df3b3667ee3d536aa))

## 1.0.0 (2025-05-01)

Full Changelog: [v0.5.14...v1.0.0](https://github.com/knocklabs/knock-python/compare/v0.5.14...v1.0.0)
Expand Down
6 changes: 0 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,6 @@ Methods:
- <code title="post /v1/messages/batch/unseen">client.messages.batch.<a href="./src/knockapi/resources/messages/batch.py">mark_as_unseen</a>(\*\*<a href="src/knockapi/types/messages/batch_mark_as_unseen_params.py">params</a>) -> <a href="./src/knockapi/types/messages/batch_mark_as_unseen_response.py">BatchMarkAsUnseenResponse</a></code>
- <code title="post /v1/messages/batch/unarchived">client.messages.batch.<a href="./src/knockapi/resources/messages/batch.py">unarchive</a>(\*\*<a href="src/knockapi/types/messages/batch_unarchive_params.py">params</a>) -> <a href="./src/knockapi/types/messages/batch_unarchive_response.py">BatchUnarchiveResponse</a></code>

## Activities

Methods:

- <code title="get /v1/messages/{message_id}/activities">client.messages.activities.<a href="./src/knockapi/resources/messages/activities.py">list</a>(message_id, \*\*<a href="src/knockapi/types/messages/activity_list_params.py">params</a>) -> <a href="./src/knockapi/types/activity.py">SyncItemsCursor[Activity]</a></code>

# Providers

## Slack
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 = "knockapi"
version = "1.0.0"
version = "1.1.0"
description = "The official Python library for the knock API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
25 changes: 25 additions & 0 deletions scripts/utils/upload-artifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -exuo pipefail

RESPONSE=$(curl -X POST "$URL" \
-H "Authorization: Bearer $AUTH" \
-H "Content-Type: application/json")

SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url')

if [[ "$SIGNED_URL" == "null" ]]; then
echo -e "\033[31mFailed to get signed URL.\033[0m"
exit 1
fi

UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \
-H "Content-Type: application/gzip" \
--data-binary @- "$SIGNED_URL" 2>&1)

if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/knock-python/$SHA'\033[0m"
else
echo -e "\033[31mFailed to upload artifact.\033[0m"
exit 1
fi
5 changes: 5 additions & 0 deletions src/knockapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import typing as _t

from . import types
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
from ._utils import file_from_path
Expand Down Expand Up @@ -68,6 +70,9 @@
"DefaultAsyncHttpxClient",
]

if not _t.TYPE_CHECKING:
from ._utils._resources_proxy import resources as resources

_setup_logging()

# Update the __module__ attribute for exported symbols so that
Expand Down
5 changes: 4 additions & 1 deletion src/knockapi/_utils/_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def __dir__(self) -> Iterable[str]:
@property # type: ignore
@override
def __class__(self) -> type: # pyright: ignore
proxied = self.__get_proxied__()
try:
proxied = self.__get_proxied__()
except Exception:
return type(self)
if issubclass(type(proxied), LazyProxy):
return type(proxied)
return proxied.__class__
Expand Down
24 changes: 24 additions & 0 deletions src/knockapi/_utils/_resources_proxy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from __future__ import annotations

from typing import Any
from typing_extensions import override

from ._proxy import LazyProxy


class ResourcesProxy(LazyProxy[Any]):
"""A proxy for the `knockapi.resources` module.

This is used so that we can lazily import `knockapi.resources` only when
needed *and* so that users can just import `knockapi` and reference `knockapi.resources`
"""

@override
def __load__(self) -> Any:
import importlib

mod = importlib.import_module("knockapi.resources")
return mod


resources = ResourcesProxy().__as_proxied__()
2 changes: 1 addition & 1 deletion src/knockapi/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "knockapi"
__version__ = "1.0.0" # x-release-please-version
__version__ = "1.1.0" # x-release-please-version
14 changes: 0 additions & 14 deletions src/knockapi/resources/messages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
MessagesResourceWithStreamingResponse,
AsyncMessagesResourceWithStreamingResponse,
)
from .activities import (
ActivitiesResource,
AsyncActivitiesResource,
ActivitiesResourceWithRawResponse,
AsyncActivitiesResourceWithRawResponse,
ActivitiesResourceWithStreamingResponse,
AsyncActivitiesResourceWithStreamingResponse,
)

__all__ = [
"BatchResource",
Expand All @@ -32,12 +24,6 @@
"AsyncBatchResourceWithRawResponse",
"BatchResourceWithStreamingResponse",
"AsyncBatchResourceWithStreamingResponse",
"ActivitiesResource",
"AsyncActivitiesResource",
"ActivitiesResourceWithRawResponse",
"AsyncActivitiesResourceWithRawResponse",
"ActivitiesResourceWithStreamingResponse",
"AsyncActivitiesResourceWithStreamingResponse",
"MessagesResource",
"AsyncMessagesResource",
"MessagesResourceWithRawResponse",
Expand Down
Loading