From 91e8fd1ecdd6d10def9215f53a73248b754b5386 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 23 Apr 2026 02:18:01 +0000 Subject: [PATCH 01/15] chore(internal): more robust bootstrap script --- scripts/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index 34878642..a5e1b80a 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -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 From 6f99d290cad4006de8f84b22cbac6694d314a3aa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 02:10:42 +0000 Subject: [PATCH 02/15] feat: support setting headers via env --- lib/courier/client.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/courier/client.rb b/lib/courier/client.rb index 82a7e162..97fc0ae8 100644 --- a/lib/courier/client.rb +++ b/lib/courier/client.rb @@ -112,6 +112,19 @@ def initialize( raise ArgumentError.new("api_key is required, and can be set via environ: \"COURIER_API_KEY\"") end + headers = {} + custom_headers_env = ENV["COURIER_CUSTOM_HEADERS"] + unless custom_headers_env.nil? + parsed = {} + custom_headers_env.split("\n").each do |line| + colon = line.index(":") + unless colon.nil? + parsed[line[0...colon].strip] = line[(colon + 1)..].strip + end + end + headers = parsed.merge(headers) + end + @api_key = api_key.to_s super( @@ -119,7 +132,8 @@ def initialize( timeout: timeout, max_retries: max_retries, initial_retry_delay: initial_retry_delay, - max_retry_delay: max_retry_delay + max_retry_delay: max_retry_delay, + headers: headers ) @send_ = Courier::Resources::Send.new(client: self) From 25e90cf57380259884889ef8aa0ec127abd8142f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 02:20:00 +0000 Subject: [PATCH 03/15] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index effa635e..71498595 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-3f78581b4e078a1f620d9f587f18d77bcde6d20f56b0e4ae798648f4236494fb.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-3f78581b4e078a1f620d9f587f18d77bcde6d20f56b0e4ae798648f4236494fb.yml openapi_spec_hash: 6bd33e0396d85e11bb46f0d549af93a3 config_hash: afcc4f6f8c33ca3f338589e32e086f56 From 77fe9539df918879f96f4af5df16c11c812f2ec7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 02:24:37 +0000 Subject: [PATCH 04/15] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 71498595..a59050a6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-3f78581b4e078a1f620d9f587f18d77bcde6d20f56b0e4ae798648f4236494fb.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-2fca943954773292b6ca82dcb420c6500d118d2fbbe1cd4718afcb804f6c818c.yml openapi_spec_hash: 6bd33e0396d85e11bb46f0d549af93a3 config_hash: afcc4f6f8c33ca3f338589e32e086f56 From 1d155896367a5a20999876f09e006aeabc47d6be Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 02:06:50 +0000 Subject: [PATCH 05/15] ci: pin GitHub Actions to commit SHAs Pin all GitHub Actions referenced in generated workflows (both first-party `actions/*` and third-party) to immutable commit SHAs. Updating pinned actions is now a deliberate codegen-side bump rather than implicit on every workflow run. --- .github/workflows/ci.yml | 14 +++++++------- .github/workflows/publish-gem.yml | 4 ++-- .github/workflows/release-doctor.yml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b05b7266..859e3483 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,9 +26,9 @@ jobs: github.repository == 'stainless-sdks/courier-ruby' && (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 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- @@ -39,7 +39,7 @@ jobs: github.repository == 'stainless-sdks/courier-ruby' && !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc - uses: actions/github-script@v8 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: script: core.setOutput('github_token', await core.getIDToken()); @@ -60,9 +60,9 @@ jobs: if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- @@ -76,9 +76,9 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/courier-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml index b7cc511a..21ef3120 100644 --- a/.github/workflows/publish-gem.yml +++ b/.github/workflows/publish-gem.yml @@ -14,9 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 404425fd..f8cb15d6 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -12,7 +12,7 @@ jobs: if: github.repository == 'trycourier/courier-ruby' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Check release environment run: | From 5f0648580bf65a97989fbb1f6583ef7166c43c2f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 02:10:03 +0000 Subject: [PATCH 06/15] fix(client): elide content type header on requests without body --- lib/courier/internal/transport/base_client.rb | 2 ++ test/courier/client_test.rb | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/courier/internal/transport/base_client.rb b/lib/courier/internal/transport/base_client.rb index c47cc9d7..e5bcddfb 100644 --- a/lib/courier/internal/transport/base_client.rb +++ b/lib/courier/internal/transport/base_client.rb @@ -306,6 +306,8 @@ def initialize( Courier::Internal::Util.deep_merge(*[req[:body], opts[:extra_body]].compact) end + headers.delete("content-type") if body.nil? + url = Courier::Internal::Util.join_parsed_uri( @base_url_components, {**req, path: path, query: query} diff --git a/test/courier/client_test.rb b/test/courier/client_test.rb index c11021b8..1cd3e345 100644 --- a/test/courier/client_test.rb +++ b/test/courier/client_test.rb @@ -203,8 +203,8 @@ def test_client_redirect_307 assert_equal(recorded.method, _1.method) assert_equal(recorded.body, _1.body) assert_equal( - recorded.headers.transform_keys(&:downcase).fetch("content-type"), - _1.headers.transform_keys(&:downcase).fetch("content-type") + recorded.headers.transform_keys(&:downcase)["content-type"], + _1.headers.transform_keys(&:downcase)["content-type"] ) end end @@ -291,8 +291,9 @@ def test_default_headers courier.send_.message(message: {}) assert_requested(:any, /./) do |req| - headers = req.headers.transform_keys(&:downcase).fetch_values("accept", "content-type") - headers.each { refute_empty(_1) } + headers = req.headers.transform_keys(&:downcase) + expected = req.body.nil? ? ["accept"] : %w[accept content-type] + headers.fetch_values(*expected).each { refute_empty(_1) } end end end From 30bc8f6ad778a9ca44ed7ccbfa743e23170192b4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 23:55:20 +0000 Subject: [PATCH 07/15] feat(api): add journey CRUD/templates/versioning endpoints, journey node/condition types --- .stats.yml | 8 +- lib/courier.rb | 43 ++ lib/courier/models.rb | 73 ++++ lib/courier/models/create_journey_request.rb | 33 ++ lib/courier/models/journey_ai_node.rb | 74 ++++ .../models/journey_api_invoke_trigger_node.rb | 70 ++++ lib/courier/models/journey_archive_params.rb | 20 + lib/courier/models/journey_condition_atom.rb | 8 + lib/courier/models/journey_condition_group.rb | 26 ++ .../models/journey_condition_nested_group.rb | 24 ++ .../models/journey_conditions_field.rb | 37 ++ lib/courier/models/journey_create_params.rb | 14 + .../models/journey_delay_duration_node.rb | 69 ++++ .../models/journey_delay_until_node.rb | 69 ++++ lib/courier/models/journey_exit_node.rb | 31 ++ .../models/journey_fetch_get_delete_node.rb | 99 +++++ .../models/journey_fetch_post_put_node.rb | 106 +++++ .../models/journey_list_versions_params.rb | 20 + lib/courier/models/journey_merge_strategy.rb | 17 + lib/courier/models/journey_node.rb | 132 ++++++ lib/courier/models/journey_publish_params.rb | 20 + lib/courier/models/journey_publish_request.rb | 15 + lib/courier/models/journey_replace_params.rb | 20 + lib/courier/models/journey_response.rb | 70 ++++ lib/courier/models/journey_retrieve_params.rb | 26 ++ .../models/journey_segment_trigger_node.rb | 88 ++++ lib/courier/models/journey_send_node.rb | 121 ++++++ lib/courier/models/journey_state.rb | 15 + .../models/journey_template_create_request.rb | 136 +++++++ .../models/journey_template_get_response.rb | 152 +++++++ .../models/journey_template_list_response.rb | 21 + .../journey_template_publish_request.rb | 15 + .../journey_template_replace_request.rb | 124 ++++++ .../models/journey_template_summary.rb | 57 +++ .../models/journey_throttle_dynamic_node.rb | 83 ++++ .../models/journey_throttle_static_node.rb | 77 ++++ lib/courier/models/journey_version_item.rb | 39 ++ .../models/journey_versions_list_response.rb | 22 + .../journeys/template_archive_params.rb | 28 ++ .../models/journeys/template_create_params.rb | 22 + .../models/journeys/template_list_params.rb | 34 ++ .../journeys/template_list_versions_params.rb | 28 ++ .../journeys/template_publish_params.rb | 28 ++ .../journeys/template_replace_params.rb | 28 ++ .../journeys/template_retrieve_params.rb | 28 ++ lib/courier/resources/journeys.rb | 152 +++++++ lib/courier/resources/journeys/templates.rb | 222 ++++++++++ rbi/courier/models.rbi | 76 ++++ rbi/courier/models/create_journey_request.rbi | 105 +++++ rbi/courier/models/journey_ai_node.rbi | 139 +++++++ .../journey_api_invoke_trigger_node.rbi | 162 ++++++++ rbi/courier/models/journey_archive_params.rbi | 35 ++ rbi/courier/models/journey_condition_atom.rbi | 11 + .../models/journey_condition_group.rbi | 43 ++ .../models/journey_condition_nested_group.rbi | 51 +++ .../models/journey_conditions_field.rbi | 27 ++ rbi/courier/models/journey_create_params.rbi | 27 ++ .../models/journey_delay_duration_node.rbi | 145 +++++++ .../models/journey_delay_until_node.rbi | 138 +++++++ rbi/courier/models/journey_exit_node.rbi | 56 +++ .../models/journey_fetch_get_delete_node.rbi | 182 +++++++++ .../models/journey_fetch_post_put_node.rbi | 186 +++++++++ .../models/journey_list_versions_params.rbi | 35 ++ rbi/courier/models/journey_merge_strategy.rbi | 25 ++ rbi/courier/models/journey_node.rbi | 231 +++++++++++ rbi/courier/models/journey_publish_params.rbi | 35 ++ .../models/journey_publish_request.rbi | 26 ++ rbi/courier/models/journey_replace_params.rbi | 35 ++ rbi/courier/models/journey_response.rbi | 105 +++++ .../models/journey_retrieve_params.rbi | 46 +++ .../models/journey_segment_trigger_node.rbi | 199 +++++++++ rbi/courier/models/journey_send_node.rbi | 252 ++++++++++++ rbi/courier/models/journey_state.rbi | 19 + .../journey_template_create_request.rbi | 380 ++++++++++++++++++ .../models/journey_template_get_response.rbi | 333 +++++++++++++++ .../models/journey_template_list_response.rbi | 44 ++ .../journey_template_publish_request.rbi | 29 ++ .../journey_template_replace_request.rbi | 367 +++++++++++++++++ .../models/journey_template_summary.rbi | 83 ++++ .../models/journey_throttle_dynamic_node.rbi | 160 ++++++++ .../models/journey_throttle_static_node.rbi | 156 +++++++ rbi/courier/models/journey_version_item.rbi | 53 +++ .../models/journey_versions_list_response.rbi | 44 ++ .../journeys/template_archive_params.rbi | 48 +++ .../journeys/template_create_params.rbi | 40 ++ .../models/journeys/template_list_params.rbi | 59 +++ .../template_list_versions_params.rbi | 48 +++ .../journeys/template_publish_params.rbi | 48 +++ .../journeys/template_replace_params.rbi | 48 +++ .../journeys/template_retrieve_params.rbi | 48 +++ rbi/courier/resources/journeys.rbi | 135 +++++++ rbi/courier/resources/journeys/templates.rbi | 156 +++++++ sig/courier/models.rbs | 72 ++++ sig/courier/models/create_journey_request.rbs | 41 ++ sig/courier/models/journey_ai_node.rbs | 72 ++++ .../journey_api_invoke_trigger_node.rbs | 68 ++++ sig/courier/models/journey_archive_params.rbs | 23 ++ sig/courier/models/journey_condition_atom.rbs | 7 + .../models/journey_condition_group.rbs | 33 ++ .../models/journey_condition_nested_group.rbs | 33 ++ .../models/journey_conditions_field.rbs | 14 + sig/courier/models/journey_create_params.rbs | 15 + .../models/journey_delay_duration_node.rbs | 66 +++ .../models/journey_delay_until_node.rbs | 66 +++ sig/courier/models/journey_exit_node.rbs | 34 ++ .../models/journey_fetch_get_delete_node.rbs | 93 +++++ .../models/journey_fetch_post_put_node.rbs | 100 +++++ .../models/journey_list_versions_params.rbs | 23 ++ sig/courier/models/journey_merge_strategy.rbs | 16 + sig/courier/models/journey_node.rbs | 117 ++++++ sig/courier/models/journey_publish_params.rbs | 25 ++ .../models/journey_publish_request.rbs | 15 + sig/courier/models/journey_replace_params.rbs | 25 ++ sig/courier/models/journey_response.rbs | 65 +++ .../models/journey_retrieve_params.rbs | 30 ++ .../models/journey_segment_trigger_node.rbs | 85 ++++ sig/courier/models/journey_send_node.rbs | 140 +++++++ sig/courier/models/journey_state.rbs | 14 + .../journey_template_create_request.rbs | 148 +++++++ .../models/journey_template_get_response.rbs | 157 ++++++++ .../models/journey_template_list_response.rbs | 25 ++ .../journey_template_publish_request.rbs | 15 + .../journey_template_replace_request.rbs | 136 +++++++ .../models/journey_template_summary.rbs | 59 +++ .../models/journey_throttle_dynamic_node.rbs | 76 ++++ .../models/journey_throttle_static_node.rbs | 72 ++++ sig/courier/models/journey_version_item.rbs | 40 ++ .../models/journey_versions_list_response.rbs | 22 + .../journeys/template_archive_params.rbs | 30 ++ .../journeys/template_create_params.rbs | 27 ++ .../models/journeys/template_list_params.rbs | 38 ++ .../template_list_versions_params.rbs | 30 ++ .../journeys/template_publish_params.rbs | 34 ++ .../journeys/template_replace_params.rbs | 34 ++ .../journeys/template_retrieve_params.rbs | 30 ++ sig/courier/resources/journeys.rbs | 41 ++ sig/courier/resources/journeys/templates.rbs | 58 +++ test/courier/resource_namespaces.rb | 3 + .../resources/journeys/templates_test.rb | 159 ++++++++ test/courier/resources/journeys_test.rb | 136 +++++++ 140 files changed, 9972 insertions(+), 4 deletions(-) create mode 100644 lib/courier/models/create_journey_request.rb create mode 100644 lib/courier/models/journey_ai_node.rb create mode 100644 lib/courier/models/journey_api_invoke_trigger_node.rb create mode 100644 lib/courier/models/journey_archive_params.rb create mode 100644 lib/courier/models/journey_condition_atom.rb create mode 100644 lib/courier/models/journey_condition_group.rb create mode 100644 lib/courier/models/journey_condition_nested_group.rb create mode 100644 lib/courier/models/journey_conditions_field.rb create mode 100644 lib/courier/models/journey_create_params.rb create mode 100644 lib/courier/models/journey_delay_duration_node.rb create mode 100644 lib/courier/models/journey_delay_until_node.rb create mode 100644 lib/courier/models/journey_exit_node.rb create mode 100644 lib/courier/models/journey_fetch_get_delete_node.rb create mode 100644 lib/courier/models/journey_fetch_post_put_node.rb create mode 100644 lib/courier/models/journey_list_versions_params.rb create mode 100644 lib/courier/models/journey_merge_strategy.rb create mode 100644 lib/courier/models/journey_node.rb create mode 100644 lib/courier/models/journey_publish_params.rb create mode 100644 lib/courier/models/journey_publish_request.rb create mode 100644 lib/courier/models/journey_replace_params.rb create mode 100644 lib/courier/models/journey_response.rb create mode 100644 lib/courier/models/journey_retrieve_params.rb create mode 100644 lib/courier/models/journey_segment_trigger_node.rb create mode 100644 lib/courier/models/journey_send_node.rb create mode 100644 lib/courier/models/journey_state.rb create mode 100644 lib/courier/models/journey_template_create_request.rb create mode 100644 lib/courier/models/journey_template_get_response.rb create mode 100644 lib/courier/models/journey_template_list_response.rb create mode 100644 lib/courier/models/journey_template_publish_request.rb create mode 100644 lib/courier/models/journey_template_replace_request.rb create mode 100644 lib/courier/models/journey_template_summary.rb create mode 100644 lib/courier/models/journey_throttle_dynamic_node.rb create mode 100644 lib/courier/models/journey_throttle_static_node.rb create mode 100644 lib/courier/models/journey_version_item.rb create mode 100644 lib/courier/models/journey_versions_list_response.rb create mode 100644 lib/courier/models/journeys/template_archive_params.rb create mode 100644 lib/courier/models/journeys/template_create_params.rb create mode 100644 lib/courier/models/journeys/template_list_params.rb create mode 100644 lib/courier/models/journeys/template_list_versions_params.rb create mode 100644 lib/courier/models/journeys/template_publish_params.rb create mode 100644 lib/courier/models/journeys/template_replace_params.rb create mode 100644 lib/courier/models/journeys/template_retrieve_params.rb create mode 100644 lib/courier/resources/journeys/templates.rb create mode 100644 rbi/courier/models/create_journey_request.rbi create mode 100644 rbi/courier/models/journey_ai_node.rbi create mode 100644 rbi/courier/models/journey_api_invoke_trigger_node.rbi create mode 100644 rbi/courier/models/journey_archive_params.rbi create mode 100644 rbi/courier/models/journey_condition_atom.rbi create mode 100644 rbi/courier/models/journey_condition_group.rbi create mode 100644 rbi/courier/models/journey_condition_nested_group.rbi create mode 100644 rbi/courier/models/journey_conditions_field.rbi create mode 100644 rbi/courier/models/journey_create_params.rbi create mode 100644 rbi/courier/models/journey_delay_duration_node.rbi create mode 100644 rbi/courier/models/journey_delay_until_node.rbi create mode 100644 rbi/courier/models/journey_exit_node.rbi create mode 100644 rbi/courier/models/journey_fetch_get_delete_node.rbi create mode 100644 rbi/courier/models/journey_fetch_post_put_node.rbi create mode 100644 rbi/courier/models/journey_list_versions_params.rbi create mode 100644 rbi/courier/models/journey_merge_strategy.rbi create mode 100644 rbi/courier/models/journey_node.rbi create mode 100644 rbi/courier/models/journey_publish_params.rbi create mode 100644 rbi/courier/models/journey_publish_request.rbi create mode 100644 rbi/courier/models/journey_replace_params.rbi create mode 100644 rbi/courier/models/journey_response.rbi create mode 100644 rbi/courier/models/journey_retrieve_params.rbi create mode 100644 rbi/courier/models/journey_segment_trigger_node.rbi create mode 100644 rbi/courier/models/journey_send_node.rbi create mode 100644 rbi/courier/models/journey_state.rbi create mode 100644 rbi/courier/models/journey_template_create_request.rbi create mode 100644 rbi/courier/models/journey_template_get_response.rbi create mode 100644 rbi/courier/models/journey_template_list_response.rbi create mode 100644 rbi/courier/models/journey_template_publish_request.rbi create mode 100644 rbi/courier/models/journey_template_replace_request.rbi create mode 100644 rbi/courier/models/journey_template_summary.rbi create mode 100644 rbi/courier/models/journey_throttle_dynamic_node.rbi create mode 100644 rbi/courier/models/journey_throttle_static_node.rbi create mode 100644 rbi/courier/models/journey_version_item.rbi create mode 100644 rbi/courier/models/journey_versions_list_response.rbi create mode 100644 rbi/courier/models/journeys/template_archive_params.rbi create mode 100644 rbi/courier/models/journeys/template_create_params.rbi create mode 100644 rbi/courier/models/journeys/template_list_params.rbi create mode 100644 rbi/courier/models/journeys/template_list_versions_params.rbi create mode 100644 rbi/courier/models/journeys/template_publish_params.rbi create mode 100644 rbi/courier/models/journeys/template_replace_params.rbi create mode 100644 rbi/courier/models/journeys/template_retrieve_params.rbi create mode 100644 rbi/courier/resources/journeys/templates.rbi create mode 100644 sig/courier/models/create_journey_request.rbs create mode 100644 sig/courier/models/journey_ai_node.rbs create mode 100644 sig/courier/models/journey_api_invoke_trigger_node.rbs create mode 100644 sig/courier/models/journey_archive_params.rbs create mode 100644 sig/courier/models/journey_condition_atom.rbs create mode 100644 sig/courier/models/journey_condition_group.rbs create mode 100644 sig/courier/models/journey_condition_nested_group.rbs create mode 100644 sig/courier/models/journey_conditions_field.rbs create mode 100644 sig/courier/models/journey_create_params.rbs create mode 100644 sig/courier/models/journey_delay_duration_node.rbs create mode 100644 sig/courier/models/journey_delay_until_node.rbs create mode 100644 sig/courier/models/journey_exit_node.rbs create mode 100644 sig/courier/models/journey_fetch_get_delete_node.rbs create mode 100644 sig/courier/models/journey_fetch_post_put_node.rbs create mode 100644 sig/courier/models/journey_list_versions_params.rbs create mode 100644 sig/courier/models/journey_merge_strategy.rbs create mode 100644 sig/courier/models/journey_node.rbs create mode 100644 sig/courier/models/journey_publish_params.rbs create mode 100644 sig/courier/models/journey_publish_request.rbs create mode 100644 sig/courier/models/journey_replace_params.rbs create mode 100644 sig/courier/models/journey_response.rbs create mode 100644 sig/courier/models/journey_retrieve_params.rbs create mode 100644 sig/courier/models/journey_segment_trigger_node.rbs create mode 100644 sig/courier/models/journey_send_node.rbs create mode 100644 sig/courier/models/journey_state.rbs create mode 100644 sig/courier/models/journey_template_create_request.rbs create mode 100644 sig/courier/models/journey_template_get_response.rbs create mode 100644 sig/courier/models/journey_template_list_response.rbs create mode 100644 sig/courier/models/journey_template_publish_request.rbs create mode 100644 sig/courier/models/journey_template_replace_request.rbs create mode 100644 sig/courier/models/journey_template_summary.rbs create mode 100644 sig/courier/models/journey_throttle_dynamic_node.rbs create mode 100644 sig/courier/models/journey_throttle_static_node.rbs create mode 100644 sig/courier/models/journey_version_item.rbs create mode 100644 sig/courier/models/journey_versions_list_response.rbs create mode 100644 sig/courier/models/journeys/template_archive_params.rbs create mode 100644 sig/courier/models/journeys/template_create_params.rbs create mode 100644 sig/courier/models/journeys/template_list_params.rbs create mode 100644 sig/courier/models/journeys/template_list_versions_params.rbs create mode 100644 sig/courier/models/journeys/template_publish_params.rbs create mode 100644 sig/courier/models/journeys/template_replace_params.rbs create mode 100644 sig/courier/models/journeys/template_retrieve_params.rbs create mode 100644 sig/courier/resources/journeys/templates.rbs create mode 100644 test/courier/resources/journeys/templates_test.rb diff --git a/.stats.yml b/.stats.yml index a59050a6..eb39c6b7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-2fca943954773292b6ca82dcb420c6500d118d2fbbe1cd4718afcb804f6c818c.yml -openapi_spec_hash: 6bd33e0396d85e11bb46f0d549af93a3 -config_hash: afcc4f6f8c33ca3f338589e32e086f56 +configured_endpoints: 116 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-389afcb57163d4391f72d240c33a82d0522b958400603f137981480cda54558a.yml +openapi_spec_hash: c861d7fcd81ad5bfdaf8da0f5a84f497 +config_hash: e40fec72c1ab30fded57c222ace689b5 diff --git a/lib/courier.rb b/lib/courier.rb index c1c82ece..a3ce4a0f 100644 --- a/lib/courier.rb +++ b/lib/courier.rb @@ -58,7 +58,12 @@ require_relative "courier/models/base_check" require_relative "courier/models/subscription_topic_new" require_relative "courier/models/elemental_channel_node" +require_relative "courier/models/create_journey_request" require_relative "courier/models/journeys_invoke_request" +require_relative "courier/models/journey_publish_request" +require_relative "courier/models/journey_template_create_request" +require_relative "courier/models/journey_template_publish_request" +require_relative "courier/models/journey_template_replace_request" require_relative "courier/models/message_details" require_relative "courier/models/notification_template_create_request" require_relative "courier/models/notification_template_publish_request" @@ -154,10 +159,47 @@ require_relative "courier/models/intercom" require_relative "courier/models/intercom_recipient" require_relative "courier/models/journey" +require_relative "courier/models/journey_ai_node" +require_relative "courier/models/journey_api_invoke_trigger_node" +require_relative "courier/models/journey_archive_params" +require_relative "courier/models/journey_condition_atom" +require_relative "courier/models/journey_condition_group" +require_relative "courier/models/journey_condition_nested_group" +require_relative "courier/models/journey_conditions_field" +require_relative "courier/models/journey_create_params" +require_relative "courier/models/journey_delay_duration_node" +require_relative "courier/models/journey_delay_until_node" +require_relative "courier/models/journey_exit_node" +require_relative "courier/models/journey_fetch_get_delete_node" +require_relative "courier/models/journey_fetch_post_put_node" require_relative "courier/models/journey_invoke_params" require_relative "courier/models/journey_list_params" +require_relative "courier/models/journey_list_versions_params" +require_relative "courier/models/journey_merge_strategy" +require_relative "courier/models/journey_node" +require_relative "courier/models/journey_publish_params" +require_relative "courier/models/journey_replace_params" +require_relative "courier/models/journey_response" +require_relative "courier/models/journey_retrieve_params" +require_relative "courier/models/journeys/template_archive_params" +require_relative "courier/models/journeys/template_create_params" +require_relative "courier/models/journeys/template_list_params" +require_relative "courier/models/journeys/template_list_versions_params" +require_relative "courier/models/journeys/template_publish_params" +require_relative "courier/models/journeys/template_replace_params" +require_relative "courier/models/journeys/template_retrieve_params" +require_relative "courier/models/journey_segment_trigger_node" +require_relative "courier/models/journey_send_node" require_relative "courier/models/journeys_invoke_response" require_relative "courier/models/journeys_list_response" +require_relative "courier/models/journey_state" +require_relative "courier/models/journey_template_get_response" +require_relative "courier/models/journey_template_list_response" +require_relative "courier/models/journey_template_summary" +require_relative "courier/models/journey_throttle_dynamic_node" +require_relative "courier/models/journey_throttle_static_node" +require_relative "courier/models/journey_version_item" +require_relative "courier/models/journey_versions_list_response" require_relative "courier/models/list_delete_params" require_relative "courier/models/list_filter" require_relative "courier/models/list_list_params" @@ -348,6 +390,7 @@ require_relative "courier/resources/bulk" require_relative "courier/resources/inbound" require_relative "courier/resources/journeys" +require_relative "courier/resources/journeys/templates" require_relative "courier/resources/lists" require_relative "courier/resources/lists/subscriptions" require_relative "courier/resources/messages" diff --git a/lib/courier/models.rb b/lib/courier/models.rb index d9479d0c..c92feb15 100644 --- a/lib/courier/models.rb +++ b/lib/courier/models.rb @@ -133,6 +133,8 @@ module Courier Check = Courier::Models::Check + CreateJourneyRequest = Courier::Models::CreateJourneyRequest + DefaultPreferences = Courier::Models::DefaultPreferences DeviceType = Courier::Models::DeviceType @@ -191,16 +193,87 @@ module Courier Journey = Courier::Models::Journey + JourneyAINode = Courier::Models::JourneyAINode + + JourneyAPIInvokeTriggerNode = Courier::Models::JourneyAPIInvokeTriggerNode + + JourneyArchiveParams = Courier::Models::JourneyArchiveParams + + # @type [Courier::Internal::Type::Converter] + JourneyConditionAtom = Courier::Models::JourneyConditionAtom + + JourneyConditionGroup = Courier::Models::JourneyConditionGroup + + JourneyConditionNestedGroup = Courier::Models::JourneyConditionNestedGroup + + JourneyConditionsField = Courier::Models::JourneyConditionsField + + JourneyCreateParams = Courier::Models::JourneyCreateParams + + JourneyDelayDurationNode = Courier::Models::JourneyDelayDurationNode + + JourneyDelayUntilNode = Courier::Models::JourneyDelayUntilNode + + JourneyExitNode = Courier::Models::JourneyExitNode + + JourneyFetchGetDeleteNode = Courier::Models::JourneyFetchGetDeleteNode + + JourneyFetchPostPutNode = Courier::Models::JourneyFetchPostPutNode + JourneyInvokeParams = Courier::Models::JourneyInvokeParams JourneyListParams = Courier::Models::JourneyListParams + JourneyListVersionsParams = Courier::Models::JourneyListVersionsParams + + JourneyMergeStrategy = Courier::Models::JourneyMergeStrategy + + JourneyNode = Courier::Models::JourneyNode + + JourneyPublishParams = Courier::Models::JourneyPublishParams + + JourneyPublishRequest = Courier::Models::JourneyPublishRequest + + JourneyReplaceParams = Courier::Models::JourneyReplaceParams + + JourneyResponse = Courier::Models::JourneyResponse + + JourneyRetrieveParams = Courier::Models::JourneyRetrieveParams + + Journeys = Courier::Models::Journeys + + JourneySegmentTriggerNode = Courier::Models::JourneySegmentTriggerNode + + JourneySendNode = Courier::Models::JourneySendNode + JourneysInvokeRequest = Courier::Models::JourneysInvokeRequest JourneysInvokeResponse = Courier::Models::JourneysInvokeResponse JourneysListResponse = Courier::Models::JourneysListResponse + JourneyState = Courier::Models::JourneyState + + JourneyTemplateCreateRequest = Courier::Models::JourneyTemplateCreateRequest + + JourneyTemplateGetResponse = Courier::Models::JourneyTemplateGetResponse + + JourneyTemplateListResponse = Courier::Models::JourneyTemplateListResponse + + JourneyTemplatePublishRequest = Courier::Models::JourneyTemplatePublishRequest + + JourneyTemplateReplaceRequest = Courier::Models::JourneyTemplateReplaceRequest + + JourneyTemplateSummary = Courier::Models::JourneyTemplateSummary + + JourneyThrottleDynamicNode = Courier::Models::JourneyThrottleDynamicNode + + JourneyThrottleStaticNode = Courier::Models::JourneyThrottleStaticNode + + JourneyVersionItem = Courier::Models::JourneyVersionItem + + JourneyVersionsListResponse = Courier::Models::JourneyVersionsListResponse + ListDeleteParams = Courier::Models::ListDeleteParams ListFilter = Courier::Models::ListFilter diff --git a/lib/courier/models/create_journey_request.rb b/lib/courier/models/create_journey_request.rb new file mode 100644 index 00000000..4449c07c --- /dev/null +++ b/lib/courier/models/create_journey_request.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Courier + module Models + class CreateJourneyRequest < Courier::Internal::Type::BaseModel + # @!attribute name + # + # @return [String] + required :name, String + + # @!attribute nodes + # + # @return [Array] + required :nodes, -> { Courier::Internal::Type::ArrayOf[union: Courier::JourneyNode] } + + # @!attribute enabled + # + # @return [Boolean, nil] + optional :enabled, Courier::Internal::Type::Boolean + + # @!attribute state + # + # @return [Symbol, Courier::Models::JourneyState, nil] + optional :state, enum: -> { Courier::JourneyState } + + # @!method initialize(name:, nodes:, enabled: nil, state: nil) + # @param name [String] + # @param nodes [Array] + # @param enabled [Boolean] + # @param state [Symbol, Courier::Models::JourneyState] + end + end +end diff --git a/lib/courier/models/journey_ai_node.rb b/lib/courier/models/journey_ai_node.rb new file mode 100644 index 00000000..09d718b5 --- /dev/null +++ b/lib/courier/models/journey_ai_node.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyAINode < Courier::Internal::Type::BaseModel + # @!attribute output_schema + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + # + # @return [Hash{Symbol=>Object}] + required :output_schema, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown] + + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneyAINode::Type] + required :type, enum: -> { Courier::JourneyAINode::Type } + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!attribute conditions + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + # + # @return [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup, nil] + optional :conditions, union: -> { Courier::JourneyConditionsField } + + # @!attribute model + # + # @return [String, nil] + optional :model, String + + # @!attribute user_prompt + # + # @return [String, nil] + optional :user_prompt, String + + # @!attribute web_search + # + # @return [Boolean, nil] + optional :web_search, Courier::Internal::Type::Boolean + + # @!method initialize(output_schema:, type:, id: nil, conditions: nil, model: nil, user_prompt: nil, web_search: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::JourneyAINode} for more details. + # + # @param output_schema [Hash{Symbol=>Object}] A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + # + # @param type [Symbol, Courier::Models::JourneyAINode::Type] + # + # @param id [String] + # + # @param conditions [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr + # + # @param model [String] + # + # @param user_prompt [String] + # + # @param web_search [Boolean] + + # @see Courier::Models::JourneyAINode#type + module Type + extend Courier::Internal::Type::Enum + + AI = :ai + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/courier/models/journey_api_invoke_trigger_node.rb b/lib/courier/models/journey_api_invoke_trigger_node.rb new file mode 100644 index 00000000..30f12637 --- /dev/null +++ b/lib/courier/models/journey_api_invoke_trigger_node.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyAPIInvokeTriggerNode < Courier::Internal::Type::BaseModel + # @!attribute trigger_type + # + # @return [Symbol, Courier::Models::JourneyAPIInvokeTriggerNode::TriggerType] + required :trigger_type, enum: -> { Courier::JourneyAPIInvokeTriggerNode::TriggerType } + + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneyAPIInvokeTriggerNode::Type] + required :type, enum: -> { Courier::JourneyAPIInvokeTriggerNode::Type } + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!attribute conditions + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + # + # @return [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup, nil] + optional :conditions, union: -> { Courier::JourneyConditionsField } + + # @!attribute schema + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + # + # @return [Hash{Symbol=>Object}, nil] + optional :schema, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown] + + # @!method initialize(trigger_type:, type:, id: nil, conditions: nil, schema: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::JourneyAPIInvokeTriggerNode} for more details. + # + # @param trigger_type [Symbol, Courier::Models::JourneyAPIInvokeTriggerNode::TriggerType] + # + # @param type [Symbol, Courier::Models::JourneyAPIInvokeTriggerNode::Type] + # + # @param id [String] + # + # @param conditions [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr + # + # @param schema [Hash{Symbol=>Object}] A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + + # @see Courier::Models::JourneyAPIInvokeTriggerNode#trigger_type + module TriggerType + extend Courier::Internal::Type::Enum + + API_INVOKE = :"api-invoke" + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneyAPIInvokeTriggerNode#type + module Type + extend Courier::Internal::Type::Enum + + TRIGGER = :trigger + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/courier/models/journey_archive_params.rb b/lib/courier/models/journey_archive_params.rb new file mode 100644 index 00000000..8eda22f5 --- /dev/null +++ b/lib/courier/models/journey_archive_params.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Courier + module Models + # @see Courier::Resources::Journeys#archive + class JourneyArchiveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!method initialize(template_id:, request_options: {}) + # @param template_id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/courier/models/journey_condition_atom.rb b/lib/courier/models/journey_condition_atom.rb new file mode 100644 index 00000000..fda18317 --- /dev/null +++ b/lib/courier/models/journey_condition_atom.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Courier + module Models + # @type [Courier::Internal::Type::Converter] + JourneyConditionAtom = Courier::Internal::Type::ArrayOf[String] + end +end diff --git a/lib/courier/models/journey_condition_group.rb b/lib/courier/models/journey_condition_group.rb new file mode 100644 index 00000000..6cfcdcbd --- /dev/null +++ b/lib/courier/models/journey_condition_group.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyConditionGroup < Courier::Internal::Type::BaseModel + # @!attribute and_ + # + # @return [Array>, nil] + optional :and_, + Courier::Internal::Type::ArrayOf[Courier::Internal::Type::ArrayOf[String]], + api_name: :AND + + # @!attribute or_ + # + # @return [Array>, nil] + optional :or_, Courier::Internal::Type::ArrayOf[Courier::Internal::Type::ArrayOf[String]], api_name: :OR + + # @!method initialize(and_: nil, or_: nil) + # A leaf condition group. Exactly one of `AND` or `OR` must be present at runtime; + # each is a list of `JourneyConditionAtom` tuples. + # + # @param and_ [Array>] + # @param or_ [Array>] + end + end +end diff --git a/lib/courier/models/journey_condition_nested_group.rb b/lib/courier/models/journey_condition_nested_group.rb new file mode 100644 index 00000000..f7cd4040 --- /dev/null +++ b/lib/courier/models/journey_condition_nested_group.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyConditionNestedGroup < Courier::Internal::Type::BaseModel + # @!attribute and_ + # + # @return [Array, nil] + optional :and_, -> { Courier::Internal::Type::ArrayOf[Courier::JourneyConditionGroup] }, api_name: :AND + + # @!attribute or_ + # + # @return [Array, nil] + optional :or_, -> { Courier::Internal::Type::ArrayOf[Courier::JourneyConditionGroup] }, api_name: :OR + + # @!method initialize(and_: nil, or_: nil) + # A nested condition group. Exactly one of `AND` or `OR` must be present at + # runtime; each is a list of `JourneyConditionGroup` items. + # + # @param and_ [Array] + # @param or_ [Array] + end + end +end diff --git a/lib/courier/models/journey_conditions_field.rb b/lib/courier/models/journey_conditions_field.rb new file mode 100644 index 00000000..908c3777 --- /dev/null +++ b/lib/courier/models/journey_conditions_field.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module Courier + module Models + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + module JourneyConditionsField + extend Courier::Internal::Type::Union + + # A single condition expressed as a positional tuple of strings. + # - Binary form (3 elements): `[path, operator, value]` where `operator` + # is one of `is equal`, `is not equal`, `contains`, `does not contain`, + # `starts with`, `ends with`, `greater than`, `greater than or equal`, + # `less than`, `less than or equal`. + # + # Example: `["user.tier", "is equal", "gold"]`. + # + # - Unary form (2 elements): `[path, operator]` where `operator` is + # one of `exists`, `does not exist`. + # + # Example: `["user.email", "exists"]`. + # + # The first element is a non-empty dot-path. The second element is the operator (must come from one of the two operator sets above). For the binary form, the third element is the comparison value (string). Runtime validation of the operator value and arity is performed by the backend; SDKs surface this as a string list. + variant -> { Courier::JourneyConditionAtom } + + # A leaf condition group. Exactly one of `AND` or `OR` must be present at runtime; each is a list of `JourneyConditionAtom` tuples. + variant -> { Courier::JourneyConditionGroup } + + # A nested condition group. Exactly one of `AND` or `OR` must be present at runtime; each is a list of `JourneyConditionGroup` items. + variant -> { Courier::JourneyConditionNestedGroup } + + # @!method self.variants + # @return [Array(Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup)] + end + end +end diff --git a/lib/courier/models/journey_create_params.rb b/lib/courier/models/journey_create_params.rb new file mode 100644 index 00000000..aeb28611 --- /dev/null +++ b/lib/courier/models/journey_create_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Courier + module Models + # @see Courier::Resources::Journeys#create + class JourneyCreateParams < Courier::Models::CreateJourneyRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/courier/models/journey_delay_duration_node.rb b/lib/courier/models/journey_delay_duration_node.rb new file mode 100644 index 00000000..0dd41734 --- /dev/null +++ b/lib/courier/models/journey_delay_duration_node.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyDelayDurationNode < Courier::Internal::Type::BaseModel + # @!attribute duration + # + # @return [String] + required :duration, String + + # @!attribute mode + # + # @return [Symbol, Courier::Models::JourneyDelayDurationNode::Mode] + required :mode, enum: -> { Courier::JourneyDelayDurationNode::Mode } + + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneyDelayDurationNode::Type] + required :type, enum: -> { Courier::JourneyDelayDurationNode::Type } + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!attribute conditions + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + # + # @return [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup, nil] + optional :conditions, union: -> { Courier::JourneyConditionsField } + + # @!method initialize(duration:, mode:, type:, id: nil, conditions: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::JourneyDelayDurationNode} for more details. + # + # @param duration [String] + # + # @param mode [Symbol, Courier::Models::JourneyDelayDurationNode::Mode] + # + # @param type [Symbol, Courier::Models::JourneyDelayDurationNode::Type] + # + # @param id [String] + # + # @param conditions [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr + + # @see Courier::Models::JourneyDelayDurationNode#mode + module Mode + extend Courier::Internal::Type::Enum + + DURATION = :duration + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneyDelayDurationNode#type + module Type + extend Courier::Internal::Type::Enum + + DELAY = :delay + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/courier/models/journey_delay_until_node.rb b/lib/courier/models/journey_delay_until_node.rb new file mode 100644 index 00000000..0790b088 --- /dev/null +++ b/lib/courier/models/journey_delay_until_node.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyDelayUntilNode < Courier::Internal::Type::BaseModel + # @!attribute mode + # + # @return [Symbol, Courier::Models::JourneyDelayUntilNode::Mode] + required :mode, enum: -> { Courier::JourneyDelayUntilNode::Mode } + + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneyDelayUntilNode::Type] + required :type, enum: -> { Courier::JourneyDelayUntilNode::Type } + + # @!attribute until_ + # + # @return [String] + required :until_, String, api_name: :until + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!attribute conditions + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + # + # @return [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup, nil] + optional :conditions, union: -> { Courier::JourneyConditionsField } + + # @!method initialize(mode:, type:, until_:, id: nil, conditions: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::JourneyDelayUntilNode} for more details. + # + # @param mode [Symbol, Courier::Models::JourneyDelayUntilNode::Mode] + # + # @param type [Symbol, Courier::Models::JourneyDelayUntilNode::Type] + # + # @param until_ [String] + # + # @param id [String] + # + # @param conditions [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr + + # @see Courier::Models::JourneyDelayUntilNode#mode + module Mode + extend Courier::Internal::Type::Enum + + UNTIL = :until + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneyDelayUntilNode#type + module Type + extend Courier::Internal::Type::Enum + + DELAY = :delay + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/courier/models/journey_exit_node.rb b/lib/courier/models/journey_exit_node.rb new file mode 100644 index 00000000..263b7abd --- /dev/null +++ b/lib/courier/models/journey_exit_node.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyExitNode < Courier::Internal::Type::BaseModel + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneyExitNode::Type] + required :type, enum: -> { Courier::JourneyExitNode::Type } + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!method initialize(type:, id: nil) + # @param type [Symbol, Courier::Models::JourneyExitNode::Type] + # @param id [String] + + # @see Courier::Models::JourneyExitNode#type + module Type + extend Courier::Internal::Type::Enum + + EXIT = :exit + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/courier/models/journey_fetch_get_delete_node.rb b/lib/courier/models/journey_fetch_get_delete_node.rb new file mode 100644 index 00000000..886ff935 --- /dev/null +++ b/lib/courier/models/journey_fetch_get_delete_node.rb @@ -0,0 +1,99 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyFetchGetDeleteNode < Courier::Internal::Type::BaseModel + # @!attribute merge_strategy + # + # @return [Symbol, Courier::Models::JourneyMergeStrategy] + required :merge_strategy, enum: -> { Courier::JourneyMergeStrategy } + + # @!attribute method_ + # + # @return [Symbol, Courier::Models::JourneyFetchGetDeleteNode::Method] + required :method_, enum: -> { Courier::JourneyFetchGetDeleteNode::Method }, api_name: :method + + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneyFetchGetDeleteNode::Type] + required :type, enum: -> { Courier::JourneyFetchGetDeleteNode::Type } + + # @!attribute url + # + # @return [String] + required :url, String + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!attribute conditions + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + # + # @return [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup, nil] + optional :conditions, union: -> { Courier::JourneyConditionsField } + + # @!attribute headers + # + # @return [Hash{Symbol=>String}, nil] + optional :headers, Courier::Internal::Type::HashOf[String] + + # @!attribute query_params + # + # @return [Hash{Symbol=>String}, nil] + optional :query_params, Courier::Internal::Type::HashOf[String] + + # @!attribute response_schema + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + # + # @return [Hash{Symbol=>Object}, nil] + optional :response_schema, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown] + + # @!method initialize(merge_strategy:, method_:, type:, url:, id: nil, conditions: nil, headers: nil, query_params: nil, response_schema: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::JourneyFetchGetDeleteNode} for more details. + # + # @param merge_strategy [Symbol, Courier::Models::JourneyMergeStrategy] + # + # @param method_ [Symbol, Courier::Models::JourneyFetchGetDeleteNode::Method] + # + # @param type [Symbol, Courier::Models::JourneyFetchGetDeleteNode::Type] + # + # @param url [String] + # + # @param id [String] + # + # @param conditions [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr + # + # @param headers [Hash{Symbol=>String}] + # + # @param query_params [Hash{Symbol=>String}] + # + # @param response_schema [Hash{Symbol=>Object}] A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + + # @see Courier::Models::JourneyFetchGetDeleteNode#method_ + module Method + extend Courier::Internal::Type::Enum + + GET = :get + DELETE = :delete + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneyFetchGetDeleteNode#type + module Type + extend Courier::Internal::Type::Enum + + FETCH = :fetch + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/courier/models/journey_fetch_post_put_node.rb b/lib/courier/models/journey_fetch_post_put_node.rb new file mode 100644 index 00000000..95e78f53 --- /dev/null +++ b/lib/courier/models/journey_fetch_post_put_node.rb @@ -0,0 +1,106 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyFetchPostPutNode < Courier::Internal::Type::BaseModel + # @!attribute merge_strategy + # + # @return [Symbol, Courier::Models::JourneyMergeStrategy] + required :merge_strategy, enum: -> { Courier::JourneyMergeStrategy } + + # @!attribute method_ + # + # @return [Symbol, Courier::Models::JourneyFetchPostPutNode::Method] + required :method_, enum: -> { Courier::JourneyFetchPostPutNode::Method }, api_name: :method + + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneyFetchPostPutNode::Type] + required :type, enum: -> { Courier::JourneyFetchPostPutNode::Type } + + # @!attribute url + # + # @return [String] + required :url, String + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!attribute body + # + # @return [String, nil] + optional :body, String + + # @!attribute conditions + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + # + # @return [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup, nil] + optional :conditions, union: -> { Courier::JourneyConditionsField } + + # @!attribute headers + # + # @return [Hash{Symbol=>String}, nil] + optional :headers, Courier::Internal::Type::HashOf[String] + + # @!attribute query_params + # + # @return [Hash{Symbol=>String}, nil] + optional :query_params, Courier::Internal::Type::HashOf[String] + + # @!attribute response_schema + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + # + # @return [Hash{Symbol=>Object}, nil] + optional :response_schema, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown] + + # @!method initialize(merge_strategy:, method_:, type:, url:, id: nil, body: nil, conditions: nil, headers: nil, query_params: nil, response_schema: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::JourneyFetchPostPutNode} for more details. + # + # @param merge_strategy [Symbol, Courier::Models::JourneyMergeStrategy] + # + # @param method_ [Symbol, Courier::Models::JourneyFetchPostPutNode::Method] + # + # @param type [Symbol, Courier::Models::JourneyFetchPostPutNode::Type] + # + # @param url [String] + # + # @param id [String] + # + # @param body [String] + # + # @param conditions [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr + # + # @param headers [Hash{Symbol=>String}] + # + # @param query_params [Hash{Symbol=>String}] + # + # @param response_schema [Hash{Symbol=>Object}] A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + + # @see Courier::Models::JourneyFetchPostPutNode#method_ + module Method + extend Courier::Internal::Type::Enum + + POST = :post + PUT = :put + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneyFetchPostPutNode#type + module Type + extend Courier::Internal::Type::Enum + + FETCH = :fetch + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/courier/models/journey_list_versions_params.rb b/lib/courier/models/journey_list_versions_params.rb new file mode 100644 index 00000000..c1cac555 --- /dev/null +++ b/lib/courier/models/journey_list_versions_params.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Courier + module Models + # @see Courier::Resources::Journeys#list_versions + class JourneyListVersionsParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!method initialize(template_id:, request_options: {}) + # @param template_id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/courier/models/journey_merge_strategy.rb b/lib/courier/models/journey_merge_strategy.rb new file mode 100644 index 00000000..20f808eb --- /dev/null +++ b/lib/courier/models/journey_merge_strategy.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Courier + module Models + module JourneyMergeStrategy + extend Courier::Internal::Type::Enum + + OVERWRITE = :overwrite + SOFT_MERGE = :"soft-merge" + REPLACE = :replace + NONE = :none + + # @!method self.values + # @return [Array] + end + end +end diff --git a/lib/courier/models/journey_node.rb b/lib/courier/models/journey_node.rb new file mode 100644 index 00000000..bf98f2c1 --- /dev/null +++ b/lib/courier/models/journey_node.rb @@ -0,0 +1,132 @@ +# frozen_string_literal: true + +module Courier + module Models + # A single node in a journey DAG. Discriminated by `type` plus a secondary + # discriminator on some variants (`trigger_type` for trigger, `mode` for delay, + # `method` for fetch, `scope` for throttle). Each variant is exported as a + # separate schema for SDK type quality. + module JourneyNode + extend Courier::Internal::Type::Union + + variant -> { Courier::JourneyAPIInvokeTriggerNode } + + variant -> { Courier::JourneySegmentTriggerNode } + + variant -> { Courier::JourneySendNode } + + variant -> { Courier::JourneyDelayDurationNode } + + variant -> { Courier::JourneyDelayUntilNode } + + variant -> { Courier::JourneyFetchGetDeleteNode } + + variant -> { Courier::JourneyFetchPostPutNode } + + variant -> { Courier::JourneyAINode } + + variant -> { Courier::JourneyThrottleStaticNode } + + variant -> { Courier::JourneyThrottleDynamicNode } + + variant -> { Courier::JourneyExitNode } + + # Branch node. Routes to one of `paths[]` whose `conditions` match, else falls through to `default.nodes`. Inlined rather than referenced so the recursive `nodes: JourneyNode[]` cycle stays within a single generated module (Stainless Python forward-ref resolution does not span modules well for this recursion shape). + variant -> { Courier::JourneyNode::JourneyBranchNode } + + class JourneyBranchNode < Courier::Internal::Type::BaseModel + # @!attribute default + # + # @return [Courier::Models::JourneyNode::JourneyBranchNode::Default] + required :default, -> { Courier::JourneyNode::JourneyBranchNode::Default } + + # @!attribute paths + # + # @return [Array] + required :paths, -> { Courier::Internal::Type::ArrayOf[Courier::JourneyNode::JourneyBranchNode::Path] } + + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneyNode::JourneyBranchNode::Type] + required :type, enum: -> { Courier::JourneyNode::JourneyBranchNode::Type } + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!method initialize(default:, paths:, type:, id: nil) + # Branch node. Routes to one of `paths[]` whose `conditions` match, else falls + # through to `default.nodes`. Inlined rather than referenced so the recursive + # `nodes: JourneyNode[]` cycle stays within a single generated module (Stainless + # Python forward-ref resolution does not span modules well for this recursion + # shape). + # + # @param default [Courier::Models::JourneyNode::JourneyBranchNode::Default] + # @param paths [Array] + # @param type [Symbol, Courier::Models::JourneyNode::JourneyBranchNode::Type] + # @param id [String] + + # @see Courier::Models::JourneyNode::JourneyBranchNode#default + class Default < Courier::Internal::Type::BaseModel + # @!attribute nodes + # + # @return [Array] + required :nodes, -> { Courier::Internal::Type::ArrayOf[union: Courier::JourneyNode] } + + # @!attribute label + # + # @return [String, nil] + optional :label, String + + # @!method initialize(nodes:, label: nil) + # @param nodes [Array] + # @param label [String] + end + + class Path < Courier::Internal::Type::BaseModel + # @!attribute conditions + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + # + # @return [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] + required :conditions, union: -> { Courier::JourneyConditionsField } + + # @!attribute nodes + # + # @return [Array] + required :nodes, -> { Courier::Internal::Type::ArrayOf[union: Courier::JourneyNode] } + + # @!attribute label + # + # @return [String, nil] + optional :label, String + + # @!method initialize(conditions:, nodes:, label: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::JourneyNode::JourneyBranchNode::Path} for more details. + # + # @param conditions [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr + # + # @param nodes [Array] + # + # @param label [String] + end + + # @see Courier::Models::JourneyNode::JourneyBranchNode#type + module Type + extend Courier::Internal::Type::Enum + + BRANCH = :branch + + # @!method self.values + # @return [Array] + end + end + + # @!method self.variants + # @return [Array(Courier::Models::JourneyAPIInvokeTriggerNode, Courier::Models::JourneySegmentTriggerNode, Courier::Models::JourneySendNode, Courier::Models::JourneyDelayDurationNode, Courier::Models::JourneyDelayUntilNode, Courier::Models::JourneyFetchGetDeleteNode, Courier::Models::JourneyFetchPostPutNode, Courier::Models::JourneyAINode, Courier::Models::JourneyThrottleStaticNode, Courier::Models::JourneyThrottleDynamicNode, Courier::Models::JourneyExitNode, Courier::Models::JourneyNode::JourneyBranchNode)] + end + end +end diff --git a/lib/courier/models/journey_publish_params.rb b/lib/courier/models/journey_publish_params.rb new file mode 100644 index 00000000..271f4f6e --- /dev/null +++ b/lib/courier/models/journey_publish_params.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Courier + module Models + # @see Courier::Resources::Journeys#publish + class JourneyPublishParams < Courier::Models::JourneyPublishRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!method initialize(template_id:, request_options: {}) + # @param template_id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/courier/models/journey_publish_request.rb b/lib/courier/models/journey_publish_request.rb new file mode 100644 index 00000000..d010a10a --- /dev/null +++ b/lib/courier/models/journey_publish_request.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyPublishRequest < Courier::Internal::Type::BaseModel + # @!attribute version + # + # @return [String, nil] + optional :version, String + + # @!method initialize(version: nil) + # @param version [String] + end + end +end diff --git a/lib/courier/models/journey_replace_params.rb b/lib/courier/models/journey_replace_params.rb new file mode 100644 index 00000000..62d0b457 --- /dev/null +++ b/lib/courier/models/journey_replace_params.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Courier + module Models + # @see Courier::Resources::Journeys#replace + class JourneyReplaceParams < Courier::Models::CreateJourneyRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!method initialize(template_id:, request_options: {}) + # @param template_id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/courier/models/journey_response.rb b/lib/courier/models/journey_response.rb new file mode 100644 index 00000000..99934c5f --- /dev/null +++ b/lib/courier/models/journey_response.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +module Courier + module Models + # @see Courier::Resources::Journeys#create + class JourneyResponse < Courier::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute created + # + # @return [Integer, nil] + required :created, Integer, nil?: true + + # @!attribute creator + # + # @return [String, nil] + required :creator, String, nil?: true + + # @!attribute enabled + # + # @return [Boolean] + required :enabled, Courier::Internal::Type::Boolean + + # @!attribute name + # + # @return [String] + required :name, String + + # @!attribute nodes + # + # @return [Array] + required :nodes, -> { Courier::Internal::Type::ArrayOf[union: Courier::JourneyNode] } + + # @!attribute published + # + # @return [Integer, nil] + required :published, Integer, nil?: true + + # @!attribute state + # + # @return [Symbol, Courier::Models::JourneyState] + required :state, enum: -> { Courier::JourneyState } + + # @!attribute updated + # + # @return [Integer, nil] + required :updated, Integer, nil?: true + + # @!attribute updater + # + # @return [String, nil] + required :updater, String, nil?: true + + # @!method initialize(id:, created:, creator:, enabled:, name:, nodes:, published:, state:, updated:, updater:) + # @param id [String] + # @param created [Integer, nil] + # @param creator [String, nil] + # @param enabled [Boolean] + # @param name [String] + # @param nodes [Array] + # @param published [Integer, nil] + # @param state [Symbol, Courier::Models::JourneyState] + # @param updated [Integer, nil] + # @param updater [String, nil] + end + end +end diff --git a/lib/courier/models/journey_retrieve_params.rb b/lib/courier/models/journey_retrieve_params.rb new file mode 100644 index 00000000..28f9bc55 --- /dev/null +++ b/lib/courier/models/journey_retrieve_params.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Courier + module Models + # @see Courier::Resources::Journeys#retrieve + class JourneyRetrieveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!attribute version + # + # @return [String, nil] + optional :version, String + + # @!method initialize(template_id:, version: nil, request_options: {}) + # @param template_id [String] + # @param version [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/courier/models/journey_segment_trigger_node.rb b/lib/courier/models/journey_segment_trigger_node.rb new file mode 100644 index 00000000..76ef4b06 --- /dev/null +++ b/lib/courier/models/journey_segment_trigger_node.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneySegmentTriggerNode < Courier::Internal::Type::BaseModel + # @!attribute request_type + # + # @return [Symbol, Courier::Models::JourneySegmentTriggerNode::RequestType] + required :request_type, enum: -> { Courier::JourneySegmentTriggerNode::RequestType } + + # @!attribute trigger_type + # + # @return [Symbol, Courier::Models::JourneySegmentTriggerNode::TriggerType] + required :trigger_type, enum: -> { Courier::JourneySegmentTriggerNode::TriggerType } + + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneySegmentTriggerNode::Type] + required :type, enum: -> { Courier::JourneySegmentTriggerNode::Type } + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!attribute conditions + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + # + # @return [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup, nil] + optional :conditions, union: -> { Courier::JourneyConditionsField } + + # @!attribute event_id + # + # @return [String, nil] + optional :event_id, String + + # @!method initialize(request_type:, trigger_type:, type:, id: nil, conditions: nil, event_id: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::JourneySegmentTriggerNode} for more details. + # + # @param request_type [Symbol, Courier::Models::JourneySegmentTriggerNode::RequestType] + # + # @param trigger_type [Symbol, Courier::Models::JourneySegmentTriggerNode::TriggerType] + # + # @param type [Symbol, Courier::Models::JourneySegmentTriggerNode::Type] + # + # @param id [String] + # + # @param conditions [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr + # + # @param event_id [String] + + # @see Courier::Models::JourneySegmentTriggerNode#request_type + module RequestType + extend Courier::Internal::Type::Enum + + IDENTIFY = :identify + GROUP = :group + TRACK = :track + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneySegmentTriggerNode#trigger_type + module TriggerType + extend Courier::Internal::Type::Enum + + SEGMENT = :segment + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneySegmentTriggerNode#type + module Type + extend Courier::Internal::Type::Enum + + TRIGGER = :trigger + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/courier/models/journey_send_node.rb b/lib/courier/models/journey_send_node.rb new file mode 100644 index 00000000..42895c9e --- /dev/null +++ b/lib/courier/models/journey_send_node.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneySendNode < Courier::Internal::Type::BaseModel + # @!attribute message + # + # @return [Courier::Models::JourneySendNode::Message] + required :message, -> { Courier::JourneySendNode::Message } + + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneySendNode::Type] + required :type, enum: -> { Courier::JourneySendNode::Type } + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!attribute conditions + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + # + # @return [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup, nil] + optional :conditions, union: -> { Courier::JourneyConditionsField } + + # @!method initialize(message:, type:, id: nil, conditions: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::JourneySendNode} for more details. + # + # @param message [Courier::Models::JourneySendNode::Message] + # + # @param type [Symbol, Courier::Models::JourneySendNode::Type] + # + # @param id [String] + # + # @param conditions [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr + + # @see Courier::Models::JourneySendNode#message + class Message < Courier::Internal::Type::BaseModel + # @!attribute template + # + # @return [String] + required :template, String + + # @!attribute data + # + # @return [Hash{Symbol=>Object}, nil] + optional :data, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown] + + # @!attribute delay + # + # @return [Courier::Models::JourneySendNode::Message::Delay, nil] + optional :delay, -> { Courier::JourneySendNode::Message::Delay } + + # @!attribute to + # + # @return [Courier::Models::JourneySendNode::Message::To, nil] + optional :to, -> { Courier::JourneySendNode::Message::To } + + # @!method initialize(template:, data: nil, delay: nil, to: nil) + # @param template [String] + # @param data [Hash{Symbol=>Object}] + # @param delay [Courier::Models::JourneySendNode::Message::Delay] + # @param to [Courier::Models::JourneySendNode::Message::To] + + # @see Courier::Models::JourneySendNode::Message#delay + class Delay < Courier::Internal::Type::BaseModel + # @!attribute until_ + # + # @return [String] + required :until_, String, api_name: :until + + # @!attribute timezone + # + # @return [String, nil] + optional :timezone, String + + # @!method initialize(until_:, timezone: nil) + # @param until_ [String] + # @param timezone [String] + end + + # @see Courier::Models::JourneySendNode::Message#to + class To < Courier::Internal::Type::BaseModel + # @!attribute email_override + # + # @return [String, nil] + optional :email_override, String + + # @!attribute phone_number_override + # + # @return [String, nil] + optional :phone_number_override, String + + # @!attribute user_id_override + # + # @return [String, nil] + optional :user_id_override, String + + # @!method initialize(email_override: nil, phone_number_override: nil, user_id_override: nil) + # @param email_override [String] + # @param phone_number_override [String] + # @param user_id_override [String] + end + end + + # @see Courier::Models::JourneySendNode#type + module Type + extend Courier::Internal::Type::Enum + + SEND = :send + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/courier/models/journey_state.rb b/lib/courier/models/journey_state.rb new file mode 100644 index 00000000..8d6f853e --- /dev/null +++ b/lib/courier/models/journey_state.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Courier + module Models + module JourneyState + extend Courier::Internal::Type::Enum + + DRAFT = :DRAFT + PUBLISHED = :PUBLISHED + + # @!method self.values + # @return [Array] + end + end +end diff --git a/lib/courier/models/journey_template_create_request.rb b/lib/courier/models/journey_template_create_request.rb new file mode 100644 index 00000000..e667de6a --- /dev/null +++ b/lib/courier/models/journey_template_create_request.rb @@ -0,0 +1,136 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyTemplateCreateRequest < Courier::Internal::Type::BaseModel + # @!attribute channel + # + # @return [String] + required :channel, String + + # @!attribute notification + # + # @return [Courier::Models::JourneyTemplateCreateRequest::Notification] + required :notification, -> { Courier::JourneyTemplateCreateRequest::Notification } + + # @!attribute provider_key + # + # @return [String, nil] + optional :provider_key, String, api_name: :providerKey + + # @!attribute state + # + # @return [String, nil] + optional :state, String + + # @!method initialize(channel:, notification:, provider_key: nil, state: nil) + # @param channel [String] + # @param notification [Courier::Models::JourneyTemplateCreateRequest::Notification] + # @param provider_key [String] + # @param state [String] + + # @see Courier::Models::JourneyTemplateCreateRequest#notification + class Notification < Courier::Internal::Type::BaseModel + # @!attribute brand + # + # @return [Courier::Models::JourneyTemplateCreateRequest::Notification::Brand, nil] + required :brand, -> { Courier::JourneyTemplateCreateRequest::Notification::Brand }, nil?: true + + # @!attribute content + # + # @return [Courier::Models::JourneyTemplateCreateRequest::Notification::Content] + required :content, -> { Courier::JourneyTemplateCreateRequest::Notification::Content } + + # @!attribute name + # + # @return [String] + required :name, String + + # @!attribute subscription + # + # @return [Courier::Models::JourneyTemplateCreateRequest::Notification::Subscription, nil] + required :subscription, + -> { Courier::JourneyTemplateCreateRequest::Notification::Subscription }, + nil?: true + + # @!attribute tags + # + # @return [Array] + required :tags, Courier::Internal::Type::ArrayOf[String] + + # @!method initialize(brand:, content:, name:, subscription:, tags:) + # @param brand [Courier::Models::JourneyTemplateCreateRequest::Notification::Brand, nil] + # @param content [Courier::Models::JourneyTemplateCreateRequest::Notification::Content] + # @param name [String] + # @param subscription [Courier::Models::JourneyTemplateCreateRequest::Notification::Subscription, nil] + # @param tags [Array] + + # @see Courier::Models::JourneyTemplateCreateRequest::Notification#brand + class Brand < Courier::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!method initialize(id:) + # @param id [String] + end + + # @see Courier::Models::JourneyTemplateCreateRequest::Notification#content + class Content < Courier::Internal::Type::BaseModel + # @!attribute elements + # + # @return [Array] + required :elements, -> { Courier::Internal::Type::ArrayOf[union: Courier::ElementalNode] } + + # @!attribute version + # + # @return [Symbol, Courier::Models::JourneyTemplateCreateRequest::Notification::Content::Version] + required :version, enum: -> { Courier::JourneyTemplateCreateRequest::Notification::Content::Version } + + # @!attribute scope + # + # @return [Symbol, Courier::Models::JourneyTemplateCreateRequest::Notification::Content::Scope, nil] + optional :scope, enum: -> { Courier::JourneyTemplateCreateRequest::Notification::Content::Scope } + + # @!method initialize(elements:, version:, scope: nil) + # @param elements [Array] + # @param version [Symbol, Courier::Models::JourneyTemplateCreateRequest::Notification::Content::Version] + # @param scope [Symbol, Courier::Models::JourneyTemplateCreateRequest::Notification::Content::Scope] + + # @see Courier::Models::JourneyTemplateCreateRequest::Notification::Content#version + module Version + extend Courier::Internal::Type::Enum + + VERSION_2022_01_01 = :"2022-01-01" + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneyTemplateCreateRequest::Notification::Content#scope + module Scope + extend Courier::Internal::Type::Enum + + DEFAULT = :default + STRICT = :strict + + # @!method self.values + # @return [Array] + end + end + + # @see Courier::Models::JourneyTemplateCreateRequest::Notification#subscription + class Subscription < Courier::Internal::Type::BaseModel + # @!attribute topic_id + # + # @return [String] + required :topic_id, String + + # @!method initialize(topic_id:) + # @param topic_id [String] + end + end + end + end +end diff --git a/lib/courier/models/journey_template_get_response.rb b/lib/courier/models/journey_template_get_response.rb new file mode 100644 index 00000000..1d786a9f --- /dev/null +++ b/lib/courier/models/journey_template_get_response.rb @@ -0,0 +1,152 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyTemplateGetResponse < Courier::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute brand + # + # @return [Courier::Models::JourneyTemplateGetResponse::Brand, nil] + required :brand, -> { Courier::JourneyTemplateGetResponse::Brand }, nil?: true + + # @!attribute content + # + # @return [Courier::Models::JourneyTemplateGetResponse::Content] + required :content, -> { Courier::JourneyTemplateGetResponse::Content } + + # @!attribute created + # + # @return [Integer] + required :created, Integer + + # @!attribute creator + # + # @return [String] + required :creator, String + + # @!attribute name + # + # @return [String] + required :name, String + + # @!attribute state + # + # @return [Symbol, Courier::Models::JourneyTemplateGetResponse::State] + required :state, enum: -> { Courier::JourneyTemplateGetResponse::State } + + # @!attribute subscription + # + # @return [Courier::Models::JourneyTemplateGetResponse::Subscription, nil] + required :subscription, -> { Courier::JourneyTemplateGetResponse::Subscription }, nil?: true + + # @!attribute tags + # + # @return [Array] + required :tags, Courier::Internal::Type::ArrayOf[String] + + # @!attribute updated + # + # @return [Integer, nil] + optional :updated, Integer + + # @!attribute updater + # + # @return [String, nil] + optional :updater, String + + # @!method initialize(id:, brand:, content:, created:, creator:, name:, state:, subscription:, tags:, updated: nil, updater: nil) + # @param id [String] + # @param brand [Courier::Models::JourneyTemplateGetResponse::Brand, nil] + # @param content [Courier::Models::JourneyTemplateGetResponse::Content] + # @param created [Integer] + # @param creator [String] + # @param name [String] + # @param state [Symbol, Courier::Models::JourneyTemplateGetResponse::State] + # @param subscription [Courier::Models::JourneyTemplateGetResponse::Subscription, nil] + # @param tags [Array] + # @param updated [Integer] + # @param updater [String] + + # @see Courier::Models::JourneyTemplateGetResponse#brand + class Brand < Courier::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!method initialize(id:) + # @param id [String] + end + + # @see Courier::Models::JourneyTemplateGetResponse#content + class Content < Courier::Internal::Type::BaseModel + # @!attribute elements + # + # @return [Array] + required :elements, -> { Courier::Internal::Type::ArrayOf[union: Courier::ElementalNode] } + + # @!attribute version + # + # @return [Symbol, Courier::Models::JourneyTemplateGetResponse::Content::Version] + required :version, enum: -> { Courier::JourneyTemplateGetResponse::Content::Version } + + # @!attribute scope + # + # @return [Symbol, Courier::Models::JourneyTemplateGetResponse::Content::Scope, nil] + optional :scope, enum: -> { Courier::JourneyTemplateGetResponse::Content::Scope } + + # @!method initialize(elements:, version:, scope: nil) + # @param elements [Array] + # @param version [Symbol, Courier::Models::JourneyTemplateGetResponse::Content::Version] + # @param scope [Symbol, Courier::Models::JourneyTemplateGetResponse::Content::Scope] + + # @see Courier::Models::JourneyTemplateGetResponse::Content#version + module Version + extend Courier::Internal::Type::Enum + + VERSION_2022_01_01 = :"2022-01-01" + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneyTemplateGetResponse::Content#scope + module Scope + extend Courier::Internal::Type::Enum + + DEFAULT = :default + STRICT = :strict + + # @!method self.values + # @return [Array] + end + end + + # @see Courier::Models::JourneyTemplateGetResponse#state + module State + extend Courier::Internal::Type::Enum + + DRAFT = :DRAFT + PUBLISHED = :PUBLISHED + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneyTemplateGetResponse#subscription + class Subscription < Courier::Internal::Type::BaseModel + # @!attribute topic_id + # + # @return [String] + required :topic_id, String + + # @!method initialize(topic_id:) + # @param topic_id [String] + end + end + end +end diff --git a/lib/courier/models/journey_template_list_response.rb b/lib/courier/models/journey_template_list_response.rb new file mode 100644 index 00000000..de435e72 --- /dev/null +++ b/lib/courier/models/journey_template_list_response.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyTemplateListResponse < Courier::Internal::Type::BaseModel + # @!attribute paging + # + # @return [Courier::Models::Paging] + required :paging, -> { Courier::Paging } + + # @!attribute results + # + # @return [Array] + required :results, -> { Courier::Internal::Type::ArrayOf[Courier::JourneyTemplateSummary] } + + # @!method initialize(paging:, results:) + # @param paging [Courier::Models::Paging] + # @param results [Array] + end + end +end diff --git a/lib/courier/models/journey_template_publish_request.rb b/lib/courier/models/journey_template_publish_request.rb new file mode 100644 index 00000000..c38e8f71 --- /dev/null +++ b/lib/courier/models/journey_template_publish_request.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyTemplatePublishRequest < Courier::Internal::Type::BaseModel + # @!attribute version + # + # @return [String, nil] + optional :version, String + + # @!method initialize(version: nil) + # @param version [String] + end + end +end diff --git a/lib/courier/models/journey_template_replace_request.rb b/lib/courier/models/journey_template_replace_request.rb new file mode 100644 index 00000000..e2f73b6b --- /dev/null +++ b/lib/courier/models/journey_template_replace_request.rb @@ -0,0 +1,124 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyTemplateReplaceRequest < Courier::Internal::Type::BaseModel + # @!attribute notification + # + # @return [Courier::Models::JourneyTemplateReplaceRequest::Notification] + required :notification, -> { Courier::JourneyTemplateReplaceRequest::Notification } + + # @!attribute state + # + # @return [String, nil] + optional :state, String + + # @!method initialize(notification:, state: nil) + # @param notification [Courier::Models::JourneyTemplateReplaceRequest::Notification] + # @param state [String] + + # @see Courier::Models::JourneyTemplateReplaceRequest#notification + class Notification < Courier::Internal::Type::BaseModel + # @!attribute brand + # + # @return [Courier::Models::JourneyTemplateReplaceRequest::Notification::Brand, nil] + required :brand, -> { Courier::JourneyTemplateReplaceRequest::Notification::Brand }, nil?: true + + # @!attribute content + # + # @return [Courier::Models::JourneyTemplateReplaceRequest::Notification::Content] + required :content, -> { Courier::JourneyTemplateReplaceRequest::Notification::Content } + + # @!attribute name + # + # @return [String] + required :name, String + + # @!attribute subscription + # + # @return [Courier::Models::JourneyTemplateReplaceRequest::Notification::Subscription, nil] + required :subscription, + -> { Courier::JourneyTemplateReplaceRequest::Notification::Subscription }, + nil?: true + + # @!attribute tags + # + # @return [Array] + required :tags, Courier::Internal::Type::ArrayOf[String] + + # @!method initialize(brand:, content:, name:, subscription:, tags:) + # @param brand [Courier::Models::JourneyTemplateReplaceRequest::Notification::Brand, nil] + # @param content [Courier::Models::JourneyTemplateReplaceRequest::Notification::Content] + # @param name [String] + # @param subscription [Courier::Models::JourneyTemplateReplaceRequest::Notification::Subscription, nil] + # @param tags [Array] + + # @see Courier::Models::JourneyTemplateReplaceRequest::Notification#brand + class Brand < Courier::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!method initialize(id:) + # @param id [String] + end + + # @see Courier::Models::JourneyTemplateReplaceRequest::Notification#content + class Content < Courier::Internal::Type::BaseModel + # @!attribute elements + # + # @return [Array] + required :elements, -> { Courier::Internal::Type::ArrayOf[union: Courier::ElementalNode] } + + # @!attribute version + # + # @return [Symbol, Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::Version] + required :version, enum: -> { Courier::JourneyTemplateReplaceRequest::Notification::Content::Version } + + # @!attribute scope + # + # @return [Symbol, Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::Scope, nil] + optional :scope, enum: -> { Courier::JourneyTemplateReplaceRequest::Notification::Content::Scope } + + # @!method initialize(elements:, version:, scope: nil) + # @param elements [Array] + # @param version [Symbol, Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::Version] + # @param scope [Symbol, Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::Scope] + + # @see Courier::Models::JourneyTemplateReplaceRequest::Notification::Content#version + module Version + extend Courier::Internal::Type::Enum + + VERSION_2022_01_01 = :"2022-01-01" + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneyTemplateReplaceRequest::Notification::Content#scope + module Scope + extend Courier::Internal::Type::Enum + + DEFAULT = :default + STRICT = :strict + + # @!method self.values + # @return [Array] + end + end + + # @see Courier::Models::JourneyTemplateReplaceRequest::Notification#subscription + class Subscription < Courier::Internal::Type::BaseModel + # @!attribute topic_id + # + # @return [String] + required :topic_id, String + + # @!method initialize(topic_id:) + # @param topic_id [String] + end + end + end + end +end diff --git a/lib/courier/models/journey_template_summary.rb b/lib/courier/models/journey_template_summary.rb new file mode 100644 index 00000000..71d500a0 --- /dev/null +++ b/lib/courier/models/journey_template_summary.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyTemplateSummary < Courier::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute created + # + # @return [Integer] + required :created, Integer + + # @!attribute creator + # + # @return [String] + required :creator, String + + # @!attribute name + # + # @return [String] + required :name, String + + # @!attribute state + # + # @return [String] + required :state, String + + # @!attribute tags + # + # @return [Array] + required :tags, Courier::Internal::Type::ArrayOf[String] + + # @!attribute updated + # + # @return [Integer, nil] + optional :updated, Integer + + # @!attribute updater + # + # @return [String, nil] + optional :updater, String + + # @!method initialize(id:, created:, creator:, name:, state:, tags:, updated: nil, updater: nil) + # @param id [String] + # @param created [Integer] + # @param creator [String] + # @param name [String] + # @param state [String] + # @param tags [Array] + # @param updated [Integer] + # @param updater [String] + end + end +end diff --git a/lib/courier/models/journey_throttle_dynamic_node.rb b/lib/courier/models/journey_throttle_dynamic_node.rb new file mode 100644 index 00000000..231887fa --- /dev/null +++ b/lib/courier/models/journey_throttle_dynamic_node.rb @@ -0,0 +1,83 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyThrottleDynamicNode < Courier::Internal::Type::BaseModel + # @!attribute max_allowed + # + # @return [Integer] + required :max_allowed, Integer + + # @!attribute period + # + # @return [String] + required :period, String + + # @!attribute scope + # + # @return [Symbol, Courier::Models::JourneyThrottleDynamicNode::Scope] + required :scope, enum: -> { Courier::JourneyThrottleDynamicNode::Scope } + + # @!attribute throttle_key + # + # @return [String] + required :throttle_key, String + + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneyThrottleDynamicNode::Type] + required :type, enum: -> { Courier::JourneyThrottleDynamicNode::Type } + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!attribute conditions + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + # + # @return [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup, nil] + optional :conditions, union: -> { Courier::JourneyConditionsField } + + # @!method initialize(max_allowed:, period:, scope:, throttle_key:, type:, id: nil, conditions: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::JourneyThrottleDynamicNode} for more details. + # + # @param max_allowed [Integer] + # + # @param period [String] + # + # @param scope [Symbol, Courier::Models::JourneyThrottleDynamicNode::Scope] + # + # @param throttle_key [String] + # + # @param type [Symbol, Courier::Models::JourneyThrottleDynamicNode::Type] + # + # @param id [String] + # + # @param conditions [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr + + # @see Courier::Models::JourneyThrottleDynamicNode#scope + module Scope + extend Courier::Internal::Type::Enum + + DYNAMIC = :dynamic + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneyThrottleDynamicNode#type + module Type + extend Courier::Internal::Type::Enum + + THROTTLE = :throttle + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/courier/models/journey_throttle_static_node.rb b/lib/courier/models/journey_throttle_static_node.rb new file mode 100644 index 00000000..a3d2c214 --- /dev/null +++ b/lib/courier/models/journey_throttle_static_node.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyThrottleStaticNode < Courier::Internal::Type::BaseModel + # @!attribute max_allowed + # + # @return [Integer] + required :max_allowed, Integer + + # @!attribute period + # + # @return [String] + required :period, String + + # @!attribute scope + # + # @return [Symbol, Courier::Models::JourneyThrottleStaticNode::Scope] + required :scope, enum: -> { Courier::JourneyThrottleStaticNode::Scope } + + # @!attribute type + # + # @return [Symbol, Courier::Models::JourneyThrottleStaticNode::Type] + required :type, enum: -> { Courier::JourneyThrottleStaticNode::Type } + + # @!attribute id + # + # @return [String, nil] + optional :id, String + + # @!attribute conditions + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + # + # @return [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup, nil] + optional :conditions, union: -> { Courier::JourneyConditionsField } + + # @!method initialize(max_allowed:, period:, scope:, type:, id: nil, conditions: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::JourneyThrottleStaticNode} for more details. + # + # @param max_allowed [Integer] + # + # @param period [String] + # + # @param scope [Symbol, Courier::Models::JourneyThrottleStaticNode::Scope] + # + # @param type [Symbol, Courier::Models::JourneyThrottleStaticNode::Type] + # + # @param id [String] + # + # @param conditions [Array, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr + + # @see Courier::Models::JourneyThrottleStaticNode#scope + module Scope + extend Courier::Internal::Type::Enum + + USER = :user + GLOBAL = :global + + # @!method self.values + # @return [Array] + end + + # @see Courier::Models::JourneyThrottleStaticNode#type + module Type + extend Courier::Internal::Type::Enum + + THROTTLE = :throttle + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/courier/models/journey_version_item.rb b/lib/courier/models/journey_version_item.rb new file mode 100644 index 00000000..102d1f1d --- /dev/null +++ b/lib/courier/models/journey_version_item.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module Courier + module Models + class JourneyVersionItem < Courier::Internal::Type::BaseModel + # @!attribute created + # + # @return [Integer, nil] + required :created, Integer, nil?: true + + # @!attribute creator + # + # @return [String, nil] + required :creator, String, nil?: true + + # @!attribute name + # + # @return [String] + required :name, String + + # @!attribute published + # + # @return [Integer, nil] + required :published, Integer, nil?: true + + # @!attribute version + # + # @return [String] + required :version, String + + # @!method initialize(created:, creator:, name:, published:, version:) + # @param created [Integer, nil] + # @param creator [String, nil] + # @param name [String] + # @param published [Integer, nil] + # @param version [String] + end + end +end diff --git a/lib/courier/models/journey_versions_list_response.rb b/lib/courier/models/journey_versions_list_response.rb new file mode 100644 index 00000000..a4dae192 --- /dev/null +++ b/lib/courier/models/journey_versions_list_response.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Courier + module Models + # @see Courier::Resources::Journeys#list_versions + class JourneyVersionsListResponse < Courier::Internal::Type::BaseModel + # @!attribute paging + # + # @return [Courier::Models::Paging] + required :paging, -> { Courier::Paging } + + # @!attribute results + # + # @return [Array] + required :results, -> { Courier::Internal::Type::ArrayOf[Courier::JourneyVersionItem] } + + # @!method initialize(paging:, results:) + # @param paging [Courier::Models::Paging] + # @param results [Array] + end + end +end diff --git a/lib/courier/models/journeys/template_archive_params.rb b/lib/courier/models/journeys/template_archive_params.rb new file mode 100644 index 00000000..732f2e29 --- /dev/null +++ b/lib/courier/models/journeys/template_archive_params.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Courier + module Models + module Journeys + # @see Courier::Resources::Journeys::Templates#archive + class TemplateArchiveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!attribute notification_id + # + # @return [String] + required :notification_id, String + + # @!method initialize(template_id:, notification_id:, request_options: {}) + # @param template_id [String] + # @param notification_id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/courier/models/journeys/template_create_params.rb b/lib/courier/models/journeys/template_create_params.rb new file mode 100644 index 00000000..3f1ed294 --- /dev/null +++ b/lib/courier/models/journeys/template_create_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Courier + module Models + module Journeys + # @see Courier::Resources::Journeys::Templates#create + class TemplateCreateParams < Courier::Models::JourneyTemplateCreateRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!method initialize(template_id:, request_options: {}) + # @param template_id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/courier/models/journeys/template_list_params.rb b/lib/courier/models/journeys/template_list_params.rb new file mode 100644 index 00000000..66646537 --- /dev/null +++ b/lib/courier/models/journeys/template_list_params.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Courier + module Models + module Journeys + # @see Courier::Resources::Journeys::Templates#list + class TemplateListParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!attribute cursor + # + # @return [String, nil] + optional :cursor, String + + # @!attribute limit + # + # @return [Integer, nil] + optional :limit, Integer + + # @!method initialize(template_id:, cursor: nil, limit: nil, request_options: {}) + # @param template_id [String] + # @param cursor [String] + # @param limit [Integer] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/courier/models/journeys/template_list_versions_params.rb b/lib/courier/models/journeys/template_list_versions_params.rb new file mode 100644 index 00000000..9fa995fb --- /dev/null +++ b/lib/courier/models/journeys/template_list_versions_params.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Courier + module Models + module Journeys + # @see Courier::Resources::Journeys::Templates#list_versions + class TemplateListVersionsParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!attribute notification_id + # + # @return [String] + required :notification_id, String + + # @!method initialize(template_id:, notification_id:, request_options: {}) + # @param template_id [String] + # @param notification_id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/courier/models/journeys/template_publish_params.rb b/lib/courier/models/journeys/template_publish_params.rb new file mode 100644 index 00000000..bc30e390 --- /dev/null +++ b/lib/courier/models/journeys/template_publish_params.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Courier + module Models + module Journeys + # @see Courier::Resources::Journeys::Templates#publish + class TemplatePublishParams < Courier::Models::JourneyTemplatePublishRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!attribute notification_id + # + # @return [String] + required :notification_id, String + + # @!method initialize(template_id:, notification_id:, request_options: {}) + # @param template_id [String] + # @param notification_id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/courier/models/journeys/template_replace_params.rb b/lib/courier/models/journeys/template_replace_params.rb new file mode 100644 index 00000000..6be183fb --- /dev/null +++ b/lib/courier/models/journeys/template_replace_params.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Courier + module Models + module Journeys + # @see Courier::Resources::Journeys::Templates#replace + class TemplateReplaceParams < Courier::Models::JourneyTemplateReplaceRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!attribute notification_id + # + # @return [String] + required :notification_id, String + + # @!method initialize(template_id:, notification_id:, request_options: {}) + # @param template_id [String] + # @param notification_id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/courier/models/journeys/template_retrieve_params.rb b/lib/courier/models/journeys/template_retrieve_params.rb new file mode 100644 index 00000000..44bdd4ed --- /dev/null +++ b/lib/courier/models/journeys/template_retrieve_params.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Courier + module Models + module Journeys + # @see Courier::Resources::Journeys::Templates#retrieve + class TemplateRetrieveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!attribute notification_id + # + # @return [String] + required :notification_id, String + + # @!method initialize(template_id:, notification_id:, request_options: {}) + # @param template_id [String] + # @param notification_id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/courier/resources/journeys.rb b/lib/courier/resources/journeys.rb index 1e39af96..14bff004 100644 --- a/lib/courier/resources/journeys.rb +++ b/lib/courier/resources/journeys.rb @@ -3,6 +3,60 @@ module Courier module Resources class Journeys + # @return [Courier::Resources::Journeys::Templates] + attr_reader :templates + + # Create a new journey. The journey is created in DRAFT state. Use POST + # /journeys/{templateId}/publish to make it live. + # + # @overload create(name:, nodes:, enabled: nil, state: nil, request_options: {}) + # + # @param name [String] + # @param nodes [Array] + # @param enabled [Boolean] + # @param state [Symbol, Courier::Models::JourneyState] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Courier::Models::JourneyResponse] + # + # @see Courier::Models::JourneyCreateParams + def create(params) + parsed, options = Courier::JourneyCreateParams.dump_request(params) + @client.request( + method: :post, + path: "journeys", + body: parsed, + model: Courier::JourneyResponse, + options: options + ) + end + + # Fetch a journey by id. Pass `?version=draft` (default `published`) to retrieve + # the working draft, or `?version=vN` to retrieve a historical version. + # + # @overload retrieve(template_id, version: nil, request_options: {}) + # + # @param template_id [String] Journey id + # + # @param version [String] + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Courier::Models::JourneyResponse] + # + # @see Courier::Models::JourneyRetrieveParams + def retrieve(template_id, params = {}) + parsed, options = Courier::JourneyRetrieveParams.dump_request(params) + query = Courier::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["journeys/%1$s", template_id], + query: query, + model: Courier::JourneyResponse, + options: options + ) + end + # Some parameter documentations has been truncated, see # {Courier::Models::JourneyListParams} for more details. # @@ -31,6 +85,27 @@ def list(params = {}) ) end + # Archive a journey. Archived journeys cannot be invoked. Existing journey runs + # continue to completion. + # + # @overload archive(template_id, request_options: {}) + # + # @param template_id [String] Journey id + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Courier::Models::JourneyArchiveParams + def archive(template_id, params = {}) + @client.request( + method: :delete, + path: ["journeys/%1$s", template_id], + model: NilClass, + options: params[:request_options] + ) + end + # Some parameter documentations has been truncated, see # {Courier::Models::JourneyInvokeParams} for more details. # @@ -62,11 +137,88 @@ def invoke(template_id, params = {}) ) end + # List published versions of a journey, ordered most recent first. + # + # @overload list_versions(template_id, request_options: {}) + # + # @param template_id [String] Journey id + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Courier::Models::JourneyVersionsListResponse] + # + # @see Courier::Models::JourneyListVersionsParams + def list_versions(template_id, params = {}) + @client.request( + method: :get, + path: ["journeys/%1$s/versions", template_id], + model: Courier::JourneyVersionsListResponse, + options: params[:request_options] + ) + end + + # Publish the current draft as a new version. Optionally rollback to a prior + # version by passing `{ version: 'vN' }`. + # + # @overload publish(template_id, version: nil, request_options: {}) + # + # @param template_id [String] Journey id + # + # @param version [String] + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Courier::Models::JourneyResponse] + # + # @see Courier::Models::JourneyPublishParams + def publish(template_id, params = {}) + parsed, options = Courier::JourneyPublishParams.dump_request(params) + @client.request( + method: :post, + path: ["journeys/%1$s/publish", template_id], + body: parsed, + model: Courier::JourneyResponse, + options: options + ) + end + + # Replace the journey draft. Updates the working draft only; call POST + # /journeys/{templateId}/publish to make it live. + # + # @overload replace(template_id, name:, nodes:, enabled: nil, state: nil, request_options: {}) + # + # @param template_id [String] Journey id + # + # @param name [String] + # + # @param nodes [Array] + # + # @param enabled [Boolean] + # + # @param state [Symbol, Courier::Models::JourneyState] + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Courier::Models::JourneyResponse] + # + # @see Courier::Models::JourneyReplaceParams + def replace(template_id, params) + parsed, options = Courier::JourneyReplaceParams.dump_request(params) + @client.request( + method: :put, + path: ["journeys/%1$s", template_id], + body: parsed, + model: Courier::JourneyResponse, + options: options + ) + end + # @api private # # @param client [Courier::Client] def initialize(client:) @client = client + @templates = Courier::Resources::Journeys::Templates.new(client: client) end end end diff --git a/lib/courier/resources/journeys/templates.rb b/lib/courier/resources/journeys/templates.rb new file mode 100644 index 00000000..d3e4ff98 --- /dev/null +++ b/lib/courier/resources/journeys/templates.rb @@ -0,0 +1,222 @@ +# frozen_string_literal: true + +module Courier + module Resources + class Journeys + class Templates + # Create a notification template scoped to this journey. The template is created + # in DRAFT state. + # + # @overload create(template_id, channel:, notification:, provider_key: nil, state: nil, request_options: {}) + # + # @param template_id [String] Journey id + # + # @param channel [String] + # + # @param notification [Courier::Models::JourneyTemplateCreateRequest::Notification] + # + # @param provider_key [String] + # + # @param state [String] + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Courier::Models::JourneyTemplateGetResponse] + # + # @see Courier::Models::Journeys::TemplateCreateParams + def create(template_id, params) + parsed, options = Courier::Journeys::TemplateCreateParams.dump_request(params) + @client.request( + method: :post, + path: ["journeys/%1$s/templates", template_id], + body: parsed, + model: Courier::JourneyTemplateGetResponse, + options: options + ) + end + + # Fetch a journey-scoped notification template by id. Pass `?version=draft` + # (default `published`) to retrieve the working draft, or `?version=vN` for a + # historical version. + # + # @overload retrieve(notification_id, template_id:, request_options: {}) + # + # @param notification_id [String] Journey template id + # + # @param template_id [String] Journey id + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Courier::Models::JourneyTemplateGetResponse] + # + # @see Courier::Models::Journeys::TemplateRetrieveParams + def retrieve(notification_id, params) + parsed, options = Courier::Journeys::TemplateRetrieveParams.dump_request(params) + template_id = + parsed.delete(:template_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + @client.request( + method: :get, + path: ["journeys/%1$s/templates/%2$s", template_id, notification_id], + model: Courier::JourneyTemplateGetResponse, + options: options + ) + end + + # List notification templates scoped to this journey. Templates scoped to a + # journey can only be referenced from `send` nodes of the same journey. + # + # @overload list(template_id, cursor: nil, limit: nil, request_options: {}) + # + # @param template_id [String] Journey id + # + # @param cursor [String] + # + # @param limit [Integer] + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Courier::Models::JourneyTemplateListResponse] + # + # @see Courier::Models::Journeys::TemplateListParams + def list(template_id, params = {}) + parsed, options = Courier::Journeys::TemplateListParams.dump_request(params) + query = Courier::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["journeys/%1$s/templates", template_id], + query: query, + model: Courier::JourneyTemplateListResponse, + options: options + ) + end + + # Archive a journey-scoped notification template. Archived templates cannot be + # sent. + # + # @overload archive(notification_id, template_id:, request_options: {}) + # + # @param notification_id [String] Journey template id + # + # @param template_id [String] Journey id + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Courier::Models::Journeys::TemplateArchiveParams + def archive(notification_id, params) + parsed, options = Courier::Journeys::TemplateArchiveParams.dump_request(params) + template_id = + parsed.delete(:template_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + @client.request( + method: :delete, + path: ["journeys/%1$s/templates/%2$s", template_id, notification_id], + model: NilClass, + options: options + ) + end + + # List published versions of a journey-scoped notification template, ordered most + # recent first. + # + # @overload list_versions(notification_id, template_id:, request_options: {}) + # + # @param notification_id [String] Journey template id + # + # @param template_id [String] Journey id + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Courier::Models::NotificationTemplateVersionListResponse] + # + # @see Courier::Models::Journeys::TemplateListVersionsParams + def list_versions(notification_id, params) + parsed, options = Courier::Journeys::TemplateListVersionsParams.dump_request(params) + template_id = + parsed.delete(:template_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + @client.request( + method: :get, + path: ["journeys/%1$s/templates/%2$s/versions", template_id, notification_id], + model: Courier::NotificationTemplateVersionListResponse, + options: options + ) + end + + # Publish the current draft of a journey-scoped notification template. + # + # @overload publish(notification_id, template_id:, version: nil, request_options: {}) + # + # @param notification_id [String] Path param: Journey template id + # + # @param template_id [String] Path param: Journey id + # + # @param version [String] Body param + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Courier::Models::Journeys::TemplatePublishParams + def publish(notification_id, params) + parsed, options = Courier::Journeys::TemplatePublishParams.dump_request(params) + template_id = + parsed.delete(:template_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + @client.request( + method: :post, + path: ["journeys/%1$s/templates/%2$s/publish", template_id, notification_id], + body: parsed, + model: NilClass, + options: options + ) + end + + # Replace a journey-scoped notification template draft. + # + # @overload replace(notification_id, template_id:, notification:, state: nil, request_options: {}) + # + # @param notification_id [String] Path param: Journey template id + # + # @param template_id [String] Path param: Journey id + # + # @param notification [Courier::Models::JourneyTemplateReplaceRequest::Notification] Body param + # + # @param state [String] Body param + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Courier::Models::JourneyTemplateGetResponse] + # + # @see Courier::Models::Journeys::TemplateReplaceParams + def replace(notification_id, params) + parsed, options = Courier::Journeys::TemplateReplaceParams.dump_request(params) + template_id = + parsed.delete(:template_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + @client.request( + method: :put, + path: ["journeys/%1$s/templates/%2$s", template_id, notification_id], + body: parsed, + model: Courier::JourneyTemplateGetResponse, + options: options + ) + end + + # @api private + # + # @param client [Courier::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/rbi/courier/models.rbi b/rbi/courier/models.rbi index 96894889..2526f9bc 100644 --- a/rbi/courier/models.rbi +++ b/rbi/courier/models.rbi @@ -97,6 +97,8 @@ module Courier Check = Courier::Models::Check + CreateJourneyRequest = Courier::Models::CreateJourneyRequest + DefaultPreferences = Courier::Models::DefaultPreferences DeviceType = Courier::Models::DeviceType @@ -155,16 +157,90 @@ module Courier Journey = Courier::Models::Journey + JourneyAINode = Courier::Models::JourneyAINode + + JourneyAPIInvokeTriggerNode = Courier::Models::JourneyAPIInvokeTriggerNode + + JourneyArchiveParams = Courier::Models::JourneyArchiveParams + + JourneyConditionAtom = + T.let( + Courier::Models::JourneyConditionAtom, + Courier::Internal::Type::Converter + ) + + JourneyConditionGroup = Courier::Models::JourneyConditionGroup + + JourneyConditionNestedGroup = Courier::Models::JourneyConditionNestedGroup + + JourneyConditionsField = Courier::Models::JourneyConditionsField + + JourneyCreateParams = Courier::Models::JourneyCreateParams + + JourneyDelayDurationNode = Courier::Models::JourneyDelayDurationNode + + JourneyDelayUntilNode = Courier::Models::JourneyDelayUntilNode + + JourneyExitNode = Courier::Models::JourneyExitNode + + JourneyFetchGetDeleteNode = Courier::Models::JourneyFetchGetDeleteNode + + JourneyFetchPostPutNode = Courier::Models::JourneyFetchPostPutNode + JourneyInvokeParams = Courier::Models::JourneyInvokeParams JourneyListParams = Courier::Models::JourneyListParams + JourneyListVersionsParams = Courier::Models::JourneyListVersionsParams + + JourneyMergeStrategy = Courier::Models::JourneyMergeStrategy + + JourneyNode = Courier::Models::JourneyNode + + JourneyPublishParams = Courier::Models::JourneyPublishParams + + JourneyPublishRequest = Courier::Models::JourneyPublishRequest + + JourneyReplaceParams = Courier::Models::JourneyReplaceParams + + JourneyResponse = Courier::Models::JourneyResponse + + JourneyRetrieveParams = Courier::Models::JourneyRetrieveParams + + Journeys = Courier::Models::Journeys + + JourneySegmentTriggerNode = Courier::Models::JourneySegmentTriggerNode + + JourneySendNode = Courier::Models::JourneySendNode + JourneysInvokeRequest = Courier::Models::JourneysInvokeRequest JourneysInvokeResponse = Courier::Models::JourneysInvokeResponse JourneysListResponse = Courier::Models::JourneysListResponse + JourneyState = Courier::Models::JourneyState + + JourneyTemplateCreateRequest = Courier::Models::JourneyTemplateCreateRequest + + JourneyTemplateGetResponse = Courier::Models::JourneyTemplateGetResponse + + JourneyTemplateListResponse = Courier::Models::JourneyTemplateListResponse + + JourneyTemplatePublishRequest = Courier::Models::JourneyTemplatePublishRequest + + JourneyTemplateReplaceRequest = Courier::Models::JourneyTemplateReplaceRequest + + JourneyTemplateSummary = Courier::Models::JourneyTemplateSummary + + JourneyThrottleDynamicNode = Courier::Models::JourneyThrottleDynamicNode + + JourneyThrottleStaticNode = Courier::Models::JourneyThrottleStaticNode + + JourneyVersionItem = Courier::Models::JourneyVersionItem + + JourneyVersionsListResponse = Courier::Models::JourneyVersionsListResponse + ListDeleteParams = Courier::Models::ListDeleteParams ListFilter = Courier::Models::ListFilter diff --git a/rbi/courier/models/create_journey_request.rbi b/rbi/courier/models/create_journey_request.rbi new file mode 100644 index 00000000..bc7ec652 --- /dev/null +++ b/rbi/courier/models/create_journey_request.rbi @@ -0,0 +1,105 @@ +# typed: strong + +module Courier + module Models + class CreateJourneyRequest < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::CreateJourneyRequest, Courier::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :name + + sig do + returns( + T::Array[ + T.any( + Courier::JourneyAPIInvokeTriggerNode, + Courier::JourneySegmentTriggerNode, + Courier::JourneySendNode, + Courier::JourneyDelayDurationNode, + Courier::JourneyDelayUntilNode, + Courier::JourneyFetchGetDeleteNode, + Courier::JourneyFetchPostPutNode, + Courier::JourneyAINode, + Courier::JourneyThrottleStaticNode, + Courier::JourneyThrottleDynamicNode, + Courier::JourneyExitNode, + Courier::JourneyNode::JourneyBranchNode + ) + ] + ) + end + attr_accessor :nodes + + sig { returns(T.nilable(T::Boolean)) } + attr_reader :enabled + + sig { params(enabled: T::Boolean).void } + attr_writer :enabled + + sig { returns(T.nilable(Courier::JourneyState::OrSymbol)) } + attr_reader :state + + sig { params(state: Courier::JourneyState::OrSymbol).void } + attr_writer :state + + sig do + params( + name: String, + nodes: + T::Array[ + T.any( + Courier::JourneyAPIInvokeTriggerNode::OrHash, + Courier::JourneySegmentTriggerNode::OrHash, + Courier::JourneySendNode::OrHash, + Courier::JourneyDelayDurationNode::OrHash, + Courier::JourneyDelayUntilNode::OrHash, + Courier::JourneyFetchGetDeleteNode::OrHash, + Courier::JourneyFetchPostPutNode::OrHash, + Courier::JourneyAINode::OrHash, + Courier::JourneyThrottleStaticNode::OrHash, + Courier::JourneyThrottleDynamicNode::OrHash, + Courier::JourneyExitNode::OrHash, + Courier::JourneyNode::JourneyBranchNode::OrHash + ) + ], + enabled: T::Boolean, + state: Courier::JourneyState::OrSymbol + ).returns(T.attached_class) + end + def self.new(name:, nodes:, enabled: nil, state: nil) + end + + sig do + override.returns( + { + name: String, + nodes: + T::Array[ + T.any( + Courier::JourneyAPIInvokeTriggerNode, + Courier::JourneySegmentTriggerNode, + Courier::JourneySendNode, + Courier::JourneyDelayDurationNode, + Courier::JourneyDelayUntilNode, + Courier::JourneyFetchGetDeleteNode, + Courier::JourneyFetchPostPutNode, + Courier::JourneyAINode, + Courier::JourneyThrottleStaticNode, + Courier::JourneyThrottleDynamicNode, + Courier::JourneyExitNode, + Courier::JourneyNode::JourneyBranchNode + ) + ], + enabled: T::Boolean, + state: Courier::JourneyState::OrSymbol + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_ai_node.rbi b/rbi/courier/models/journey_ai_node.rbi new file mode 100644 index 00000000..9456c06f --- /dev/null +++ b/rbi/courier/models/journey_ai_node.rbi @@ -0,0 +1,139 @@ +# typed: strong + +module Courier + module Models + class JourneyAINode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyAINode, Courier::Internal::AnyHash) + end + + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + sig { returns(T::Hash[Symbol, T.anything]) } + attr_accessor :output_schema + + sig { returns(Courier::JourneyAINode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + sig do + returns( + T.nilable( + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + ) + ) + end + attr_reader :conditions + + sig do + params( + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).void + end + attr_writer :conditions + + sig { returns(T.nilable(String)) } + attr_reader :model + + sig { params(model: String).void } + attr_writer :model + + sig { returns(T.nilable(String)) } + attr_reader :user_prompt + + sig { params(user_prompt: String).void } + attr_writer :user_prompt + + sig { returns(T.nilable(T::Boolean)) } + attr_reader :web_search + + sig { params(web_search: T::Boolean).void } + attr_writer :web_search + + sig do + params( + output_schema: T::Hash[Symbol, T.anything], + type: Courier::JourneyAINode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ), + model: String, + user_prompt: String, + web_search: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + output_schema:, + type:, + id: nil, + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + conditions: nil, + model: nil, + user_prompt: nil, + web_search: nil + ) + end + + sig do + override.returns( + { + output_schema: T::Hash[Symbol, T.anything], + type: Courier::JourneyAINode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ), + model: String, + user_prompt: String, + web_search: T::Boolean + } + ) + end + def to_hash + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Courier::JourneyAINode::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AI = T.let(:ai, Courier::JourneyAINode::Type::TaggedSymbol) + + sig do + override.returns(T::Array[Courier::JourneyAINode::Type::TaggedSymbol]) + end + def self.values + end + end + end + end +end diff --git a/rbi/courier/models/journey_api_invoke_trigger_node.rbi b/rbi/courier/models/journey_api_invoke_trigger_node.rbi new file mode 100644 index 00000000..5403b193 --- /dev/null +++ b/rbi/courier/models/journey_api_invoke_trigger_node.rbi @@ -0,0 +1,162 @@ +# typed: strong + +module Courier + module Models + class JourneyAPIInvokeTriggerNode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyAPIInvokeTriggerNode, + Courier::Internal::AnyHash + ) + end + + sig do + returns(Courier::JourneyAPIInvokeTriggerNode::TriggerType::OrSymbol) + end + attr_accessor :trigger_type + + sig { returns(Courier::JourneyAPIInvokeTriggerNode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + sig do + returns( + T.nilable( + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + ) + ) + end + attr_reader :conditions + + sig do + params( + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).void + end + attr_writer :conditions + + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :schema + + sig { params(schema: T::Hash[Symbol, T.anything]).void } + attr_writer :schema + + sig do + params( + trigger_type: + Courier::JourneyAPIInvokeTriggerNode::TriggerType::OrSymbol, + type: Courier::JourneyAPIInvokeTriggerNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ), + schema: T::Hash[Symbol, T.anything] + ).returns(T.attached_class) + end + def self.new( + trigger_type:, + type:, + id: nil, + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + conditions: nil, + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + schema: nil + ) + end + + sig do + override.returns( + { + trigger_type: + Courier::JourneyAPIInvokeTriggerNode::TriggerType::OrSymbol, + type: Courier::JourneyAPIInvokeTriggerNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ), + schema: T::Hash[Symbol, T.anything] + } + ) + end + def to_hash + end + + module TriggerType + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyAPIInvokeTriggerNode::TriggerType) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + API_INVOKE = + T.let( + :"api-invoke", + Courier::JourneyAPIInvokeTriggerNode::TriggerType::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Courier::JourneyAPIInvokeTriggerNode::TriggerType::TaggedSymbol + ] + ) + end + def self.values + end + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyAPIInvokeTriggerNode::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TRIGGER = + T.let( + :trigger, + Courier::JourneyAPIInvokeTriggerNode::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Courier::JourneyAPIInvokeTriggerNode::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/courier/models/journey_archive_params.rbi b/rbi/courier/models/journey_archive_params.rbi new file mode 100644 index 00000000..5faff116 --- /dev/null +++ b/rbi/courier/models/journey_archive_params.rbi @@ -0,0 +1,35 @@ +# typed: strong + +module Courier + module Models + class JourneyArchiveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Courier::JourneyArchiveParams, Courier::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :template_id + + sig do + params( + template_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, request_options: {}) + end + + sig do + override.returns( + { template_id: String, request_options: Courier::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_condition_atom.rbi b/rbi/courier/models/journey_condition_atom.rbi new file mode 100644 index 00000000..5a2c49ca --- /dev/null +++ b/rbi/courier/models/journey_condition_atom.rbi @@ -0,0 +1,11 @@ +# typed: strong + +module Courier + module Models + JourneyConditionAtom = + T.let( + Courier::Internal::Type::ArrayOf[String], + Courier::Internal::Type::Converter + ) + end +end diff --git a/rbi/courier/models/journey_condition_group.rbi b/rbi/courier/models/journey_condition_group.rbi new file mode 100644 index 00000000..0306cd9a --- /dev/null +++ b/rbi/courier/models/journey_condition_group.rbi @@ -0,0 +1,43 @@ +# typed: strong + +module Courier + module Models + class JourneyConditionGroup < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyConditionGroup, Courier::Internal::AnyHash) + end + + sig { returns(T.nilable(T::Array[T::Array[String]])) } + attr_reader :and_ + + sig { params(and_: T::Array[T::Array[String]]).void } + attr_writer :and_ + + sig { returns(T.nilable(T::Array[T::Array[String]])) } + attr_reader :or_ + + sig { params(or_: T::Array[T::Array[String]]).void } + attr_writer :or_ + + # A leaf condition group. Exactly one of `AND` or `OR` must be present at runtime; + # each is a list of `JourneyConditionAtom` tuples. + sig do + params( + and_: T::Array[T::Array[String]], + or_: T::Array[T::Array[String]] + ).returns(T.attached_class) + end + def self.new(and_: nil, or_: nil) + end + + sig do + override.returns( + { and_: T::Array[T::Array[String]], or_: T::Array[T::Array[String]] } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_condition_nested_group.rbi b/rbi/courier/models/journey_condition_nested_group.rbi new file mode 100644 index 00000000..eb1dd217 --- /dev/null +++ b/rbi/courier/models/journey_condition_nested_group.rbi @@ -0,0 +1,51 @@ +# typed: strong + +module Courier + module Models + class JourneyConditionNestedGroup < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyConditionNestedGroup, + Courier::Internal::AnyHash + ) + end + + sig { returns(T.nilable(T::Array[Courier::JourneyConditionGroup])) } + attr_reader :and_ + + sig do + params(and_: T::Array[Courier::JourneyConditionGroup::OrHash]).void + end + attr_writer :and_ + + sig { returns(T.nilable(T::Array[Courier::JourneyConditionGroup])) } + attr_reader :or_ + + sig { params(or_: T::Array[Courier::JourneyConditionGroup::OrHash]).void } + attr_writer :or_ + + # A nested condition group. Exactly one of `AND` or `OR` must be present at + # runtime; each is a list of `JourneyConditionGroup` items. + sig do + params( + and_: T::Array[Courier::JourneyConditionGroup::OrHash], + or_: T::Array[Courier::JourneyConditionGroup::OrHash] + ).returns(T.attached_class) + end + def self.new(and_: nil, or_: nil) + end + + sig do + override.returns( + { + and_: T::Array[Courier::JourneyConditionGroup], + or_: T::Array[Courier::JourneyConditionGroup] + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_conditions_field.rbi b/rbi/courier/models/journey_conditions_field.rbi new file mode 100644 index 00000000..950f194f --- /dev/null +++ b/rbi/courier/models/journey_conditions_field.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Courier + module Models + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + module JourneyConditionsField + extend Courier::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + end + + sig do + override.returns(T::Array[Courier::JourneyConditionsField::Variants]) + end + def self.variants + end + end + end +end diff --git a/rbi/courier/models/journey_create_params.rbi b/rbi/courier/models/journey_create_params.rbi new file mode 100644 index 00000000..ad84e882 --- /dev/null +++ b/rbi/courier/models/journey_create_params.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Courier + module Models + class JourneyCreateParams < Courier::Models::CreateJourneyRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Courier::JourneyCreateParams, Courier::Internal::AnyHash) + end + + sig do + params(request_options: Courier::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Courier::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_delay_duration_node.rbi b/rbi/courier/models/journey_delay_duration_node.rbi new file mode 100644 index 00000000..ebecb813 --- /dev/null +++ b/rbi/courier/models/journey_delay_duration_node.rbi @@ -0,0 +1,145 @@ +# typed: strong + +module Courier + module Models + class JourneyDelayDurationNode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyDelayDurationNode, Courier::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :duration + + sig { returns(Courier::JourneyDelayDurationNode::Mode::OrSymbol) } + attr_accessor :mode + + sig { returns(Courier::JourneyDelayDurationNode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + sig do + returns( + T.nilable( + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + ) + ) + end + attr_reader :conditions + + sig do + params( + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).void + end + attr_writer :conditions + + sig do + params( + duration: String, + mode: Courier::JourneyDelayDurationNode::Mode::OrSymbol, + type: Courier::JourneyDelayDurationNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).returns(T.attached_class) + end + def self.new( + duration:, + mode:, + type:, + id: nil, + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + conditions: nil + ) + end + + sig do + override.returns( + { + duration: String, + mode: Courier::JourneyDelayDurationNode::Mode::OrSymbol, + type: Courier::JourneyDelayDurationNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + } + ) + end + def to_hash + end + + module Mode + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyDelayDurationNode::Mode) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DURATION = + T.let( + :duration, + Courier::JourneyDelayDurationNode::Mode::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Courier::JourneyDelayDurationNode::Mode::TaggedSymbol] + ) + end + def self.values + end + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyDelayDurationNode::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DELAY = + T.let(:delay, Courier::JourneyDelayDurationNode::Type::TaggedSymbol) + + sig do + override.returns( + T::Array[Courier::JourneyDelayDurationNode::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/courier/models/journey_delay_until_node.rbi b/rbi/courier/models/journey_delay_until_node.rbi new file mode 100644 index 00000000..f6f908c4 --- /dev/null +++ b/rbi/courier/models/journey_delay_until_node.rbi @@ -0,0 +1,138 @@ +# typed: strong + +module Courier + module Models + class JourneyDelayUntilNode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyDelayUntilNode, Courier::Internal::AnyHash) + end + + sig { returns(Courier::JourneyDelayUntilNode::Mode::OrSymbol) } + attr_accessor :mode + + sig { returns(Courier::JourneyDelayUntilNode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(String) } + attr_accessor :until_ + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + sig do + returns( + T.nilable( + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + ) + ) + end + attr_reader :conditions + + sig do + params( + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).void + end + attr_writer :conditions + + sig do + params( + mode: Courier::JourneyDelayUntilNode::Mode::OrSymbol, + type: Courier::JourneyDelayUntilNode::Type::OrSymbol, + until_: String, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).returns(T.attached_class) + end + def self.new( + mode:, + type:, + until_:, + id: nil, + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + conditions: nil + ) + end + + sig do + override.returns( + { + mode: Courier::JourneyDelayUntilNode::Mode::OrSymbol, + type: Courier::JourneyDelayUntilNode::Type::OrSymbol, + until_: String, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + } + ) + end + def to_hash + end + + module Mode + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Courier::JourneyDelayUntilNode::Mode) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + UNTIL = + T.let(:until, Courier::JourneyDelayUntilNode::Mode::TaggedSymbol) + + sig do + override.returns( + T::Array[Courier::JourneyDelayUntilNode::Mode::TaggedSymbol] + ) + end + def self.values + end + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Courier::JourneyDelayUntilNode::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DELAY = + T.let(:delay, Courier::JourneyDelayUntilNode::Type::TaggedSymbol) + + sig do + override.returns( + T::Array[Courier::JourneyDelayUntilNode::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/courier/models/journey_exit_node.rbi b/rbi/courier/models/journey_exit_node.rbi new file mode 100644 index 00000000..93051525 --- /dev/null +++ b/rbi/courier/models/journey_exit_node.rbi @@ -0,0 +1,56 @@ +# typed: strong + +module Courier + module Models + class JourneyExitNode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyExitNode, Courier::Internal::AnyHash) + end + + sig { returns(Courier::JourneyExitNode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + sig do + params( + type: Courier::JourneyExitNode::Type::OrSymbol, + id: String + ).returns(T.attached_class) + end + def self.new(type:, id: nil) + end + + sig do + override.returns( + { type: Courier::JourneyExitNode::Type::OrSymbol, id: String } + ) + end + def to_hash + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Courier::JourneyExitNode::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + EXIT = T.let(:exit, Courier::JourneyExitNode::Type::TaggedSymbol) + + sig do + override.returns( + T::Array[Courier::JourneyExitNode::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/courier/models/journey_fetch_get_delete_node.rbi b/rbi/courier/models/journey_fetch_get_delete_node.rbi new file mode 100644 index 00000000..469bed24 --- /dev/null +++ b/rbi/courier/models/journey_fetch_get_delete_node.rbi @@ -0,0 +1,182 @@ +# typed: strong + +module Courier + module Models + class JourneyFetchGetDeleteNode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyFetchGetDeleteNode, Courier::Internal::AnyHash) + end + + sig { returns(Courier::JourneyMergeStrategy::OrSymbol) } + attr_accessor :merge_strategy + + sig { returns(Courier::JourneyFetchGetDeleteNode::Method::OrSymbol) } + attr_accessor :method_ + + sig { returns(Courier::JourneyFetchGetDeleteNode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(String) } + attr_accessor :url + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + sig do + returns( + T.nilable( + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + ) + ) + end + attr_reader :conditions + + sig do + params( + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).void + end + attr_writer :conditions + + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :headers + + sig { params(headers: T::Hash[Symbol, String]).void } + attr_writer :headers + + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :query_params + + sig { params(query_params: T::Hash[Symbol, String]).void } + attr_writer :query_params + + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :response_schema + + sig { params(response_schema: T::Hash[Symbol, T.anything]).void } + attr_writer :response_schema + + sig do + params( + merge_strategy: Courier::JourneyMergeStrategy::OrSymbol, + method_: Courier::JourneyFetchGetDeleteNode::Method::OrSymbol, + type: Courier::JourneyFetchGetDeleteNode::Type::OrSymbol, + url: String, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ), + headers: T::Hash[Symbol, String], + query_params: T::Hash[Symbol, String], + response_schema: T::Hash[Symbol, T.anything] + ).returns(T.attached_class) + end + def self.new( + merge_strategy:, + method_:, + type:, + url:, + id: nil, + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + conditions: nil, + headers: nil, + query_params: nil, + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + response_schema: nil + ) + end + + sig do + override.returns( + { + merge_strategy: Courier::JourneyMergeStrategy::OrSymbol, + method_: Courier::JourneyFetchGetDeleteNode::Method::OrSymbol, + type: Courier::JourneyFetchGetDeleteNode::Type::OrSymbol, + url: String, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ), + headers: T::Hash[Symbol, String], + query_params: T::Hash[Symbol, String], + response_schema: T::Hash[Symbol, T.anything] + } + ) + end + def to_hash + end + + module Method + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyFetchGetDeleteNode::Method) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GET = + T.let(:get, Courier::JourneyFetchGetDeleteNode::Method::TaggedSymbol) + DELETE = + T.let( + :delete, + Courier::JourneyFetchGetDeleteNode::Method::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Courier::JourneyFetchGetDeleteNode::Method::TaggedSymbol] + ) + end + def self.values + end + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyFetchGetDeleteNode::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + FETCH = + T.let(:fetch, Courier::JourneyFetchGetDeleteNode::Type::TaggedSymbol) + + sig do + override.returns( + T::Array[Courier::JourneyFetchGetDeleteNode::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/courier/models/journey_fetch_post_put_node.rbi b/rbi/courier/models/journey_fetch_post_put_node.rbi new file mode 100644 index 00000000..ffbf3094 --- /dev/null +++ b/rbi/courier/models/journey_fetch_post_put_node.rbi @@ -0,0 +1,186 @@ +# typed: strong + +module Courier + module Models + class JourneyFetchPostPutNode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyFetchPostPutNode, Courier::Internal::AnyHash) + end + + sig { returns(Courier::JourneyMergeStrategy::OrSymbol) } + attr_accessor :merge_strategy + + sig { returns(Courier::JourneyFetchPostPutNode::Method::OrSymbol) } + attr_accessor :method_ + + sig { returns(Courier::JourneyFetchPostPutNode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(String) } + attr_accessor :url + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + sig { returns(T.nilable(String)) } + attr_reader :body + + sig { params(body: String).void } + attr_writer :body + + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + sig do + returns( + T.nilable( + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + ) + ) + end + attr_reader :conditions + + sig do + params( + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).void + end + attr_writer :conditions + + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :headers + + sig { params(headers: T::Hash[Symbol, String]).void } + attr_writer :headers + + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :query_params + + sig { params(query_params: T::Hash[Symbol, String]).void } + attr_writer :query_params + + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :response_schema + + sig { params(response_schema: T::Hash[Symbol, T.anything]).void } + attr_writer :response_schema + + sig do + params( + merge_strategy: Courier::JourneyMergeStrategy::OrSymbol, + method_: Courier::JourneyFetchPostPutNode::Method::OrSymbol, + type: Courier::JourneyFetchPostPutNode::Type::OrSymbol, + url: String, + id: String, + body: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ), + headers: T::Hash[Symbol, String], + query_params: T::Hash[Symbol, String], + response_schema: T::Hash[Symbol, T.anything] + ).returns(T.attached_class) + end + def self.new( + merge_strategy:, + method_:, + type:, + url:, + id: nil, + body: nil, + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + conditions: nil, + headers: nil, + query_params: nil, + # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. + response_schema: nil + ) + end + + sig do + override.returns( + { + merge_strategy: Courier::JourneyMergeStrategy::OrSymbol, + method_: Courier::JourneyFetchPostPutNode::Method::OrSymbol, + type: Courier::JourneyFetchPostPutNode::Type::OrSymbol, + url: String, + id: String, + body: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ), + headers: T::Hash[Symbol, String], + query_params: T::Hash[Symbol, String], + response_schema: T::Hash[Symbol, T.anything] + } + ) + end + def to_hash + end + + module Method + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyFetchPostPutNode::Method) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + POST = + T.let(:post, Courier::JourneyFetchPostPutNode::Method::TaggedSymbol) + PUT = + T.let(:put, Courier::JourneyFetchPostPutNode::Method::TaggedSymbol) + + sig do + override.returns( + T::Array[Courier::JourneyFetchPostPutNode::Method::TaggedSymbol] + ) + end + def self.values + end + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Courier::JourneyFetchPostPutNode::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + FETCH = + T.let(:fetch, Courier::JourneyFetchPostPutNode::Type::TaggedSymbol) + + sig do + override.returns( + T::Array[Courier::JourneyFetchPostPutNode::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/courier/models/journey_list_versions_params.rbi b/rbi/courier/models/journey_list_versions_params.rbi new file mode 100644 index 00000000..2fc08093 --- /dev/null +++ b/rbi/courier/models/journey_list_versions_params.rbi @@ -0,0 +1,35 @@ +# typed: strong + +module Courier + module Models + class JourneyListVersionsParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Courier::JourneyListVersionsParams, Courier::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :template_id + + sig do + params( + template_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, request_options: {}) + end + + sig do + override.returns( + { template_id: String, request_options: Courier::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_merge_strategy.rbi b/rbi/courier/models/journey_merge_strategy.rbi new file mode 100644 index 00000000..90eed017 --- /dev/null +++ b/rbi/courier/models/journey_merge_strategy.rbi @@ -0,0 +1,25 @@ +# typed: strong + +module Courier + module Models + module JourneyMergeStrategy + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Courier::JourneyMergeStrategy) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + OVERWRITE = T.let(:overwrite, Courier::JourneyMergeStrategy::TaggedSymbol) + SOFT_MERGE = + T.let(:"soft-merge", Courier::JourneyMergeStrategy::TaggedSymbol) + REPLACE = T.let(:replace, Courier::JourneyMergeStrategy::TaggedSymbol) + NONE = T.let(:none, Courier::JourneyMergeStrategy::TaggedSymbol) + + sig do + override.returns(T::Array[Courier::JourneyMergeStrategy::TaggedSymbol]) + end + def self.values + end + end + end +end diff --git a/rbi/courier/models/journey_node.rbi b/rbi/courier/models/journey_node.rbi new file mode 100644 index 00000000..465977f6 --- /dev/null +++ b/rbi/courier/models/journey_node.rbi @@ -0,0 +1,231 @@ +# typed: strong + +module Courier + module Models + # A single node in a journey DAG. Discriminated by `type` plus a secondary + # discriminator on some variants (`trigger_type` for trigger, `mode` for delay, + # `method` for fetch, `scope` for throttle). Each variant is exported as a + # separate schema for SDK type quality. + module JourneyNode + extend Courier::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Courier::JourneyAPIInvokeTriggerNode, + Courier::JourneySegmentTriggerNode, + Courier::JourneySendNode, + Courier::JourneyDelayDurationNode, + Courier::JourneyDelayUntilNode, + Courier::JourneyFetchGetDeleteNode, + Courier::JourneyFetchPostPutNode, + Courier::JourneyAINode, + Courier::JourneyThrottleStaticNode, + Courier::JourneyThrottleDynamicNode, + Courier::JourneyExitNode, + Courier::JourneyNode::JourneyBranchNode + ) + end + + class JourneyBranchNode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyNode::JourneyBranchNode, + Courier::Internal::AnyHash + ) + end + + sig { returns(Courier::JourneyNode::JourneyBranchNode::Default) } + attr_reader :default + + sig do + params( + default: Courier::JourneyNode::JourneyBranchNode::Default::OrHash + ).void + end + attr_writer :default + + sig { returns(T::Array[Courier::JourneyNode::JourneyBranchNode::Path]) } + attr_accessor :paths + + sig { returns(Courier::JourneyNode::JourneyBranchNode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Branch node. Routes to one of `paths[]` whose `conditions` match, else falls + # through to `default.nodes`. Inlined rather than referenced so the recursive + # `nodes: JourneyNode[]` cycle stays within a single generated module (Stainless + # Python forward-ref resolution does not span modules well for this recursion + # shape). + sig do + params( + default: Courier::JourneyNode::JourneyBranchNode::Default::OrHash, + paths: + T::Array[Courier::JourneyNode::JourneyBranchNode::Path::OrHash], + type: Courier::JourneyNode::JourneyBranchNode::Type::OrSymbol, + id: String + ).returns(T.attached_class) + end + def self.new(default:, paths:, type:, id: nil) + end + + sig do + override.returns( + { + default: Courier::JourneyNode::JourneyBranchNode::Default, + paths: T::Array[Courier::JourneyNode::JourneyBranchNode::Path], + type: Courier::JourneyNode::JourneyBranchNode::Type::OrSymbol, + id: String + } + ) + end + def to_hash + end + + class Default < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyNode::JourneyBranchNode::Default, + Courier::Internal::AnyHash + ) + end + + sig { returns(T::Array[Courier::JourneyNode]) } + attr_accessor :nodes + + sig { returns(T.nilable(String)) } + attr_reader :label + + sig { params(label: String).void } + attr_writer :label + + sig do + params( + nodes: T::Array[Courier::JourneyNode], + label: String + ).returns(T.attached_class) + end + def self.new(nodes:, label: nil) + end + + sig do + override.returns( + { nodes: T::Array[Courier::JourneyNode], label: String } + ) + end + def to_hash + end + end + + class Path < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyNode::JourneyBranchNode::Path, + Courier::Internal::AnyHash + ) + end + + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + sig do + returns( + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + ) + end + attr_accessor :conditions + + sig { returns(T::Array[Courier::JourneyNode]) } + attr_accessor :nodes + + sig { returns(T.nilable(String)) } + attr_reader :label + + sig { params(label: String).void } + attr_writer :label + + sig do + params( + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ), + nodes: T::Array[Courier::JourneyNode], + label: String + ).returns(T.attached_class) + end + def self.new( + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + conditions:, + nodes:, + label: nil + ) + end + + sig do + override.returns( + { + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ), + nodes: T::Array[Courier::JourneyNode], + label: String + } + ) + end + def to_hash + end + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyNode::JourneyBranchNode::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + BRANCH = + T.let( + :branch, + Courier::JourneyNode::JourneyBranchNode::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Courier::JourneyNode::JourneyBranchNode::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + sig { override.returns(T::Array[Courier::JourneyNode::Variants]) } + def self.variants + end + end + end +end diff --git a/rbi/courier/models/journey_publish_params.rbi b/rbi/courier/models/journey_publish_params.rbi new file mode 100644 index 00000000..5687c690 --- /dev/null +++ b/rbi/courier/models/journey_publish_params.rbi @@ -0,0 +1,35 @@ +# typed: strong + +module Courier + module Models + class JourneyPublishParams < Courier::Models::JourneyPublishRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Courier::JourneyPublishParams, Courier::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :template_id + + sig do + params( + template_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, request_options: {}) + end + + sig do + override.returns( + { template_id: String, request_options: Courier::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_publish_request.rbi b/rbi/courier/models/journey_publish_request.rbi new file mode 100644 index 00000000..43c56e4f --- /dev/null +++ b/rbi/courier/models/journey_publish_request.rbi @@ -0,0 +1,26 @@ +# typed: strong + +module Courier + module Models + class JourneyPublishRequest < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyPublishRequest, Courier::Internal::AnyHash) + end + + sig { returns(T.nilable(String)) } + attr_reader :version + + sig { params(version: String).void } + attr_writer :version + + sig { params(version: String).returns(T.attached_class) } + def self.new(version: nil) + end + + sig { override.returns({ version: String }) } + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_replace_params.rbi b/rbi/courier/models/journey_replace_params.rbi new file mode 100644 index 00000000..c456679d --- /dev/null +++ b/rbi/courier/models/journey_replace_params.rbi @@ -0,0 +1,35 @@ +# typed: strong + +module Courier + module Models + class JourneyReplaceParams < Courier::Models::CreateJourneyRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Courier::JourneyReplaceParams, Courier::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :template_id + + sig do + params( + template_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, request_options: {}) + end + + sig do + override.returns( + { template_id: String, request_options: Courier::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_response.rbi b/rbi/courier/models/journey_response.rbi new file mode 100644 index 00000000..8afa398a --- /dev/null +++ b/rbi/courier/models/journey_response.rbi @@ -0,0 +1,105 @@ +# typed: strong + +module Courier + module Models + class JourneyResponse < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyResponse, Courier::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :id + + sig { returns(T.nilable(Integer)) } + attr_accessor :created + + sig { returns(T.nilable(String)) } + attr_accessor :creator + + sig { returns(T::Boolean) } + attr_accessor :enabled + + sig { returns(String) } + attr_accessor :name + + sig { returns(T::Array[Courier::JourneyNode::Variants]) } + attr_accessor :nodes + + sig { returns(T.nilable(Integer)) } + attr_accessor :published + + sig { returns(Courier::JourneyState::TaggedSymbol) } + attr_accessor :state + + sig { returns(T.nilable(Integer)) } + attr_accessor :updated + + sig { returns(T.nilable(String)) } + attr_accessor :updater + + sig do + params( + id: String, + created: T.nilable(Integer), + creator: T.nilable(String), + enabled: T::Boolean, + name: String, + nodes: + T::Array[ + T.any( + Courier::JourneyAPIInvokeTriggerNode::OrHash, + Courier::JourneySegmentTriggerNode::OrHash, + Courier::JourneySendNode::OrHash, + Courier::JourneyDelayDurationNode::OrHash, + Courier::JourneyDelayUntilNode::OrHash, + Courier::JourneyFetchGetDeleteNode::OrHash, + Courier::JourneyFetchPostPutNode::OrHash, + Courier::JourneyAINode::OrHash, + Courier::JourneyThrottleStaticNode::OrHash, + Courier::JourneyThrottleDynamicNode::OrHash, + Courier::JourneyExitNode::OrHash, + Courier::JourneyNode::JourneyBranchNode::OrHash + ) + ], + published: T.nilable(Integer), + state: Courier::JourneyState::OrSymbol, + updated: T.nilable(Integer), + updater: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + id:, + created:, + creator:, + enabled:, + name:, + nodes:, + published:, + state:, + updated:, + updater: + ) + end + + sig do + override.returns( + { + id: String, + created: T.nilable(Integer), + creator: T.nilable(String), + enabled: T::Boolean, + name: String, + nodes: T::Array[Courier::JourneyNode::Variants], + published: T.nilable(Integer), + state: Courier::JourneyState::TaggedSymbol, + updated: T.nilable(Integer), + updater: T.nilable(String) + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_retrieve_params.rbi b/rbi/courier/models/journey_retrieve_params.rbi new file mode 100644 index 00000000..4bf07902 --- /dev/null +++ b/rbi/courier/models/journey_retrieve_params.rbi @@ -0,0 +1,46 @@ +# typed: strong + +module Courier + module Models + class JourneyRetrieveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Courier::JourneyRetrieveParams, Courier::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :template_id + + sig { returns(T.nilable(String)) } + attr_reader :version + + sig { params(version: String).void } + attr_writer :version + + sig do + params( + template_id: String, + version: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, version: nil, request_options: {}) + end + + sig do + override.returns( + { + template_id: String, + version: String, + request_options: Courier::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_segment_trigger_node.rbi b/rbi/courier/models/journey_segment_trigger_node.rbi new file mode 100644 index 00000000..9e6b06dd --- /dev/null +++ b/rbi/courier/models/journey_segment_trigger_node.rbi @@ -0,0 +1,199 @@ +# typed: strong + +module Courier + module Models + class JourneySegmentTriggerNode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneySegmentTriggerNode, Courier::Internal::AnyHash) + end + + sig { returns(Courier::JourneySegmentTriggerNode::RequestType::OrSymbol) } + attr_accessor :request_type + + sig { returns(Courier::JourneySegmentTriggerNode::TriggerType::OrSymbol) } + attr_accessor :trigger_type + + sig { returns(Courier::JourneySegmentTriggerNode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + sig do + returns( + T.nilable( + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + ) + ) + end + attr_reader :conditions + + sig do + params( + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).void + end + attr_writer :conditions + + sig { returns(T.nilable(String)) } + attr_reader :event_id + + sig { params(event_id: String).void } + attr_writer :event_id + + sig do + params( + request_type: + Courier::JourneySegmentTriggerNode::RequestType::OrSymbol, + trigger_type: + Courier::JourneySegmentTriggerNode::TriggerType::OrSymbol, + type: Courier::JourneySegmentTriggerNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ), + event_id: String + ).returns(T.attached_class) + end + def self.new( + request_type:, + trigger_type:, + type:, + id: nil, + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + conditions: nil, + event_id: nil + ) + end + + sig do + override.returns( + { + request_type: + Courier::JourneySegmentTriggerNode::RequestType::OrSymbol, + trigger_type: + Courier::JourneySegmentTriggerNode::TriggerType::OrSymbol, + type: Courier::JourneySegmentTriggerNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ), + event_id: String + } + ) + end + def to_hash + end + + module RequestType + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneySegmentTriggerNode::RequestType) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + IDENTIFY = + T.let( + :identify, + Courier::JourneySegmentTriggerNode::RequestType::TaggedSymbol + ) + GROUP = + T.let( + :group, + Courier::JourneySegmentTriggerNode::RequestType::TaggedSymbol + ) + TRACK = + T.let( + :track, + Courier::JourneySegmentTriggerNode::RequestType::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Courier::JourneySegmentTriggerNode::RequestType::TaggedSymbol + ] + ) + end + def self.values + end + end + + module TriggerType + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneySegmentTriggerNode::TriggerType) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SEGMENT = + T.let( + :segment, + Courier::JourneySegmentTriggerNode::TriggerType::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Courier::JourneySegmentTriggerNode::TriggerType::TaggedSymbol + ] + ) + end + def self.values + end + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneySegmentTriggerNode::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TRIGGER = + T.let( + :trigger, + Courier::JourneySegmentTriggerNode::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Courier::JourneySegmentTriggerNode::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/courier/models/journey_send_node.rbi b/rbi/courier/models/journey_send_node.rbi new file mode 100644 index 00000000..1ba7ab0d --- /dev/null +++ b/rbi/courier/models/journey_send_node.rbi @@ -0,0 +1,252 @@ +# typed: strong + +module Courier + module Models + class JourneySendNode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneySendNode, Courier::Internal::AnyHash) + end + + sig { returns(Courier::JourneySendNode::Message) } + attr_reader :message + + sig { params(message: Courier::JourneySendNode::Message::OrHash).void } + attr_writer :message + + sig { returns(Courier::JourneySendNode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + sig do + returns( + T.nilable( + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + ) + ) + end + attr_reader :conditions + + sig do + params( + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).void + end + attr_writer :conditions + + sig do + params( + message: Courier::JourneySendNode::Message::OrHash, + type: Courier::JourneySendNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).returns(T.attached_class) + end + def self.new( + message:, + type:, + id: nil, + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + conditions: nil + ) + end + + sig do + override.returns( + { + message: Courier::JourneySendNode::Message, + type: Courier::JourneySendNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + } + ) + end + def to_hash + end + + class Message < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneySendNode::Message, Courier::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :template + + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :data + + sig { params(data: T::Hash[Symbol, T.anything]).void } + attr_writer :data + + sig { returns(T.nilable(Courier::JourneySendNode::Message::Delay)) } + attr_reader :delay + + sig do + params(delay: Courier::JourneySendNode::Message::Delay::OrHash).void + end + attr_writer :delay + + sig { returns(T.nilable(Courier::JourneySendNode::Message::To)) } + attr_reader :to + + sig { params(to: Courier::JourneySendNode::Message::To::OrHash).void } + attr_writer :to + + sig do + params( + template: String, + data: T::Hash[Symbol, T.anything], + delay: Courier::JourneySendNode::Message::Delay::OrHash, + to: Courier::JourneySendNode::Message::To::OrHash + ).returns(T.attached_class) + end + def self.new(template:, data: nil, delay: nil, to: nil) + end + + sig do + override.returns( + { + template: String, + data: T::Hash[Symbol, T.anything], + delay: Courier::JourneySendNode::Message::Delay, + to: Courier::JourneySendNode::Message::To + } + ) + end + def to_hash + end + + class Delay < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneySendNode::Message::Delay, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :until_ + + sig { returns(T.nilable(String)) } + attr_reader :timezone + + sig { params(timezone: String).void } + attr_writer :timezone + + sig do + params(until_: String, timezone: String).returns(T.attached_class) + end + def self.new(until_:, timezone: nil) + end + + sig { override.returns({ until_: String, timezone: String }) } + def to_hash + end + end + + class To < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneySendNode::Message::To, + Courier::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :email_override + + sig { params(email_override: String).void } + attr_writer :email_override + + sig { returns(T.nilable(String)) } + attr_reader :phone_number_override + + sig { params(phone_number_override: String).void } + attr_writer :phone_number_override + + sig { returns(T.nilable(String)) } + attr_reader :user_id_override + + sig { params(user_id_override: String).void } + attr_writer :user_id_override + + sig do + params( + email_override: String, + phone_number_override: String, + user_id_override: String + ).returns(T.attached_class) + end + def self.new( + email_override: nil, + phone_number_override: nil, + user_id_override: nil + ) + end + + sig do + override.returns( + { + email_override: String, + phone_number_override: String, + user_id_override: String + } + ) + end + def to_hash + end + end + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Courier::JourneySendNode::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SEND = T.let(:send, Courier::JourneySendNode::Type::TaggedSymbol) + + sig do + override.returns( + T::Array[Courier::JourneySendNode::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/courier/models/journey_state.rbi b/rbi/courier/models/journey_state.rbi new file mode 100644 index 00000000..34de01da --- /dev/null +++ b/rbi/courier/models/journey_state.rbi @@ -0,0 +1,19 @@ +# typed: strong + +module Courier + module Models + module JourneyState + extend Courier::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, Courier::JourneyState) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DRAFT = T.let(:DRAFT, Courier::JourneyState::TaggedSymbol) + PUBLISHED = T.let(:PUBLISHED, Courier::JourneyState::TaggedSymbol) + + sig { override.returns(T::Array[Courier::JourneyState::TaggedSymbol]) } + def self.values + end + end + end +end diff --git a/rbi/courier/models/journey_template_create_request.rbi b/rbi/courier/models/journey_template_create_request.rbi new file mode 100644 index 00000000..8d5f88ab --- /dev/null +++ b/rbi/courier/models/journey_template_create_request.rbi @@ -0,0 +1,380 @@ +# typed: strong + +module Courier + module Models + class JourneyTemplateCreateRequest < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateCreateRequest, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :channel + + sig { returns(Courier::JourneyTemplateCreateRequest::Notification) } + attr_reader :notification + + sig do + params( + notification: + Courier::JourneyTemplateCreateRequest::Notification::OrHash + ).void + end + attr_writer :notification + + sig { returns(T.nilable(String)) } + attr_reader :provider_key + + sig { params(provider_key: String).void } + attr_writer :provider_key + + sig { returns(T.nilable(String)) } + attr_reader :state + + sig { params(state: String).void } + attr_writer :state + + sig do + params( + channel: String, + notification: + Courier::JourneyTemplateCreateRequest::Notification::OrHash, + provider_key: String, + state: String + ).returns(T.attached_class) + end + def self.new(channel:, notification:, provider_key: nil, state: nil) + end + + sig do + override.returns( + { + channel: String, + notification: Courier::JourneyTemplateCreateRequest::Notification, + provider_key: String, + state: String + } + ) + end + def to_hash + end + + class Notification < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateCreateRequest::Notification, + Courier::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + Courier::JourneyTemplateCreateRequest::Notification::Brand + ) + ) + end + attr_reader :brand + + sig do + params( + brand: + T.nilable( + Courier::JourneyTemplateCreateRequest::Notification::Brand::OrHash + ) + ).void + end + attr_writer :brand + + sig do + returns(Courier::JourneyTemplateCreateRequest::Notification::Content) + end + attr_reader :content + + sig do + params( + content: + Courier::JourneyTemplateCreateRequest::Notification::Content::OrHash + ).void + end + attr_writer :content + + sig { returns(String) } + attr_accessor :name + + sig do + returns( + T.nilable( + Courier::JourneyTemplateCreateRequest::Notification::Subscription + ) + ) + end + attr_reader :subscription + + sig do + params( + subscription: + T.nilable( + Courier::JourneyTemplateCreateRequest::Notification::Subscription::OrHash + ) + ).void + end + attr_writer :subscription + + sig { returns(T::Array[String]) } + attr_accessor :tags + + sig do + params( + brand: + T.nilable( + Courier::JourneyTemplateCreateRequest::Notification::Brand::OrHash + ), + content: + Courier::JourneyTemplateCreateRequest::Notification::Content::OrHash, + name: String, + subscription: + T.nilable( + Courier::JourneyTemplateCreateRequest::Notification::Subscription::OrHash + ), + tags: T::Array[String] + ).returns(T.attached_class) + end + def self.new(brand:, content:, name:, subscription:, tags:) + end + + sig do + override.returns( + { + brand: + T.nilable( + Courier::JourneyTemplateCreateRequest::Notification::Brand + ), + content: + Courier::JourneyTemplateCreateRequest::Notification::Content, + name: String, + subscription: + T.nilable( + Courier::JourneyTemplateCreateRequest::Notification::Subscription + ), + tags: T::Array[String] + } + ) + end + def to_hash + end + + class Brand < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateCreateRequest::Notification::Brand, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig { params(id: String).returns(T.attached_class) } + def self.new(id:) + end + + sig { override.returns({ id: String }) } + def to_hash + end + end + + class Content < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateCreateRequest::Notification::Content, + Courier::Internal::AnyHash + ) + end + + sig do + returns( + T::Array[ + T.any( + Courier::ElementalTextNodeWithType, + Courier::ElementalMetaNodeWithType, + Courier::ElementalChannelNodeWithType, + Courier::ElementalImageNodeWithType, + Courier::ElementalActionNodeWithType, + Courier::ElementalDividerNodeWithType, + Courier::ElementalQuoteNodeWithType, + Courier::ElementalHTMLNodeWithType + ) + ] + ) + end + attr_accessor :elements + + sig do + returns( + Courier::JourneyTemplateCreateRequest::Notification::Content::Version::OrSymbol + ) + end + attr_accessor :version + + sig do + returns( + T.nilable( + Courier::JourneyTemplateCreateRequest::Notification::Content::Scope::OrSymbol + ) + ) + end + attr_reader :scope + + sig do + params( + scope: + Courier::JourneyTemplateCreateRequest::Notification::Content::Scope::OrSymbol + ).void + end + attr_writer :scope + + sig do + params( + elements: + T::Array[ + T.any( + Courier::ElementalTextNodeWithType::OrHash, + Courier::ElementalMetaNodeWithType::OrHash, + Courier::ElementalChannelNodeWithType::OrHash, + Courier::ElementalImageNodeWithType::OrHash, + Courier::ElementalActionNodeWithType::OrHash, + Courier::ElementalDividerNodeWithType::OrHash, + Courier::ElementalQuoteNodeWithType::OrHash, + Courier::ElementalHTMLNodeWithType::OrHash + ) + ], + version: + Courier::JourneyTemplateCreateRequest::Notification::Content::Version::OrSymbol, + scope: + Courier::JourneyTemplateCreateRequest::Notification::Content::Scope::OrSymbol + ).returns(T.attached_class) + end + def self.new(elements:, version:, scope: nil) + end + + sig do + override.returns( + { + elements: + T::Array[ + T.any( + Courier::ElementalTextNodeWithType, + Courier::ElementalMetaNodeWithType, + Courier::ElementalChannelNodeWithType, + Courier::ElementalImageNodeWithType, + Courier::ElementalActionNodeWithType, + Courier::ElementalDividerNodeWithType, + Courier::ElementalQuoteNodeWithType, + Courier::ElementalHTMLNodeWithType + ) + ], + version: + Courier::JourneyTemplateCreateRequest::Notification::Content::Version::OrSymbol, + scope: + Courier::JourneyTemplateCreateRequest::Notification::Content::Scope::OrSymbol + } + ) + end + def to_hash + end + + module Version + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Courier::JourneyTemplateCreateRequest::Notification::Content::Version + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + VERSION_2022_01_01 = + T.let( + :"2022-01-01", + Courier::JourneyTemplateCreateRequest::Notification::Content::Version::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Courier::JourneyTemplateCreateRequest::Notification::Content::Version::TaggedSymbol + ] + ) + end + def self.values + end + end + + module Scope + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Courier::JourneyTemplateCreateRequest::Notification::Content::Scope + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DEFAULT = + T.let( + :default, + Courier::JourneyTemplateCreateRequest::Notification::Content::Scope::TaggedSymbol + ) + STRICT = + T.let( + :strict, + Courier::JourneyTemplateCreateRequest::Notification::Content::Scope::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Courier::JourneyTemplateCreateRequest::Notification::Content::Scope::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Subscription < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateCreateRequest::Notification::Subscription, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :topic_id + + sig { params(topic_id: String).returns(T.attached_class) } + def self.new(topic_id:) + end + + sig { override.returns({ topic_id: String }) } + def to_hash + end + end + end + end + end +end diff --git a/rbi/courier/models/journey_template_get_response.rbi b/rbi/courier/models/journey_template_get_response.rbi new file mode 100644 index 00000000..934a4e12 --- /dev/null +++ b/rbi/courier/models/journey_template_get_response.rbi @@ -0,0 +1,333 @@ +# typed: strong + +module Courier + module Models + class JourneyTemplateGetResponse < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyTemplateGetResponse, Courier::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :id + + sig { returns(T.nilable(Courier::JourneyTemplateGetResponse::Brand)) } + attr_reader :brand + + sig do + params( + brand: T.nilable(Courier::JourneyTemplateGetResponse::Brand::OrHash) + ).void + end + attr_writer :brand + + sig { returns(Courier::JourneyTemplateGetResponse::Content) } + attr_reader :content + + sig do + params( + content: Courier::JourneyTemplateGetResponse::Content::OrHash + ).void + end + attr_writer :content + + sig { returns(Integer) } + attr_accessor :created + + sig { returns(String) } + attr_accessor :creator + + sig { returns(String) } + attr_accessor :name + + sig { returns(Courier::JourneyTemplateGetResponse::State::TaggedSymbol) } + attr_accessor :state + + sig do + returns(T.nilable(Courier::JourneyTemplateGetResponse::Subscription)) + end + attr_reader :subscription + + sig do + params( + subscription: + T.nilable(Courier::JourneyTemplateGetResponse::Subscription::OrHash) + ).void + end + attr_writer :subscription + + sig { returns(T::Array[String]) } + attr_accessor :tags + + sig { returns(T.nilable(Integer)) } + attr_reader :updated + + sig { params(updated: Integer).void } + attr_writer :updated + + sig { returns(T.nilable(String)) } + attr_reader :updater + + sig { params(updater: String).void } + attr_writer :updater + + sig do + params( + id: String, + brand: T.nilable(Courier::JourneyTemplateGetResponse::Brand::OrHash), + content: Courier::JourneyTemplateGetResponse::Content::OrHash, + created: Integer, + creator: String, + name: String, + state: Courier::JourneyTemplateGetResponse::State::OrSymbol, + subscription: + T.nilable( + Courier::JourneyTemplateGetResponse::Subscription::OrHash + ), + tags: T::Array[String], + updated: Integer, + updater: String + ).returns(T.attached_class) + end + def self.new( + id:, + brand:, + content:, + created:, + creator:, + name:, + state:, + subscription:, + tags:, + updated: nil, + updater: nil + ) + end + + sig do + override.returns( + { + id: String, + brand: T.nilable(Courier::JourneyTemplateGetResponse::Brand), + content: Courier::JourneyTemplateGetResponse::Content, + created: Integer, + creator: String, + name: String, + state: Courier::JourneyTemplateGetResponse::State::TaggedSymbol, + subscription: + T.nilable(Courier::JourneyTemplateGetResponse::Subscription), + tags: T::Array[String], + updated: Integer, + updater: String + } + ) + end + def to_hash + end + + class Brand < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateGetResponse::Brand, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig { params(id: String).returns(T.attached_class) } + def self.new(id:) + end + + sig { override.returns({ id: String }) } + def to_hash + end + end + + class Content < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateGetResponse::Content, + Courier::Internal::AnyHash + ) + end + + sig { returns(T::Array[Courier::ElementalNode::Variants]) } + attr_accessor :elements + + sig do + returns( + Courier::JourneyTemplateGetResponse::Content::Version::TaggedSymbol + ) + end + attr_accessor :version + + sig do + returns( + T.nilable( + Courier::JourneyTemplateGetResponse::Content::Scope::TaggedSymbol + ) + ) + end + attr_reader :scope + + sig do + params( + scope: Courier::JourneyTemplateGetResponse::Content::Scope::OrSymbol + ).void + end + attr_writer :scope + + sig do + params( + elements: + T::Array[ + T.any( + Courier::ElementalTextNodeWithType::OrHash, + Courier::ElementalMetaNodeWithType::OrHash, + Courier::ElementalChannelNodeWithType::OrHash, + Courier::ElementalImageNodeWithType::OrHash, + Courier::ElementalActionNodeWithType::OrHash, + Courier::ElementalDividerNodeWithType::OrHash, + Courier::ElementalQuoteNodeWithType::OrHash, + Courier::ElementalHTMLNodeWithType::OrHash + ) + ], + version: + Courier::JourneyTemplateGetResponse::Content::Version::OrSymbol, + scope: Courier::JourneyTemplateGetResponse::Content::Scope::OrSymbol + ).returns(T.attached_class) + end + def self.new(elements:, version:, scope: nil) + end + + sig do + override.returns( + { + elements: T::Array[Courier::ElementalNode::Variants], + version: + Courier::JourneyTemplateGetResponse::Content::Version::TaggedSymbol, + scope: + Courier::JourneyTemplateGetResponse::Content::Scope::TaggedSymbol + } + ) + end + def to_hash + end + + module Version + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Courier::JourneyTemplateGetResponse::Content::Version + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + VERSION_2022_01_01 = + T.let( + :"2022-01-01", + Courier::JourneyTemplateGetResponse::Content::Version::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Courier::JourneyTemplateGetResponse::Content::Version::TaggedSymbol + ] + ) + end + def self.values + end + end + + module Scope + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyTemplateGetResponse::Content::Scope) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DEFAULT = + T.let( + :default, + Courier::JourneyTemplateGetResponse::Content::Scope::TaggedSymbol + ) + STRICT = + T.let( + :strict, + Courier::JourneyTemplateGetResponse::Content::Scope::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Courier::JourneyTemplateGetResponse::Content::Scope::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + module State + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyTemplateGetResponse::State) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DRAFT = + T.let( + :DRAFT, + Courier::JourneyTemplateGetResponse::State::TaggedSymbol + ) + PUBLISHED = + T.let( + :PUBLISHED, + Courier::JourneyTemplateGetResponse::State::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Courier::JourneyTemplateGetResponse::State::TaggedSymbol] + ) + end + def self.values + end + end + + class Subscription < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateGetResponse::Subscription, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :topic_id + + sig { params(topic_id: String).returns(T.attached_class) } + def self.new(topic_id:) + end + + sig { override.returns({ topic_id: String }) } + def to_hash + end + end + end + end +end diff --git a/rbi/courier/models/journey_template_list_response.rbi b/rbi/courier/models/journey_template_list_response.rbi new file mode 100644 index 00000000..a8cd1f8b --- /dev/null +++ b/rbi/courier/models/journey_template_list_response.rbi @@ -0,0 +1,44 @@ +# typed: strong + +module Courier + module Models + class JourneyTemplateListResponse < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateListResponse, + Courier::Internal::AnyHash + ) + end + + sig { returns(Courier::Paging) } + attr_reader :paging + + sig { params(paging: Courier::Paging::OrHash).void } + attr_writer :paging + + sig { returns(T::Array[Courier::JourneyTemplateSummary]) } + attr_accessor :results + + sig do + params( + paging: Courier::Paging::OrHash, + results: T::Array[Courier::JourneyTemplateSummary::OrHash] + ).returns(T.attached_class) + end + def self.new(paging:, results:) + end + + sig do + override.returns( + { + paging: Courier::Paging, + results: T::Array[Courier::JourneyTemplateSummary] + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_template_publish_request.rbi b/rbi/courier/models/journey_template_publish_request.rbi new file mode 100644 index 00000000..6ca32274 --- /dev/null +++ b/rbi/courier/models/journey_template_publish_request.rbi @@ -0,0 +1,29 @@ +# typed: strong + +module Courier + module Models + class JourneyTemplatePublishRequest < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplatePublishRequest, + Courier::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :version + + sig { params(version: String).void } + attr_writer :version + + sig { params(version: String).returns(T.attached_class) } + def self.new(version: nil) + end + + sig { override.returns({ version: String }) } + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_template_replace_request.rbi b/rbi/courier/models/journey_template_replace_request.rbi new file mode 100644 index 00000000..68c1f8c6 --- /dev/null +++ b/rbi/courier/models/journey_template_replace_request.rbi @@ -0,0 +1,367 @@ +# typed: strong + +module Courier + module Models + class JourneyTemplateReplaceRequest < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateReplaceRequest, + Courier::Internal::AnyHash + ) + end + + sig { returns(Courier::JourneyTemplateReplaceRequest::Notification) } + attr_reader :notification + + sig do + params( + notification: + Courier::JourneyTemplateReplaceRequest::Notification::OrHash + ).void + end + attr_writer :notification + + sig { returns(T.nilable(String)) } + attr_reader :state + + sig { params(state: String).void } + attr_writer :state + + sig do + params( + notification: + Courier::JourneyTemplateReplaceRequest::Notification::OrHash, + state: String + ).returns(T.attached_class) + end + def self.new(notification:, state: nil) + end + + sig do + override.returns( + { + notification: Courier::JourneyTemplateReplaceRequest::Notification, + state: String + } + ) + end + def to_hash + end + + class Notification < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateReplaceRequest::Notification, + Courier::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + Courier::JourneyTemplateReplaceRequest::Notification::Brand + ) + ) + end + attr_reader :brand + + sig do + params( + brand: + T.nilable( + Courier::JourneyTemplateReplaceRequest::Notification::Brand::OrHash + ) + ).void + end + attr_writer :brand + + sig do + returns(Courier::JourneyTemplateReplaceRequest::Notification::Content) + end + attr_reader :content + + sig do + params( + content: + Courier::JourneyTemplateReplaceRequest::Notification::Content::OrHash + ).void + end + attr_writer :content + + sig { returns(String) } + attr_accessor :name + + sig do + returns( + T.nilable( + Courier::JourneyTemplateReplaceRequest::Notification::Subscription + ) + ) + end + attr_reader :subscription + + sig do + params( + subscription: + T.nilable( + Courier::JourneyTemplateReplaceRequest::Notification::Subscription::OrHash + ) + ).void + end + attr_writer :subscription + + sig { returns(T::Array[String]) } + attr_accessor :tags + + sig do + params( + brand: + T.nilable( + Courier::JourneyTemplateReplaceRequest::Notification::Brand::OrHash + ), + content: + Courier::JourneyTemplateReplaceRequest::Notification::Content::OrHash, + name: String, + subscription: + T.nilable( + Courier::JourneyTemplateReplaceRequest::Notification::Subscription::OrHash + ), + tags: T::Array[String] + ).returns(T.attached_class) + end + def self.new(brand:, content:, name:, subscription:, tags:) + end + + sig do + override.returns( + { + brand: + T.nilable( + Courier::JourneyTemplateReplaceRequest::Notification::Brand + ), + content: + Courier::JourneyTemplateReplaceRequest::Notification::Content, + name: String, + subscription: + T.nilable( + Courier::JourneyTemplateReplaceRequest::Notification::Subscription + ), + tags: T::Array[String] + } + ) + end + def to_hash + end + + class Brand < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateReplaceRequest::Notification::Brand, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig { params(id: String).returns(T.attached_class) } + def self.new(id:) + end + + sig { override.returns({ id: String }) } + def to_hash + end + end + + class Content < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateReplaceRequest::Notification::Content, + Courier::Internal::AnyHash + ) + end + + sig do + returns( + T::Array[ + T.any( + Courier::ElementalTextNodeWithType, + Courier::ElementalMetaNodeWithType, + Courier::ElementalChannelNodeWithType, + Courier::ElementalImageNodeWithType, + Courier::ElementalActionNodeWithType, + Courier::ElementalDividerNodeWithType, + Courier::ElementalQuoteNodeWithType, + Courier::ElementalHTMLNodeWithType + ) + ] + ) + end + attr_accessor :elements + + sig do + returns( + Courier::JourneyTemplateReplaceRequest::Notification::Content::Version::OrSymbol + ) + end + attr_accessor :version + + sig do + returns( + T.nilable( + Courier::JourneyTemplateReplaceRequest::Notification::Content::Scope::OrSymbol + ) + ) + end + attr_reader :scope + + sig do + params( + scope: + Courier::JourneyTemplateReplaceRequest::Notification::Content::Scope::OrSymbol + ).void + end + attr_writer :scope + + sig do + params( + elements: + T::Array[ + T.any( + Courier::ElementalTextNodeWithType::OrHash, + Courier::ElementalMetaNodeWithType::OrHash, + Courier::ElementalChannelNodeWithType::OrHash, + Courier::ElementalImageNodeWithType::OrHash, + Courier::ElementalActionNodeWithType::OrHash, + Courier::ElementalDividerNodeWithType::OrHash, + Courier::ElementalQuoteNodeWithType::OrHash, + Courier::ElementalHTMLNodeWithType::OrHash + ) + ], + version: + Courier::JourneyTemplateReplaceRequest::Notification::Content::Version::OrSymbol, + scope: + Courier::JourneyTemplateReplaceRequest::Notification::Content::Scope::OrSymbol + ).returns(T.attached_class) + end + def self.new(elements:, version:, scope: nil) + end + + sig do + override.returns( + { + elements: + T::Array[ + T.any( + Courier::ElementalTextNodeWithType, + Courier::ElementalMetaNodeWithType, + Courier::ElementalChannelNodeWithType, + Courier::ElementalImageNodeWithType, + Courier::ElementalActionNodeWithType, + Courier::ElementalDividerNodeWithType, + Courier::ElementalQuoteNodeWithType, + Courier::ElementalHTMLNodeWithType + ) + ], + version: + Courier::JourneyTemplateReplaceRequest::Notification::Content::Version::OrSymbol, + scope: + Courier::JourneyTemplateReplaceRequest::Notification::Content::Scope::OrSymbol + } + ) + end + def to_hash + end + + module Version + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Courier::JourneyTemplateReplaceRequest::Notification::Content::Version + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + VERSION_2022_01_01 = + T.let( + :"2022-01-01", + Courier::JourneyTemplateReplaceRequest::Notification::Content::Version::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Courier::JourneyTemplateReplaceRequest::Notification::Content::Version::TaggedSymbol + ] + ) + end + def self.values + end + end + + module Scope + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Courier::JourneyTemplateReplaceRequest::Notification::Content::Scope + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DEFAULT = + T.let( + :default, + Courier::JourneyTemplateReplaceRequest::Notification::Content::Scope::TaggedSymbol + ) + STRICT = + T.let( + :strict, + Courier::JourneyTemplateReplaceRequest::Notification::Content::Scope::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Courier::JourneyTemplateReplaceRequest::Notification::Content::Scope::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Subscription < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyTemplateReplaceRequest::Notification::Subscription, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :topic_id + + sig { params(topic_id: String).returns(T.attached_class) } + def self.new(topic_id:) + end + + sig { override.returns({ topic_id: String }) } + def to_hash + end + end + end + end + end +end diff --git a/rbi/courier/models/journey_template_summary.rbi b/rbi/courier/models/journey_template_summary.rbi new file mode 100644 index 00000000..b0bd461d --- /dev/null +++ b/rbi/courier/models/journey_template_summary.rbi @@ -0,0 +1,83 @@ +# typed: strong + +module Courier + module Models + class JourneyTemplateSummary < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyTemplateSummary, Courier::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :id + + sig { returns(Integer) } + attr_accessor :created + + sig { returns(String) } + attr_accessor :creator + + sig { returns(String) } + attr_accessor :name + + sig { returns(String) } + attr_accessor :state + + sig { returns(T::Array[String]) } + attr_accessor :tags + + sig { returns(T.nilable(Integer)) } + attr_reader :updated + + sig { params(updated: Integer).void } + attr_writer :updated + + sig { returns(T.nilable(String)) } + attr_reader :updater + + sig { params(updater: String).void } + attr_writer :updater + + sig do + params( + id: String, + created: Integer, + creator: String, + name: String, + state: String, + tags: T::Array[String], + updated: Integer, + updater: String + ).returns(T.attached_class) + end + def self.new( + id:, + created:, + creator:, + name:, + state:, + tags:, + updated: nil, + updater: nil + ) + end + + sig do + override.returns( + { + id: String, + created: Integer, + creator: String, + name: String, + state: String, + tags: T::Array[String], + updated: Integer, + updater: String + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_throttle_dynamic_node.rbi b/rbi/courier/models/journey_throttle_dynamic_node.rbi new file mode 100644 index 00000000..98b0e33f --- /dev/null +++ b/rbi/courier/models/journey_throttle_dynamic_node.rbi @@ -0,0 +1,160 @@ +# typed: strong + +module Courier + module Models + class JourneyThrottleDynamicNode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyThrottleDynamicNode, Courier::Internal::AnyHash) + end + + sig { returns(Integer) } + attr_accessor :max_allowed + + sig { returns(String) } + attr_accessor :period + + sig { returns(Courier::JourneyThrottleDynamicNode::Scope::OrSymbol) } + attr_accessor :scope + + sig { returns(String) } + attr_accessor :throttle_key + + sig { returns(Courier::JourneyThrottleDynamicNode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + sig do + returns( + T.nilable( + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + ) + ) + end + attr_reader :conditions + + sig do + params( + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).void + end + attr_writer :conditions + + sig do + params( + max_allowed: Integer, + period: String, + scope: Courier::JourneyThrottleDynamicNode::Scope::OrSymbol, + throttle_key: String, + type: Courier::JourneyThrottleDynamicNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).returns(T.attached_class) + end + def self.new( + max_allowed:, + period:, + scope:, + throttle_key:, + type:, + id: nil, + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + conditions: nil + ) + end + + sig do + override.returns( + { + max_allowed: Integer, + period: String, + scope: Courier::JourneyThrottleDynamicNode::Scope::OrSymbol, + throttle_key: String, + type: Courier::JourneyThrottleDynamicNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + } + ) + end + def to_hash + end + + module Scope + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyThrottleDynamicNode::Scope) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DYNAMIC = + T.let( + :dynamic, + Courier::JourneyThrottleDynamicNode::Scope::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Courier::JourneyThrottleDynamicNode::Scope::TaggedSymbol] + ) + end + def self.values + end + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyThrottleDynamicNode::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + THROTTLE = + T.let( + :throttle, + Courier::JourneyThrottleDynamicNode::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Courier::JourneyThrottleDynamicNode::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/courier/models/journey_throttle_static_node.rbi b/rbi/courier/models/journey_throttle_static_node.rbi new file mode 100644 index 00000000..97a909b6 --- /dev/null +++ b/rbi/courier/models/journey_throttle_static_node.rbi @@ -0,0 +1,156 @@ +# typed: strong + +module Courier + module Models + class JourneyThrottleStaticNode < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyThrottleStaticNode, Courier::Internal::AnyHash) + end + + sig { returns(Integer) } + attr_accessor :max_allowed + + sig { returns(String) } + attr_accessor :period + + sig { returns(Courier::JourneyThrottleStaticNode::Scope::OrSymbol) } + attr_accessor :scope + + sig { returns(Courier::JourneyThrottleStaticNode::Type::OrSymbol) } + attr_accessor :type + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + sig do + returns( + T.nilable( + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + ) + ) + end + attr_reader :conditions + + sig do + params( + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).void + end + attr_writer :conditions + + sig do + params( + max_allowed: Integer, + period: String, + scope: Courier::JourneyThrottleStaticNode::Scope::OrSymbol, + type: Courier::JourneyThrottleStaticNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup::OrHash, + Courier::JourneyConditionNestedGroup::OrHash + ) + ).returns(T.attached_class) + end + def self.new( + max_allowed:, + period:, + scope:, + type:, + id: nil, + # Condition spec for a journey node. Accepts a single condition atom, an AND/OR + # group, or an AND/OR nested group. Omit the `conditions` property entirely to + # express "no conditions". + conditions: nil + ) + end + + sig do + override.returns( + { + max_allowed: Integer, + period: String, + scope: Courier::JourneyThrottleStaticNode::Scope::OrSymbol, + type: Courier::JourneyThrottleStaticNode::Type::OrSymbol, + id: String, + conditions: + T.any( + T::Array[String], + Courier::JourneyConditionGroup, + Courier::JourneyConditionNestedGroup + ) + } + ) + end + def to_hash + end + + module Scope + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyThrottleStaticNode::Scope) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + USER = + T.let(:user, Courier::JourneyThrottleStaticNode::Scope::TaggedSymbol) + GLOBAL = + T.let( + :global, + Courier::JourneyThrottleStaticNode::Scope::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Courier::JourneyThrottleStaticNode::Scope::TaggedSymbol] + ) + end + def self.values + end + end + + module Type + extend Courier::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Courier::JourneyThrottleStaticNode::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + THROTTLE = + T.let( + :throttle, + Courier::JourneyThrottleStaticNode::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Courier::JourneyThrottleStaticNode::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/courier/models/journey_version_item.rbi b/rbi/courier/models/journey_version_item.rbi new file mode 100644 index 00000000..e3bdb345 --- /dev/null +++ b/rbi/courier/models/journey_version_item.rbi @@ -0,0 +1,53 @@ +# typed: strong + +module Courier + module Models + class JourneyVersionItem < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Courier::JourneyVersionItem, Courier::Internal::AnyHash) + end + + sig { returns(T.nilable(Integer)) } + attr_accessor :created + + sig { returns(T.nilable(String)) } + attr_accessor :creator + + sig { returns(String) } + attr_accessor :name + + sig { returns(T.nilable(Integer)) } + attr_accessor :published + + sig { returns(String) } + attr_accessor :version + + sig do + params( + created: T.nilable(Integer), + creator: T.nilable(String), + name: String, + published: T.nilable(Integer), + version: String + ).returns(T.attached_class) + end + def self.new(created:, creator:, name:, published:, version:) + end + + sig do + override.returns( + { + created: T.nilable(Integer), + creator: T.nilable(String), + name: String, + published: T.nilable(Integer), + version: String + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journey_versions_list_response.rbi b/rbi/courier/models/journey_versions_list_response.rbi new file mode 100644 index 00000000..12637daa --- /dev/null +++ b/rbi/courier/models/journey_versions_list_response.rbi @@ -0,0 +1,44 @@ +# typed: strong + +module Courier + module Models + class JourneyVersionsListResponse < Courier::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Courier::JourneyVersionsListResponse, + Courier::Internal::AnyHash + ) + end + + sig { returns(Courier::Paging) } + attr_reader :paging + + sig { params(paging: Courier::Paging::OrHash).void } + attr_writer :paging + + sig { returns(T::Array[Courier::JourneyVersionItem]) } + attr_accessor :results + + sig do + params( + paging: Courier::Paging::OrHash, + results: T::Array[Courier::JourneyVersionItem::OrHash] + ).returns(T.attached_class) + end + def self.new(paging:, results:) + end + + sig do + override.returns( + { + paging: Courier::Paging, + results: T::Array[Courier::JourneyVersionItem] + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/journeys/template_archive_params.rbi b/rbi/courier/models/journeys/template_archive_params.rbi new file mode 100644 index 00000000..4b0992d7 --- /dev/null +++ b/rbi/courier/models/journeys/template_archive_params.rbi @@ -0,0 +1,48 @@ +# typed: strong + +module Courier + module Models + module Journeys + class TemplateArchiveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Courier::Journeys::TemplateArchiveParams, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :template_id + + sig { returns(String) } + attr_accessor :notification_id + + sig do + params( + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, notification_id:, request_options: {}) + end + + sig do + override.returns( + { + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/courier/models/journeys/template_create_params.rbi b/rbi/courier/models/journeys/template_create_params.rbi new file mode 100644 index 00000000..bdf8b46a --- /dev/null +++ b/rbi/courier/models/journeys/template_create_params.rbi @@ -0,0 +1,40 @@ +# typed: strong + +module Courier + module Models + module Journeys + class TemplateCreateParams < Courier::Models::JourneyTemplateCreateRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Courier::Journeys::TemplateCreateParams, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :template_id + + sig do + params( + template_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, request_options: {}) + end + + sig do + override.returns( + { template_id: String, request_options: Courier::RequestOptions } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/courier/models/journeys/template_list_params.rbi b/rbi/courier/models/journeys/template_list_params.rbi new file mode 100644 index 00000000..71c52b5c --- /dev/null +++ b/rbi/courier/models/journeys/template_list_params.rbi @@ -0,0 +1,59 @@ +# typed: strong + +module Courier + module Models + module Journeys + class TemplateListParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Courier::Journeys::TemplateListParams, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :template_id + + sig { returns(T.nilable(String)) } + attr_reader :cursor + + sig { params(cursor: String).void } + attr_writer :cursor + + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + sig do + params( + template_id: String, + cursor: String, + limit: Integer, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, cursor: nil, limit: nil, request_options: {}) + end + + sig do + override.returns( + { + template_id: String, + cursor: String, + limit: Integer, + request_options: Courier::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/courier/models/journeys/template_list_versions_params.rbi b/rbi/courier/models/journeys/template_list_versions_params.rbi new file mode 100644 index 00000000..500dc93a --- /dev/null +++ b/rbi/courier/models/journeys/template_list_versions_params.rbi @@ -0,0 +1,48 @@ +# typed: strong + +module Courier + module Models + module Journeys + class TemplateListVersionsParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Courier::Journeys::TemplateListVersionsParams, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :template_id + + sig { returns(String) } + attr_accessor :notification_id + + sig do + params( + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, notification_id:, request_options: {}) + end + + sig do + override.returns( + { + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/courier/models/journeys/template_publish_params.rbi b/rbi/courier/models/journeys/template_publish_params.rbi new file mode 100644 index 00000000..b1297f8a --- /dev/null +++ b/rbi/courier/models/journeys/template_publish_params.rbi @@ -0,0 +1,48 @@ +# typed: strong + +module Courier + module Models + module Journeys + class TemplatePublishParams < Courier::Models::JourneyTemplatePublishRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Courier::Journeys::TemplatePublishParams, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :template_id + + sig { returns(String) } + attr_accessor :notification_id + + sig do + params( + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, notification_id:, request_options: {}) + end + + sig do + override.returns( + { + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/courier/models/journeys/template_replace_params.rbi b/rbi/courier/models/journeys/template_replace_params.rbi new file mode 100644 index 00000000..733ab751 --- /dev/null +++ b/rbi/courier/models/journeys/template_replace_params.rbi @@ -0,0 +1,48 @@ +# typed: strong + +module Courier + module Models + module Journeys + class TemplateReplaceParams < Courier::Models::JourneyTemplateReplaceRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Courier::Journeys::TemplateReplaceParams, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :template_id + + sig { returns(String) } + attr_accessor :notification_id + + sig do + params( + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, notification_id:, request_options: {}) + end + + sig do + override.returns( + { + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/courier/models/journeys/template_retrieve_params.rbi b/rbi/courier/models/journeys/template_retrieve_params.rbi new file mode 100644 index 00000000..f0dde7e5 --- /dev/null +++ b/rbi/courier/models/journeys/template_retrieve_params.rbi @@ -0,0 +1,48 @@ +# typed: strong + +module Courier + module Models + module Journeys + class TemplateRetrieveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Courier::Journeys::TemplateRetrieveParams, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :template_id + + sig { returns(String) } + attr_accessor :notification_id + + sig do + params( + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(template_id:, notification_id:, request_options: {}) + end + + sig do + override.returns( + { + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/courier/resources/journeys.rbi b/rbi/courier/resources/journeys.rbi index 404d16a1..fc2c0ad3 100644 --- a/rbi/courier/resources/journeys.rbi +++ b/rbi/courier/resources/journeys.rbi @@ -3,6 +3,56 @@ module Courier module Resources class Journeys + sig { returns(Courier::Resources::Journeys::Templates) } + attr_reader :templates + + # Create a new journey. The journey is created in DRAFT state. Use POST + # /journeys/{templateId}/publish to make it live. + sig do + params( + name: String, + nodes: + T::Array[ + T.any( + Courier::JourneyAPIInvokeTriggerNode::OrHash, + Courier::JourneySegmentTriggerNode::OrHash, + Courier::JourneySendNode::OrHash, + Courier::JourneyDelayDurationNode::OrHash, + Courier::JourneyDelayUntilNode::OrHash, + Courier::JourneyFetchGetDeleteNode::OrHash, + Courier::JourneyFetchPostPutNode::OrHash, + Courier::JourneyAINode::OrHash, + Courier::JourneyThrottleStaticNode::OrHash, + Courier::JourneyThrottleDynamicNode::OrHash, + Courier::JourneyExitNode::OrHash, + Courier::JourneyNode::JourneyBranchNode::OrHash + ) + ], + enabled: T::Boolean, + state: Courier::JourneyState::OrSymbol, + request_options: Courier::RequestOptions::OrHash + ).returns(Courier::JourneyResponse) + end + def create(name:, nodes:, enabled: nil, state: nil, request_options: {}) + end + + # Fetch a journey by id. Pass `?version=draft` (default `published`) to retrieve + # the working draft, or `?version=vN` to retrieve a historical version. + sig do + params( + template_id: String, + version: String, + request_options: Courier::RequestOptions::OrHash + ).returns(Courier::JourneyResponse) + end + def retrieve( + # Journey id + template_id, + version: nil, + request_options: {} + ) + end + # Get the list of journeys. sig do params( @@ -22,6 +72,21 @@ module Courier ) end + # Archive a journey. Archived journeys cannot be invoked. Existing journey runs + # continue to completion. + sig do + params( + template_id: String, + request_options: Courier::RequestOptions::OrHash + ).void + end + def archive( + # Journey id + template_id, + request_options: {} + ) + end + # Invoke a journey run from a journey template. sig do params( @@ -55,6 +120,76 @@ module Courier ) end + # List published versions of a journey, ordered most recent first. + sig do + params( + template_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(Courier::JourneyVersionsListResponse) + end + def list_versions( + # Journey id + template_id, + request_options: {} + ) + end + + # Publish the current draft as a new version. Optionally rollback to a prior + # version by passing `{ version: 'vN' }`. + sig do + params( + template_id: String, + version: String, + request_options: Courier::RequestOptions::OrHash + ).returns(Courier::JourneyResponse) + end + def publish( + # Journey id + template_id, + version: nil, + request_options: {} + ) + end + + # Replace the journey draft. Updates the working draft only; call POST + # /journeys/{templateId}/publish to make it live. + sig do + params( + template_id: String, + name: String, + nodes: + T::Array[ + T.any( + Courier::JourneyAPIInvokeTriggerNode::OrHash, + Courier::JourneySegmentTriggerNode::OrHash, + Courier::JourneySendNode::OrHash, + Courier::JourneyDelayDurationNode::OrHash, + Courier::JourneyDelayUntilNode::OrHash, + Courier::JourneyFetchGetDeleteNode::OrHash, + Courier::JourneyFetchPostPutNode::OrHash, + Courier::JourneyAINode::OrHash, + Courier::JourneyThrottleStaticNode::OrHash, + Courier::JourneyThrottleDynamicNode::OrHash, + Courier::JourneyExitNode::OrHash, + Courier::JourneyNode::JourneyBranchNode::OrHash + ) + ], + enabled: T::Boolean, + state: Courier::JourneyState::OrSymbol, + request_options: Courier::RequestOptions::OrHash + ).returns(Courier::JourneyResponse) + end + def replace( + # Journey id + template_id, + name:, + nodes:, + enabled: nil, + state: nil, + request_options: {} + ) + end + # @api private sig { params(client: Courier::Client).returns(T.attached_class) } def self.new(client:) diff --git a/rbi/courier/resources/journeys/templates.rbi b/rbi/courier/resources/journeys/templates.rbi new file mode 100644 index 00000000..42547d2d --- /dev/null +++ b/rbi/courier/resources/journeys/templates.rbi @@ -0,0 +1,156 @@ +# typed: strong + +module Courier + module Resources + class Journeys + class Templates + # Create a notification template scoped to this journey. The template is created + # in DRAFT state. + sig do + params( + template_id: String, + channel: String, + notification: + Courier::JourneyTemplateCreateRequest::Notification::OrHash, + provider_key: String, + state: String, + request_options: Courier::RequestOptions::OrHash + ).returns(Courier::JourneyTemplateGetResponse) + end + def create( + # Journey id + template_id, + channel:, + notification:, + provider_key: nil, + state: nil, + request_options: {} + ) + end + + # Fetch a journey-scoped notification template by id. Pass `?version=draft` + # (default `published`) to retrieve the working draft, or `?version=vN` for a + # historical version. + sig do + params( + notification_id: String, + template_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(Courier::JourneyTemplateGetResponse) + end + def retrieve( + # Journey template id + notification_id, + # Journey id + template_id:, + request_options: {} + ) + end + + # List notification templates scoped to this journey. Templates scoped to a + # journey can only be referenced from `send` nodes of the same journey. + sig do + params( + template_id: String, + cursor: String, + limit: Integer, + request_options: Courier::RequestOptions::OrHash + ).returns(Courier::JourneyTemplateListResponse) + end + def list( + # Journey id + template_id, + cursor: nil, + limit: nil, + request_options: {} + ) + end + + # Archive a journey-scoped notification template. Archived templates cannot be + # sent. + sig do + params( + notification_id: String, + template_id: String, + request_options: Courier::RequestOptions::OrHash + ).void + end + def archive( + # Journey template id + notification_id, + # Journey id + template_id:, + request_options: {} + ) + end + + # List published versions of a journey-scoped notification template, ordered most + # recent first. + sig do + params( + notification_id: String, + template_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(Courier::NotificationTemplateVersionListResponse) + end + def list_versions( + # Journey template id + notification_id, + # Journey id + template_id:, + request_options: {} + ) + end + + # Publish the current draft of a journey-scoped notification template. + sig do + params( + notification_id: String, + template_id: String, + version: String, + request_options: Courier::RequestOptions::OrHash + ).void + end + def publish( + # Path param: Journey template id + notification_id, + # Path param: Journey id + template_id:, + # Body param + version: nil, + request_options: {} + ) + end + + # Replace a journey-scoped notification template draft. + sig do + params( + notification_id: String, + template_id: String, + notification: + Courier::JourneyTemplateReplaceRequest::Notification::OrHash, + state: String, + request_options: Courier::RequestOptions::OrHash + ).returns(Courier::JourneyTemplateGetResponse) + end + def replace( + # Path param: Journey template id + notification_id, + # Path param: Journey id + template_id:, + # Body param + notification:, + # Body param + state: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: Courier::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end +end diff --git a/sig/courier/models.rbs b/sig/courier/models.rbs index 8ee0fbd3..58dcb379 100644 --- a/sig/courier/models.rbs +++ b/sig/courier/models.rbs @@ -93,6 +93,8 @@ module Courier class Check = Courier::Models::Check + class CreateJourneyRequest = Courier::Models::CreateJourneyRequest + class DefaultPreferences = Courier::Models::DefaultPreferences class DeviceType = Courier::Models::DeviceType @@ -151,16 +153,86 @@ module Courier class Journey = Courier::Models::Journey + class JourneyAINode = Courier::Models::JourneyAINode + + class JourneyAPIInvokeTriggerNode = Courier::Models::JourneyAPIInvokeTriggerNode + + class JourneyArchiveParams = Courier::Models::JourneyArchiveParams + + JourneyConditionAtom: Courier::Internal::Type::Converter + + class JourneyConditionGroup = Courier::Models::JourneyConditionGroup + + class JourneyConditionNestedGroup = Courier::Models::JourneyConditionNestedGroup + + module JourneyConditionsField = Courier::Models::JourneyConditionsField + + class JourneyCreateParams = Courier::Models::JourneyCreateParams + + class JourneyDelayDurationNode = Courier::Models::JourneyDelayDurationNode + + class JourneyDelayUntilNode = Courier::Models::JourneyDelayUntilNode + + class JourneyExitNode = Courier::Models::JourneyExitNode + + class JourneyFetchGetDeleteNode = Courier::Models::JourneyFetchGetDeleteNode + + class JourneyFetchPostPutNode = Courier::Models::JourneyFetchPostPutNode + class JourneyInvokeParams = Courier::Models::JourneyInvokeParams class JourneyListParams = Courier::Models::JourneyListParams + class JourneyListVersionsParams = Courier::Models::JourneyListVersionsParams + + module JourneyMergeStrategy = Courier::Models::JourneyMergeStrategy + + module JourneyNode = Courier::Models::JourneyNode + + class JourneyPublishParams = Courier::Models::JourneyPublishParams + + class JourneyPublishRequest = Courier::Models::JourneyPublishRequest + + class JourneyReplaceParams = Courier::Models::JourneyReplaceParams + + class JourneyResponse = Courier::Models::JourneyResponse + + class JourneyRetrieveParams = Courier::Models::JourneyRetrieveParams + + module Journeys = Courier::Models::Journeys + + class JourneySegmentTriggerNode = Courier::Models::JourneySegmentTriggerNode + + class JourneySendNode = Courier::Models::JourneySendNode + class JourneysInvokeRequest = Courier::Models::JourneysInvokeRequest class JourneysInvokeResponse = Courier::Models::JourneysInvokeResponse class JourneysListResponse = Courier::Models::JourneysListResponse + module JourneyState = Courier::Models::JourneyState + + class JourneyTemplateCreateRequest = Courier::Models::JourneyTemplateCreateRequest + + class JourneyTemplateGetResponse = Courier::Models::JourneyTemplateGetResponse + + class JourneyTemplateListResponse = Courier::Models::JourneyTemplateListResponse + + class JourneyTemplatePublishRequest = Courier::Models::JourneyTemplatePublishRequest + + class JourneyTemplateReplaceRequest = Courier::Models::JourneyTemplateReplaceRequest + + class JourneyTemplateSummary = Courier::Models::JourneyTemplateSummary + + class JourneyThrottleDynamicNode = Courier::Models::JourneyThrottleDynamicNode + + class JourneyThrottleStaticNode = Courier::Models::JourneyThrottleStaticNode + + class JourneyVersionItem = Courier::Models::JourneyVersionItem + + class JourneyVersionsListResponse = Courier::Models::JourneyVersionsListResponse + class ListDeleteParams = Courier::Models::ListDeleteParams class ListFilter = Courier::Models::ListFilter diff --git a/sig/courier/models/create_journey_request.rbs b/sig/courier/models/create_journey_request.rbs new file mode 100644 index 00000000..fbc45c77 --- /dev/null +++ b/sig/courier/models/create_journey_request.rbs @@ -0,0 +1,41 @@ +module Courier + module Models + type create_journey_request = + { + name: String, + nodes: ::Array[Courier::Models::journey_node], + enabled: bool, + state: Courier::Models::journey_state + } + + class CreateJourneyRequest < Courier::Internal::Type::BaseModel + attr_accessor name: String + + attr_accessor nodes: ::Array[Courier::Models::journey_node] + + attr_reader enabled: bool? + + def enabled=: (bool) -> bool + + attr_reader state: Courier::Models::journey_state? + + def state=: ( + Courier::Models::journey_state + ) -> Courier::Models::journey_state + + def initialize: ( + name: String, + nodes: ::Array[Courier::Models::journey_node], + ?enabled: bool, + ?state: Courier::Models::journey_state + ) -> void + + def to_hash: -> { + name: String, + nodes: ::Array[Courier::Models::journey_node], + enabled: bool, + state: Courier::Models::journey_state + } + end + end +end diff --git a/sig/courier/models/journey_ai_node.rbs b/sig/courier/models/journey_ai_node.rbs new file mode 100644 index 00000000..dcb3f90d --- /dev/null +++ b/sig/courier/models/journey_ai_node.rbs @@ -0,0 +1,72 @@ +module Courier + module Models + type journey_ai_node = + { + output_schema: ::Hash[Symbol, top], + type: Courier::Models::JourneyAINode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field, + model: String, + user_prompt: String, + web_search: bool + } + + class JourneyAINode < Courier::Internal::Type::BaseModel + attr_accessor output_schema: ::Hash[Symbol, top] + + attr_accessor type: Courier::Models::JourneyAINode::type_ + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader conditions: Courier::Models::journey_conditions_field? + + def conditions=: ( + Courier::Models::journey_conditions_field + ) -> Courier::Models::journey_conditions_field + + attr_reader model: String? + + def model=: (String) -> String + + attr_reader user_prompt: String? + + def user_prompt=: (String) -> String + + attr_reader web_search: bool? + + def web_search=: (bool) -> bool + + def initialize: ( + output_schema: ::Hash[Symbol, top], + type: Courier::Models::JourneyAINode::type_, + ?id: String, + ?conditions: Courier::Models::journey_conditions_field, + ?model: String, + ?user_prompt: String, + ?web_search: bool + ) -> void + + def to_hash: -> { + output_schema: ::Hash[Symbol, top], + type: Courier::Models::JourneyAINode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field, + model: String, + user_prompt: String, + web_search: bool + } + + type type_ = :ai + + module Type + extend Courier::Internal::Type::Enum + + AI: :ai + + def self?.values: -> ::Array[Courier::Models::JourneyAINode::type_] + end + end + end +end diff --git a/sig/courier/models/journey_api_invoke_trigger_node.rbs b/sig/courier/models/journey_api_invoke_trigger_node.rbs new file mode 100644 index 00000000..8c2438bc --- /dev/null +++ b/sig/courier/models/journey_api_invoke_trigger_node.rbs @@ -0,0 +1,68 @@ +module Courier + module Models + type journey_api_invoke_trigger_node = + { + trigger_type: Courier::Models::JourneyAPIInvokeTriggerNode::trigger_type, + type: Courier::Models::JourneyAPIInvokeTriggerNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field, + schema: ::Hash[Symbol, top] + } + + class JourneyAPIInvokeTriggerNode < Courier::Internal::Type::BaseModel + attr_accessor trigger_type: Courier::Models::JourneyAPIInvokeTriggerNode::trigger_type + + attr_accessor type: Courier::Models::JourneyAPIInvokeTriggerNode::type_ + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader conditions: Courier::Models::journey_conditions_field? + + def conditions=: ( + Courier::Models::journey_conditions_field + ) -> Courier::Models::journey_conditions_field + + attr_reader schema: ::Hash[Symbol, top]? + + def schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + def initialize: ( + trigger_type: Courier::Models::JourneyAPIInvokeTriggerNode::trigger_type, + type: Courier::Models::JourneyAPIInvokeTriggerNode::type_, + ?id: String, + ?conditions: Courier::Models::journey_conditions_field, + ?schema: ::Hash[Symbol, top] + ) -> void + + def to_hash: -> { + trigger_type: Courier::Models::JourneyAPIInvokeTriggerNode::trigger_type, + type: Courier::Models::JourneyAPIInvokeTriggerNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field, + schema: ::Hash[Symbol, top] + } + + type trigger_type = :"api-invoke" + + module TriggerType + extend Courier::Internal::Type::Enum + + API_INVOKE: :"api-invoke" + + def self?.values: -> ::Array[Courier::Models::JourneyAPIInvokeTriggerNode::trigger_type] + end + + type type_ = :trigger + + module Type + extend Courier::Internal::Type::Enum + + TRIGGER: :trigger + + def self?.values: -> ::Array[Courier::Models::JourneyAPIInvokeTriggerNode::type_] + end + end + end +end diff --git a/sig/courier/models/journey_archive_params.rbs b/sig/courier/models/journey_archive_params.rbs new file mode 100644 index 00000000..e105911d --- /dev/null +++ b/sig/courier/models/journey_archive_params.rbs @@ -0,0 +1,23 @@ +module Courier + module Models + type journey_archive_params = + { template_id: String } & Courier::Internal::Type::request_parameters + + class JourneyArchiveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + attr_accessor template_id: String + + def initialize: ( + template_id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + request_options: Courier::RequestOptions + } + end + end +end diff --git a/sig/courier/models/journey_condition_atom.rbs b/sig/courier/models/journey_condition_atom.rbs new file mode 100644 index 00000000..a6899e43 --- /dev/null +++ b/sig/courier/models/journey_condition_atom.rbs @@ -0,0 +1,7 @@ +module Courier + module Models + type journey_condition_atom = ::Array[String] + + JourneyConditionAtom: Courier::Internal::Type::Converter + end +end diff --git a/sig/courier/models/journey_condition_group.rbs b/sig/courier/models/journey_condition_group.rbs new file mode 100644 index 00000000..268bc906 --- /dev/null +++ b/sig/courier/models/journey_condition_group.rbs @@ -0,0 +1,33 @@ +module Courier + module Models + type journey_condition_group = + { + and_: ::Array[Courier::Models::journey_condition_atom], + or_: ::Array[Courier::Models::journey_condition_atom] + } + + class JourneyConditionGroup < Courier::Internal::Type::BaseModel + attr_reader and_: ::Array[Courier::Models::journey_condition_atom]? + + def and_=: ( + ::Array[Courier::Models::journey_condition_atom] + ) -> ::Array[Courier::Models::journey_condition_atom] + + attr_reader or_: ::Array[Courier::Models::journey_condition_atom]? + + def or_=: ( + ::Array[Courier::Models::journey_condition_atom] + ) -> ::Array[Courier::Models::journey_condition_atom] + + def initialize: ( + ?and_: ::Array[Courier::Models::journey_condition_atom], + ?or_: ::Array[Courier::Models::journey_condition_atom] + ) -> void + + def to_hash: -> { + and_: ::Array[Courier::Models::journey_condition_atom], + or_: ::Array[Courier::Models::journey_condition_atom] + } + end + end +end diff --git a/sig/courier/models/journey_condition_nested_group.rbs b/sig/courier/models/journey_condition_nested_group.rbs new file mode 100644 index 00000000..c375f8bc --- /dev/null +++ b/sig/courier/models/journey_condition_nested_group.rbs @@ -0,0 +1,33 @@ +module Courier + module Models + type journey_condition_nested_group = + { + and_: ::Array[Courier::JourneyConditionGroup], + or_: ::Array[Courier::JourneyConditionGroup] + } + + class JourneyConditionNestedGroup < Courier::Internal::Type::BaseModel + attr_reader and_: ::Array[Courier::JourneyConditionGroup]? + + def and_=: ( + ::Array[Courier::JourneyConditionGroup] + ) -> ::Array[Courier::JourneyConditionGroup] + + attr_reader or_: ::Array[Courier::JourneyConditionGroup]? + + def or_=: ( + ::Array[Courier::JourneyConditionGroup] + ) -> ::Array[Courier::JourneyConditionGroup] + + def initialize: ( + ?and_: ::Array[Courier::JourneyConditionGroup], + ?or_: ::Array[Courier::JourneyConditionGroup] + ) -> void + + def to_hash: -> { + and_: ::Array[Courier::JourneyConditionGroup], + or_: ::Array[Courier::JourneyConditionGroup] + } + end + end +end diff --git a/sig/courier/models/journey_conditions_field.rbs b/sig/courier/models/journey_conditions_field.rbs new file mode 100644 index 00000000..76bcc913 --- /dev/null +++ b/sig/courier/models/journey_conditions_field.rbs @@ -0,0 +1,14 @@ +module Courier + module Models + type journey_conditions_field = + Courier::Models::journey_condition_atom + | Courier::JourneyConditionGroup + | Courier::JourneyConditionNestedGroup + + module JourneyConditionsField + extend Courier::Internal::Type::Union + + def self?.variants: -> ::Array[Courier::Models::journey_conditions_field] + end + end +end diff --git a/sig/courier/models/journey_create_params.rbs b/sig/courier/models/journey_create_params.rbs new file mode 100644 index 00000000..0e2c7fc5 --- /dev/null +++ b/sig/courier/models/journey_create_params.rbs @@ -0,0 +1,15 @@ +module Courier + module Models + type journey_create_params = + { } & Courier::Internal::Type::request_parameters + + class JourneyCreateParams < Courier::Models::CreateJourneyRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + def initialize: (?request_options: Courier::request_opts) -> void + + def to_hash: -> { request_options: Courier::RequestOptions } + end + end +end diff --git a/sig/courier/models/journey_delay_duration_node.rbs b/sig/courier/models/journey_delay_duration_node.rbs new file mode 100644 index 00000000..2d477c75 --- /dev/null +++ b/sig/courier/models/journey_delay_duration_node.rbs @@ -0,0 +1,66 @@ +module Courier + module Models + type journey_delay_duration_node = + { + duration: String, + mode: Courier::Models::JourneyDelayDurationNode::mode, + type: Courier::Models::JourneyDelayDurationNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field + } + + class JourneyDelayDurationNode < Courier::Internal::Type::BaseModel + attr_accessor duration: String + + attr_accessor mode: Courier::Models::JourneyDelayDurationNode::mode + + attr_accessor type: Courier::Models::JourneyDelayDurationNode::type_ + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader conditions: Courier::Models::journey_conditions_field? + + def conditions=: ( + Courier::Models::journey_conditions_field + ) -> Courier::Models::journey_conditions_field + + def initialize: ( + duration: String, + mode: Courier::Models::JourneyDelayDurationNode::mode, + type: Courier::Models::JourneyDelayDurationNode::type_, + ?id: String, + ?conditions: Courier::Models::journey_conditions_field + ) -> void + + def to_hash: -> { + duration: String, + mode: Courier::Models::JourneyDelayDurationNode::mode, + type: Courier::Models::JourneyDelayDurationNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field + } + + type mode = :duration + + module Mode + extend Courier::Internal::Type::Enum + + DURATION: :duration + + def self?.values: -> ::Array[Courier::Models::JourneyDelayDurationNode::mode] + end + + type type_ = :delay + + module Type + extend Courier::Internal::Type::Enum + + DELAY: :delay + + def self?.values: -> ::Array[Courier::Models::JourneyDelayDurationNode::type_] + end + end + end +end diff --git a/sig/courier/models/journey_delay_until_node.rbs b/sig/courier/models/journey_delay_until_node.rbs new file mode 100644 index 00000000..08e5f3a1 --- /dev/null +++ b/sig/courier/models/journey_delay_until_node.rbs @@ -0,0 +1,66 @@ +module Courier + module Models + type journey_delay_until_node = + { + mode: Courier::Models::JourneyDelayUntilNode::mode, + type: Courier::Models::JourneyDelayUntilNode::type_, + until_: String, + id: String, + conditions: Courier::Models::journey_conditions_field + } + + class JourneyDelayUntilNode < Courier::Internal::Type::BaseModel + attr_accessor mode: Courier::Models::JourneyDelayUntilNode::mode + + attr_accessor type: Courier::Models::JourneyDelayUntilNode::type_ + + attr_accessor until_: String + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader conditions: Courier::Models::journey_conditions_field? + + def conditions=: ( + Courier::Models::journey_conditions_field + ) -> Courier::Models::journey_conditions_field + + def initialize: ( + mode: Courier::Models::JourneyDelayUntilNode::mode, + type: Courier::Models::JourneyDelayUntilNode::type_, + until_: String, + ?id: String, + ?conditions: Courier::Models::journey_conditions_field + ) -> void + + def to_hash: -> { + mode: Courier::Models::JourneyDelayUntilNode::mode, + type: Courier::Models::JourneyDelayUntilNode::type_, + until_: String, + id: String, + conditions: Courier::Models::journey_conditions_field + } + + type mode = :until + + module Mode + extend Courier::Internal::Type::Enum + + UNTIL: :until + + def self?.values: -> ::Array[Courier::Models::JourneyDelayUntilNode::mode] + end + + type type_ = :delay + + module Type + extend Courier::Internal::Type::Enum + + DELAY: :delay + + def self?.values: -> ::Array[Courier::Models::JourneyDelayUntilNode::type_] + end + end + end +end diff --git a/sig/courier/models/journey_exit_node.rbs b/sig/courier/models/journey_exit_node.rbs new file mode 100644 index 00000000..68dc498c --- /dev/null +++ b/sig/courier/models/journey_exit_node.rbs @@ -0,0 +1,34 @@ +module Courier + module Models + type journey_exit_node = + { type: Courier::Models::JourneyExitNode::type_, id: String } + + class JourneyExitNode < Courier::Internal::Type::BaseModel + attr_accessor type: Courier::Models::JourneyExitNode::type_ + + attr_reader id: String? + + def id=: (String) -> String + + def initialize: ( + type: Courier::Models::JourneyExitNode::type_, + ?id: String + ) -> void + + def to_hash: -> { + type: Courier::Models::JourneyExitNode::type_, + id: String + } + + type type_ = :exit + + module Type + extend Courier::Internal::Type::Enum + + EXIT: :exit + + def self?.values: -> ::Array[Courier::Models::JourneyExitNode::type_] + end + end + end +end diff --git a/sig/courier/models/journey_fetch_get_delete_node.rbs b/sig/courier/models/journey_fetch_get_delete_node.rbs new file mode 100644 index 00000000..d1a7e9e5 --- /dev/null +++ b/sig/courier/models/journey_fetch_get_delete_node.rbs @@ -0,0 +1,93 @@ +module Courier + module Models + type journey_fetch_get_delete_node = + { + merge_strategy: Courier::Models::journey_merge_strategy, + method_: Courier::Models::JourneyFetchGetDeleteNode::method_, + type: Courier::Models::JourneyFetchGetDeleteNode::type_, + url: String, + id: String, + conditions: Courier::Models::journey_conditions_field, + headers: ::Hash[Symbol, String], + query_params: ::Hash[Symbol, String], + response_schema: ::Hash[Symbol, top] + } + + class JourneyFetchGetDeleteNode < Courier::Internal::Type::BaseModel + attr_accessor merge_strategy: Courier::Models::journey_merge_strategy + + attr_accessor method_: Courier::Models::JourneyFetchGetDeleteNode::method_ + + attr_accessor type: Courier::Models::JourneyFetchGetDeleteNode::type_ + + attr_accessor url: String + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader conditions: Courier::Models::journey_conditions_field? + + def conditions=: ( + Courier::Models::journey_conditions_field + ) -> Courier::Models::journey_conditions_field + + attr_reader headers: ::Hash[Symbol, String]? + + def headers=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader query_params: ::Hash[Symbol, String]? + + def query_params=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader response_schema: ::Hash[Symbol, top]? + + def response_schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + def initialize: ( + merge_strategy: Courier::Models::journey_merge_strategy, + method_: Courier::Models::JourneyFetchGetDeleteNode::method_, + type: Courier::Models::JourneyFetchGetDeleteNode::type_, + url: String, + ?id: String, + ?conditions: Courier::Models::journey_conditions_field, + ?headers: ::Hash[Symbol, String], + ?query_params: ::Hash[Symbol, String], + ?response_schema: ::Hash[Symbol, top] + ) -> void + + def to_hash: -> { + merge_strategy: Courier::Models::journey_merge_strategy, + method_: Courier::Models::JourneyFetchGetDeleteNode::method_, + type: Courier::Models::JourneyFetchGetDeleteNode::type_, + url: String, + id: String, + conditions: Courier::Models::journey_conditions_field, + headers: ::Hash[Symbol, String], + query_params: ::Hash[Symbol, String], + response_schema: ::Hash[Symbol, top] + } + + type method_ = :get | :delete + + module Method + extend Courier::Internal::Type::Enum + + GET: :get + DELETE: :delete + + def self?.values: -> ::Array[Courier::Models::JourneyFetchGetDeleteNode::method_] + end + + type type_ = :fetch + + module Type + extend Courier::Internal::Type::Enum + + FETCH: :fetch + + def self?.values: -> ::Array[Courier::Models::JourneyFetchGetDeleteNode::type_] + end + end + end +end diff --git a/sig/courier/models/journey_fetch_post_put_node.rbs b/sig/courier/models/journey_fetch_post_put_node.rbs new file mode 100644 index 00000000..6e554a2a --- /dev/null +++ b/sig/courier/models/journey_fetch_post_put_node.rbs @@ -0,0 +1,100 @@ +module Courier + module Models + type journey_fetch_post_put_node = + { + merge_strategy: Courier::Models::journey_merge_strategy, + method_: Courier::Models::JourneyFetchPostPutNode::method_, + type: Courier::Models::JourneyFetchPostPutNode::type_, + url: String, + id: String, + body: String, + conditions: Courier::Models::journey_conditions_field, + headers: ::Hash[Symbol, String], + query_params: ::Hash[Symbol, String], + response_schema: ::Hash[Symbol, top] + } + + class JourneyFetchPostPutNode < Courier::Internal::Type::BaseModel + attr_accessor merge_strategy: Courier::Models::journey_merge_strategy + + attr_accessor method_: Courier::Models::JourneyFetchPostPutNode::method_ + + attr_accessor type: Courier::Models::JourneyFetchPostPutNode::type_ + + attr_accessor url: String + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader body: String? + + def body=: (String) -> String + + attr_reader conditions: Courier::Models::journey_conditions_field? + + def conditions=: ( + Courier::Models::journey_conditions_field + ) -> Courier::Models::journey_conditions_field + + attr_reader headers: ::Hash[Symbol, String]? + + def headers=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader query_params: ::Hash[Symbol, String]? + + def query_params=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader response_schema: ::Hash[Symbol, top]? + + def response_schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + def initialize: ( + merge_strategy: Courier::Models::journey_merge_strategy, + method_: Courier::Models::JourneyFetchPostPutNode::method_, + type: Courier::Models::JourneyFetchPostPutNode::type_, + url: String, + ?id: String, + ?body: String, + ?conditions: Courier::Models::journey_conditions_field, + ?headers: ::Hash[Symbol, String], + ?query_params: ::Hash[Symbol, String], + ?response_schema: ::Hash[Symbol, top] + ) -> void + + def to_hash: -> { + merge_strategy: Courier::Models::journey_merge_strategy, + method_: Courier::Models::JourneyFetchPostPutNode::method_, + type: Courier::Models::JourneyFetchPostPutNode::type_, + url: String, + id: String, + body: String, + conditions: Courier::Models::journey_conditions_field, + headers: ::Hash[Symbol, String], + query_params: ::Hash[Symbol, String], + response_schema: ::Hash[Symbol, top] + } + + type method_ = :post | :put + + module Method + extend Courier::Internal::Type::Enum + + POST: :post + PUT: :put + + def self?.values: -> ::Array[Courier::Models::JourneyFetchPostPutNode::method_] + end + + type type_ = :fetch + + module Type + extend Courier::Internal::Type::Enum + + FETCH: :fetch + + def self?.values: -> ::Array[Courier::Models::JourneyFetchPostPutNode::type_] + end + end + end +end diff --git a/sig/courier/models/journey_list_versions_params.rbs b/sig/courier/models/journey_list_versions_params.rbs new file mode 100644 index 00000000..e5def7bc --- /dev/null +++ b/sig/courier/models/journey_list_versions_params.rbs @@ -0,0 +1,23 @@ +module Courier + module Models + type journey_list_versions_params = + { template_id: String } & Courier::Internal::Type::request_parameters + + class JourneyListVersionsParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + attr_accessor template_id: String + + def initialize: ( + template_id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + request_options: Courier::RequestOptions + } + end + end +end diff --git a/sig/courier/models/journey_merge_strategy.rbs b/sig/courier/models/journey_merge_strategy.rbs new file mode 100644 index 00000000..f4595486 --- /dev/null +++ b/sig/courier/models/journey_merge_strategy.rbs @@ -0,0 +1,16 @@ +module Courier + module Models + type journey_merge_strategy = :overwrite | :"soft-merge" | :replace | :none + + module JourneyMergeStrategy + extend Courier::Internal::Type::Enum + + OVERWRITE: :overwrite + SOFT_MERGE: :"soft-merge" + REPLACE: :replace + NONE: :none + + def self?.values: -> ::Array[Courier::Models::journey_merge_strategy] + end + end +end diff --git a/sig/courier/models/journey_node.rbs b/sig/courier/models/journey_node.rbs new file mode 100644 index 00000000..021b14bd --- /dev/null +++ b/sig/courier/models/journey_node.rbs @@ -0,0 +1,117 @@ +module Courier + module Models + type journey_node = + Courier::JourneyAPIInvokeTriggerNode + | Courier::JourneySegmentTriggerNode + | Courier::JourneySendNode + | Courier::JourneyDelayDurationNode + | Courier::JourneyDelayUntilNode + | Courier::JourneyFetchGetDeleteNode + | Courier::JourneyFetchPostPutNode + | Courier::JourneyAINode + | Courier::JourneyThrottleStaticNode + | Courier::JourneyThrottleDynamicNode + | Courier::JourneyExitNode + | Courier::JourneyNode::JourneyBranchNode + + module JourneyNode + extend Courier::Internal::Type::Union + + type journey_branch_node = + { + default: Courier::JourneyNode::JourneyBranchNode::Default, + paths: ::Array[Courier::JourneyNode::JourneyBranchNode::Path], + type: Courier::Models::JourneyNode::JourneyBranchNode::type_, + id: String + } + + class JourneyBranchNode < Courier::Internal::Type::BaseModel + attr_accessor default: Courier::JourneyNode::JourneyBranchNode::Default + + attr_accessor paths: ::Array[Courier::JourneyNode::JourneyBranchNode::Path] + + attr_accessor type: Courier::Models::JourneyNode::JourneyBranchNode::type_ + + attr_reader id: String? + + def id=: (String) -> String + + def initialize: ( + default: Courier::JourneyNode::JourneyBranchNode::Default, + paths: ::Array[Courier::JourneyNode::JourneyBranchNode::Path], + type: Courier::Models::JourneyNode::JourneyBranchNode::type_, + ?id: String + ) -> void + + def to_hash: -> { + default: Courier::JourneyNode::JourneyBranchNode::Default, + paths: ::Array[Courier::JourneyNode::JourneyBranchNode::Path], + type: Courier::Models::JourneyNode::JourneyBranchNode::type_, + id: String + } + + type default = + { nodes: ::Array[Courier::Models::journey_node], label: String } + + class Default < Courier::Internal::Type::BaseModel + attr_accessor nodes: ::Array[Courier::Models::journey_node] + + attr_reader label: String? + + def label=: (String) -> String + + def initialize: ( + nodes: ::Array[Courier::Models::journey_node], + ?label: String + ) -> void + + def to_hash: -> { + nodes: ::Array[Courier::Models::journey_node], + label: String + } + end + + type path = + { + conditions: Courier::Models::journey_conditions_field, + nodes: ::Array[Courier::Models::journey_node], + label: String + } + + class Path < Courier::Internal::Type::BaseModel + attr_accessor conditions: Courier::Models::journey_conditions_field + + attr_accessor nodes: ::Array[Courier::Models::journey_node] + + attr_reader label: String? + + def label=: (String) -> String + + def initialize: ( + conditions: Courier::Models::journey_conditions_field, + nodes: ::Array[Courier::Models::journey_node], + ?label: String + ) -> void + + def to_hash: -> { + conditions: Courier::Models::journey_conditions_field, + nodes: ::Array[Courier::Models::journey_node], + label: String + } + end + + type type_ = :branch + + module Type + extend Courier::Internal::Type::Enum + + BRANCH: :branch + + def self?.values: -> ::Array[Courier::Models::JourneyNode::JourneyBranchNode::type_] + end + end + + def self?.variants: -> ::Array[Courier::Models::journey_node] + end + end +end diff --git a/sig/courier/models/journey_publish_params.rbs b/sig/courier/models/journey_publish_params.rbs new file mode 100644 index 00000000..906e1577 --- /dev/null +++ b/sig/courier/models/journey_publish_params.rbs @@ -0,0 +1,25 @@ +module Courier + module Models + type journey_publish_params = + { template_id: String } & Courier::Internal::Type::request_parameters + + class JourneyPublishParams < Courier::Models::JourneyPublishRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + def template_id: -> String + + def template_id=: (String _) -> String + + def initialize: ( + template_id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + request_options: Courier::RequestOptions + } + end + end +end diff --git a/sig/courier/models/journey_publish_request.rbs b/sig/courier/models/journey_publish_request.rbs new file mode 100644 index 00000000..45d34d19 --- /dev/null +++ b/sig/courier/models/journey_publish_request.rbs @@ -0,0 +1,15 @@ +module Courier + module Models + type journey_publish_request = { version: String } + + class JourneyPublishRequest < Courier::Internal::Type::BaseModel + attr_reader version: String? + + def version=: (String) -> String + + def initialize: (?version: String) -> void + + def to_hash: -> { version: String } + end + end +end diff --git a/sig/courier/models/journey_replace_params.rbs b/sig/courier/models/journey_replace_params.rbs new file mode 100644 index 00000000..145f7bfa --- /dev/null +++ b/sig/courier/models/journey_replace_params.rbs @@ -0,0 +1,25 @@ +module Courier + module Models + type journey_replace_params = + { template_id: String } & Courier::Internal::Type::request_parameters + + class JourneyReplaceParams < Courier::Models::CreateJourneyRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + def template_id: -> String + + def template_id=: (String _) -> String + + def initialize: ( + template_id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + request_options: Courier::RequestOptions + } + end + end +end diff --git a/sig/courier/models/journey_response.rbs b/sig/courier/models/journey_response.rbs new file mode 100644 index 00000000..36c78770 --- /dev/null +++ b/sig/courier/models/journey_response.rbs @@ -0,0 +1,65 @@ +module Courier + module Models + type journey_response = + { + id: String, + created: Integer?, + creator: String?, + enabled: bool, + name: String, + nodes: ::Array[Courier::Models::journey_node], + published: Integer?, + state: Courier::Models::journey_state, + updated: Integer?, + updater: String? + } + + class JourneyResponse < Courier::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created: Integer? + + attr_accessor creator: String? + + attr_accessor enabled: bool + + attr_accessor name: String + + attr_accessor nodes: ::Array[Courier::Models::journey_node] + + attr_accessor published: Integer? + + attr_accessor state: Courier::Models::journey_state + + attr_accessor updated: Integer? + + attr_accessor updater: String? + + def initialize: ( + id: String, + created: Integer?, + creator: String?, + enabled: bool, + name: String, + nodes: ::Array[Courier::Models::journey_node], + published: Integer?, + state: Courier::Models::journey_state, + updated: Integer?, + updater: String? + ) -> void + + def to_hash: -> { + id: String, + created: Integer?, + creator: String?, + enabled: bool, + name: String, + nodes: ::Array[Courier::Models::journey_node], + published: Integer?, + state: Courier::Models::journey_state, + updated: Integer?, + updater: String? + } + end + end +end diff --git a/sig/courier/models/journey_retrieve_params.rbs b/sig/courier/models/journey_retrieve_params.rbs new file mode 100644 index 00000000..c7f4f5ff --- /dev/null +++ b/sig/courier/models/journey_retrieve_params.rbs @@ -0,0 +1,30 @@ +module Courier + module Models + type journey_retrieve_params = + { template_id: String, version: String } + & Courier::Internal::Type::request_parameters + + class JourneyRetrieveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + attr_accessor template_id: String + + attr_reader version: String? + + def version=: (String) -> String + + def initialize: ( + template_id: String, + ?version: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + version: String, + request_options: Courier::RequestOptions + } + end + end +end diff --git a/sig/courier/models/journey_segment_trigger_node.rbs b/sig/courier/models/journey_segment_trigger_node.rbs new file mode 100644 index 00000000..614ce48f --- /dev/null +++ b/sig/courier/models/journey_segment_trigger_node.rbs @@ -0,0 +1,85 @@ +module Courier + module Models + type journey_segment_trigger_node = + { + request_type: Courier::Models::JourneySegmentTriggerNode::request_type, + trigger_type: Courier::Models::JourneySegmentTriggerNode::trigger_type, + type: Courier::Models::JourneySegmentTriggerNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field, + event_id: String + } + + class JourneySegmentTriggerNode < Courier::Internal::Type::BaseModel + attr_accessor request_type: Courier::Models::JourneySegmentTriggerNode::request_type + + attr_accessor trigger_type: Courier::Models::JourneySegmentTriggerNode::trigger_type + + attr_accessor type: Courier::Models::JourneySegmentTriggerNode::type_ + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader conditions: Courier::Models::journey_conditions_field? + + def conditions=: ( + Courier::Models::journey_conditions_field + ) -> Courier::Models::journey_conditions_field + + attr_reader event_id: String? + + def event_id=: (String) -> String + + def initialize: ( + request_type: Courier::Models::JourneySegmentTriggerNode::request_type, + trigger_type: Courier::Models::JourneySegmentTriggerNode::trigger_type, + type: Courier::Models::JourneySegmentTriggerNode::type_, + ?id: String, + ?conditions: Courier::Models::journey_conditions_field, + ?event_id: String + ) -> void + + def to_hash: -> { + request_type: Courier::Models::JourneySegmentTriggerNode::request_type, + trigger_type: Courier::Models::JourneySegmentTriggerNode::trigger_type, + type: Courier::Models::JourneySegmentTriggerNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field, + event_id: String + } + + type request_type = :identify | :group | :track + + module RequestType + extend Courier::Internal::Type::Enum + + IDENTIFY: :identify + GROUP: :group + TRACK: :track + + def self?.values: -> ::Array[Courier::Models::JourneySegmentTriggerNode::request_type] + end + + type trigger_type = :segment + + module TriggerType + extend Courier::Internal::Type::Enum + + SEGMENT: :segment + + def self?.values: -> ::Array[Courier::Models::JourneySegmentTriggerNode::trigger_type] + end + + type type_ = :trigger + + module Type + extend Courier::Internal::Type::Enum + + TRIGGER: :trigger + + def self?.values: -> ::Array[Courier::Models::JourneySegmentTriggerNode::type_] + end + end + end +end diff --git a/sig/courier/models/journey_send_node.rbs b/sig/courier/models/journey_send_node.rbs new file mode 100644 index 00000000..de575832 --- /dev/null +++ b/sig/courier/models/journey_send_node.rbs @@ -0,0 +1,140 @@ +module Courier + module Models + type journey_send_node = + { + message: Courier::JourneySendNode::Message, + type: Courier::Models::JourneySendNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field + } + + class JourneySendNode < Courier::Internal::Type::BaseModel + attr_accessor message: Courier::JourneySendNode::Message + + attr_accessor type: Courier::Models::JourneySendNode::type_ + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader conditions: Courier::Models::journey_conditions_field? + + def conditions=: ( + Courier::Models::journey_conditions_field + ) -> Courier::Models::journey_conditions_field + + def initialize: ( + message: Courier::JourneySendNode::Message, + type: Courier::Models::JourneySendNode::type_, + ?id: String, + ?conditions: Courier::Models::journey_conditions_field + ) -> void + + def to_hash: -> { + message: Courier::JourneySendNode::Message, + type: Courier::Models::JourneySendNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field + } + + type message = + { + template: String, + data: ::Hash[Symbol, top], + delay: Courier::JourneySendNode::Message::Delay, + to: Courier::JourneySendNode::Message::To + } + + class Message < Courier::Internal::Type::BaseModel + attr_accessor template: String + + attr_reader data: ::Hash[Symbol, top]? + + def data=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader delay: Courier::JourneySendNode::Message::Delay? + + def delay=: ( + Courier::JourneySendNode::Message::Delay + ) -> Courier::JourneySendNode::Message::Delay + + attr_reader to: Courier::JourneySendNode::Message::To? + + def to=: ( + Courier::JourneySendNode::Message::To + ) -> Courier::JourneySendNode::Message::To + + def initialize: ( + template: String, + ?data: ::Hash[Symbol, top], + ?delay: Courier::JourneySendNode::Message::Delay, + ?to: Courier::JourneySendNode::Message::To + ) -> void + + def to_hash: -> { + template: String, + data: ::Hash[Symbol, top], + delay: Courier::JourneySendNode::Message::Delay, + to: Courier::JourneySendNode::Message::To + } + + type delay = { until_: String, timezone: String } + + class Delay < Courier::Internal::Type::BaseModel + attr_accessor until_: String + + attr_reader timezone: String? + + def timezone=: (String) -> String + + def initialize: (until_: String, ?timezone: String) -> void + + def to_hash: -> { until_: String, timezone: String } + end + + type to = + { + email_override: String, + phone_number_override: String, + user_id_override: String + } + + class To < Courier::Internal::Type::BaseModel + attr_reader email_override: String? + + def email_override=: (String) -> String + + attr_reader phone_number_override: String? + + def phone_number_override=: (String) -> String + + attr_reader user_id_override: String? + + def user_id_override=: (String) -> String + + def initialize: ( + ?email_override: String, + ?phone_number_override: String, + ?user_id_override: String + ) -> void + + def to_hash: -> { + email_override: String, + phone_number_override: String, + user_id_override: String + } + end + end + + type type_ = :send + + module Type + extend Courier::Internal::Type::Enum + + SEND: :send + + def self?.values: -> ::Array[Courier::Models::JourneySendNode::type_] + end + end + end +end diff --git a/sig/courier/models/journey_state.rbs b/sig/courier/models/journey_state.rbs new file mode 100644 index 00000000..643bfe5f --- /dev/null +++ b/sig/courier/models/journey_state.rbs @@ -0,0 +1,14 @@ +module Courier + module Models + type journey_state = :DRAFT | :PUBLISHED + + module JourneyState + extend Courier::Internal::Type::Enum + + DRAFT: :DRAFT + PUBLISHED: :PUBLISHED + + def self?.values: -> ::Array[Courier::Models::journey_state] + end + end +end diff --git a/sig/courier/models/journey_template_create_request.rbs b/sig/courier/models/journey_template_create_request.rbs new file mode 100644 index 00000000..a9b0e55a --- /dev/null +++ b/sig/courier/models/journey_template_create_request.rbs @@ -0,0 +1,148 @@ +module Courier + module Models + type journey_template_create_request = + { + channel: String, + notification: Courier::JourneyTemplateCreateRequest::Notification, + provider_key: String, + state: String + } + + class JourneyTemplateCreateRequest < Courier::Internal::Type::BaseModel + attr_accessor channel: String + + attr_accessor notification: Courier::JourneyTemplateCreateRequest::Notification + + attr_reader provider_key: String? + + def provider_key=: (String) -> String + + attr_reader state: String? + + def state=: (String) -> String + + def initialize: ( + channel: String, + notification: Courier::JourneyTemplateCreateRequest::Notification, + ?provider_key: String, + ?state: String + ) -> void + + def to_hash: -> { + channel: String, + notification: Courier::JourneyTemplateCreateRequest::Notification, + provider_key: String, + state: String + } + + type notification = + { + brand: Courier::JourneyTemplateCreateRequest::Notification::Brand?, + content: Courier::JourneyTemplateCreateRequest::Notification::Content, + name: String, + subscription: Courier::JourneyTemplateCreateRequest::Notification::Subscription?, + tags: ::Array[String] + } + + class Notification < Courier::Internal::Type::BaseModel + attr_accessor brand: Courier::JourneyTemplateCreateRequest::Notification::Brand? + + attr_accessor content: Courier::JourneyTemplateCreateRequest::Notification::Content + + attr_accessor name: String + + attr_accessor subscription: Courier::JourneyTemplateCreateRequest::Notification::Subscription? + + attr_accessor tags: ::Array[String] + + def initialize: ( + brand: Courier::JourneyTemplateCreateRequest::Notification::Brand?, + content: Courier::JourneyTemplateCreateRequest::Notification::Content, + name: String, + subscription: Courier::JourneyTemplateCreateRequest::Notification::Subscription?, + tags: ::Array[String] + ) -> void + + def to_hash: -> { + brand: Courier::JourneyTemplateCreateRequest::Notification::Brand?, + content: Courier::JourneyTemplateCreateRequest::Notification::Content, + name: String, + subscription: Courier::JourneyTemplateCreateRequest::Notification::Subscription?, + tags: ::Array[String] + } + + type brand = { id: String } + + class Brand < Courier::Internal::Type::BaseModel + attr_accessor id: String + + def initialize: (id: String) -> void + + def to_hash: -> { id: String } + end + + type content = + { + elements: ::Array[Courier::Models::elemental_node], + version: Courier::Models::JourneyTemplateCreateRequest::Notification::Content::version, + scope: Courier::Models::JourneyTemplateCreateRequest::Notification::Content::scope + } + + class Content < Courier::Internal::Type::BaseModel + attr_accessor elements: ::Array[Courier::Models::elemental_node] + + attr_accessor version: Courier::Models::JourneyTemplateCreateRequest::Notification::Content::version + + attr_reader scope: Courier::Models::JourneyTemplateCreateRequest::Notification::Content::scope? + + def scope=: ( + Courier::Models::JourneyTemplateCreateRequest::Notification::Content::scope + ) -> Courier::Models::JourneyTemplateCreateRequest::Notification::Content::scope + + def initialize: ( + elements: ::Array[Courier::Models::elemental_node], + version: Courier::Models::JourneyTemplateCreateRequest::Notification::Content::version, + ?scope: Courier::Models::JourneyTemplateCreateRequest::Notification::Content::scope + ) -> void + + def to_hash: -> { + elements: ::Array[Courier::Models::elemental_node], + version: Courier::Models::JourneyTemplateCreateRequest::Notification::Content::version, + scope: Courier::Models::JourneyTemplateCreateRequest::Notification::Content::scope + } + + type version = :"2022-01-01" + + module Version + extend Courier::Internal::Type::Enum + + VERSION_2022_01_01: :"2022-01-01" + + def self?.values: -> ::Array[Courier::Models::JourneyTemplateCreateRequest::Notification::Content::version] + end + + type scope = :default | :strict + + module Scope + extend Courier::Internal::Type::Enum + + DEFAULT: :default + STRICT: :strict + + def self?.values: -> ::Array[Courier::Models::JourneyTemplateCreateRequest::Notification::Content::scope] + end + end + + type subscription = { topic_id: String } + + class Subscription < Courier::Internal::Type::BaseModel + attr_accessor topic_id: String + + def initialize: (topic_id: String) -> void + + def to_hash: -> { topic_id: String } + end + end + end + end +end diff --git a/sig/courier/models/journey_template_get_response.rbs b/sig/courier/models/journey_template_get_response.rbs new file mode 100644 index 00000000..66ffa682 --- /dev/null +++ b/sig/courier/models/journey_template_get_response.rbs @@ -0,0 +1,157 @@ +module Courier + module Models + type journey_template_get_response = + { + id: String, + brand: Courier::JourneyTemplateGetResponse::Brand?, + content: Courier::JourneyTemplateGetResponse::Content, + created: Integer, + creator: String, + name: String, + state: Courier::Models::JourneyTemplateGetResponse::state, + subscription: Courier::JourneyTemplateGetResponse::Subscription?, + tags: ::Array[String], + updated: Integer, + updater: String + } + + class JourneyTemplateGetResponse < Courier::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor brand: Courier::JourneyTemplateGetResponse::Brand? + + attr_accessor content: Courier::JourneyTemplateGetResponse::Content + + attr_accessor created: Integer + + attr_accessor creator: String + + attr_accessor name: String + + attr_accessor state: Courier::Models::JourneyTemplateGetResponse::state + + attr_accessor subscription: Courier::JourneyTemplateGetResponse::Subscription? + + attr_accessor tags: ::Array[String] + + attr_reader updated: Integer? + + def updated=: (Integer) -> Integer + + attr_reader updater: String? + + def updater=: (String) -> String + + def initialize: ( + id: String, + brand: Courier::JourneyTemplateGetResponse::Brand?, + content: Courier::JourneyTemplateGetResponse::Content, + created: Integer, + creator: String, + name: String, + state: Courier::Models::JourneyTemplateGetResponse::state, + subscription: Courier::JourneyTemplateGetResponse::Subscription?, + tags: ::Array[String], + ?updated: Integer, + ?updater: String + ) -> void + + def to_hash: -> { + id: String, + brand: Courier::JourneyTemplateGetResponse::Brand?, + content: Courier::JourneyTemplateGetResponse::Content, + created: Integer, + creator: String, + name: String, + state: Courier::Models::JourneyTemplateGetResponse::state, + subscription: Courier::JourneyTemplateGetResponse::Subscription?, + tags: ::Array[String], + updated: Integer, + updater: String + } + + type brand = { id: String } + + class Brand < Courier::Internal::Type::BaseModel + attr_accessor id: String + + def initialize: (id: String) -> void + + def to_hash: -> { id: String } + end + + type content = + { + elements: ::Array[Courier::Models::elemental_node], + version: Courier::Models::JourneyTemplateGetResponse::Content::version, + scope: Courier::Models::JourneyTemplateGetResponse::Content::scope + } + + class Content < Courier::Internal::Type::BaseModel + attr_accessor elements: ::Array[Courier::Models::elemental_node] + + attr_accessor version: Courier::Models::JourneyTemplateGetResponse::Content::version + + attr_reader scope: Courier::Models::JourneyTemplateGetResponse::Content::scope? + + def scope=: ( + Courier::Models::JourneyTemplateGetResponse::Content::scope + ) -> Courier::Models::JourneyTemplateGetResponse::Content::scope + + def initialize: ( + elements: ::Array[Courier::Models::elemental_node], + version: Courier::Models::JourneyTemplateGetResponse::Content::version, + ?scope: Courier::Models::JourneyTemplateGetResponse::Content::scope + ) -> void + + def to_hash: -> { + elements: ::Array[Courier::Models::elemental_node], + version: Courier::Models::JourneyTemplateGetResponse::Content::version, + scope: Courier::Models::JourneyTemplateGetResponse::Content::scope + } + + type version = :"2022-01-01" + + module Version + extend Courier::Internal::Type::Enum + + VERSION_2022_01_01: :"2022-01-01" + + def self?.values: -> ::Array[Courier::Models::JourneyTemplateGetResponse::Content::version] + end + + type scope = :default | :strict + + module Scope + extend Courier::Internal::Type::Enum + + DEFAULT: :default + STRICT: :strict + + def self?.values: -> ::Array[Courier::Models::JourneyTemplateGetResponse::Content::scope] + end + end + + type state = :DRAFT | :PUBLISHED + + module State + extend Courier::Internal::Type::Enum + + DRAFT: :DRAFT + PUBLISHED: :PUBLISHED + + def self?.values: -> ::Array[Courier::Models::JourneyTemplateGetResponse::state] + end + + type subscription = { topic_id: String } + + class Subscription < Courier::Internal::Type::BaseModel + attr_accessor topic_id: String + + def initialize: (topic_id: String) -> void + + def to_hash: -> { topic_id: String } + end + end + end +end diff --git a/sig/courier/models/journey_template_list_response.rbs b/sig/courier/models/journey_template_list_response.rbs new file mode 100644 index 00000000..ca935fa5 --- /dev/null +++ b/sig/courier/models/journey_template_list_response.rbs @@ -0,0 +1,25 @@ +module Courier + module Models + type journey_template_list_response = + { + paging: Courier::Paging, + results: ::Array[Courier::JourneyTemplateSummary] + } + + class JourneyTemplateListResponse < Courier::Internal::Type::BaseModel + attr_accessor paging: Courier::Paging + + attr_accessor results: ::Array[Courier::JourneyTemplateSummary] + + def initialize: ( + paging: Courier::Paging, + results: ::Array[Courier::JourneyTemplateSummary] + ) -> void + + def to_hash: -> { + paging: Courier::Paging, + results: ::Array[Courier::JourneyTemplateSummary] + } + end + end +end diff --git a/sig/courier/models/journey_template_publish_request.rbs b/sig/courier/models/journey_template_publish_request.rbs new file mode 100644 index 00000000..760e39e3 --- /dev/null +++ b/sig/courier/models/journey_template_publish_request.rbs @@ -0,0 +1,15 @@ +module Courier + module Models + type journey_template_publish_request = { version: String } + + class JourneyTemplatePublishRequest < Courier::Internal::Type::BaseModel + attr_reader version: String? + + def version=: (String) -> String + + def initialize: (?version: String) -> void + + def to_hash: -> { version: String } + end + end +end diff --git a/sig/courier/models/journey_template_replace_request.rbs b/sig/courier/models/journey_template_replace_request.rbs new file mode 100644 index 00000000..766e6744 --- /dev/null +++ b/sig/courier/models/journey_template_replace_request.rbs @@ -0,0 +1,136 @@ +module Courier + module Models + type journey_template_replace_request = + { + notification: Courier::JourneyTemplateReplaceRequest::Notification, + state: String + } + + class JourneyTemplateReplaceRequest < Courier::Internal::Type::BaseModel + attr_accessor notification: Courier::JourneyTemplateReplaceRequest::Notification + + attr_reader state: String? + + def state=: (String) -> String + + def initialize: ( + notification: Courier::JourneyTemplateReplaceRequest::Notification, + ?state: String + ) -> void + + def to_hash: -> { + notification: Courier::JourneyTemplateReplaceRequest::Notification, + state: String + } + + type notification = + { + brand: Courier::JourneyTemplateReplaceRequest::Notification::Brand?, + content: Courier::JourneyTemplateReplaceRequest::Notification::Content, + name: String, + subscription: Courier::JourneyTemplateReplaceRequest::Notification::Subscription?, + tags: ::Array[String] + } + + class Notification < Courier::Internal::Type::BaseModel + attr_accessor brand: Courier::JourneyTemplateReplaceRequest::Notification::Brand? + + attr_accessor content: Courier::JourneyTemplateReplaceRequest::Notification::Content + + attr_accessor name: String + + attr_accessor subscription: Courier::JourneyTemplateReplaceRequest::Notification::Subscription? + + attr_accessor tags: ::Array[String] + + def initialize: ( + brand: Courier::JourneyTemplateReplaceRequest::Notification::Brand?, + content: Courier::JourneyTemplateReplaceRequest::Notification::Content, + name: String, + subscription: Courier::JourneyTemplateReplaceRequest::Notification::Subscription?, + tags: ::Array[String] + ) -> void + + def to_hash: -> { + brand: Courier::JourneyTemplateReplaceRequest::Notification::Brand?, + content: Courier::JourneyTemplateReplaceRequest::Notification::Content, + name: String, + subscription: Courier::JourneyTemplateReplaceRequest::Notification::Subscription?, + tags: ::Array[String] + } + + type brand = { id: String } + + class Brand < Courier::Internal::Type::BaseModel + attr_accessor id: String + + def initialize: (id: String) -> void + + def to_hash: -> { id: String } + end + + type content = + { + elements: ::Array[Courier::Models::elemental_node], + version: Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::version, + scope: Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::scope + } + + class Content < Courier::Internal::Type::BaseModel + attr_accessor elements: ::Array[Courier::Models::elemental_node] + + attr_accessor version: Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::version + + attr_reader scope: Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::scope? + + def scope=: ( + Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::scope + ) -> Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::scope + + def initialize: ( + elements: ::Array[Courier::Models::elemental_node], + version: Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::version, + ?scope: Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::scope + ) -> void + + def to_hash: -> { + elements: ::Array[Courier::Models::elemental_node], + version: Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::version, + scope: Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::scope + } + + type version = :"2022-01-01" + + module Version + extend Courier::Internal::Type::Enum + + VERSION_2022_01_01: :"2022-01-01" + + def self?.values: -> ::Array[Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::version] + end + + type scope = :default | :strict + + module Scope + extend Courier::Internal::Type::Enum + + DEFAULT: :default + STRICT: :strict + + def self?.values: -> ::Array[Courier::Models::JourneyTemplateReplaceRequest::Notification::Content::scope] + end + end + + type subscription = { topic_id: String } + + class Subscription < Courier::Internal::Type::BaseModel + attr_accessor topic_id: String + + def initialize: (topic_id: String) -> void + + def to_hash: -> { topic_id: String } + end + end + end + end +end diff --git a/sig/courier/models/journey_template_summary.rbs b/sig/courier/models/journey_template_summary.rbs new file mode 100644 index 00000000..be940afd --- /dev/null +++ b/sig/courier/models/journey_template_summary.rbs @@ -0,0 +1,59 @@ +module Courier + module Models + type journey_template_summary = + { + id: String, + created: Integer, + creator: String, + name: String, + state: String, + tags: ::Array[String], + updated: Integer, + updater: String + } + + class JourneyTemplateSummary < Courier::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created: Integer + + attr_accessor creator: String + + attr_accessor name: String + + attr_accessor state: String + + attr_accessor tags: ::Array[String] + + attr_reader updated: Integer? + + def updated=: (Integer) -> Integer + + attr_reader updater: String? + + def updater=: (String) -> String + + def initialize: ( + id: String, + created: Integer, + creator: String, + name: String, + state: String, + tags: ::Array[String], + ?updated: Integer, + ?updater: String + ) -> void + + def to_hash: -> { + id: String, + created: Integer, + creator: String, + name: String, + state: String, + tags: ::Array[String], + updated: Integer, + updater: String + } + end + end +end diff --git a/sig/courier/models/journey_throttle_dynamic_node.rbs b/sig/courier/models/journey_throttle_dynamic_node.rbs new file mode 100644 index 00000000..c6aaac7a --- /dev/null +++ b/sig/courier/models/journey_throttle_dynamic_node.rbs @@ -0,0 +1,76 @@ +module Courier + module Models + type journey_throttle_dynamic_node = + { + max_allowed: Integer, + period: String, + scope: Courier::Models::JourneyThrottleDynamicNode::scope, + throttle_key: String, + type: Courier::Models::JourneyThrottleDynamicNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field + } + + class JourneyThrottleDynamicNode < Courier::Internal::Type::BaseModel + attr_accessor max_allowed: Integer + + attr_accessor period: String + + attr_accessor scope: Courier::Models::JourneyThrottleDynamicNode::scope + + attr_accessor throttle_key: String + + attr_accessor type: Courier::Models::JourneyThrottleDynamicNode::type_ + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader conditions: Courier::Models::journey_conditions_field? + + def conditions=: ( + Courier::Models::journey_conditions_field + ) -> Courier::Models::journey_conditions_field + + def initialize: ( + max_allowed: Integer, + period: String, + scope: Courier::Models::JourneyThrottleDynamicNode::scope, + throttle_key: String, + type: Courier::Models::JourneyThrottleDynamicNode::type_, + ?id: String, + ?conditions: Courier::Models::journey_conditions_field + ) -> void + + def to_hash: -> { + max_allowed: Integer, + period: String, + scope: Courier::Models::JourneyThrottleDynamicNode::scope, + throttle_key: String, + type: Courier::Models::JourneyThrottleDynamicNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field + } + + type scope = :dynamic + + module Scope + extend Courier::Internal::Type::Enum + + DYNAMIC: :dynamic + + def self?.values: -> ::Array[Courier::Models::JourneyThrottleDynamicNode::scope] + end + + type type_ = :throttle + + module Type + extend Courier::Internal::Type::Enum + + THROTTLE: :throttle + + def self?.values: -> ::Array[Courier::Models::JourneyThrottleDynamicNode::type_] + end + end + end +end diff --git a/sig/courier/models/journey_throttle_static_node.rbs b/sig/courier/models/journey_throttle_static_node.rbs new file mode 100644 index 00000000..867e163e --- /dev/null +++ b/sig/courier/models/journey_throttle_static_node.rbs @@ -0,0 +1,72 @@ +module Courier + module Models + type journey_throttle_static_node = + { + max_allowed: Integer, + period: String, + scope: Courier::Models::JourneyThrottleStaticNode::scope, + type: Courier::Models::JourneyThrottleStaticNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field + } + + class JourneyThrottleStaticNode < Courier::Internal::Type::BaseModel + attr_accessor max_allowed: Integer + + attr_accessor period: String + + attr_accessor scope: Courier::Models::JourneyThrottleStaticNode::scope + + attr_accessor type: Courier::Models::JourneyThrottleStaticNode::type_ + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader conditions: Courier::Models::journey_conditions_field? + + def conditions=: ( + Courier::Models::journey_conditions_field + ) -> Courier::Models::journey_conditions_field + + def initialize: ( + max_allowed: Integer, + period: String, + scope: Courier::Models::JourneyThrottleStaticNode::scope, + type: Courier::Models::JourneyThrottleStaticNode::type_, + ?id: String, + ?conditions: Courier::Models::journey_conditions_field + ) -> void + + def to_hash: -> { + max_allowed: Integer, + period: String, + scope: Courier::Models::JourneyThrottleStaticNode::scope, + type: Courier::Models::JourneyThrottleStaticNode::type_, + id: String, + conditions: Courier::Models::journey_conditions_field + } + + type scope = :user | :global + + module Scope + extend Courier::Internal::Type::Enum + + USER: :user + GLOBAL: :global + + def self?.values: -> ::Array[Courier::Models::JourneyThrottleStaticNode::scope] + end + + type type_ = :throttle + + module Type + extend Courier::Internal::Type::Enum + + THROTTLE: :throttle + + def self?.values: -> ::Array[Courier::Models::JourneyThrottleStaticNode::type_] + end + end + end +end diff --git a/sig/courier/models/journey_version_item.rbs b/sig/courier/models/journey_version_item.rbs new file mode 100644 index 00000000..25746745 --- /dev/null +++ b/sig/courier/models/journey_version_item.rbs @@ -0,0 +1,40 @@ +module Courier + module Models + type journey_version_item = + { + created: Integer?, + creator: String?, + name: String, + published: Integer?, + version: String + } + + class JourneyVersionItem < Courier::Internal::Type::BaseModel + attr_accessor created: Integer? + + attr_accessor creator: String? + + attr_accessor name: String + + attr_accessor published: Integer? + + attr_accessor version: String + + def initialize: ( + created: Integer?, + creator: String?, + name: String, + published: Integer?, + version: String + ) -> void + + def to_hash: -> { + created: Integer?, + creator: String?, + name: String, + published: Integer?, + version: String + } + end + end +end diff --git a/sig/courier/models/journey_versions_list_response.rbs b/sig/courier/models/journey_versions_list_response.rbs new file mode 100644 index 00000000..424e0264 --- /dev/null +++ b/sig/courier/models/journey_versions_list_response.rbs @@ -0,0 +1,22 @@ +module Courier + module Models + type journey_versions_list_response = + { paging: Courier::Paging, results: ::Array[Courier::JourneyVersionItem] } + + class JourneyVersionsListResponse < Courier::Internal::Type::BaseModel + attr_accessor paging: Courier::Paging + + attr_accessor results: ::Array[Courier::JourneyVersionItem] + + def initialize: ( + paging: Courier::Paging, + results: ::Array[Courier::JourneyVersionItem] + ) -> void + + def to_hash: -> { + paging: Courier::Paging, + results: ::Array[Courier::JourneyVersionItem] + } + end + end +end diff --git a/sig/courier/models/journeys/template_archive_params.rbs b/sig/courier/models/journeys/template_archive_params.rbs new file mode 100644 index 00000000..14eeb189 --- /dev/null +++ b/sig/courier/models/journeys/template_archive_params.rbs @@ -0,0 +1,30 @@ +module Courier + module Models + module Journeys + type template_archive_params = + { template_id: String, notification_id: String } + & Courier::Internal::Type::request_parameters + + class TemplateArchiveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + attr_accessor template_id: String + + attr_accessor notification_id: String + + def initialize: ( + template_id: String, + notification_id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions + } + end + end + end +end diff --git a/sig/courier/models/journeys/template_create_params.rbs b/sig/courier/models/journeys/template_create_params.rbs new file mode 100644 index 00000000..1e835b55 --- /dev/null +++ b/sig/courier/models/journeys/template_create_params.rbs @@ -0,0 +1,27 @@ +module Courier + module Models + module Journeys + type template_create_params = + { template_id: String } & Courier::Internal::Type::request_parameters + + class TemplateCreateParams < Courier::Models::JourneyTemplateCreateRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + def template_id: -> String + + def template_id=: (String _) -> String + + def initialize: ( + template_id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + request_options: Courier::RequestOptions + } + end + end + end +end diff --git a/sig/courier/models/journeys/template_list_params.rbs b/sig/courier/models/journeys/template_list_params.rbs new file mode 100644 index 00000000..7f8d0e78 --- /dev/null +++ b/sig/courier/models/journeys/template_list_params.rbs @@ -0,0 +1,38 @@ +module Courier + module Models + module Journeys + type template_list_params = + { template_id: String, cursor: String, limit: Integer } + & Courier::Internal::Type::request_parameters + + class TemplateListParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + attr_accessor template_id: String + + attr_reader cursor: String? + + def cursor=: (String) -> String + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + def initialize: ( + template_id: String, + ?cursor: String, + ?limit: Integer, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + cursor: String, + limit: Integer, + request_options: Courier::RequestOptions + } + end + end + end +end diff --git a/sig/courier/models/journeys/template_list_versions_params.rbs b/sig/courier/models/journeys/template_list_versions_params.rbs new file mode 100644 index 00000000..8ca6072f --- /dev/null +++ b/sig/courier/models/journeys/template_list_versions_params.rbs @@ -0,0 +1,30 @@ +module Courier + module Models + module Journeys + type template_list_versions_params = + { template_id: String, notification_id: String } + & Courier::Internal::Type::request_parameters + + class TemplateListVersionsParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + attr_accessor template_id: String + + attr_accessor notification_id: String + + def initialize: ( + template_id: String, + notification_id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions + } + end + end + end +end diff --git a/sig/courier/models/journeys/template_publish_params.rbs b/sig/courier/models/journeys/template_publish_params.rbs new file mode 100644 index 00000000..a39f9b6f --- /dev/null +++ b/sig/courier/models/journeys/template_publish_params.rbs @@ -0,0 +1,34 @@ +module Courier + module Models + module Journeys + type template_publish_params = + { template_id: String, notification_id: String } + & Courier::Internal::Type::request_parameters + + class TemplatePublishParams < Courier::Models::JourneyTemplatePublishRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + def template_id: -> String + + def template_id=: (String _) -> String + + def notification_id: -> String + + def notification_id=: (String _) -> String + + def initialize: ( + template_id: String, + notification_id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions + } + end + end + end +end diff --git a/sig/courier/models/journeys/template_replace_params.rbs b/sig/courier/models/journeys/template_replace_params.rbs new file mode 100644 index 00000000..e9c3de6a --- /dev/null +++ b/sig/courier/models/journeys/template_replace_params.rbs @@ -0,0 +1,34 @@ +module Courier + module Models + module Journeys + type template_replace_params = + { template_id: String, notification_id: String } + & Courier::Internal::Type::request_parameters + + class TemplateReplaceParams < Courier::Models::JourneyTemplateReplaceRequest + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + def template_id: -> String + + def template_id=: (String _) -> String + + def notification_id: -> String + + def notification_id=: (String _) -> String + + def initialize: ( + template_id: String, + notification_id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions + } + end + end + end +end diff --git a/sig/courier/models/journeys/template_retrieve_params.rbs b/sig/courier/models/journeys/template_retrieve_params.rbs new file mode 100644 index 00000000..b526af55 --- /dev/null +++ b/sig/courier/models/journeys/template_retrieve_params.rbs @@ -0,0 +1,30 @@ +module Courier + module Models + module Journeys + type template_retrieve_params = + { template_id: String, notification_id: String } + & Courier::Internal::Type::request_parameters + + class TemplateRetrieveParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + attr_accessor template_id: String + + attr_accessor notification_id: String + + def initialize: ( + template_id: String, + notification_id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + template_id: String, + notification_id: String, + request_options: Courier::RequestOptions + } + end + end + end +end diff --git a/sig/courier/resources/journeys.rbs b/sig/courier/resources/journeys.rbs index 086bc02b..74a19e63 100644 --- a/sig/courier/resources/journeys.rbs +++ b/sig/courier/resources/journeys.rbs @@ -1,12 +1,33 @@ module Courier module Resources class Journeys + attr_reader templates: Courier::Resources::Journeys::Templates + + def create: ( + name: String, + nodes: ::Array[Courier::Models::journey_node], + ?enabled: bool, + ?state: Courier::Models::journey_state, + ?request_options: Courier::request_opts + ) -> Courier::JourneyResponse + + def retrieve: ( + String template_id, + ?version: String, + ?request_options: Courier::request_opts + ) -> Courier::JourneyResponse + def list: ( ?cursor: String, ?version: Courier::Models::JourneyListParams::version, ?request_options: Courier::request_opts ) -> Courier::JourneysListResponse + def archive: ( + String template_id, + ?request_options: Courier::request_opts + ) -> nil + def invoke: ( String template_id, ?data: ::Hash[Symbol, top], @@ -15,6 +36,26 @@ module Courier ?request_options: Courier::request_opts ) -> Courier::JourneysInvokeResponse + def list_versions: ( + String template_id, + ?request_options: Courier::request_opts + ) -> Courier::JourneyVersionsListResponse + + def publish: ( + String template_id, + ?version: String, + ?request_options: Courier::request_opts + ) -> Courier::JourneyResponse + + def replace: ( + String template_id, + name: String, + nodes: ::Array[Courier::Models::journey_node], + ?enabled: bool, + ?state: Courier::Models::journey_state, + ?request_options: Courier::request_opts + ) -> Courier::JourneyResponse + def initialize: (client: Courier::Client) -> void end end diff --git a/sig/courier/resources/journeys/templates.rbs b/sig/courier/resources/journeys/templates.rbs new file mode 100644 index 00000000..fd0d8b19 --- /dev/null +++ b/sig/courier/resources/journeys/templates.rbs @@ -0,0 +1,58 @@ +module Courier + module Resources + class Journeys + class Templates + def create: ( + String template_id, + channel: String, + notification: Courier::JourneyTemplateCreateRequest::Notification, + ?provider_key: String, + ?state: String, + ?request_options: Courier::request_opts + ) -> Courier::JourneyTemplateGetResponse + + def retrieve: ( + String notification_id, + template_id: String, + ?request_options: Courier::request_opts + ) -> Courier::JourneyTemplateGetResponse + + def list: ( + String template_id, + ?cursor: String, + ?limit: Integer, + ?request_options: Courier::request_opts + ) -> Courier::JourneyTemplateListResponse + + def archive: ( + String notification_id, + template_id: String, + ?request_options: Courier::request_opts + ) -> nil + + def list_versions: ( + String notification_id, + template_id: String, + ?request_options: Courier::request_opts + ) -> Courier::NotificationTemplateVersionListResponse + + def publish: ( + String notification_id, + template_id: String, + ?version: String, + ?request_options: Courier::request_opts + ) -> nil + + def replace: ( + String notification_id, + template_id: String, + notification: Courier::JourneyTemplateReplaceRequest::Notification, + ?state: String, + ?request_options: Courier::request_opts + ) -> Courier::JourneyTemplateGetResponse + + def initialize: (client: Courier::Client) -> void + end + end + end +end diff --git a/test/courier/resource_namespaces.rb b/test/courier/resource_namespaces.rb index 542310b2..d84a5e8f 100644 --- a/test/courier/resource_namespaces.rb +++ b/test/courier/resource_namespaces.rb @@ -6,6 +6,9 @@ module Resources module Automations end + module Journeys + end + module Lists end diff --git a/test/courier/resources/journeys/templates_test.rb b/test/courier/resources/journeys/templates_test.rb new file mode 100644 index 00000000..f8065a16 --- /dev/null +++ b/test/courier/resources/journeys/templates_test.rb @@ -0,0 +1,159 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Courier::Test::Resources::Journeys::TemplatesTest < Courier::Test::ResourceTest + def test_create_required_params + skip("Mock server tests are disabled") + + response = + @courier.journeys.templates.create( + "x", + channel: "email", + notification: { + brand: {id: "id"}, + content: {elements: [{}], version: :"2022-01-01"}, + name: "Welcome email", + subscription: {topic_id: "topic_id"}, + tags: ["string"] + } + ) + + assert_pattern do + response => Courier::JourneyTemplateGetResponse + end + + assert_pattern do + response => { + id: String, + brand: Courier::JourneyTemplateGetResponse::Brand | nil, + content: Courier::JourneyTemplateGetResponse::Content, + created: Integer, + creator: String, + name: String, + state: Courier::JourneyTemplateGetResponse::State, + subscription: Courier::JourneyTemplateGetResponse::Subscription | nil, + tags: ^(Courier::Internal::Type::ArrayOf[String]), + updated: Integer | nil, + updater: String | nil + } + end + end + + def test_retrieve_required_params + skip("Mock server tests are disabled") + + response = @courier.journeys.templates.retrieve("x", template_id: "x") + + assert_pattern do + response => Courier::JourneyTemplateGetResponse + end + + assert_pattern do + response => { + id: String, + brand: Courier::JourneyTemplateGetResponse::Brand | nil, + content: Courier::JourneyTemplateGetResponse::Content, + created: Integer, + creator: String, + name: String, + state: Courier::JourneyTemplateGetResponse::State, + subscription: Courier::JourneyTemplateGetResponse::Subscription | nil, + tags: ^(Courier::Internal::Type::ArrayOf[String]), + updated: Integer | nil, + updater: String | nil + } + end + end + + def test_list + skip("Mock server tests are disabled") + + response = @courier.journeys.templates.list("x") + + assert_pattern do + response => Courier::JourneyTemplateListResponse + end + + assert_pattern do + response => { + paging: Courier::Paging, + results: ^(Courier::Internal::Type::ArrayOf[Courier::JourneyTemplateSummary]) + } + end + end + + def test_archive_required_params + skip("Mock server tests are disabled") + + response = @courier.journeys.templates.archive("x", template_id: "x") + + assert_pattern do + response => nil + end + end + + def test_list_versions_required_params + skip("Mock server tests are disabled") + + response = @courier.journeys.templates.list_versions("x", template_id: "x") + + assert_pattern do + response => Courier::NotificationTemplateVersionListResponse + end + + assert_pattern do + response => { + paging: Courier::Paging, + versions: ^(Courier::Internal::Type::ArrayOf[Courier::VersionNode]) + } + end + end + + def test_publish_required_params + skip("Mock server tests are disabled") + + response = @courier.journeys.templates.publish("x", template_id: "x") + + assert_pattern do + response => nil + end + end + + def test_replace_required_params + skip("Mock server tests are disabled") + + response = + @courier.journeys.templates.replace( + "x", + template_id: "x", + notification: { + brand: {id: "id"}, + content: {elements: [{}], version: :"2022-01-01"}, + name: "name", + subscription: {topic_id: "topic_id"}, + tags: ["string"] + } + ) + + assert_pattern do + response => Courier::JourneyTemplateGetResponse + end + + assert_pattern do + response => { + id: String, + brand: Courier::JourneyTemplateGetResponse::Brand | nil, + content: Courier::JourneyTemplateGetResponse::Content, + created: Integer, + creator: String, + name: String, + state: Courier::JourneyTemplateGetResponse::State, + subscription: Courier::JourneyTemplateGetResponse::Subscription | nil, + tags: ^(Courier::Internal::Type::ArrayOf[String]), + updated: Integer | nil, + updater: String | nil + } + end + end +end diff --git a/test/courier/resources/journeys_test.rb b/test/courier/resources/journeys_test.rb index 740db435..589545b2 100644 --- a/test/courier/resources/journeys_test.rb +++ b/test/courier/resources/journeys_test.rb @@ -3,6 +3,60 @@ require_relative "../test_helper" class Courier::Test::Resources::JourneysTest < Courier::Test::ResourceTest + def test_create_required_params + skip("Mock server tests are disabled") + + response = + @courier.journeys.create( + name: "Welcome Journey", + nodes: [{trigger_type: :"api-invoke", type: :trigger}, {trigger_type: :"api-invoke", type: :trigger}] + ) + + assert_pattern do + response => Courier::JourneyResponse + end + + assert_pattern do + response => { + id: String, + created: Integer | nil, + creator: String | nil, + enabled: Courier::Internal::Type::Boolean, + name: String, + nodes: ^(Courier::Internal::Type::ArrayOf[union: Courier::JourneyNode]), + published: Integer | nil, + state: Courier::JourneyState, + updated: Integer | nil, + updater: String | nil + } + end + end + + def test_retrieve + skip("Mock server tests are disabled") + + response = @courier.journeys.retrieve("x") + + assert_pattern do + response => Courier::JourneyResponse + end + + assert_pattern do + response => { + id: String, + created: Integer | nil, + creator: String | nil, + enabled: Courier::Internal::Type::Boolean, + name: String, + nodes: ^(Courier::Internal::Type::ArrayOf[union: Courier::JourneyNode]), + published: Integer | nil, + state: Courier::JourneyState, + updated: Integer | nil, + updater: String | nil + } + end + end + def test_list skip("Mock server tests are disabled") @@ -20,6 +74,16 @@ def test_list end end + def test_archive + skip("Mock server tests are disabled") + + response = @courier.journeys.archive("x") + + assert_pattern do + response => nil + end + end + def test_invoke skip("Mock server tests are disabled") @@ -35,4 +99,76 @@ def test_invoke } end end + + def test_list_versions + skip("Mock server tests are disabled") + + response = @courier.journeys.list_versions("x") + + assert_pattern do + response => Courier::JourneyVersionsListResponse + end + + assert_pattern do + response => { + paging: Courier::Paging, + results: ^(Courier::Internal::Type::ArrayOf[Courier::JourneyVersionItem]) + } + end + end + + def test_publish + skip("Mock server tests are disabled") + + response = @courier.journeys.publish("x") + + assert_pattern do + response => Courier::JourneyResponse + end + + assert_pattern do + response => { + id: String, + created: Integer | nil, + creator: String | nil, + enabled: Courier::Internal::Type::Boolean, + name: String, + nodes: ^(Courier::Internal::Type::ArrayOf[union: Courier::JourneyNode]), + published: Integer | nil, + state: Courier::JourneyState, + updated: Integer | nil, + updater: String | nil + } + end + end + + def test_replace_required_params + skip("Mock server tests are disabled") + + response = + @courier.journeys.replace( + "x", + name: "Welcome Journey v2", + nodes: [{trigger_type: :"api-invoke", type: :trigger}] + ) + + assert_pattern do + response => Courier::JourneyResponse + end + + assert_pattern do + response => { + id: String, + created: Integer | nil, + creator: String | nil, + enabled: Courier::Internal::Type::Boolean, + name: String, + nodes: ^(Courier::Internal::Type::ArrayOf[union: Courier::JourneyNode]), + published: Integer | nil, + state: Courier::JourneyState, + updated: Integer | nil, + updater: String | nil + } + end + end end From 72df650b8e3e6bde00a5a8f047c16e77f2c97ac3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 15 May 2026 17:18:49 +0000 Subject: [PATCH 08/15] feat: [SUP-607] Add DELETE endpoint for Courier Create tenant templates --- .stats.yml | 8 ++-- lib/courier.rb | 1 + .../models/tenants/template_delete_params.rb | 28 +++++++++++ lib/courier/resources/tenants/templates.rb | 32 +++++++++++++ .../models/tenants/template_delete_params.rbi | 48 +++++++++++++++++++ rbi/courier/resources/tenants/templates.rbi | 22 +++++++++ .../models/tenants/template_delete_params.rbs | 30 ++++++++++++ sig/courier/resources/tenants/templates.rbs | 6 +++ .../resources/tenants/templates_test.rb | 10 ++++ 9 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 lib/courier/models/tenants/template_delete_params.rb create mode 100644 rbi/courier/models/tenants/template_delete_params.rbi create mode 100644 sig/courier/models/tenants/template_delete_params.rbs diff --git a/.stats.yml b/.stats.yml index eb39c6b7..d43ae964 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 116 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-389afcb57163d4391f72d240c33a82d0522b958400603f137981480cda54558a.yml -openapi_spec_hash: c861d7fcd81ad5bfdaf8da0f5a84f497 -config_hash: e40fec72c1ab30fded57c222ace689b5 +configured_endpoints: 117 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-ebe0d758a32897eaf20f252329168bbe2c2da7f580bb871357e63f4b451c684e.yml +openapi_spec_hash: ba0c3cf85aa82f17744e217258a55b2e +config_hash: 10bd597dd6cc89023541bc551b6532b8 diff --git a/lib/courier.rb b/lib/courier.rb index a3ce4a0f..80d81406 100644 --- a/lib/courier.rb +++ b/lib/courier.rb @@ -333,6 +333,7 @@ require_relative "courier/models/tenant_retrieve_params" require_relative "courier/models/tenants/preferences/item_delete_params" require_relative "courier/models/tenants/preferences/item_update_params" +require_relative "courier/models/tenants/template_delete_params" require_relative "courier/models/tenants/template_list_params" require_relative "courier/models/tenants/template_list_response" require_relative "courier/models/tenants/template_publish_params" diff --git a/lib/courier/models/tenants/template_delete_params.rb b/lib/courier/models/tenants/template_delete_params.rb new file mode 100644 index 00000000..7337f535 --- /dev/null +++ b/lib/courier/models/tenants/template_delete_params.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Courier + module Models + module Tenants + # @see Courier::Resources::Tenants::Templates#delete + class TemplateDeleteParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute tenant_id + # + # @return [String] + required :tenant_id, String + + # @!attribute template_id + # + # @return [String] + required :template_id, String + + # @!method initialize(tenant_id:, template_id:, request_options: {}) + # @param tenant_id [String] + # @param template_id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/courier/resources/tenants/templates.rb b/lib/courier/resources/tenants/templates.rb index 823e5ab3..4816549d 100644 --- a/lib/courier/resources/tenants/templates.rb +++ b/lib/courier/resources/tenants/templates.rb @@ -61,6 +61,38 @@ def list(tenant_id, params = {}) ) end + # Deletes the tenant's notification template with the given `template_id`. + # + # Returns **204 No Content** with an empty body on success. + # + # Returns **404** if there is no template with this ID for the tenant, including a + # second `DELETE` after a successful removal. + # + # @overload delete(template_id, tenant_id:, request_options: {}) + # + # @param template_id [String] Id of the template to remove from the tenant. + # + # @param tenant_id [String] Id of the tenant that owns the template. + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Courier::Models::Tenants::TemplateDeleteParams + def delete(template_id, params) + parsed, options = Courier::Tenants::TemplateDeleteParams.dump_request(params) + tenant_id = + parsed.delete(:tenant_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + @client.request( + method: :delete, + path: ["tenants/%1$s/templates/%2$s", tenant_id, template_id], + model: NilClass, + options: options + ) + end + # Some parameter documentations has been truncated, see # {Courier::Models::Tenants::TemplatePublishParams} for more details. # diff --git a/rbi/courier/models/tenants/template_delete_params.rbi b/rbi/courier/models/tenants/template_delete_params.rbi new file mode 100644 index 00000000..781c1be5 --- /dev/null +++ b/rbi/courier/models/tenants/template_delete_params.rbi @@ -0,0 +1,48 @@ +# typed: strong + +module Courier + module Models + module Tenants + class TemplateDeleteParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Courier::Tenants::TemplateDeleteParams, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :tenant_id + + sig { returns(String) } + attr_accessor :template_id + + sig do + params( + tenant_id: String, + template_id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(tenant_id:, template_id:, request_options: {}) + end + + sig do + override.returns( + { + tenant_id: String, + template_id: String, + request_options: Courier::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/courier/resources/tenants/templates.rbi b/rbi/courier/resources/tenants/templates.rbi index 922c1905..2e40d7e1 100644 --- a/rbi/courier/resources/tenants/templates.rbi +++ b/rbi/courier/resources/tenants/templates.rbi @@ -44,6 +44,28 @@ module Courier ) end + # Deletes the tenant's notification template with the given `template_id`. + # + # Returns **204 No Content** with an empty body on success. + # + # Returns **404** if there is no template with this ID for the tenant, including a + # second `DELETE` after a successful removal. + sig do + params( + template_id: String, + tenant_id: String, + request_options: Courier::RequestOptions::OrHash + ).void + end + def delete( + # Id of the template to remove from the tenant. + template_id, + # Id of the tenant that owns the template. + tenant_id:, + request_options: {} + ) + end + # Publishes a specific version of a notification template for a tenant. # # The template must already exist in the tenant's notification map. If no version diff --git a/sig/courier/models/tenants/template_delete_params.rbs b/sig/courier/models/tenants/template_delete_params.rbs new file mode 100644 index 00000000..1e90b54f --- /dev/null +++ b/sig/courier/models/tenants/template_delete_params.rbs @@ -0,0 +1,30 @@ +module Courier + module Models + module Tenants + type template_delete_params = + { tenant_id: String, template_id: String } + & Courier::Internal::Type::request_parameters + + class TemplateDeleteParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + attr_accessor tenant_id: String + + attr_accessor template_id: String + + def initialize: ( + tenant_id: String, + template_id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { + tenant_id: String, + template_id: String, + request_options: Courier::RequestOptions + } + end + end + end +end diff --git a/sig/courier/resources/tenants/templates.rbs b/sig/courier/resources/tenants/templates.rbs index 0b06fb01..b5c55997 100644 --- a/sig/courier/resources/tenants/templates.rbs +++ b/sig/courier/resources/tenants/templates.rbs @@ -17,6 +17,12 @@ module Courier ?request_options: Courier::request_opts ) -> Courier::Models::Tenants::TemplateListResponse + def delete: ( + String template_id, + tenant_id: String, + ?request_options: Courier::request_opts + ) -> nil + def publish: ( String template_id, tenant_id: String, diff --git a/test/courier/resources/tenants/templates_test.rb b/test/courier/resources/tenants/templates_test.rb index 8f017bcb..c79db73e 100644 --- a/test/courier/resources/tenants/templates_test.rb +++ b/test/courier/resources/tenants/templates_test.rb @@ -44,6 +44,16 @@ def test_list end end + def test_delete_required_params + skip("Mock server tests are disabled") + + response = @courier.tenants.templates.delete("template_id", tenant_id: "tenant_id") + + assert_pattern do + response => nil + end + end + def test_publish_required_params skip("Mock server tests are disabled") From 3aee861ccc8f4e402515bb83da2e4d4d00bd1d5e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 20:43:32 +0000 Subject: [PATCH 09/15] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index d43ae964..ddb532d0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 117 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-ebe0d758a32897eaf20f252329168bbe2c2da7f580bb871357e63f4b451c684e.yml -openapi_spec_hash: ba0c3cf85aa82f17744e217258a55b2e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-9c7c42e30eba90a90a7559c8442efb90604f8632e0d2354dba56b28921fe8bc2.yml +openapi_spec_hash: d144aadd6edbc5b99304da401b9b9e9a config_hash: 10bd597dd6cc89023541bc551b6532b8 From ace9f560613c57297a217875e757cd837bee933c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 21:07:32 +0000 Subject: [PATCH 10/15] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ddb532d0..a5421369 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 117 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-9c7c42e30eba90a90a7559c8442efb90604f8632e0d2354dba56b28921fe8bc2.yml -openapi_spec_hash: d144aadd6edbc5b99304da401b9b9e9a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-d8dfdbe328b158491d3c3f4c9bb2dd4d92dc57f8582cdd4ef25c5b69ace1b859.yml +openapi_spec_hash: f657cb57513b19acc97edb5f95289a73 config_hash: 10bd597dd6cc89023541bc551b6532b8 From 7afce3ac93531e7365ede9c8f23f47a8e729ec43 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 21:36:59 +0000 Subject: [PATCH 11/15] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a5421369..efb115f2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 117 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-d8dfdbe328b158491d3c3f4c9bb2dd4d92dc57f8582cdd4ef25c5b69ace1b859.yml -openapi_spec_hash: f657cb57513b19acc97edb5f95289a73 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-602215ef914077f1b7c18b9159f77ad23b8efe46da1022734cfb1a7d0d4d3d0d.yml +openapi_spec_hash: 2e56ad5f78a5cc71d639227c14683d20 config_hash: 10bd597dd6cc89023541bc551b6532b8 From 2821d57b709c25ca2b17b6aa8c7ef847f585eace Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 21:46:12 +0000 Subject: [PATCH 12/15] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index efb115f2..58f9ecd9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 117 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-602215ef914077f1b7c18b9159f77ad23b8efe46da1022734cfb1a7d0d4d3d0d.yml -openapi_spec_hash: 2e56ad5f78a5cc71d639227c14683d20 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-4c42b45dbeb17b835571e6d0e319517cdd77133c1c5a99ef9c942d974017157a.yml +openapi_spec_hash: 6705bdaf23c4ecf94646d565de5f158c config_hash: 10bd597dd6cc89023541bc551b6532b8 From 5930853b36e87fc434a5f316d5144459d8a5156c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 01:20:27 +0000 Subject: [PATCH 13/15] feat: [C-18380] Journeys API reference: copy + naming cleanup --- .stats.yml | 4 +- lib/courier/models/create_journey_request.rb | 8 +++- lib/courier/models/journey_ai_node.rb | 3 ++ .../models/journey_api_invoke_trigger_node.rb | 3 ++ .../models/journey_delay_duration_node.rb | 2 + .../models/journey_delay_until_node.rb | 2 + lib/courier/models/journey_exit_node.rb | 2 + .../models/journey_fetch_get_delete_node.rb | 6 ++- .../models/journey_fetch_post_put_node.rb | 6 ++- lib/courier/models/journey_merge_strategy.rb | 1 + lib/courier/models/journey_node.rb | 25 +++++++----- lib/courier/models/journey_publish_request.rb | 3 ++ lib/courier/models/journey_response.rb | 14 ++++++- lib/courier/models/journey_retrieve_params.rb | 5 ++- .../models/journey_segment_trigger_node.rb | 2 + lib/courier/models/journey_send_node.rb | 3 ++ lib/courier/models/journey_state.rb | 1 + .../models/journey_template_create_request.rb | 2 + .../models/journey_template_get_response.rb | 2 + .../models/journey_template_list_response.rb | 2 + .../journey_template_publish_request.rb | 3 ++ .../journey_template_replace_request.rb | 2 + .../models/journey_template_summary.rb | 3 ++ .../models/journey_throttle_dynamic_node.rb | 3 ++ .../models/journey_throttle_static_node.rb | 3 ++ lib/courier/models/journey_version_item.rb | 2 + .../models/journey_versions_list_response.rb | 2 + .../models/journeys/template_list_params.rb | 9 ++++- lib/courier/resources/journeys.rb | 35 +++++++++++------ lib/courier/resources/journeys/templates.rb | 34 +++++++++-------- rbi/courier/models/create_journey_request.rbi | 10 ++++- rbi/courier/models/journey_ai_node.rbi | 2 + .../journey_api_invoke_trigger_node.rbi | 2 + .../models/journey_delay_duration_node.rbi | 1 + .../models/journey_delay_until_node.rbi | 1 + rbi/courier/models/journey_exit_node.rbi | 1 + .../models/journey_fetch_get_delete_node.rbi | 4 ++ .../models/journey_fetch_post_put_node.rbi | 4 ++ rbi/courier/models/journey_merge_strategy.rbi | 1 + rbi/courier/models/journey_node.rbi | 12 ++---- .../models/journey_publish_request.rbi | 2 + rbi/courier/models/journey_response.rbi | 3 ++ .../models/journey_retrieve_params.rbi | 8 +++- .../models/journey_segment_trigger_node.rbi | 1 + rbi/courier/models/journey_send_node.rbi | 2 + rbi/courier/models/journey_state.rbi | 1 + .../journey_template_create_request.rbi | 1 + .../models/journey_template_get_response.rbi | 1 + .../models/journey_template_list_response.rbi | 1 + .../journey_template_publish_request.rbi | 2 + .../journey_template_replace_request.rbi | 1 + .../models/journey_template_summary.rbi | 2 + .../models/journey_throttle_dynamic_node.rbi | 2 + .../models/journey_throttle_static_node.rbi | 2 + rbi/courier/models/journey_version_item.rbi | 1 + .../models/journey_versions_list_response.rbi | 1 + .../models/journeys/template_list_params.rbi | 11 +++++- rbi/courier/resources/journeys.rbi | 38 ++++++++++++++----- rbi/courier/resources/journeys/templates.rbi | 32 +++++++++------- 59 files changed, 262 insertions(+), 80 deletions(-) diff --git a/.stats.yml b/.stats.yml index 58f9ecd9..7f546431 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 117 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-4c42b45dbeb17b835571e6d0e319517cdd77133c1c5a99ef9c942d974017157a.yml -openapi_spec_hash: 6705bdaf23c4ecf94646d565de5f158c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-0addc822732cc48a729cc4c482fb1b7e47fd959adf40697f8db46eeb521f3c13.yml +openapi_spec_hash: 922cd04426937679b26ef6a4e2f54cc8 config_hash: 10bd597dd6cc89023541bc551b6532b8 diff --git a/lib/courier/models/create_journey_request.rb b/lib/courier/models/create_journey_request.rb index 4449c07c..c74b0513 100644 --- a/lib/courier/models/create_journey_request.rb +++ b/lib/courier/models/create_journey_request.rb @@ -19,15 +19,21 @@ class CreateJourneyRequest < Courier::Internal::Type::BaseModel optional :enabled, Courier::Internal::Type::Boolean # @!attribute state + # Lifecycle state of a journey. # # @return [Symbol, Courier::Models::JourneyState, nil] optional :state, enum: -> { Courier::JourneyState } # @!method initialize(name:, nodes:, enabled: nil, state: nil) + # Request body for creating a journey. + # # @param name [String] + # # @param nodes [Array] + # # @param enabled [Boolean] - # @param state [Symbol, Courier::Models::JourneyState] + # + # @param state [Symbol, Courier::Models::JourneyState] Lifecycle state of a journey. end end end diff --git a/lib/courier/models/journey_ai_node.rb b/lib/courier/models/journey_ai_node.rb index 09d718b5..ef6877e3 100644 --- a/lib/courier/models/journey_ai_node.rb +++ b/lib/courier/models/journey_ai_node.rb @@ -46,6 +46,9 @@ class JourneyAINode < Courier::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Courier::Models::JourneyAINode} for more details. # + # Invoke an AI step with `user_prompt` and optional `web_search`. Returns a + # structured response conforming to `output_schema`. + # # @param output_schema [Hash{Symbol=>Object}] A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv. # # @param type [Symbol, Courier::Models::JourneyAINode::Type] diff --git a/lib/courier/models/journey_api_invoke_trigger_node.rb b/lib/courier/models/journey_api_invoke_trigger_node.rb index 30f12637..d6e594b9 100644 --- a/lib/courier/models/journey_api_invoke_trigger_node.rb +++ b/lib/courier/models/journey_api_invoke_trigger_node.rb @@ -36,6 +36,9 @@ class JourneyAPIInvokeTriggerNode < Courier::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Courier::Models::JourneyAPIInvokeTriggerNode} for more details. # + # Trigger fired when the journey is invoked via the API. The optional `schema` + # field is a JSON Schema that validates the invocation payload. + # # @param trigger_type [Symbol, Courier::Models::JourneyAPIInvokeTriggerNode::TriggerType] # # @param type [Symbol, Courier::Models::JourneyAPIInvokeTriggerNode::Type] diff --git a/lib/courier/models/journey_delay_duration_node.rb b/lib/courier/models/journey_delay_duration_node.rb index 0dd41734..97e9897a 100644 --- a/lib/courier/models/journey_delay_duration_node.rb +++ b/lib/courier/models/journey_delay_duration_node.rb @@ -35,6 +35,8 @@ class JourneyDelayDurationNode < Courier::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Courier::Models::JourneyDelayDurationNode} for more details. # + # Pause the journey run for a fixed `duration`. + # # @param duration [String] # # @param mode [Symbol, Courier::Models::JourneyDelayDurationNode::Mode] diff --git a/lib/courier/models/journey_delay_until_node.rb b/lib/courier/models/journey_delay_until_node.rb index 0790b088..681c9119 100644 --- a/lib/courier/models/journey_delay_until_node.rb +++ b/lib/courier/models/journey_delay_until_node.rb @@ -35,6 +35,8 @@ class JourneyDelayUntilNode < Courier::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Courier::Models::JourneyDelayUntilNode} for more details. # + # Pause the journey run `until` a specific time. + # # @param mode [Symbol, Courier::Models::JourneyDelayUntilNode::Mode] # # @param type [Symbol, Courier::Models::JourneyDelayUntilNode::Type] diff --git a/lib/courier/models/journey_exit_node.rb b/lib/courier/models/journey_exit_node.rb index 263b7abd..20f6969b 100644 --- a/lib/courier/models/journey_exit_node.rb +++ b/lib/courier/models/journey_exit_node.rb @@ -14,6 +14,8 @@ class JourneyExitNode < Courier::Internal::Type::BaseModel optional :id, String # @!method initialize(type:, id: nil) + # Terminate the journey run. + # # @param type [Symbol, Courier::Models::JourneyExitNode::Type] # @param id [String] diff --git a/lib/courier/models/journey_fetch_get_delete_node.rb b/lib/courier/models/journey_fetch_get_delete_node.rb index 886ff935..392f19e0 100644 --- a/lib/courier/models/journey_fetch_get_delete_node.rb +++ b/lib/courier/models/journey_fetch_get_delete_node.rb @@ -4,6 +4,7 @@ module Courier module Models class JourneyFetchGetDeleteNode < Courier::Internal::Type::BaseModel # @!attribute merge_strategy + # Strategy for merging a fetch response into the journey run state. # # @return [Symbol, Courier::Models::JourneyMergeStrategy] required :merge_strategy, enum: -> { Courier::JourneyMergeStrategy } @@ -56,7 +57,10 @@ class JourneyFetchGetDeleteNode < Courier::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Courier::Models::JourneyFetchGetDeleteNode} for more details. # - # @param merge_strategy [Symbol, Courier::Models::JourneyMergeStrategy] + # Issue an HTTP GET or DELETE request and merge the response into the journey + # state per `merge_strategy`. + # + # @param merge_strategy [Symbol, Courier::Models::JourneyMergeStrategy] Strategy for merging a fetch response into the journey run state. # # @param method_ [Symbol, Courier::Models::JourneyFetchGetDeleteNode::Method] # diff --git a/lib/courier/models/journey_fetch_post_put_node.rb b/lib/courier/models/journey_fetch_post_put_node.rb index 95e78f53..6b93241c 100644 --- a/lib/courier/models/journey_fetch_post_put_node.rb +++ b/lib/courier/models/journey_fetch_post_put_node.rb @@ -4,6 +4,7 @@ module Courier module Models class JourneyFetchPostPutNode < Courier::Internal::Type::BaseModel # @!attribute merge_strategy + # Strategy for merging a fetch response into the journey run state. # # @return [Symbol, Courier::Models::JourneyMergeStrategy] required :merge_strategy, enum: -> { Courier::JourneyMergeStrategy } @@ -61,7 +62,10 @@ class JourneyFetchPostPutNode < Courier::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Courier::Models::JourneyFetchPostPutNode} for more details. # - # @param merge_strategy [Symbol, Courier::Models::JourneyMergeStrategy] + # Issue an HTTP POST or PUT request with a `body` and merge the response into the + # journey state per `merge_strategy`. + # + # @param merge_strategy [Symbol, Courier::Models::JourneyMergeStrategy] Strategy for merging a fetch response into the journey run state. # # @param method_ [Symbol, Courier::Models::JourneyFetchPostPutNode::Method] # diff --git a/lib/courier/models/journey_merge_strategy.rb b/lib/courier/models/journey_merge_strategy.rb index 20f808eb..7e9f2f43 100644 --- a/lib/courier/models/journey_merge_strategy.rb +++ b/lib/courier/models/journey_merge_strategy.rb @@ -2,6 +2,7 @@ module Courier module Models + # Strategy for merging a fetch response into the journey run state. module JourneyMergeStrategy extend Courier::Internal::Type::Enum diff --git a/lib/courier/models/journey_node.rb b/lib/courier/models/journey_node.rb index bf98f2c1..1336520b 100644 --- a/lib/courier/models/journey_node.rb +++ b/lib/courier/models/journey_node.rb @@ -2,36 +2,46 @@ module Courier module Models - # A single node in a journey DAG. Discriminated by `type` plus a secondary + # A single node in a journey DAG. Discriminated by `type`, with a secondary # discriminator on some variants (`trigger_type` for trigger, `mode` for delay, - # `method` for fetch, `scope` for throttle). Each variant is exported as a - # separate schema for SDK type quality. + # `method` for fetch, `scope` for throttle). module JourneyNode extend Courier::Internal::Type::Union + # Trigger fired when the journey is invoked via the API. The optional `schema` field is a JSON Schema that validates the invocation payload. variant -> { Courier::JourneyAPIInvokeTriggerNode } + # Trigger fired by a segment event (`identify`, `group`, or `track`). variant -> { Courier::JourneySegmentTriggerNode } + # Send a notification template to the recipient. Optionally override the recipient address, delay the send, or attach `data`. variant -> { Courier::JourneySendNode } + # Pause the journey run for a fixed `duration`. variant -> { Courier::JourneyDelayDurationNode } + # Pause the journey run `until` a specific time. variant -> { Courier::JourneyDelayUntilNode } + # Issue an HTTP GET or DELETE request and merge the response into the journey state per `merge_strategy`. variant -> { Courier::JourneyFetchGetDeleteNode } + # Issue an HTTP POST or PUT request with a `body` and merge the response into the journey state per `merge_strategy`. variant -> { Courier::JourneyFetchPostPutNode } + # Invoke an AI step with `user_prompt` and optional `web_search`. Returns a structured response conforming to `output_schema`. variant -> { Courier::JourneyAINode } + # Throttle the journey by a static `scope` (`user` or `global`), allowing at most `max_allowed` invocations per `period`. variant -> { Courier::JourneyThrottleStaticNode } + # Throttle the journey by a dynamic `throttle_key`, allowing at most `max_allowed` invocations per `period`. variant -> { Courier::JourneyThrottleDynamicNode } + # Terminate the journey run. variant -> { Courier::JourneyExitNode } - # Branch node. Routes to one of `paths[]` whose `conditions` match, else falls through to `default.nodes`. Inlined rather than referenced so the recursive `nodes: JourneyNode[]` cycle stays within a single generated module (Stainless Python forward-ref resolution does not span modules well for this recursion shape). + # Branch node. Routes to the first entry in `paths[]` whose `conditions` match, else falls through to `default.nodes`. variant -> { Courier::JourneyNode::JourneyBranchNode } class JourneyBranchNode < Courier::Internal::Type::BaseModel @@ -56,11 +66,8 @@ class JourneyBranchNode < Courier::Internal::Type::BaseModel optional :id, String # @!method initialize(default:, paths:, type:, id: nil) - # Branch node. Routes to one of `paths[]` whose `conditions` match, else falls - # through to `default.nodes`. Inlined rather than referenced so the recursive - # `nodes: JourneyNode[]` cycle stays within a single generated module (Stainless - # Python forward-ref resolution does not span modules well for this recursion - # shape). + # Branch node. Routes to the first entry in `paths[]` whose `conditions` match, + # else falls through to `default.nodes`. # # @param default [Courier::Models::JourneyNode::JourneyBranchNode::Default] # @param paths [Array] diff --git a/lib/courier/models/journey_publish_request.rb b/lib/courier/models/journey_publish_request.rb index d010a10a..ae74a8ec 100644 --- a/lib/courier/models/journey_publish_request.rb +++ b/lib/courier/models/journey_publish_request.rb @@ -9,6 +9,9 @@ class JourneyPublishRequest < Courier::Internal::Type::BaseModel optional :version, String # @!method initialize(version: nil) + # Request body for publishing a journey. Pass `version` to roll back to a prior + # version; omit to publish the current draft. + # # @param version [String] end end diff --git a/lib/courier/models/journey_response.rb b/lib/courier/models/journey_response.rb index 99934c5f..746cf22c 100644 --- a/lib/courier/models/journey_response.rb +++ b/lib/courier/models/journey_response.rb @@ -40,6 +40,7 @@ class JourneyResponse < Courier::Internal::Type::BaseModel required :published, Integer, nil?: true # @!attribute state + # Lifecycle state of a journey. # # @return [Symbol, Courier::Models::JourneyState] required :state, enum: -> { Courier::JourneyState } @@ -55,15 +56,26 @@ class JourneyResponse < Courier::Internal::Type::BaseModel required :updater, String, nil?: true # @!method initialize(id:, created:, creator:, enabled:, name:, nodes:, published:, state:, updated:, updater:) + # A journey, with its current draft or published nodes and metadata. + # # @param id [String] + # # @param created [Integer, nil] + # # @param creator [String, nil] + # # @param enabled [Boolean] + # # @param name [String] + # # @param nodes [Array] + # # @param published [Integer, nil] - # @param state [Symbol, Courier::Models::JourneyState] + # + # @param state [Symbol, Courier::Models::JourneyState] Lifecycle state of a journey. + # # @param updated [Integer, nil] + # # @param updater [String, nil] end end diff --git a/lib/courier/models/journey_retrieve_params.rb b/lib/courier/models/journey_retrieve_params.rb index 28f9bc55..28be4864 100644 --- a/lib/courier/models/journey_retrieve_params.rb +++ b/lib/courier/models/journey_retrieve_params.rb @@ -13,13 +13,16 @@ class JourneyRetrieveParams < Courier::Internal::Type::BaseModel required :template_id, String # @!attribute version + # Version selector: `draft`, `published` (default), or `vN`. # # @return [String, nil] optional :version, String # @!method initialize(template_id:, version: nil, request_options: {}) # @param template_id [String] - # @param version [String] + # + # @param version [String] Version selector: `draft`, `published` (default), or `vN`. + # # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/courier/models/journey_segment_trigger_node.rb b/lib/courier/models/journey_segment_trigger_node.rb index 76ef4b06..b8c855a6 100644 --- a/lib/courier/models/journey_segment_trigger_node.rb +++ b/lib/courier/models/journey_segment_trigger_node.rb @@ -40,6 +40,8 @@ class JourneySegmentTriggerNode < Courier::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Courier::Models::JourneySegmentTriggerNode} for more details. # + # Trigger fired by a segment event (`identify`, `group`, or `track`). + # # @param request_type [Symbol, Courier::Models::JourneySegmentTriggerNode::RequestType] # # @param trigger_type [Symbol, Courier::Models::JourneySegmentTriggerNode::TriggerType] diff --git a/lib/courier/models/journey_send_node.rb b/lib/courier/models/journey_send_node.rb index 42895c9e..3f67bb8d 100644 --- a/lib/courier/models/journey_send_node.rb +++ b/lib/courier/models/journey_send_node.rb @@ -30,6 +30,9 @@ class JourneySendNode < Courier::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Courier::Models::JourneySendNode} for more details. # + # Send a notification template to the recipient. Optionally override the recipient + # address, delay the send, or attach `data`. + # # @param message [Courier::Models::JourneySendNode::Message] # # @param type [Symbol, Courier::Models::JourneySendNode::Type] diff --git a/lib/courier/models/journey_state.rb b/lib/courier/models/journey_state.rb index 8d6f853e..7127e208 100644 --- a/lib/courier/models/journey_state.rb +++ b/lib/courier/models/journey_state.rb @@ -2,6 +2,7 @@ module Courier module Models + # Lifecycle state of a journey. module JourneyState extend Courier::Internal::Type::Enum diff --git a/lib/courier/models/journey_template_create_request.rb b/lib/courier/models/journey_template_create_request.rb index e667de6a..be4cce78 100644 --- a/lib/courier/models/journey_template_create_request.rb +++ b/lib/courier/models/journey_template_create_request.rb @@ -24,6 +24,8 @@ class JourneyTemplateCreateRequest < Courier::Internal::Type::BaseModel optional :state, String # @!method initialize(channel:, notification:, provider_key: nil, state: nil) + # Request body for creating a notification template scoped to a journey. + # # @param channel [String] # @param notification [Courier::Models::JourneyTemplateCreateRequest::Notification] # @param provider_key [String] diff --git a/lib/courier/models/journey_template_get_response.rb b/lib/courier/models/journey_template_get_response.rb index 1d786a9f..f0c397a0 100644 --- a/lib/courier/models/journey_template_get_response.rb +++ b/lib/courier/models/journey_template_get_response.rb @@ -59,6 +59,8 @@ class JourneyTemplateGetResponse < Courier::Internal::Type::BaseModel optional :updater, String # @!method initialize(id:, brand:, content:, created:, creator:, name:, state:, subscription:, tags:, updated: nil, updater: nil) + # A journey-scoped notification template. + # # @param id [String] # @param brand [Courier::Models::JourneyTemplateGetResponse::Brand, nil] # @param content [Courier::Models::JourneyTemplateGetResponse::Content] diff --git a/lib/courier/models/journey_template_list_response.rb b/lib/courier/models/journey_template_list_response.rb index de435e72..718ca2d6 100644 --- a/lib/courier/models/journey_template_list_response.rb +++ b/lib/courier/models/journey_template_list_response.rb @@ -14,6 +14,8 @@ class JourneyTemplateListResponse < Courier::Internal::Type::BaseModel required :results, -> { Courier::Internal::Type::ArrayOf[Courier::JourneyTemplateSummary] } # @!method initialize(paging:, results:) + # Paged list of journey-scoped notification templates. + # # @param paging [Courier::Models::Paging] # @param results [Array] end diff --git a/lib/courier/models/journey_template_publish_request.rb b/lib/courier/models/journey_template_publish_request.rb index c38e8f71..5f349951 100644 --- a/lib/courier/models/journey_template_publish_request.rb +++ b/lib/courier/models/journey_template_publish_request.rb @@ -9,6 +9,9 @@ class JourneyTemplatePublishRequest < Courier::Internal::Type::BaseModel optional :version, String # @!method initialize(version: nil) + # Request body for publishing a journey-scoped notification template. Pass + # `version` to roll back to a prior version; omit to publish the current draft. + # # @param version [String] end end diff --git a/lib/courier/models/journey_template_replace_request.rb b/lib/courier/models/journey_template_replace_request.rb index e2f73b6b..eea42f7c 100644 --- a/lib/courier/models/journey_template_replace_request.rb +++ b/lib/courier/models/journey_template_replace_request.rb @@ -14,6 +14,8 @@ class JourneyTemplateReplaceRequest < Courier::Internal::Type::BaseModel optional :state, String # @!method initialize(notification:, state: nil) + # Request body for replacing a journey-scoped notification template draft. + # # @param notification [Courier::Models::JourneyTemplateReplaceRequest::Notification] # @param state [String] diff --git a/lib/courier/models/journey_template_summary.rb b/lib/courier/models/journey_template_summary.rb index 71d500a0..4f9650b4 100644 --- a/lib/courier/models/journey_template_summary.rb +++ b/lib/courier/models/journey_template_summary.rb @@ -44,6 +44,9 @@ class JourneyTemplateSummary < Courier::Internal::Type::BaseModel optional :updater, String # @!method initialize(id:, created:, creator:, name:, state:, tags:, updated: nil, updater: nil) + # Summary fields of a journey-scoped notification template returned in list + # responses. + # # @param id [String] # @param created [Integer] # @param creator [String] diff --git a/lib/courier/models/journey_throttle_dynamic_node.rb b/lib/courier/models/journey_throttle_dynamic_node.rb index 231887fa..78c1b172 100644 --- a/lib/courier/models/journey_throttle_dynamic_node.rb +++ b/lib/courier/models/journey_throttle_dynamic_node.rb @@ -45,6 +45,9 @@ class JourneyThrottleDynamicNode < Courier::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Courier::Models::JourneyThrottleDynamicNode} for more details. # + # Throttle the journey by a dynamic `throttle_key`, allowing at most `max_allowed` + # invocations per `period`. + # # @param max_allowed [Integer] # # @param period [String] diff --git a/lib/courier/models/journey_throttle_static_node.rb b/lib/courier/models/journey_throttle_static_node.rb index a3d2c214..bf72d502 100644 --- a/lib/courier/models/journey_throttle_static_node.rb +++ b/lib/courier/models/journey_throttle_static_node.rb @@ -40,6 +40,9 @@ class JourneyThrottleStaticNode < Courier::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Courier::Models::JourneyThrottleStaticNode} for more details. # + # Throttle the journey by a static `scope` (`user` or `global`), allowing at most + # `max_allowed` invocations per `period`. + # # @param max_allowed [Integer] # # @param period [String] diff --git a/lib/courier/models/journey_version_item.rb b/lib/courier/models/journey_version_item.rb index 102d1f1d..07e7d803 100644 --- a/lib/courier/models/journey_version_item.rb +++ b/lib/courier/models/journey_version_item.rb @@ -29,6 +29,8 @@ class JourneyVersionItem < Courier::Internal::Type::BaseModel required :version, String # @!method initialize(created:, creator:, name:, published:, version:) + # A published version of a journey. + # # @param created [Integer, nil] # @param creator [String, nil] # @param name [String] diff --git a/lib/courier/models/journey_versions_list_response.rb b/lib/courier/models/journey_versions_list_response.rb index a4dae192..65d49d16 100644 --- a/lib/courier/models/journey_versions_list_response.rb +++ b/lib/courier/models/journey_versions_list_response.rb @@ -15,6 +15,8 @@ class JourneyVersionsListResponse < Courier::Internal::Type::BaseModel required :results, -> { Courier::Internal::Type::ArrayOf[Courier::JourneyVersionItem] } # @!method initialize(paging:, results:) + # Paged list of published journey versions, most recent first. + # # @param paging [Courier::Models::Paging] # @param results [Array] end diff --git a/lib/courier/models/journeys/template_list_params.rb b/lib/courier/models/journeys/template_list_params.rb index 66646537..1da13ab2 100644 --- a/lib/courier/models/journeys/template_list_params.rb +++ b/lib/courier/models/journeys/template_list_params.rb @@ -14,19 +14,24 @@ class TemplateListParams < Courier::Internal::Type::BaseModel required :template_id, String # @!attribute cursor + # Pagination cursor from a prior response. # # @return [String, nil] optional :cursor, String # @!attribute limit + # Page size. Minimum 1, maximum 100. # # @return [Integer, nil] optional :limit, Integer # @!method initialize(template_id:, cursor: nil, limit: nil, request_options: {}) # @param template_id [String] - # @param cursor [String] - # @param limit [Integer] + # + # @param cursor [String] Pagination cursor from a prior response. + # + # @param limit [Integer] Page size. Minimum 1, maximum 100. + # # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/courier/resources/journeys.rb b/lib/courier/resources/journeys.rb index 14bff004..a071bd84 100644 --- a/lib/courier/resources/journeys.rb +++ b/lib/courier/resources/journeys.rb @@ -6,15 +6,23 @@ class Journeys # @return [Courier::Resources::Journeys::Templates] attr_reader :templates - # Create a new journey. The journey is created in DRAFT state. Use POST - # /journeys/{templateId}/publish to make it live. + # Create a journey. Defaults to `DRAFT` state; pass `state: "PUBLISHED"` to + # publish on create. Send nodes are not allowed on `POST`. The standard flow is: + # create the journey shell here, add notification templates with + # `POST /journeys/{templateId}/templates`, then wire them into the journey with + # `PUT /journeys/{templateId}`. Call `POST /journeys/{templateId}/publish` to + # publish a draft after the fact. # # @overload create(name:, nodes:, enabled: nil, state: nil, request_options: {}) # # @param name [String] + # # @param nodes [Array] + # # @param enabled [Boolean] - # @param state [Symbol, Courier::Models::JourneyState] + # + # @param state [Symbol, Courier::Models::JourneyState] Lifecycle state of a journey. + # # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [Courier::Models::JourneyResponse] @@ -38,7 +46,7 @@ def create(params) # # @param template_id [String] Journey id # - # @param version [String] + # @param version [String] Version selector: `draft`, `published` (default), or `vN`. # # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] # @@ -109,11 +117,12 @@ def archive(template_id, params = {}) # Some parameter documentations has been truncated, see # {Courier::Models::JourneyInvokeParams} for more details. # - # Invoke a journey run from a journey template. + # Invoke a journey by id or alias to start a new run. The response includes a + # `runId` identifying the run. # # @overload invoke(template_id, data: nil, profile: nil, user_id: nil, request_options: {}) # - # @param template_id [String] A unique identifier representing the journey template to be invoked. This could + # @param template_id [String] A unique identifier representing the journey to be invoked. Accepts a Journey ID # # @param data [Hash{Symbol=>Object}] Data payload passed to the journey. The expected shape can be predefined using t # @@ -157,8 +166,9 @@ def list_versions(template_id, params = {}) ) end - # Publish the current draft as a new version. Optionally rollback to a prior - # version by passing `{ version: 'vN' }`. + # Publish the current draft as a new version. Body is optional; pass + # `{ "version": "vN" }` to roll back to a prior version instead. Returns 404 if + # the journey has no draft to publish. # # @overload publish(template_id, version: nil, request_options: {}) # @@ -182,8 +192,11 @@ def publish(template_id, params = {}) ) end - # Replace the journey draft. Updates the working draft only; call POST - # /journeys/{templateId}/publish to make it live. + # Replace the journey draft. Updates the working draft only; call + # `POST /journeys/{templateId}/publish` to make it live, or pass + # `state: "PUBLISHED"` in this request to publish immediately. Send-node + # `template` ids must already exist and be scoped to this journey, and node ids + # must not be claimed by another journey. # # @overload replace(template_id, name:, nodes:, enabled: nil, state: nil, request_options: {}) # @@ -195,7 +208,7 @@ def publish(template_id, params = {}) # # @param enabled [Boolean] # - # @param state [Symbol, Courier::Models::JourneyState] + # @param state [Symbol, Courier::Models::JourneyState] Lifecycle state of a journey. # # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] # diff --git a/lib/courier/resources/journeys/templates.rb b/lib/courier/resources/journeys/templates.rb index d3e4ff98..a0c6791d 100644 --- a/lib/courier/resources/journeys/templates.rb +++ b/lib/courier/resources/journeys/templates.rb @@ -4,8 +4,8 @@ module Courier module Resources class Journeys class Templates - # Create a notification template scoped to this journey. The template is created - # in DRAFT state. + # Create a notification template scoped to this journey. Defaults to `DRAFT` + # state; pass `state: "PUBLISHED"` to publish on create. # # @overload create(template_id, channel:, notification:, provider_key: nil, state: nil, request_options: {}) # @@ -41,7 +41,7 @@ def create(template_id, params) # # @overload retrieve(notification_id, template_id:, request_options: {}) # - # @param notification_id [String] Journey template id + # @param notification_id [String] Notification template id # # @param template_id [String] Journey id # @@ -64,16 +64,16 @@ def retrieve(notification_id, params) ) end - # List notification templates scoped to this journey. Templates scoped to a - # journey can only be referenced from `send` nodes of the same journey. + # List notification templates scoped to this journey. Journey-scoped notification + # templates can only be referenced from `send` nodes within the same journey. # # @overload list(template_id, cursor: nil, limit: nil, request_options: {}) # # @param template_id [String] Journey id # - # @param cursor [String] + # @param cursor [String] Pagination cursor from a prior response. # - # @param limit [Integer] + # @param limit [Integer] Page size. Minimum 1, maximum 100. # # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] # @@ -92,12 +92,12 @@ def list(template_id, params = {}) ) end - # Archive a journey-scoped notification template. Archived templates cannot be + # Archive the journey-scoped notification template. Archived templates cannot be # sent. # # @overload archive(notification_id, template_id:, request_options: {}) # - # @param notification_id [String] Journey template id + # @param notification_id [String] Notification template id # # @param template_id [String] Journey id # @@ -120,12 +120,12 @@ def archive(notification_id, params) ) end - # List published versions of a journey-scoped notification template, ordered most - # recent first. + # List published versions of the journey-scoped notification template, ordered + # most recent first. # # @overload list_versions(notification_id, template_id:, request_options: {}) # - # @param notification_id [String] Journey template id + # @param notification_id [String] Notification template id # # @param template_id [String] Journey id # @@ -148,11 +148,13 @@ def list_versions(notification_id, params) ) end - # Publish the current draft of a journey-scoped notification template. + # Publish the current draft of the journey-scoped notification template as a new + # version. Optionally roll back to a prior version by passing + # `{ "version": "vN" }`. # # @overload publish(notification_id, template_id:, version: nil, request_options: {}) # - # @param notification_id [String] Path param: Journey template id + # @param notification_id [String] Path param: Notification template id # # @param template_id [String] Path param: Journey id # @@ -178,11 +180,11 @@ def publish(notification_id, params) ) end - # Replace a journey-scoped notification template draft. + # Replace the journey-scoped notification template draft. # # @overload replace(notification_id, template_id:, notification:, state: nil, request_options: {}) # - # @param notification_id [String] Path param: Journey template id + # @param notification_id [String] Path param: Notification template id # # @param template_id [String] Path param: Journey id # diff --git a/rbi/courier/models/create_journey_request.rbi b/rbi/courier/models/create_journey_request.rbi index bc7ec652..0889babb 100644 --- a/rbi/courier/models/create_journey_request.rbi +++ b/rbi/courier/models/create_journey_request.rbi @@ -39,12 +39,14 @@ module Courier sig { params(enabled: T::Boolean).void } attr_writer :enabled + # Lifecycle state of a journey. sig { returns(T.nilable(Courier::JourneyState::OrSymbol)) } attr_reader :state sig { params(state: Courier::JourneyState::OrSymbol).void } attr_writer :state + # Request body for creating a journey. sig do params( name: String, @@ -69,7 +71,13 @@ module Courier state: Courier::JourneyState::OrSymbol ).returns(T.attached_class) end - def self.new(name:, nodes:, enabled: nil, state: nil) + def self.new( + name:, + nodes:, + enabled: nil, + # Lifecycle state of a journey. + state: nil + ) end sig do diff --git a/rbi/courier/models/journey_ai_node.rbi b/rbi/courier/models/journey_ai_node.rbi index 9456c06f..3fe87ea9 100644 --- a/rbi/courier/models/journey_ai_node.rbi +++ b/rbi/courier/models/journey_ai_node.rbi @@ -67,6 +67,8 @@ module Courier sig { params(web_search: T::Boolean).void } attr_writer :web_search + # Invoke an AI step with `user_prompt` and optional `web_search`. Returns a + # structured response conforming to `output_schema`. sig do params( output_schema: T::Hash[Symbol, T.anything], diff --git a/rbi/courier/models/journey_api_invoke_trigger_node.rbi b/rbi/courier/models/journey_api_invoke_trigger_node.rbi index 5403b193..1f6e2c2b 100644 --- a/rbi/courier/models/journey_api_invoke_trigger_node.rbi +++ b/rbi/courier/models/journey_api_invoke_trigger_node.rbi @@ -60,6 +60,8 @@ module Courier sig { params(schema: T::Hash[Symbol, T.anything]).void } attr_writer :schema + # Trigger fired when the journey is invoked via the API. The optional `schema` + # field is a JSON Schema that validates the invocation payload. sig do params( trigger_type: diff --git a/rbi/courier/models/journey_delay_duration_node.rbi b/rbi/courier/models/journey_delay_duration_node.rbi index ebecb813..24e94fc3 100644 --- a/rbi/courier/models/journey_delay_duration_node.rbi +++ b/rbi/courier/models/journey_delay_duration_node.rbi @@ -51,6 +51,7 @@ module Courier end attr_writer :conditions + # Pause the journey run for a fixed `duration`. sig do params( duration: String, diff --git a/rbi/courier/models/journey_delay_until_node.rbi b/rbi/courier/models/journey_delay_until_node.rbi index f6f908c4..261ddb99 100644 --- a/rbi/courier/models/journey_delay_until_node.rbi +++ b/rbi/courier/models/journey_delay_until_node.rbi @@ -51,6 +51,7 @@ module Courier end attr_writer :conditions + # Pause the journey run `until` a specific time. sig do params( mode: Courier::JourneyDelayUntilNode::Mode::OrSymbol, diff --git a/rbi/courier/models/journey_exit_node.rbi b/rbi/courier/models/journey_exit_node.rbi index 93051525..972a35c7 100644 --- a/rbi/courier/models/journey_exit_node.rbi +++ b/rbi/courier/models/journey_exit_node.rbi @@ -17,6 +17,7 @@ module Courier sig { params(id: String).void } attr_writer :id + # Terminate the journey run. sig do params( type: Courier::JourneyExitNode::Type::OrSymbol, diff --git a/rbi/courier/models/journey_fetch_get_delete_node.rbi b/rbi/courier/models/journey_fetch_get_delete_node.rbi index 469bed24..237b6b8e 100644 --- a/rbi/courier/models/journey_fetch_get_delete_node.rbi +++ b/rbi/courier/models/journey_fetch_get_delete_node.rbi @@ -8,6 +8,7 @@ module Courier T.any(Courier::JourneyFetchGetDeleteNode, Courier::Internal::AnyHash) end + # Strategy for merging a fetch response into the journey run state. sig { returns(Courier::JourneyMergeStrategy::OrSymbol) } attr_accessor :merge_strategy @@ -73,6 +74,8 @@ module Courier sig { params(response_schema: T::Hash[Symbol, T.anything]).void } attr_writer :response_schema + # Issue an HTTP GET or DELETE request and merge the response into the journey + # state per `merge_strategy`. sig do params( merge_strategy: Courier::JourneyMergeStrategy::OrSymbol, @@ -92,6 +95,7 @@ module Courier ).returns(T.attached_class) end def self.new( + # Strategy for merging a fetch response into the journey run state. merge_strategy:, method_:, type:, diff --git a/rbi/courier/models/journey_fetch_post_put_node.rbi b/rbi/courier/models/journey_fetch_post_put_node.rbi index ffbf3094..a9b61996 100644 --- a/rbi/courier/models/journey_fetch_post_put_node.rbi +++ b/rbi/courier/models/journey_fetch_post_put_node.rbi @@ -8,6 +8,7 @@ module Courier T.any(Courier::JourneyFetchPostPutNode, Courier::Internal::AnyHash) end + # Strategy for merging a fetch response into the journey run state. sig { returns(Courier::JourneyMergeStrategy::OrSymbol) } attr_accessor :merge_strategy @@ -79,6 +80,8 @@ module Courier sig { params(response_schema: T::Hash[Symbol, T.anything]).void } attr_writer :response_schema + # Issue an HTTP POST or PUT request with a `body` and merge the response into the + # journey state per `merge_strategy`. sig do params( merge_strategy: Courier::JourneyMergeStrategy::OrSymbol, @@ -99,6 +102,7 @@ module Courier ).returns(T.attached_class) end def self.new( + # Strategy for merging a fetch response into the journey run state. merge_strategy:, method_:, type:, diff --git a/rbi/courier/models/journey_merge_strategy.rbi b/rbi/courier/models/journey_merge_strategy.rbi index 90eed017..a1a386f9 100644 --- a/rbi/courier/models/journey_merge_strategy.rbi +++ b/rbi/courier/models/journey_merge_strategy.rbi @@ -2,6 +2,7 @@ module Courier module Models + # Strategy for merging a fetch response into the journey run state. module JourneyMergeStrategy extend Courier::Internal::Type::Enum diff --git a/rbi/courier/models/journey_node.rbi b/rbi/courier/models/journey_node.rbi index 465977f6..47ed4e28 100644 --- a/rbi/courier/models/journey_node.rbi +++ b/rbi/courier/models/journey_node.rbi @@ -2,10 +2,9 @@ module Courier module Models - # A single node in a journey DAG. Discriminated by `type` plus a secondary + # A single node in a journey DAG. Discriminated by `type`, with a secondary # discriminator on some variants (`trigger_type` for trigger, `mode` for delay, - # `method` for fetch, `scope` for throttle). Each variant is exported as a - # separate schema for SDK type quality. + # `method` for fetch, `scope` for throttle). module JourneyNode extend Courier::Internal::Type::Union @@ -58,11 +57,8 @@ module Courier sig { params(id: String).void } attr_writer :id - # Branch node. Routes to one of `paths[]` whose `conditions` match, else falls - # through to `default.nodes`. Inlined rather than referenced so the recursive - # `nodes: JourneyNode[]` cycle stays within a single generated module (Stainless - # Python forward-ref resolution does not span modules well for this recursion - # shape). + # Branch node. Routes to the first entry in `paths[]` whose `conditions` match, + # else falls through to `default.nodes`. sig do params( default: Courier::JourneyNode::JourneyBranchNode::Default::OrHash, diff --git a/rbi/courier/models/journey_publish_request.rbi b/rbi/courier/models/journey_publish_request.rbi index 43c56e4f..febdce41 100644 --- a/rbi/courier/models/journey_publish_request.rbi +++ b/rbi/courier/models/journey_publish_request.rbi @@ -14,6 +14,8 @@ module Courier sig { params(version: String).void } attr_writer :version + # Request body for publishing a journey. Pass `version` to roll back to a prior + # version; omit to publish the current draft. sig { params(version: String).returns(T.attached_class) } def self.new(version: nil) end diff --git a/rbi/courier/models/journey_response.rbi b/rbi/courier/models/journey_response.rbi index 8afa398a..25bcacb4 100644 --- a/rbi/courier/models/journey_response.rbi +++ b/rbi/courier/models/journey_response.rbi @@ -29,6 +29,7 @@ module Courier sig { returns(T.nilable(Integer)) } attr_accessor :published + # Lifecycle state of a journey. sig { returns(Courier::JourneyState::TaggedSymbol) } attr_accessor :state @@ -38,6 +39,7 @@ module Courier sig { returns(T.nilable(String)) } attr_accessor :updater + # A journey, with its current draft or published nodes and metadata. sig do params( id: String, @@ -76,6 +78,7 @@ module Courier name:, nodes:, published:, + # Lifecycle state of a journey. state:, updated:, updater: diff --git a/rbi/courier/models/journey_retrieve_params.rbi b/rbi/courier/models/journey_retrieve_params.rbi index 4bf07902..8623946e 100644 --- a/rbi/courier/models/journey_retrieve_params.rbi +++ b/rbi/courier/models/journey_retrieve_params.rbi @@ -14,6 +14,7 @@ module Courier sig { returns(String) } attr_accessor :template_id + # Version selector: `draft`, `published` (default), or `vN`. sig { returns(T.nilable(String)) } attr_reader :version @@ -27,7 +28,12 @@ module Courier request_options: Courier::RequestOptions::OrHash ).returns(T.attached_class) end - def self.new(template_id:, version: nil, request_options: {}) + def self.new( + template_id:, + # Version selector: `draft`, `published` (default), or `vN`. + version: nil, + request_options: {} + ) end sig do diff --git a/rbi/courier/models/journey_segment_trigger_node.rbi b/rbi/courier/models/journey_segment_trigger_node.rbi index 9e6b06dd..1bf7a189 100644 --- a/rbi/courier/models/journey_segment_trigger_node.rbi +++ b/rbi/courier/models/journey_segment_trigger_node.rbi @@ -57,6 +57,7 @@ module Courier sig { params(event_id: String).void } attr_writer :event_id + # Trigger fired by a segment event (`identify`, `group`, or `track`). sig do params( request_type: diff --git a/rbi/courier/models/journey_send_node.rbi b/rbi/courier/models/journey_send_node.rbi index 1ba7ab0d..4b2a62f4 100644 --- a/rbi/courier/models/journey_send_node.rbi +++ b/rbi/courier/models/journey_send_node.rbi @@ -51,6 +51,8 @@ module Courier end attr_writer :conditions + # Send a notification template to the recipient. Optionally override the recipient + # address, delay the send, or attach `data`. sig do params( message: Courier::JourneySendNode::Message::OrHash, diff --git a/rbi/courier/models/journey_state.rbi b/rbi/courier/models/journey_state.rbi index 34de01da..49530c56 100644 --- a/rbi/courier/models/journey_state.rbi +++ b/rbi/courier/models/journey_state.rbi @@ -2,6 +2,7 @@ module Courier module Models + # Lifecycle state of a journey. module JourneyState extend Courier::Internal::Type::Enum diff --git a/rbi/courier/models/journey_template_create_request.rbi b/rbi/courier/models/journey_template_create_request.rbi index 8d5f88ab..6cc7fae3 100644 --- a/rbi/courier/models/journey_template_create_request.rbi +++ b/rbi/courier/models/journey_template_create_request.rbi @@ -37,6 +37,7 @@ module Courier sig { params(state: String).void } attr_writer :state + # Request body for creating a notification template scoped to a journey. sig do params( channel: String, diff --git a/rbi/courier/models/journey_template_get_response.rbi b/rbi/courier/models/journey_template_get_response.rbi index 934a4e12..553754da 100644 --- a/rbi/courier/models/journey_template_get_response.rbi +++ b/rbi/courier/models/journey_template_get_response.rbi @@ -71,6 +71,7 @@ module Courier sig { params(updater: String).void } attr_writer :updater + # A journey-scoped notification template. sig do params( id: String, diff --git a/rbi/courier/models/journey_template_list_response.rbi b/rbi/courier/models/journey_template_list_response.rbi index a8cd1f8b..3eed7258 100644 --- a/rbi/courier/models/journey_template_list_response.rbi +++ b/rbi/courier/models/journey_template_list_response.rbi @@ -20,6 +20,7 @@ module Courier sig { returns(T::Array[Courier::JourneyTemplateSummary]) } attr_accessor :results + # Paged list of journey-scoped notification templates. sig do params( paging: Courier::Paging::OrHash, diff --git a/rbi/courier/models/journey_template_publish_request.rbi b/rbi/courier/models/journey_template_publish_request.rbi index 6ca32274..9ac318c8 100644 --- a/rbi/courier/models/journey_template_publish_request.rbi +++ b/rbi/courier/models/journey_template_publish_request.rbi @@ -17,6 +17,8 @@ module Courier sig { params(version: String).void } attr_writer :version + # Request body for publishing a journey-scoped notification template. Pass + # `version` to roll back to a prior version; omit to publish the current draft. sig { params(version: String).returns(T.attached_class) } def self.new(version: nil) end diff --git a/rbi/courier/models/journey_template_replace_request.rbi b/rbi/courier/models/journey_template_replace_request.rbi index 68c1f8c6..6bcaca71 100644 --- a/rbi/courier/models/journey_template_replace_request.rbi +++ b/rbi/courier/models/journey_template_replace_request.rbi @@ -28,6 +28,7 @@ module Courier sig { params(state: String).void } attr_writer :state + # Request body for replacing a journey-scoped notification template draft. sig do params( notification: diff --git a/rbi/courier/models/journey_template_summary.rbi b/rbi/courier/models/journey_template_summary.rbi index b0bd461d..8538877c 100644 --- a/rbi/courier/models/journey_template_summary.rbi +++ b/rbi/courier/models/journey_template_summary.rbi @@ -38,6 +38,8 @@ module Courier sig { params(updater: String).void } attr_writer :updater + # Summary fields of a journey-scoped notification template returned in list + # responses. sig do params( id: String, diff --git a/rbi/courier/models/journey_throttle_dynamic_node.rbi b/rbi/courier/models/journey_throttle_dynamic_node.rbi index 98b0e33f..6c03d5b6 100644 --- a/rbi/courier/models/journey_throttle_dynamic_node.rbi +++ b/rbi/courier/models/journey_throttle_dynamic_node.rbi @@ -57,6 +57,8 @@ module Courier end attr_writer :conditions + # Throttle the journey by a dynamic `throttle_key`, allowing at most `max_allowed` + # invocations per `period`. sig do params( max_allowed: Integer, diff --git a/rbi/courier/models/journey_throttle_static_node.rbi b/rbi/courier/models/journey_throttle_static_node.rbi index 97a909b6..101bb85a 100644 --- a/rbi/courier/models/journey_throttle_static_node.rbi +++ b/rbi/courier/models/journey_throttle_static_node.rbi @@ -54,6 +54,8 @@ module Courier end attr_writer :conditions + # Throttle the journey by a static `scope` (`user` or `global`), allowing at most + # `max_allowed` invocations per `period`. sig do params( max_allowed: Integer, diff --git a/rbi/courier/models/journey_version_item.rbi b/rbi/courier/models/journey_version_item.rbi index e3bdb345..e9afd8c0 100644 --- a/rbi/courier/models/journey_version_item.rbi +++ b/rbi/courier/models/journey_version_item.rbi @@ -23,6 +23,7 @@ module Courier sig { returns(String) } attr_accessor :version + # A published version of a journey. sig do params( created: T.nilable(Integer), diff --git a/rbi/courier/models/journey_versions_list_response.rbi b/rbi/courier/models/journey_versions_list_response.rbi index 12637daa..5ed5f381 100644 --- a/rbi/courier/models/journey_versions_list_response.rbi +++ b/rbi/courier/models/journey_versions_list_response.rbi @@ -20,6 +20,7 @@ module Courier sig { returns(T::Array[Courier::JourneyVersionItem]) } attr_accessor :results + # Paged list of published journey versions, most recent first. sig do params( paging: Courier::Paging::OrHash, diff --git a/rbi/courier/models/journeys/template_list_params.rbi b/rbi/courier/models/journeys/template_list_params.rbi index 71c52b5c..284b4657 100644 --- a/rbi/courier/models/journeys/template_list_params.rbi +++ b/rbi/courier/models/journeys/template_list_params.rbi @@ -18,12 +18,14 @@ module Courier sig { returns(String) } attr_accessor :template_id + # Pagination cursor from a prior response. sig { returns(T.nilable(String)) } attr_reader :cursor sig { params(cursor: String).void } attr_writer :cursor + # Page size. Minimum 1, maximum 100. sig { returns(T.nilable(Integer)) } attr_reader :limit @@ -38,7 +40,14 @@ module Courier request_options: Courier::RequestOptions::OrHash ).returns(T.attached_class) end - def self.new(template_id:, cursor: nil, limit: nil, request_options: {}) + def self.new( + template_id:, + # Pagination cursor from a prior response. + cursor: nil, + # Page size. Minimum 1, maximum 100. + limit: nil, + request_options: {} + ) end sig do diff --git a/rbi/courier/resources/journeys.rbi b/rbi/courier/resources/journeys.rbi index fc2c0ad3..980566ee 100644 --- a/rbi/courier/resources/journeys.rbi +++ b/rbi/courier/resources/journeys.rbi @@ -6,8 +6,12 @@ module Courier sig { returns(Courier::Resources::Journeys::Templates) } attr_reader :templates - # Create a new journey. The journey is created in DRAFT state. Use POST - # /journeys/{templateId}/publish to make it live. + # Create a journey. Defaults to `DRAFT` state; pass `state: "PUBLISHED"` to + # publish on create. Send nodes are not allowed on `POST`. The standard flow is: + # create the journey shell here, add notification templates with + # `POST /journeys/{templateId}/templates`, then wire them into the journey with + # `PUT /journeys/{templateId}`. Call `POST /journeys/{templateId}/publish` to + # publish a draft after the fact. sig do params( name: String, @@ -33,7 +37,14 @@ module Courier request_options: Courier::RequestOptions::OrHash ).returns(Courier::JourneyResponse) end - def create(name:, nodes:, enabled: nil, state: nil, request_options: {}) + def create( + name:, + nodes:, + enabled: nil, + # Lifecycle state of a journey. + state: nil, + request_options: {} + ) end # Fetch a journey by id. Pass `?version=draft` (default `published`) to retrieve @@ -48,6 +59,7 @@ module Courier def retrieve( # Journey id template_id, + # Version selector: `draft`, `published` (default), or `vN`. version: nil, request_options: {} ) @@ -87,7 +99,8 @@ module Courier ) end - # Invoke a journey run from a journey template. + # Invoke a journey by id or alias to start a new run. The response includes a + # `runId` identifying the run. sig do params( template_id: String, @@ -98,8 +111,8 @@ module Courier ).returns(Courier::JourneysInvokeResponse) end def invoke( - # A unique identifier representing the journey template to be invoked. This could - # be the Journey Template ID or the Journey Template Alias. + # A unique identifier representing the journey to be invoked. Accepts a Journey ID + # or Journey Alias. template_id, # Data payload passed to the journey. The expected shape can be predefined using # the schema builder in the journey editor. This data is available in journey @@ -134,8 +147,9 @@ module Courier ) end - # Publish the current draft as a new version. Optionally rollback to a prior - # version by passing `{ version: 'vN' }`. + # Publish the current draft as a new version. Body is optional; pass + # `{ "version": "vN" }` to roll back to a prior version instead. Returns 404 if + # the journey has no draft to publish. sig do params( template_id: String, @@ -151,8 +165,11 @@ module Courier ) end - # Replace the journey draft. Updates the working draft only; call POST - # /journeys/{templateId}/publish to make it live. + # Replace the journey draft. Updates the working draft only; call + # `POST /journeys/{templateId}/publish` to make it live, or pass + # `state: "PUBLISHED"` in this request to publish immediately. Send-node + # `template` ids must already exist and be scoped to this journey, and node ids + # must not be claimed by another journey. sig do params( template_id: String, @@ -185,6 +202,7 @@ module Courier name:, nodes:, enabled: nil, + # Lifecycle state of a journey. state: nil, request_options: {} ) diff --git a/rbi/courier/resources/journeys/templates.rbi b/rbi/courier/resources/journeys/templates.rbi index 42547d2d..cb1a0e78 100644 --- a/rbi/courier/resources/journeys/templates.rbi +++ b/rbi/courier/resources/journeys/templates.rbi @@ -4,8 +4,8 @@ module Courier module Resources class Journeys class Templates - # Create a notification template scoped to this journey. The template is created - # in DRAFT state. + # Create a notification template scoped to this journey. Defaults to `DRAFT` + # state; pass `state: "PUBLISHED"` to publish on create. sig do params( template_id: String, @@ -39,7 +39,7 @@ module Courier ).returns(Courier::JourneyTemplateGetResponse) end def retrieve( - # Journey template id + # Notification template id notification_id, # Journey id template_id:, @@ -47,8 +47,8 @@ module Courier ) end - # List notification templates scoped to this journey. Templates scoped to a - # journey can only be referenced from `send` nodes of the same journey. + # List notification templates scoped to this journey. Journey-scoped notification + # templates can only be referenced from `send` nodes within the same journey. sig do params( template_id: String, @@ -60,13 +60,15 @@ module Courier def list( # Journey id template_id, + # Pagination cursor from a prior response. cursor: nil, + # Page size. Minimum 1, maximum 100. limit: nil, request_options: {} ) end - # Archive a journey-scoped notification template. Archived templates cannot be + # Archive the journey-scoped notification template. Archived templates cannot be # sent. sig do params( @@ -76,7 +78,7 @@ module Courier ).void end def archive( - # Journey template id + # Notification template id notification_id, # Journey id template_id:, @@ -84,8 +86,8 @@ module Courier ) end - # List published versions of a journey-scoped notification template, ordered most - # recent first. + # List published versions of the journey-scoped notification template, ordered + # most recent first. sig do params( notification_id: String, @@ -94,7 +96,7 @@ module Courier ).returns(Courier::NotificationTemplateVersionListResponse) end def list_versions( - # Journey template id + # Notification template id notification_id, # Journey id template_id:, @@ -102,7 +104,9 @@ module Courier ) end - # Publish the current draft of a journey-scoped notification template. + # Publish the current draft of the journey-scoped notification template as a new + # version. Optionally roll back to a prior version by passing + # `{ "version": "vN" }`. sig do params( notification_id: String, @@ -112,7 +116,7 @@ module Courier ).void end def publish( - # Path param: Journey template id + # Path param: Notification template id notification_id, # Path param: Journey id template_id:, @@ -122,7 +126,7 @@ module Courier ) end - # Replace a journey-scoped notification template draft. + # Replace the journey-scoped notification template draft. sig do params( notification_id: String, @@ -134,7 +138,7 @@ module Courier ).returns(Courier::JourneyTemplateGetResponse) end def replace( - # Path param: Journey template id + # Path param: Notification template id notification_id, # Path param: Journey id template_id:, From c4c465696f05f285dd576dd943822521c96f3408 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 16:21:05 +0000 Subject: [PATCH 14/15] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7f546431..17321d43 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 117 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-0addc822732cc48a729cc4c482fb1b7e47fd959adf40697f8db46eeb521f3c13.yml -openapi_spec_hash: 922cd04426937679b26ef6a4e2f54cc8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-8e7ad3d889c555ff9c381518b627b24b85e3eb7376bdc3689adc7a96ec78e537.yml +openapi_spec_hash: 53b3680aae719487c56efaa782bbe5b2 config_hash: 10bd597dd6cc89023541bc551b6532b8 From d0eabad4d0b36f7dd260dc888c34d6e19114847a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 16:21:42 +0000 Subject: [PATCH 15/15] release: 4.11.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++++ Gemfile.lock | 2 +- lib/courier/version.rb | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e11f8276..a43b15a4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.10.2" + ".": "4.11.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 75590b13..db427655 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 4.11.0 (2026-05-19) + +Full Changelog: [v4.10.2...v4.11.0](https://github.com/trycourier/courier-ruby/compare/v4.10.2...v4.11.0) + +### Features + +* [C-18380] Journeys API reference: copy + naming cleanup ([5930853](https://github.com/trycourier/courier-ruby/commit/5930853b36e87fc434a5f316d5144459d8a5156c)) +* [SUP-607] Add DELETE endpoint for Courier Create tenant templates ([72df650](https://github.com/trycourier/courier-ruby/commit/72df650b8e3e6bde00a5a8f047c16e77f2c97ac3)) +* **api:** add journey CRUD/templates/versioning endpoints, journey node/condition types ([30bc8f6](https://github.com/trycourier/courier-ruby/commit/30bc8f6ad778a9ca44ed7ccbfa743e23170192b4)) +* support setting headers via env ([6f99d29](https://github.com/trycourier/courier-ruby/commit/6f99d290cad4006de8f84b22cbac6694d314a3aa)) + + +### Bug Fixes + +* **client:** elide content type header on requests without body ([5f06485](https://github.com/trycourier/courier-ruby/commit/5f0648580bf65a97989fbb1f6583ef7166c43c2f)) + + +### Chores + +* **internal:** more robust bootstrap script ([91e8fd1](https://github.com/trycourier/courier-ruby/commit/91e8fd1ecdd6d10def9215f53a73248b754b5386)) + ## 4.10.2 (2026-04-14) Full Changelog: [v4.10.1...v4.10.2](https://github.com/trycourier/courier-ruby/compare/v4.10.1...v4.10.2) diff --git a/Gemfile.lock b/Gemfile.lock index f35a67e3..a4018fe3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - trycourier (4.10.2) + trycourier (4.11.0) cgi connection_pool diff --git a/lib/courier/version.rb b/lib/courier/version.rb index cb7875b9..bf96ded2 100644 --- a/lib/courier/version.rb +++ b/lib/courier/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Courier - VERSION = "4.10.2" + VERSION = "4.11.0" end