trycourier 1.10.0 → 3.0.0.pre.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/environment.rb +7 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/requests.rb +121 -0
- data/lib/trycourier/audiences/client.rb +235 -0
- data/lib/trycourier/audiences/types/audience.rb +86 -0
- data/lib/trycourier/audiences/types/audience_list_response.rb +62 -0
- data/lib/trycourier/audiences/types/audience_member.rb +74 -0
- data/lib/trycourier/audiences/types/audience_member_get_response.rb +53 -0
- data/lib/trycourier/audiences/types/audience_member_list_response.rb +62 -0
- data/lib/trycourier/audiences/types/audience_update_response.rb +53 -0
- data/lib/trycourier/audiences/types/base_filter_config.rb +53 -0
- data/lib/trycourier/audiences/types/comparison_operator.rb +21 -0
- data/lib/trycourier/audiences/types/filter.rb +50 -0
- data/lib/trycourier/audiences/types/filter_config.rb +50 -0
- data/lib/trycourier/audiences/types/logical_operator.rb +10 -0
- data/lib/trycourier/audiences/types/nested_filter_config.rb +63 -0
- data/lib/trycourier/audiences/types/operator.rb +48 -0
- data/lib/trycourier/audiences/types/single_filter_config.rb +64 -0
- data/lib/trycourier/audit_events/client.rb +104 -0
- data/lib/trycourier/audit_events/types/actor.rb +52 -0
- data/lib/trycourier/audit_events/types/audit_event.rb +92 -0
- data/lib/trycourier/audit_events/types/get_audit_event_params.rb +47 -0
- data/lib/trycourier/audit_events/types/list_audit_events_params.rb +47 -0
- data/lib/trycourier/audit_events/types/list_audit_events_response.rb +62 -0
- data/lib/trycourier/audit_events/types/target.rb +52 -0
- data/lib/trycourier/auth_tokens/client.rb +85 -0
- data/lib/trycourier/auth_tokens/types/issue_token_response.rb +47 -0
- data/lib/trycourier/automations/client.rb +151 -0
- data/lib/trycourier/automations/types/automation.rb +56 -0
- data/lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb +88 -0
- data/lib/trycourier/automations/types/automation_cancel_step.rb +62 -0
- data/lib/trycourier/automations/types/automation_delay_step.rb +62 -0
- data/lib/trycourier/automations/types/automation_invoke_params.rb +69 -0
- data/lib/trycourier/automations/types/automation_invoke_response.rb +47 -0
- data/lib/trycourier/automations/types/automation_invoke_step.rb +62 -0
- data/lib/trycourier/automations/types/automation_invoke_template_params.rb +82 -0
- data/lib/trycourier/automations/types/automation_run_context.rb +69 -0
- data/lib/trycourier/automations/types/automation_send_list_step.rb +93 -0
- data/lib/trycourier/automations/types/automation_send_step.rb +99 -0
- data/lib/trycourier/automations/types/automation_step.rb +52 -0
- data/lib/trycourier/automations/types/automation_step_action.rb +14 -0
- data/lib/trycourier/automations/types/automation_step_option.rb +110 -0
- data/lib/trycourier/automations/types/automation_update_profile_step.rb +64 -0
- data/lib/trycourier/automations/types/automation_v_2_send_step.rb +68 -0
- data/lib/trycourier/automations/types/merge_algorithm.rb +12 -0
- data/lib/trycourier/automations/types/profile.rb +7 -0
- data/lib/trycourier/brands/client.rb +281 -0
- data/lib/trycourier/brands/types/brand.rb +105 -0
- data/lib/trycourier/brands/types/brand_colors.rb +57 -0
- data/lib/trycourier/brands/types/brand_get_all_response.rb +62 -0
- data/lib/trycourier/brands/types/brand_parameters.rb +74 -0
- data/lib/trycourier/brands/types/brand_settings.rb +69 -0
- data/lib/trycourier/brands/types/brand_snippet.rb +57 -0
- data/lib/trycourier/brands/types/brand_snippets.rb +51 -0
- data/lib/trycourier/brands/types/brands_response.rb +62 -0
- data/lib/trycourier/bulk/client.rb +249 -0
- data/lib/trycourier/bulk/types/bulk_create_job_response.rb +47 -0
- data/lib/trycourier/bulk/types/bulk_get_job_params.rb +47 -0
- data/lib/trycourier/bulk/types/bulk_get_job_response.rb +53 -0
- data/lib/trycourier/bulk/types/bulk_get_job_users_params.rb +52 -0
- data/lib/trycourier/bulk/types/bulk_get_job_users_response.rb +62 -0
- data/lib/trycourier/bulk/types/bulk_ingest_error.rb +52 -0
- data/lib/trycourier/bulk/types/bulk_ingest_users_params.rb +51 -0
- data/lib/trycourier/bulk/types/bulk_ingest_users_response.rb +56 -0
- data/lib/trycourier/bulk/types/bulk_job_status.rb +12 -0
- data/lib/trycourier/bulk/types/bulk_job_user_status.rb +11 -0
- data/lib/trycourier/bulk/types/bulk_message_user_response.rb +100 -0
- data/lib/trycourier/bulk/types/inbound_bulk_content_message.rb +165 -0
- data/lib/trycourier/bulk/types/inbound_bulk_message.rb +95 -0
- data/lib/trycourier/bulk/types/inbound_bulk_message_user.rb +80 -0
- data/lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb +75 -0
- data/lib/trycourier/bulk/types/inbound_bulk_message_v_2.rb +50 -0
- data/lib/trycourier/bulk/types/inbound_bulk_template_message.rb +157 -0
- data/lib/trycourier/bulk/types/job_details.rb +81 -0
- data/lib/trycourier/commons/types/already_exists.rb +52 -0
- data/lib/trycourier/commons/types/bad_request.rb +52 -0
- data/lib/trycourier/commons/types/base_error.rb +47 -0
- data/lib/trycourier/commons/types/channel_classification.rb +14 -0
- data/lib/trycourier/commons/types/channel_preference.rb +48 -0
- data/lib/trycourier/commons/types/conflict.rb +52 -0
- data/lib/trycourier/commons/types/email.rb +52 -0
- data/lib/trycourier/commons/types/message_not_found.rb +52 -0
- data/lib/trycourier/commons/types/not_found.rb +52 -0
- data/lib/trycourier/commons/types/notification_preference_details.rb +66 -0
- data/lib/trycourier/commons/types/notification_preferences.rb +7 -0
- data/lib/trycourier/commons/types/paging.rb +52 -0
- data/lib/trycourier/commons/types/payment_required.rb +52 -0
- data/lib/trycourier/commons/types/preference_status.rb +11 -0
- data/lib/trycourier/commons/types/recipient_preferences.rb +53 -0
- data/lib/trycourier/commons/types/rule.rb +52 -0
- data/lib/trycourier/commons/types/user_tenant_association.rb +62 -0
- data/lib/trycourier/lists/client.rb +454 -0
- data/lib/trycourier/lists/types/list.rb +62 -0
- data/lib/trycourier/lists/types/list_get_all_response.rb +62 -0
- data/lib/trycourier/lists/types/list_get_subscriptions_response.rb +62 -0
- data/lib/trycourier/lists/types/list_put_params.rb +58 -0
- data/lib/trycourier/lists/types/list_subscription_recipient.rb +63 -0
- data/lib/trycourier/lists/types/put_subscriptions_recipient.rb +58 -0
- data/lib/trycourier/messages/client.rb +300 -0
- data/lib/trycourier/messages/types/list_messages_response.rb +62 -0
- data/lib/trycourier/messages/types/message_details.rb +120 -0
- data/lib/trycourier/messages/types/message_history_response.rb +51 -0
- data/lib/trycourier/messages/types/message_status.rb +17 -0
- data/lib/trycourier/messages/types/reason.rb +14 -0
- data/lib/trycourier/messages/types/render_output.rb +63 -0
- data/lib/trycourier/messages/types/render_output_response.rb +51 -0
- data/lib/trycourier/messages/types/rendered_message_block.rb +52 -0
- data/lib/trycourier/messages/types/rendered_message_content.rb +77 -0
- data/lib/trycourier/notifications/client.rb +379 -0
- data/lib/trycourier/notifications/types/base_check.rb +58 -0
- data/lib/trycourier/notifications/types/block_type.rb +17 -0
- data/lib/trycourier/notifications/types/check.rb +63 -0
- data/lib/trycourier/notifications/types/check_status.rb +11 -0
- data/lib/trycourier/notifications/types/message_routing.rb +57 -0
- data/lib/trycourier/notifications/types/message_routing_channel.rb +49 -0
- data/lib/trycourier/notifications/types/message_routing_method.rb +10 -0
- data/lib/trycourier/notifications/types/notification.rb +63 -0
- data/lib/trycourier/notifications/types/notification_block.rb +94 -0
- data/lib/trycourier/notifications/types/notification_channel.rb +73 -0
- data/lib/trycourier/notifications/types/notification_channel_content.rb +52 -0
- data/lib/trycourier/notifications/types/notification_content.rb +49 -0
- data/lib/trycourier/notifications/types/notification_content_hierarchy.rb +52 -0
- data/lib/trycourier/notifications/types/notification_get_content_response.rb +65 -0
- data/lib/trycourier/notifications/types/notification_list_response.rb +62 -0
- data/lib/trycourier/notifications/types/submission_checks_get_response.rb +51 -0
- data/lib/trycourier/notifications/types/submission_checks_replace_response.rb +51 -0
- data/lib/trycourier/profiles/client.rb +325 -0
- data/lib/trycourier/profiles/types/address.rb +81 -0
- data/lib/trycourier/profiles/types/airship_profile.rb +59 -0
- data/lib/trycourier/profiles/types/airship_profile_audience.rb +47 -0
- data/lib/trycourier/profiles/types/delete_list_subscription_response.rb +47 -0
- data/lib/trycourier/profiles/types/device_type.rb +7 -0
- data/lib/trycourier/profiles/types/discord.rb +50 -0
- data/lib/trycourier/profiles/types/expo.rb +50 -0
- data/lib/trycourier/profiles/types/get_list_subscriptions_list.rb +74 -0
- data/lib/trycourier/profiles/types/get_list_subscriptions_response.rb +62 -0
- data/lib/trycourier/profiles/types/intercom.rb +58 -0
- data/lib/trycourier/profiles/types/intercom_recipient.rb +47 -0
- data/lib/trycourier/profiles/types/merge_profile_response.rb +47 -0
- data/lib/trycourier/profiles/types/ms_teams.rb +86 -0
- data/lib/trycourier/profiles/types/ms_teams_base_properties.rb +52 -0
- data/lib/trycourier/profiles/types/multiple_tokens.rb +51 -0
- data/lib/trycourier/profiles/types/profile_get_parameters.rb +47 -0
- data/lib/trycourier/profiles/types/profile_get_response.rb +58 -0
- data/lib/trycourier/profiles/types/replace_profile_response.rb +47 -0
- data/lib/trycourier/profiles/types/send_direct_message.rb +47 -0
- data/lib/trycourier/profiles/types/send_to_channel.rb +47 -0
- data/lib/trycourier/profiles/types/send_to_ms_teams_channel_id.rb +57 -0
- data/lib/trycourier/profiles/types/send_to_ms_teams_channel_name.rb +68 -0
- data/lib/trycourier/profiles/types/send_to_ms_teams_conversation_id.rb +58 -0
- data/lib/trycourier/profiles/types/send_to_ms_teams_email.rb +57 -0
- data/lib/trycourier/profiles/types/send_to_ms_teams_user_id.rb +57 -0
- data/lib/trycourier/profiles/types/send_to_slack_channel.rb +52 -0
- data/lib/trycourier/profiles/types/send_to_slack_email.rb +52 -0
- data/lib/trycourier/profiles/types/send_to_slack_user_id.rb +52 -0
- data/lib/trycourier/profiles/types/slack.rb +62 -0
- data/lib/trycourier/profiles/types/slack_base_properties.rb +47 -0
- data/lib/trycourier/profiles/types/snooze_rule.rb +58 -0
- data/lib/trycourier/profiles/types/snooze_rule_type.rb +9 -0
- data/lib/trycourier/profiles/types/subscribe_to_lists_request.rb +51 -0
- data/lib/trycourier/profiles/types/subscribe_to_lists_request_list_object.rb +58 -0
- data/lib/trycourier/profiles/types/subscribe_to_lists_response.rb +47 -0
- data/lib/trycourier/profiles/types/token.rb +47 -0
- data/lib/trycourier/profiles/types/user_profile.rb +274 -0
- data/lib/trycourier/send/types/attachment.rb +7 -0
- data/lib/trycourier/send/types/audience_filter.rb +57 -0
- data/lib/trycourier/send/types/audience_recipient.rb +62 -0
- data/lib/trycourier/send/types/base_message.rb +149 -0
- data/lib/trycourier/send/types/base_social_presence.rb +47 -0
- data/lib/trycourier/send/types/brand_settings_email.rb +87 -0
- data/lib/trycourier/send/types/brand_settings_in_app.rb +119 -0
- data/lib/trycourier/send/types/brand_settings_social_presence.rb +107 -0
- data/lib/trycourier/send/types/brand_template.rb +88 -0
- data/lib/trycourier/send/types/brand_template_override.rb +112 -0
- data/lib/trycourier/send/types/channel.rb +113 -0
- data/lib/trycourier/send/types/channel_metadata.rb +53 -0
- data/lib/trycourier/send/types/channel_source.rb +11 -0
- data/lib/trycourier/send/types/content.rb +50 -0
- data/lib/trycourier/send/types/content_message.rb +177 -0
- data/lib/trycourier/send/types/criteria.rb +12 -0
- data/lib/trycourier/send/types/delay.rb +47 -0
- data/lib/trycourier/send/types/elemental_action_node.rb +116 -0
- data/lib/trycourier/send/types/elemental_base_node.rb +62 -0
- data/lib/trycourier/send/types/elemental_channel_node.rb +105 -0
- data/lib/trycourier/send/types/elemental_content.rb +61 -0
- data/lib/trycourier/send/types/elemental_content_sugar.rb +53 -0
- data/lib/trycourier/send/types/elemental_divider_node.rb +68 -0
- data/lib/trycourier/send/types/elemental_group_node.rb +72 -0
- data/lib/trycourier/send/types/elemental_image_node.rb +101 -0
- data/lib/trycourier/send/types/elemental_meta_node.rb +70 -0
- data/lib/trycourier/send/types/elemental_node.rb +170 -0
- data/lib/trycourier/send/types/elemental_quote_node.rb +104 -0
- data/lib/trycourier/send/types/elemental_text_node.rb +136 -0
- data/lib/trycourier/send/types/email_footer.rb +52 -0
- data/lib/trycourier/send/types/email_head.rb +52 -0
- data/lib/trycourier/send/types/email_header.rb +63 -0
- data/lib/trycourier/send/types/expires_in_type.rb +48 -0
- data/lib/trycourier/send/types/expiry.rb +58 -0
- data/lib/trycourier/send/types/i_action_button_style.rb +10 -0
- data/lib/trycourier/send/types/i_alignment.rb +12 -0
- data/lib/trycourier/send/types/i_preferences.rb +7 -0
- data/lib/trycourier/send/types/i_profile_preferences.rb +59 -0
- data/lib/trycourier/send/types/icons.rb +52 -0
- data/lib/trycourier/send/types/in_app_placement.rb +12 -0
- data/lib/trycourier/send/types/invalid_list_pattern_recipient.rb +52 -0
- data/lib/trycourier/send/types/invalid_list_recipient.rb +52 -0
- data/lib/trycourier/send/types/invalid_user_recipient.rb +52 -0
- data/lib/trycourier/send/types/list_filter.rb +57 -0
- data/lib/trycourier/send/types/list_pattern_recipient.rb +53 -0
- data/lib/trycourier/send/types/list_pattern_recipient_type.rb +41 -0
- data/lib/trycourier/send/types/list_recipient.rb +62 -0
- data/lib/trycourier/send/types/list_recipient_type.rb +41 -0
- data/lib/trycourier/send/types/locale.rb +47 -0
- data/lib/trycourier/send/types/locales.rb +7 -0
- data/lib/trycourier/send/types/logo.rb +52 -0
- data/lib/trycourier/send/types/message.rb +50 -0
- data/lib/trycourier/send/types/message_channel_email_override.rb +119 -0
- data/lib/trycourier/send/types/message_channels.rb +7 -0
- data/lib/trycourier/send/types/message_context.rb +49 -0
- data/lib/trycourier/send/types/message_data.rb +7 -0
- data/lib/trycourier/send/types/message_metadata.rb +68 -0
- data/lib/trycourier/send/types/message_providers.rb +7 -0
- data/lib/trycourier/send/types/message_providers_type.rb +72 -0
- data/lib/trycourier/send/types/message_recipient.rb +54 -0
- data/lib/trycourier/send/types/metadata.rb +53 -0
- data/lib/trycourier/send/types/ms_teams_recipient.rb +53 -0
- data/lib/trycourier/send/types/override.rb +10 -0
- data/lib/trycourier/send/types/preference.rb +73 -0
- data/lib/trycourier/send/types/preferences.rb +47 -0
- data/lib/trycourier/send/types/recipient.rb +98 -0
- data/lib/trycourier/send/types/routing.rb +64 -0
- data/lib/trycourier/send/types/routing_channel.rb +61 -0
- data/lib/trycourier/send/types/routing_method.rb +10 -0
- data/lib/trycourier/send/types/routing_strategy_channel.rb +70 -0
- data/lib/trycourier/send/types/routing_strategy_provider.rb +68 -0
- data/lib/trycourier/send/types/rule_type.rb +11 -0
- data/lib/trycourier/send/types/slack_recipient.rb +53 -0
- data/lib/trycourier/send/types/template_message.rb +169 -0
- data/lib/trycourier/send/types/text_align.rb +11 -0
- data/lib/trycourier/send/types/text_style.rb +12 -0
- data/lib/trycourier/send/types/timeout.rb +76 -0
- data/lib/trycourier/send/types/timeouts.rb +52 -0
- data/lib/trycourier/send/types/tracking_override.rb +47 -0
- data/lib/trycourier/send/types/user_recipient.rb +115 -0
- data/lib/trycourier/send/types/user_recipient_type.rb +41 -0
- data/lib/trycourier/send/types/utm.rb +68 -0
- data/lib/trycourier/send/types/widget_background.rb +52 -0
- data/lib/trycourier/templates/client.rb +67 -0
- data/lib/trycourier/templates/types/channel_identifier.rb +7 -0
- data/lib/trycourier/templates/types/list_templates_response.rb +62 -0
- data/lib/trycourier/templates/types/notification_templates.rb +90 -0
- data/lib/trycourier/templates/types/routing_strategy.rb +54 -0
- data/lib/trycourier/templates/types/routing_strategy_method.rb +10 -0
- data/lib/trycourier/templates/types/tag.rb +51 -0
- data/lib/trycourier/templates/types/tag_data.rb +52 -0
- data/lib/trycourier/tenants/client.rb +255 -0
- data/lib/trycourier/tenants/types/default_preferences.rb +51 -0
- data/lib/trycourier/tenants/types/list_users_for_tenant_response.rb +88 -0
- data/lib/trycourier/tenants/types/subscription_topic.rb +53 -0
- data/lib/trycourier/tenants/types/subscription_topic_status.rb +11 -0
- data/lib/trycourier/tenants/types/template_property.rb +7 -0
- data/lib/trycourier/tenants/types/tenant.rb +95 -0
- data/lib/trycourier/tenants/types/tenant_list_response.rb +86 -0
- data/lib/trycourier/translations/client.rb +106 -0
- data/lib/trycourier/types/send_message_response.rb +49 -0
- data/lib/trycourier/users/client.rb +34 -0
- data/lib/trycourier/users/preferences/client.rb +171 -0
- data/lib/trycourier/users/preferences/types/topic_preference.rb +86 -0
- data/lib/trycourier/users/preferences/types/user_preferences_get_response.rb +55 -0
- data/lib/trycourier/users/preferences/types/user_preferences_list_response.rb +64 -0
- data/lib/trycourier/users/preferences/types/user_preferences_update_response.rb +49 -0
- data/lib/trycourier/users/tenants/client.rb +267 -0
- data/lib/trycourier/users/tenants/types/add_user_to_single_tenants_params_profile.rb +76 -0
- data/lib/trycourier/users/tenants/types/list_tenants_for_user_response.rb +90 -0
- data/lib/trycourier/users/tokens/client.rb +264 -0
- data/lib/trycourier/users/tokens/types/delete_user_token_opts.rb +54 -0
- data/lib/trycourier/users/tokens/types/device.rb +83 -0
- data/lib/trycourier/users/tokens/types/expiry_date.rb +50 -0
- data/lib/trycourier/users/tokens/types/get_all_tokens_response.rb +11 -0
- data/lib/trycourier/users/tokens/types/get_user_token_opts.rb +54 -0
- data/lib/trycourier/users/tokens/types/get_user_token_response.rb +116 -0
- data/lib/trycourier/users/tokens/types/get_user_tokens_opts.rb +49 -0
- data/lib/trycourier/users/tokens/types/patch_op.rb +16 -0
- data/lib/trycourier/users/tokens/types/patch_operation.rb +59 -0
- data/lib/trycourier/users/tokens/types/patch_user_token_opts.rb +53 -0
- data/lib/trycourier/users/tokens/types/provider_key.rb +14 -0
- data/lib/trycourier/users/tokens/types/put_user_token_opts.rb +60 -0
- data/lib/trycourier/users/tokens/types/put_user_tokens_opts.rb +58 -0
- data/lib/trycourier/users/tokens/types/token_status.rb +14 -0
- data/lib/trycourier/users/tokens/types/tracking.rb +64 -0
- data/lib/trycourier/users/tokens/types/user_token.rb +102 -0
- data/lib/trycourier.rb +114 -138
- data/lib/types_export.rb +273 -0
- metadata +362 -50
- data/.github/ISSUE_TEMPLATE.md +0 -17
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -27
- data/.github/workflows/gem-push.yml +0 -51
- data/.gitignore +0 -67
- data/.rspec +0 -3
- data/CHANGELOG.md +0 -126
- data/CONTRIBUTING.md +0 -28
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -72
- data/LICENSE +0 -21
- data/README.md +0 -610
- data/Rakefile +0 -7
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/trycourier/accounts.rb +0 -43
- data/lib/trycourier/audiences.rb +0 -45
- data/lib/trycourier/audit_events.rb +0 -27
- data/lib/trycourier/auth_tokens.rb +0 -23
- data/lib/trycourier/automations.rb +0 -67
- data/lib/trycourier/brands.rb +0 -70
- data/lib/trycourier/bulk.rb +0 -79
- data/lib/trycourier/events.rb +0 -35
- data/lib/trycourier/exceptions.rb +0 -39
- data/lib/trycourier/lists.rb +0 -109
- data/lib/trycourier/messages.rb +0 -57
- data/lib/trycourier/profiles.rb +0 -64
- data/lib/trycourier/session.rb +0 -80
- data/lib/trycourier/version.rb +0 -3
- data/trycourier.gemspec +0 -32
@@ -0,0 +1,267 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../requests"
|
4
|
+
require_relative "../../commons/types/user_tenant_association"
|
5
|
+
require_relative "types/add_user_to_single_tenants_params_profile"
|
6
|
+
require_relative "types/list_tenants_for_user_response"
|
7
|
+
require "async"
|
8
|
+
|
9
|
+
module Courier
|
10
|
+
module Users
|
11
|
+
class TenantsClient
|
12
|
+
attr_reader :request_client
|
13
|
+
|
14
|
+
# @param request_client [RequestClient]
|
15
|
+
# @return [Users::TenantsClient]
|
16
|
+
def initialize(request_client:)
|
17
|
+
# @type [RequestClient]
|
18
|
+
@request_client = request_client
|
19
|
+
end
|
20
|
+
|
21
|
+
# This endpoint is used to add a user to
|
22
|
+
# multiple tenants in one call.
|
23
|
+
# A custom profile can also be supplied for each tenant.
|
24
|
+
# This profile will be merged with the user's main
|
25
|
+
# profile when sending to the user with that tenant.
|
26
|
+
#
|
27
|
+
# @param user_id [String] The user's ID. This can be any uniquely identifiable string.
|
28
|
+
# @param tenants [Array<Hash>] Request of type Array<Commons::UserTenantAssociation>, as a Hash
|
29
|
+
# * :user_id (String)
|
30
|
+
# * :type (String)
|
31
|
+
# * :tenant_id (String)
|
32
|
+
# * :profile (Hash{String => String})
|
33
|
+
# @param request_options [RequestOptions]
|
34
|
+
# @return [Void]
|
35
|
+
def add_multple(user_id:, tenants:, request_options: nil)
|
36
|
+
@request_client.conn.put("/users/#{user_id}/tenants") do |req|
|
37
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
38
|
+
unless request_options&.authorization_token.nil?
|
39
|
+
req.headers["Authorization"] =
|
40
|
+
request_options.authorization_token
|
41
|
+
end
|
42
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
43
|
+
req.body = { **(request_options&.additional_body_parameters || {}), tenants: tenants }.compact
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# This endpoint is used to add a single tenant.
|
48
|
+
#
|
49
|
+
# A custom profile can also be supplied with the tenant.
|
50
|
+
# This profile will be merged with the user's main profile
|
51
|
+
# when sending to the user with that tenant.
|
52
|
+
#
|
53
|
+
# @param user_id [String] Id of the user to be added to the supplied tenant.
|
54
|
+
# @param tenant_id [String] Id of the tenant the user should be added to.
|
55
|
+
# @param profile [Hash] Request of type Users::Tenants::AddUserToSingleTenantsParamsProfile, as a Hash
|
56
|
+
# * :title (String)
|
57
|
+
# * :email (String)
|
58
|
+
# * :phone_number (String)
|
59
|
+
# * :locale (String)
|
60
|
+
# * :additional_fields (Hash{String => String})
|
61
|
+
# @param request_options [RequestOptions]
|
62
|
+
# @return [Void]
|
63
|
+
def add(user_id:, tenant_id:, profile:, request_options: nil)
|
64
|
+
@request_client.conn.put("/users/#{user_id}/tenants/#{tenant_id}") do |req|
|
65
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
66
|
+
unless request_options&.authorization_token.nil?
|
67
|
+
req.headers["Authorization"] =
|
68
|
+
request_options.authorization_token
|
69
|
+
end
|
70
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
71
|
+
req.body = { **(request_options&.additional_body_parameters || {}), profile: profile }.compact
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Removes a user from any tenants they may have been associated with.
|
76
|
+
#
|
77
|
+
# @param user_id [String] Id of the user to be removed from the supplied tenant.
|
78
|
+
# @param request_options [RequestOptions]
|
79
|
+
# @return [Void]
|
80
|
+
def remove_all(user_id:, request_options: nil)
|
81
|
+
@request_client.conn.delete("/users/#{user_id}/tenants") do |req|
|
82
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
83
|
+
unless request_options&.authorization_token.nil?
|
84
|
+
req.headers["Authorization"] =
|
85
|
+
request_options.authorization_token
|
86
|
+
end
|
87
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Removes a user from the supplied tenant.
|
92
|
+
#
|
93
|
+
# @param user_id [String] Id of the user to be removed from the supplied tenant.
|
94
|
+
# @param tenant_id [String] Id of the tenant the user should be removed from.
|
95
|
+
# @param request_options [RequestOptions]
|
96
|
+
# @return [Void]
|
97
|
+
def remove(user_id:, tenant_id:, request_options: nil)
|
98
|
+
@request_client.conn.delete("/users/#{user_id}/tenants/#{tenant_id}") do |req|
|
99
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
100
|
+
unless request_options&.authorization_token.nil?
|
101
|
+
req.headers["Authorization"] =
|
102
|
+
request_options.authorization_token
|
103
|
+
end
|
104
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# Returns a paginated list of user tenant associations.
|
109
|
+
#
|
110
|
+
# @param user_id [String] Id of the user to retrieve all associated tenants for.
|
111
|
+
# @param limit [Integer] The number of accounts to return
|
112
|
+
# (defaults to 20, maximum value of 100)
|
113
|
+
# @param cursor [String] Continue the pagination with the next cursor
|
114
|
+
# @param request_options [RequestOptions]
|
115
|
+
# @return [Users::Tenants::ListTenantsForUserResponse]
|
116
|
+
def list(user_id:, limit: nil, cursor: nil, request_options: nil)
|
117
|
+
response = @request_client.conn.get("/users/#{user_id}/tenants") do |req|
|
118
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
119
|
+
unless request_options&.authorization_token.nil?
|
120
|
+
req.headers["Authorization"] =
|
121
|
+
request_options.authorization_token
|
122
|
+
end
|
123
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
124
|
+
req.params = {
|
125
|
+
**(request_options&.additional_query_parameters || {}),
|
126
|
+
"limit": limit,
|
127
|
+
"cursor": cursor
|
128
|
+
}.compact
|
129
|
+
end
|
130
|
+
Users::Tenants::ListTenantsForUserResponse.from_json(json_object: response.body)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
class AsyncTenantsClient
|
135
|
+
attr_reader :request_client
|
136
|
+
|
137
|
+
# @param request_client [AsyncRequestClient]
|
138
|
+
# @return [Users::AsyncTenantsClient]
|
139
|
+
def initialize(request_client:)
|
140
|
+
# @type [AsyncRequestClient]
|
141
|
+
@request_client = request_client
|
142
|
+
end
|
143
|
+
|
144
|
+
# This endpoint is used to add a user to
|
145
|
+
# multiple tenants in one call.
|
146
|
+
# A custom profile can also be supplied for each tenant.
|
147
|
+
# This profile will be merged with the user's main
|
148
|
+
# profile when sending to the user with that tenant.
|
149
|
+
#
|
150
|
+
# @param user_id [String] The user's ID. This can be any uniquely identifiable string.
|
151
|
+
# @param tenants [Array<Hash>] Request of type Array<Commons::UserTenantAssociation>, as a Hash
|
152
|
+
# * :user_id (String)
|
153
|
+
# * :type (String)
|
154
|
+
# * :tenant_id (String)
|
155
|
+
# * :profile (Hash{String => String})
|
156
|
+
# @param request_options [RequestOptions]
|
157
|
+
# @return [Void]
|
158
|
+
def add_multple(user_id:, tenants:, request_options: nil)
|
159
|
+
Async do
|
160
|
+
@request_client.conn.put("/users/#{user_id}/tenants") do |req|
|
161
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
162
|
+
unless request_options&.authorization_token.nil?
|
163
|
+
req.headers["Authorization"] =
|
164
|
+
request_options.authorization_token
|
165
|
+
end
|
166
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
167
|
+
req.body = { **(request_options&.additional_body_parameters || {}), tenants: tenants }.compact
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# This endpoint is used to add a single tenant.
|
173
|
+
#
|
174
|
+
# A custom profile can also be supplied with the tenant.
|
175
|
+
# This profile will be merged with the user's main profile
|
176
|
+
# when sending to the user with that tenant.
|
177
|
+
#
|
178
|
+
# @param user_id [String] Id of the user to be added to the supplied tenant.
|
179
|
+
# @param tenant_id [String] Id of the tenant the user should be added to.
|
180
|
+
# @param profile [Hash] Request of type Users::Tenants::AddUserToSingleTenantsParamsProfile, as a Hash
|
181
|
+
# * :title (String)
|
182
|
+
# * :email (String)
|
183
|
+
# * :phone_number (String)
|
184
|
+
# * :locale (String)
|
185
|
+
# * :additional_fields (Hash{String => String})
|
186
|
+
# @param request_options [RequestOptions]
|
187
|
+
# @return [Void]
|
188
|
+
def add(user_id:, tenant_id:, profile:, request_options: nil)
|
189
|
+
Async do
|
190
|
+
@request_client.conn.put("/users/#{user_id}/tenants/#{tenant_id}") do |req|
|
191
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
192
|
+
unless request_options&.authorization_token.nil?
|
193
|
+
req.headers["Authorization"] =
|
194
|
+
request_options.authorization_token
|
195
|
+
end
|
196
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
197
|
+
req.body = { **(request_options&.additional_body_parameters || {}), profile: profile }.compact
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
# Removes a user from any tenants they may have been associated with.
|
203
|
+
#
|
204
|
+
# @param user_id [String] Id of the user to be removed from the supplied tenant.
|
205
|
+
# @param request_options [RequestOptions]
|
206
|
+
# @return [Void]
|
207
|
+
def remove_all(user_id:, request_options: nil)
|
208
|
+
Async do
|
209
|
+
@request_client.conn.delete("/users/#{user_id}/tenants") do |req|
|
210
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
211
|
+
unless request_options&.authorization_token.nil?
|
212
|
+
req.headers["Authorization"] =
|
213
|
+
request_options.authorization_token
|
214
|
+
end
|
215
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# Removes a user from the supplied tenant.
|
221
|
+
#
|
222
|
+
# @param user_id [String] Id of the user to be removed from the supplied tenant.
|
223
|
+
# @param tenant_id [String] Id of the tenant the user should be removed from.
|
224
|
+
# @param request_options [RequestOptions]
|
225
|
+
# @return [Void]
|
226
|
+
def remove(user_id:, tenant_id:, request_options: nil)
|
227
|
+
Async do
|
228
|
+
@request_client.conn.delete("/users/#{user_id}/tenants/#{tenant_id}") do |req|
|
229
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
230
|
+
unless request_options&.authorization_token.nil?
|
231
|
+
req.headers["Authorization"] =
|
232
|
+
request_options.authorization_token
|
233
|
+
end
|
234
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# Returns a paginated list of user tenant associations.
|
240
|
+
#
|
241
|
+
# @param user_id [String] Id of the user to retrieve all associated tenants for.
|
242
|
+
# @param limit [Integer] The number of accounts to return
|
243
|
+
# (defaults to 20, maximum value of 100)
|
244
|
+
# @param cursor [String] Continue the pagination with the next cursor
|
245
|
+
# @param request_options [RequestOptions]
|
246
|
+
# @return [Users::Tenants::ListTenantsForUserResponse]
|
247
|
+
def list(user_id:, limit: nil, cursor: nil, request_options: nil)
|
248
|
+
Async do
|
249
|
+
response = @request_client.conn.get("/users/#{user_id}/tenants") do |req|
|
250
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
251
|
+
unless request_options&.authorization_token.nil?
|
252
|
+
req.headers["Authorization"] =
|
253
|
+
request_options.authorization_token
|
254
|
+
end
|
255
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
256
|
+
req.params = {
|
257
|
+
**(request_options&.additional_query_parameters || {}),
|
258
|
+
"limit": limit,
|
259
|
+
"cursor": cursor
|
260
|
+
}.compact
|
261
|
+
end
|
262
|
+
Users::Tenants::ListTenantsForUserResponse.from_json(json_object: response.body)
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Courier
|
6
|
+
module Users
|
7
|
+
class Tenants
|
8
|
+
class AddUserToSingleTenantsParamsProfile
|
9
|
+
attr_reader :title, :email, :phone_number, :locale, :additional_fields, :additional_properties
|
10
|
+
|
11
|
+
# @param title [String]
|
12
|
+
# @param email [String] Email Address
|
13
|
+
# @param phone_number [String] A valid phone number
|
14
|
+
# @param locale [String] The user's preferred ISO 639-1 language code.
|
15
|
+
# @param additional_fields [Hash{String => String}] Additional provider specific fields may be specified.
|
16
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
# @return [Users::Tenants::AddUserToSingleTenantsParamsProfile]
|
18
|
+
def initialize(title:, email:, phone_number:, locale:, additional_fields:, additional_properties: nil)
|
19
|
+
# @type [String]
|
20
|
+
@title = title
|
21
|
+
# @type [String] Email Address
|
22
|
+
@email = email
|
23
|
+
# @type [String] A valid phone number
|
24
|
+
@phone_number = phone_number
|
25
|
+
# @type [String] The user's preferred ISO 639-1 language code.
|
26
|
+
@locale = locale
|
27
|
+
# @type [Hash{String => String}] Additional provider specific fields may be specified.
|
28
|
+
@additional_fields = additional_fields
|
29
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
30
|
+
@additional_properties = additional_properties
|
31
|
+
end
|
32
|
+
|
33
|
+
# Deserialize a JSON object to an instance of AddUserToSingleTenantsParamsProfile
|
34
|
+
#
|
35
|
+
# @param json_object [JSON]
|
36
|
+
# @return [Users::Tenants::AddUserToSingleTenantsParamsProfile]
|
37
|
+
def self.from_json(json_object:)
|
38
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
39
|
+
JSON.parse(json_object)
|
40
|
+
title = struct.title
|
41
|
+
email = struct.email
|
42
|
+
phone_number = struct.phone_number
|
43
|
+
locale = struct.locale
|
44
|
+
additional_fields = struct.additional_fields
|
45
|
+
new(title: title, email: email, phone_number: phone_number, locale: locale,
|
46
|
+
additional_fields: additional_fields, additional_properties: struct)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Serialize an instance of AddUserToSingleTenantsParamsProfile to a JSON object
|
50
|
+
#
|
51
|
+
# @return [JSON]
|
52
|
+
def to_json(*_args)
|
53
|
+
{
|
54
|
+
"title": @title,
|
55
|
+
"email": @email,
|
56
|
+
"phone_number": @phone_number,
|
57
|
+
"locale": @locale,
|
58
|
+
"additional_fields": @additional_fields
|
59
|
+
}.to_json
|
60
|
+
end
|
61
|
+
|
62
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
63
|
+
#
|
64
|
+
# @param obj [Object]
|
65
|
+
# @return [Void]
|
66
|
+
def self.validate_raw(obj:)
|
67
|
+
obj.title.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.")
|
68
|
+
obj.email.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
|
69
|
+
obj.phone_number.is_a?(String) != false || raise("Passed value for field obj.phone_number is not the expected type, validation failed.")
|
70
|
+
obj.locale.is_a?(String) != false || raise("Passed value for field obj.locale is not the expected type, validation failed.")
|
71
|
+
obj.additional_fields.is_a?(Hash) != false || raise("Passed value for field obj.additional_fields is not the expected type, validation failed.")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../commons/types/user_tenant_association"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Courier
|
7
|
+
module Users
|
8
|
+
class Tenants
|
9
|
+
class ListTenantsForUserResponse
|
10
|
+
attr_reader :items, :has_more, :url, :next_url, :cursor, :type, :additional_properties
|
11
|
+
|
12
|
+
# @param items [Array<Commons::UserTenantAssociation>]
|
13
|
+
# @param has_more [Boolean] Set to true when there are more pages that can be retrieved.
|
14
|
+
# @param url [String] A url that may be used to generate these results.
|
15
|
+
# @param next_url [String] A url that may be used to generate fetch the next set of results.
|
16
|
+
# Defined only when `has_more` is set to true
|
17
|
+
# @param cursor [String] A pointer to the next page of results. Defined
|
18
|
+
# only when `has_more` is set to true
|
19
|
+
# @param type [String] Always set to `list`. Represents the type of this object.
|
20
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
21
|
+
# @return [Users::Tenants::ListTenantsForUserResponse]
|
22
|
+
def initialize(has_more:, url:, type:, items: nil, next_url: nil, cursor: nil, additional_properties: nil)
|
23
|
+
# @type [Array<Commons::UserTenantAssociation>]
|
24
|
+
@items = items
|
25
|
+
# @type [Boolean] Set to true when there are more pages that can be retrieved.
|
26
|
+
@has_more = has_more
|
27
|
+
# @type [String] A url that may be used to generate these results.
|
28
|
+
@url = url
|
29
|
+
# @type [String] A url that may be used to generate fetch the next set of results.
|
30
|
+
# Defined only when `has_more` is set to true
|
31
|
+
@next_url = next_url
|
32
|
+
# @type [String] A pointer to the next page of results. Defined
|
33
|
+
# only when `has_more` is set to true
|
34
|
+
@cursor = cursor
|
35
|
+
# @type [String] Always set to `list`. Represents the type of this object.
|
36
|
+
@type = type
|
37
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
38
|
+
@additional_properties = additional_properties
|
39
|
+
end
|
40
|
+
|
41
|
+
# Deserialize a JSON object to an instance of ListTenantsForUserResponse
|
42
|
+
#
|
43
|
+
# @param json_object [JSON]
|
44
|
+
# @return [Users::Tenants::ListTenantsForUserResponse]
|
45
|
+
def self.from_json(json_object:)
|
46
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
47
|
+
parsed_json = JSON.parse(json_object)
|
48
|
+
items = parsed_json["items"]&.map do |v|
|
49
|
+
v = v.to_json
|
50
|
+
Commons::UserTenantAssociation.from_json(json_object: v)
|
51
|
+
end
|
52
|
+
has_more = struct.has_more
|
53
|
+
url = struct.url
|
54
|
+
next_url = struct.next_url
|
55
|
+
cursor = struct.cursor
|
56
|
+
type = struct.type
|
57
|
+
new(items: items, has_more: has_more, url: url, next_url: next_url, cursor: cursor, type: type,
|
58
|
+
additional_properties: struct)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Serialize an instance of ListTenantsForUserResponse to a JSON object
|
62
|
+
#
|
63
|
+
# @return [JSON]
|
64
|
+
def to_json(*_args)
|
65
|
+
{
|
66
|
+
"items": @items,
|
67
|
+
"has_more": @has_more,
|
68
|
+
"url": @url,
|
69
|
+
"next_url": @next_url,
|
70
|
+
"cursor": @cursor,
|
71
|
+
"type": @type
|
72
|
+
}.to_json
|
73
|
+
end
|
74
|
+
|
75
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
76
|
+
#
|
77
|
+
# @param obj [Object]
|
78
|
+
# @return [Void]
|
79
|
+
def self.validate_raw(obj:)
|
80
|
+
obj.items&.is_a?(Array) != false || raise("Passed value for field obj.items is not the expected type, validation failed.")
|
81
|
+
obj.has_more.is_a?(Boolean) != false || raise("Passed value for field obj.has_more is not the expected type, validation failed.")
|
82
|
+
obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
|
83
|
+
obj.next_url&.is_a?(String) != false || raise("Passed value for field obj.next_url is not the expected type, validation failed.")
|
84
|
+
obj.cursor&.is_a?(String) != false || raise("Passed value for field obj.cursor is not the expected type, validation failed.")
|
85
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|