Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3faab94
fix(deps): bump minimum typing-extensions version
stainless-app[bot] Mar 16, 2026
4c01647
chore(internal): tweak CI branches
stainless-app[bot] Mar 16, 2026
5615d9e
fix: sanitize endpoint path params
stainless-app[bot] Mar 19, 2026
29d5c77
refactor(tests): switch from prism to steady
stainless-app[bot] Mar 19, 2026
1b211c0
chore(tests): bump steady to v0.19.4
stainless-app[bot] Mar 20, 2026
a0638b5
chore(tests): bump steady to v0.19.5
stainless-app[bot] Mar 20, 2026
e5e89f5
chore(internal): update gitignore
stainless-app[bot] Mar 23, 2026
f09d000
chore(tests): bump steady to v0.19.6
stainless-app[bot] Mar 23, 2026
64c3c93
chore(ci): skip lint on metadata-only changes
stainless-app[bot] Mar 24, 2026
973f8be
chore(tests): bump steady to v0.19.7
stainless-app[bot] Mar 24, 2026
5d9ba46
feat(api): api update
stainless-app[bot] Mar 26, 2026
e7db532
feat(internal): implement indices array format for query and form ser…
stainless-app[bot] Mar 26, 2026
ddb0590
chore(tests): bump steady to v0.20.1
stainless-app[bot] Mar 31, 2026
17eac93
chore(tests): bump steady to v0.20.2
stainless-app[bot] Mar 31, 2026
6cd8630
codegen metadata
stainless-app[bot] Apr 1, 2026
519404b
feat(api): added new unset preferences methods
stainless-app[bot] Apr 2, 2026
f0c9120
feat(api): api update
stainless-app[bot] Apr 6, 2026
b94df51
fix(client): preserve hardcoded query params when merging with user p…
stainless-app[bot] Apr 7, 2026
2437d41
codegen metadata
stainless-app[bot] Apr 9, 2026
fd255f8
codegen metadata
stainless-app[bot] Apr 9, 2026
05206e0
fix: ensure file data are only sent as 1 parameter
stainless-app[bot] Apr 10, 2026
b76a899
codegen metadata
stainless-app[bot] Apr 10, 2026
c47c485
docs: improve examples
stainless-app[bot] Apr 10, 2026
b58482f
codegen metadata
stainless-app[bot] Apr 10, 2026
b742a9f
perf(client): optimize file structure copying in multipart requests
stainless-app[bot] Apr 17, 2026
726ca11
chore(tests): bump steady to v0.22.1
stainless-app[bot] Apr 17, 2026
10be0e6
feat(KNO-12791): Add workflow recipient run APIs
stainless-app[bot] Apr 21, 2026
6f7de4e
chore(internal): more robust bootstrap script
stainless-app[bot] Apr 22, 2026
8d2a780
feat(api): api update
stainless-app[bot] Apr 22, 2026
69bb5b7
feat(api): api update
stainless-app[bot] Apr 23, 2026
a36266c
feat(api): skip tests for 2 endpoints in 2 languages
stainless-app[bot] Apr 23, 2026
be4d254
release: 1.25.0
stainless-app[bot] Apr 23, 2026
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
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
Expand All @@ -17,7 +19,7 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/knock-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6

Expand All @@ -36,7 +38,7 @@ jobs:
run: ./scripts/lint

build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
timeout-minutes: 10
name: build
permissions:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.prism.log
.stdy.log
_dev

__pycache__
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.24.1"
".": "1.25.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 90
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-8453f7087b0207e02d485220151fc4eb2348689b4c281de0184cdc80f9a15c01.yml
openapi_spec_hash: deda6ffd2fc6c4d79a556cb216811cc8
config_hash: 32503026a45db991d0d102f25af40a77
configured_endpoints: 94
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-3e8f3a4664d48b3d546339018b451a356f8e20c223a2d21e7c3824fad4cddc7b.yml
openapi_spec_hash: c2b6637451a63e39c1f1042c6a7cc7f7
config_hash: 625db64572b7ee0ee1dd00546e53fc5f
53 changes: 53 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,58 @@
# Changelog

## 1.25.0 (2026-04-23)

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

### Features

* **api:** added new unset preferences methods ([519404b](https://github.com/knocklabs/knock-python/commit/519404bee37ce267e3e43ef65067c8172f95219f))
* **api:** api update ([69bb5b7](https://github.com/knocklabs/knock-python/commit/69bb5b7b9aba93811ba0faee5b6a068332faf86e))
* **api:** api update ([8d2a780](https://github.com/knocklabs/knock-python/commit/8d2a780c8ddbd78858570bb97a5907f34329d5fd))
* **api:** api update ([f0c9120](https://github.com/knocklabs/knock-python/commit/f0c9120cefcd5905de5b0a208ae1bc5b35452acd))
* **api:** api update ([5d9ba46](https://github.com/knocklabs/knock-python/commit/5d9ba46e6ab6200bba7d6a7fed0f87582b2ad34e))
* **api:** skip tests for 2 endpoints in 2 languages ([a36266c](https://github.com/knocklabs/knock-python/commit/a36266c02d2574422a9f2f0d8b3de5b9a2ce8b17))
* **internal:** implement indices array format for query and form serialization ([e7db532](https://github.com/knocklabs/knock-python/commit/e7db532103b42156c58ea021d78ae97f71b8c0bd))
* **KNO-12791:** Add workflow recipient run APIs ([10be0e6](https://github.com/knocklabs/knock-python/commit/10be0e64f3623ac7e17c0db4fd1c6b45eb505ed5))


### Bug Fixes

* **client:** preserve hardcoded query params when merging with user params ([b94df51](https://github.com/knocklabs/knock-python/commit/b94df5190b4c56bc70d87a8d5c10817a5c6e4ba8))
* **deps:** bump minimum typing-extensions version ([3faab94](https://github.com/knocklabs/knock-python/commit/3faab948d5ae4297d7c35150545d843e0c34f427))
* ensure file data are only sent as 1 parameter ([05206e0](https://github.com/knocklabs/knock-python/commit/05206e0e5f9c871bd9dac1b14f457df734da26ed))
* sanitize endpoint path params ([5615d9e](https://github.com/knocklabs/knock-python/commit/5615d9e295147ff3a2321ca06222d2f04c875e30))


### Performance Improvements

* **client:** optimize file structure copying in multipart requests ([b742a9f](https://github.com/knocklabs/knock-python/commit/b742a9fab9d76f56b6081fb6bc5a2b356676a67b))


### Chores

* **ci:** skip lint on metadata-only changes ([64c3c93](https://github.com/knocklabs/knock-python/commit/64c3c93d337ee63ea4b81c23bbefd9d7c12a7e7b))
* **internal:** more robust bootstrap script ([6f7de4e](https://github.com/knocklabs/knock-python/commit/6f7de4e88c3f990e94753a8c347cc72a509acca0))
* **internal:** tweak CI branches ([4c01647](https://github.com/knocklabs/knock-python/commit/4c016474b315185a18ec577ea79e0b3115607dd3))
* **internal:** update gitignore ([e5e89f5](https://github.com/knocklabs/knock-python/commit/e5e89f5f97e9170e602a836907a68987756b82f8))
* **tests:** bump steady to v0.19.4 ([1b211c0](https://github.com/knocklabs/knock-python/commit/1b211c0a547eff991969ddfb57418b9797cb5f10))
* **tests:** bump steady to v0.19.5 ([a0638b5](https://github.com/knocklabs/knock-python/commit/a0638b570e32ab0db5028d1e5ab4f24da80bee7b))
* **tests:** bump steady to v0.19.6 ([f09d000](https://github.com/knocklabs/knock-python/commit/f09d000d0185189f1134f655cf96f522c59dfd24))
* **tests:** bump steady to v0.19.7 ([973f8be](https://github.com/knocklabs/knock-python/commit/973f8bec907c1b613f410dd36711d171d43e97ef))
* **tests:** bump steady to v0.20.1 ([ddb0590](https://github.com/knocklabs/knock-python/commit/ddb05902d4de62871a6574566fcc263d97b5057c))
* **tests:** bump steady to v0.20.2 ([17eac93](https://github.com/knocklabs/knock-python/commit/17eac9319d41e7978dc3b2e201bb843ad3eb7f23))
* **tests:** bump steady to v0.22.1 ([726ca11](https://github.com/knocklabs/knock-python/commit/726ca11ad213e6b2c947ebf5931491dfdf440d01))


### Documentation

* improve examples ([c47c485](https://github.com/knocklabs/knock-python/commit/c47c4853030bb13ffc641094d76ef223507a884a))


### Refactors

* **tests:** switch from prism to steady ([29d5c77](https://github.com/knocklabs/knock-python/commit/29d5c776dae1ed8712a0d5514f48ee0fe6afda14))

## 1.24.1 (2026-03-16)

Full Changelog: [v1.24.0...v1.24.1](https://github.com/knocklabs/knock-python/compare/v1.24.0...v1.24.1)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $ pip install ./path-to-wheel-file.whl

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
Most tests require you to [set up a mock server](https://github.com/dgellow/steady) against the OpenAPI spec to run the tests.

```sh
$ ./scripts/mock
Expand Down
19 changes: 19 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Methods:
- <code title="put /v1/users/{user_id}/channel_data/{channel_id}">client.users.<a href="./src/knockapi/resources/users/users.py">set_channel_data</a>(user_id, channel_id, \*\*<a href="src/knockapi/types/user_set_channel_data_params.py">params</a>) -> <a href="./src/knockapi/types/recipients/channel_data.py">ChannelData</a></code>
- <code title="put /v1/users/{user_id}/preferences/{id}">client.users.<a href="./src/knockapi/resources/users/users.py">set_preferences</a>(user_id, id, \*\*<a href="src/knockapi/types/user_set_preferences_params.py">params</a>) -> <a href="./src/knockapi/types/recipients/preference_set.py">PreferenceSet</a></code>
- <code title="delete /v1/users/{user_id}/channel_data/{channel_id}">client.users.<a href="./src/knockapi/resources/users/users.py">unset_channel_data</a>(user_id, channel_id) -> None</code>
- <code title="delete /v1/users/{user_id}/preferences/{id}">client.users.<a href="./src/knockapi/resources/users/users.py">unset_preferences</a>(user_id, id) -> None</code>

## Feeds

Expand Down Expand Up @@ -157,6 +158,7 @@ Methods:
- <code title="put /v1/objects/{collection}/{object_id}/channel_data/{channel_id}">client.objects.<a href="./src/knockapi/resources/objects/objects.py">set_channel_data</a>(collection, object_id, channel_id, \*\*<a href="src/knockapi/types/object_set_channel_data_params.py">params</a>) -> <a href="./src/knockapi/types/recipients/channel_data.py">ChannelData</a></code>
- <code title="put /v1/objects/{collection}/{object_id}/preferences/{id}">client.objects.<a href="./src/knockapi/resources/objects/objects.py">set_preferences</a>(collection, object_id, id, \*\*<a href="src/knockapi/types/object_set_preferences_params.py">params</a>) -> <a href="./src/knockapi/types/recipients/preference_set.py">PreferenceSet</a></code>
- <code title="delete /v1/objects/{collection}/{object_id}/channel_data/{channel_id}">client.objects.<a href="./src/knockapi/resources/objects/objects.py">unset_channel_data</a>(collection, object_id, channel_id) -> None</code>
- <code title="delete /v1/objects/{collection}/{object_id}/preferences/{id}">client.objects.<a href="./src/knockapi/resources/objects/objects.py">unset_preferences</a>(collection, object_id, id) -> None</code>

## Bulk

Expand Down Expand Up @@ -338,6 +340,23 @@ Methods:
- <code title="post /v1/workflows/{key}/cancel">client.workflows.<a href="./src/knockapi/resources/workflows.py">cancel</a>(key, \*\*<a href="src/knockapi/types/workflow_cancel_params.py">params</a>) -> None</code>
- <code title="post /v1/workflows/{key}/trigger">client.workflows.<a href="./src/knockapi/resources/workflows.py">trigger</a>(key, \*\*<a href="src/knockapi/types/workflow_trigger_params.py">params</a>) -> <a href="./src/knockapi/types/workflow_trigger_response.py">WorkflowTriggerResponse</a></code>

# WorkflowRecipientRuns

Types:

```python
from knockapi.types import (
WorkflowRecipientRun,
WorkflowRecipientRunDetail,
WorkflowRecipientRunEvent,
)
```

Methods:

- <code title="get /v1/workflow_recipient_runs">client.workflow_recipient_runs.<a href="./src/knockapi/resources/workflow_recipient_runs.py">list</a>(\*\*<a href="src/knockapi/types/workflow_recipient_run_list_params.py">params</a>) -> <a href="./src/knockapi/types/workflow_recipient_run.py">SyncItemsCursor[WorkflowRecipientRun]</a></code>
- <code title="get /v1/workflow_recipient_runs/{id}">client.workflow_recipient_runs.<a href="./src/knockapi/resources/workflow_recipient_runs.py">get</a>(id) -> <a href="./src/knockapi/types/workflow_recipient_run_detail.py">WorkflowRecipientRunDetail</a></code>

# Schedules

Types:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "knockapi"
version = "1.24.1"
version = "1.25.0"
description = "The official Python library for the knock API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -11,7 +11,7 @@ authors = [
dependencies = [
"httpx>=0.23.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.10, <5",
"typing-extensions>=4.14, <5",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
Expand Down
2 changes: 1 addition & 1 deletion scripts/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

cd "$(dirname "$0")/.."

if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then
if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "${SKIP_BREW:-}" != "1" ] && [ -t 0 ]; then
brew bundle check >/dev/null 2>&1 || {
echo -n "==> Install Homebrew dependencies? (y/N): "
read -r response
Expand Down
26 changes: 13 additions & 13 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,34 @@ fi

echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
# Run steady mock on the given spec
if [ "$1" == "--daemon" ]; then
# Pre-install the package so the download doesn't eat into the startup timeout
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version
npm exec --package=@stdy/cli@0.22.1 -- steady --version

npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=brackets --validator-form-array-format=brackets --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log &

# Wait for server to come online (max 30s)
# Wait for server to come online via health endpoint (max 30s)
echo -n "Waiting for server"
attempts=0
while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do
if ! kill -0 $! 2>/dev/null; then
echo
cat .stdy.log
exit 1
fi
attempts=$((attempts + 1))
if [ "$attempts" -ge 300 ]; then
echo
echo "Timed out waiting for Prism server to start"
cat .prism.log
echo "Timed out waiting for Steady server to start"
cat .stdy.log
exit 1
fi
echo -n "."
sleep 0.1
done

if grep -q "✖ fatal" ".prism.log"; then
cat .prism.log
exit 1
fi

echo
else
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=brackets --validator-form-array-format=brackets --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL"
fi
16 changes: 8 additions & 8 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

function prism_is_running() {
curl --silent "http://localhost:4010" >/dev/null 2>&1
function steady_is_running() {
curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1
}

kill_server_on_port() {
Expand All @@ -25,7 +25,7 @@ function is_overriding_api_base_url() {
[ -n "$TEST_API_BASE_URL" ]
}

if ! is_overriding_api_base_url && ! prism_is_running ; then
if ! is_overriding_api_base_url && ! steady_is_running ; then
# When we exit this script, make sure to kill the background mock server process
trap 'kill_server_on_port 4010' EXIT

Expand All @@ -36,19 +36,19 @@ fi
if is_overriding_api_base_url ; then
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
echo
elif ! prism_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
elif ! steady_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady server"
echo -e "running against your OpenAPI spec."
echo
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the prism command:"
echo -e "spec to the steady command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.22.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=brackets --validator-form-array-format=brackets --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}"
echo

exit 1
else
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
echo -e "${GREEN}✔ Mock steady server is running with your OpenAPI spec${NC}"
echo
fi

Expand Down
4 changes: 4 additions & 0 deletions src/knockapi/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,10 @@ def _build_request(
files = cast(HttpxRequestFiles, ForceMultipartDict())

prepared_url = self._prepare_url(options.url)
# preserve hard-coded query params from the url
if params and prepared_url.query:
params = {**dict(prepared_url.params.items()), **params}
prepared_url = prepared_url.copy_with(raw_path=prepared_url.raw_path.split(b"?", 1)[0])
if "_" in prepared_url.host:
# work around https://github.com/encode/httpx/discussions/2880
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
Expand Down
Loading
Loading