sendx-ruby-sdk 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +220 -81
- data/lib/sendx-ruby-sdk/api/campaign_api.rb +95 -143
- data/lib/sendx-ruby-sdk/api/contact_api.rb +129 -96
- data/lib/sendx-ruby-sdk/api/custom_field_api.rb +391 -0
- data/lib/sendx-ruby-sdk/api/email_sending_api.rb +158 -0
- data/lib/sendx-ruby-sdk/api/event_api.rb +91 -57
- data/lib/sendx-ruby-sdk/api/events_api.rb +158 -0
- data/lib/sendx-ruby-sdk/api/getting_started_api.rb +2 -2
- data/lib/sendx-ruby-sdk/api/list_api.rb +126 -91
- data/lib/sendx-ruby-sdk/api/post_api.rb +380 -0
- data/lib/sendx-ruby-sdk/api/post_category_api.rb +362 -0
- data/lib/sendx-ruby-sdk/api/post_tag_api.rb +362 -0
- data/lib/sendx-ruby-sdk/api/report_api.rb +90 -0
- data/lib/sendx-ruby-sdk/api/reports_api.rb +4 -4
- data/lib/sendx-ruby-sdk/api/sender_api.rb +28 -37
- data/lib/sendx-ruby-sdk/api/tag_api.rb +380 -0
- data/lib/sendx-ruby-sdk/api/tags_api.rb +8 -8
- data/lib/sendx-ruby-sdk/api/team_member_api.rb +147 -0
- data/lib/sendx-ruby-sdk/api/template_api.rb +391 -0
- data/lib/sendx-ruby-sdk/api/tracking_api.rb +158 -0
- data/lib/sendx-ruby-sdk/api/webhook_api.rb +362 -0
- data/lib/sendx-ruby-sdk/api_client.rb +10 -11
- data/lib/sendx-ruby-sdk/api_error.rb +3 -3
- data/lib/sendx-ruby-sdk/configuration.rb +6 -10
- data/lib/sendx-ruby-sdk/models/campaign.rb +23 -7
- data/lib/sendx-ruby-sdk/models/campaign_dashboard_data.rb +11 -5
- data/lib/sendx-ruby-sdk/models/campaign_request.rb +13 -41
- data/lib/sendx-ruby-sdk/models/contact.rb +11 -5
- data/lib/sendx-ruby-sdk/models/contact_request.rb +11 -5
- data/lib/sendx-ruby-sdk/models/create_response.rb +11 -5
- data/lib/sendx-ruby-sdk/models/custom_event_request.rb +37 -42
- data/lib/sendx-ruby-sdk/models/custom_field.rb +285 -0
- data/lib/sendx-ruby-sdk/models/customfield_customfield_id_delete200_response.rb +220 -0
- data/lib/sendx-ruby-sdk/models/dashboard_stats.rb +11 -5
- data/lib/sendx-ruby-sdk/models/delete_campaign200_response.rb +11 -5
- data/lib/sendx-ruby-sdk/models/delete_request.rb +11 -5
- data/lib/sendx-ruby-sdk/models/delete_response.rb +77 -13
- data/lib/sendx-ruby-sdk/models/e_custom_field.rb +295 -0
- data/lib/sendx-ruby-sdk/models/error_response.rb +288 -0
- data/lib/sendx-ruby-sdk/models/event_response.rb +13 -19
- data/lib/sendx-ruby-sdk/models/events_revenue_postback_get200_response.rb +229 -0
- data/lib/sendx-ruby-sdk/models/events_revenue_postback_get400_response.rb +220 -0
- data/lib/sendx-ruby-sdk/models/events_revenue_postback_get500_response.rb +220 -0
- data/lib/sendx-ruby-sdk/models/identify_error_response.rb +220 -0
- data/lib/sendx-ruby-sdk/models/identify_request.rb +52 -40
- data/lib/sendx-ruby-sdk/models/identify_response.rb +16 -19
- data/lib/sendx-ruby-sdk/models/last_sent_campaign_stat.rb +11 -5
- data/lib/sendx-ruby-sdk/models/link_stat.rb +232 -0
- data/lib/sendx-ruby-sdk/models/list_model.rb +11 -6
- data/lib/sendx-ruby-sdk/models/list_request.rb +11 -5
- data/lib/sendx-ruby-sdk/models/message_response.rb +229 -0
- data/lib/sendx-ruby-sdk/models/operation_response.rb +241 -0
- data/lib/sendx-ruby-sdk/models/postback_response.rb +229 -0
- data/lib/sendx-ruby-sdk/models/report_data.rb +11 -5
- data/lib/sendx-ruby-sdk/models/response.rb +11 -5
- data/lib/sendx-ruby-sdk/models/rest_e_campaign.rb +539 -0
- data/lib/sendx-ruby-sdk/models/rest_e_contact.rb +380 -0
- data/lib/sendx-ruby-sdk/models/rest_e_custom_field.rb +299 -0
- data/lib/sendx-ruby-sdk/models/rest_e_list.rb +238 -0
- data/lib/sendx-ruby-sdk/models/rest_e_post.rb +443 -0
- data/lib/sendx-ruby-sdk/models/rest_e_post_category.rb +238 -0
- data/lib/sendx-ruby-sdk/models/rest_e_post_tag.rb +238 -0
- data/lib/sendx-ruby-sdk/models/rest_e_sender.rb +265 -0
- data/lib/sendx-ruby-sdk/models/rest_e_tag.rb +238 -0
- data/lib/sendx-ruby-sdk/models/rest_e_template.rb +307 -0
- data/lib/sendx-ruby-sdk/models/rest_e_webhook.rb +349 -0
- data/lib/sendx-ruby-sdk/models/rest_r_campaign.rb +580 -0
- data/lib/sendx-ruby-sdk/models/rest_r_contact.rb +438 -0
- data/lib/sendx-ruby-sdk/models/rest_r_custom_field.rb +306 -0
- data/lib/sendx-ruby-sdk/models/rest_r_list.rb +291 -0
- data/lib/sendx-ruby-sdk/models/rest_r_member.rb +274 -0
- data/lib/sendx-ruby-sdk/models/rest_r_post.rb +384 -0
- data/lib/sendx-ruby-sdk/models/rest_r_post_category.rb +251 -0
- data/lib/sendx-ruby-sdk/models/rest_r_post_tag.rb +250 -0
- data/lib/sendx-ruby-sdk/models/rest_r_sender.rb +272 -0
- data/lib/sendx-ruby-sdk/models/rest_r_tag.rb +272 -0
- data/lib/sendx-ruby-sdk/models/rest_r_template.rb +366 -0
- data/lib/sendx-ruby-sdk/models/rest_r_webhook.rb +326 -0
- data/lib/sendx-ruby-sdk/models/rest_report_data.rb +312 -0
- data/lib/sendx-ruby-sdk/models/revenue_event_request.rb +37 -42
- data/lib/sendx-ruby-sdk/models/sender.rb +41 -5
- data/lib/sendx-ruby-sdk/models/sender_request.rb +31 -5
- data/lib/sendx-ruby-sdk/models/sender_response.rb +51 -5
- data/lib/sendx-ruby-sdk/models/tag.rb +11 -5
- data/lib/sendx-ruby-sdk/models/tag_request.rb +11 -5
- data/lib/sendx-ruby-sdk/models/template_email_message.rb +337 -0
- data/lib/sendx-ruby-sdk/models/track_request.rb +28 -20
- data/lib/sendx-ruby-sdk/models/track_response.rb +12 -6
- data/lib/sendx-ruby-sdk/models/webhook.rb +311 -0
- data/lib/sendx-ruby-sdk/models/webhook_object.rb +451 -0
- data/lib/sendx-ruby-sdk/models/webhook_request.rb +291 -0
- data/lib/sendx-ruby-sdk/models/x_attachment.rb +263 -0
- data/lib/sendx-ruby-sdk/models/x_email_message.rb +356 -0
- data/lib/sendx-ruby-sdk/models/x_email_response.rb +261 -0
- data/lib/sendx-ruby-sdk/models/x_from.rb +246 -0
- data/lib/sendx-ruby-sdk/models/x_reply_to.rb +246 -0
- data/lib/sendx-ruby-sdk/models/xto.rb +279 -0
- data/lib/sendx-ruby-sdk/version.rb +4 -4
- data/lib/sendx-ruby-sdk.rb +53 -25
- data/spec/api/custom_field_api_spec.rb +98 -0
- data/spec/api/email_sending_api_spec.rb +59 -0
- data/spec/api/events_api_spec.rb +59 -0
- data/spec/api/post_api_spec.rb +97 -0
- data/spec/api/post_category_api_spec.rb +95 -0
- data/spec/api/post_tag_api_spec.rb +95 -0
- data/spec/api/report_api_spec.rb +47 -0
- data/spec/api/tag_api_spec.rb +97 -0
- data/spec/api/team_member_api_spec.rb +58 -0
- data/spec/api/template_api_spec.rb +98 -0
- data/spec/api/tracking_api_spec.rb +59 -0
- data/spec/api/webhook_api_spec.rb +95 -0
- data/spec/models/custom_field_spec.rb +58 -0
- data/spec/models/customfield_customfield_id_delete200_response_spec.rb +36 -0
- data/spec/models/e_custom_field_spec.rb +64 -0
- data/spec/models/error_response_spec.rb +46 -0
- data/spec/models/events_revenue_postback_get200_response_spec.rb +42 -0
- data/spec/models/events_revenue_postback_get400_response_spec.rb +36 -0
- data/spec/models/events_revenue_postback_get500_response_spec.rb +36 -0
- data/spec/models/identify_error_response_spec.rb +36 -0
- data/spec/models/link_stat_spec.rb +42 -0
- data/spec/models/message_response_spec.rb +42 -0
- data/spec/models/operation_response_spec.rb +48 -0
- data/spec/models/postback_response_spec.rb +42 -0
- data/spec/models/rest_e_campaign_spec.rb +154 -0
- data/spec/models/rest_e_contact_spec.rb +78 -0
- data/spec/models/rest_e_custom_field_spec.rb +52 -0
- data/spec/models/rest_e_list_spec.rb +36 -0
- data/spec/models/rest_e_post_category_spec.rb +36 -0
- data/spec/models/rest_e_post_spec.rb +144 -0
- data/spec/models/rest_e_post_tag_spec.rb +36 -0
- data/spec/models/rest_e_sender_spec.rb +42 -0
- data/spec/models/rest_e_tag_spec.rb +36 -0
- data/spec/models/rest_e_template_spec.rb +66 -0
- data/spec/models/rest_e_webhook_spec.rb +84 -0
- data/spec/models/rest_r_campaign_spec.rb +178 -0
- data/spec/models/rest_r_contact_spec.rb +150 -0
- data/spec/models/rest_r_custom_field_spec.rb +58 -0
- data/spec/models/rest_r_list_spec.rb +64 -0
- data/spec/models/rest_r_member_spec.rb +72 -0
- data/spec/models/rest_r_post_category_spec.rb +54 -0
- data/spec/models/rest_r_post_spec.rb +144 -0
- data/spec/models/rest_r_post_tag_spec.rb +54 -0
- data/spec/models/rest_r_sender_spec.rb +54 -0
- data/spec/models/rest_r_tag_spec.rb +54 -0
- data/spec/models/rest_r_template_spec.rb +94 -0
- data/spec/models/rest_r_webhook_spec.rb +90 -0
- data/spec/models/rest_report_data_spec.rb +90 -0
- data/spec/models/template_email_message_spec.rb +72 -0
- data/spec/models/webhook_object_spec.rb +180 -0
- data/spec/models/webhook_request_spec.rb +78 -0
- data/spec/models/webhook_spec.rb +90 -0
- data/spec/models/x_attachment_spec.rb +42 -0
- data/spec/models/x_email_message_spec.rb +90 -0
- data/spec/models/x_email_response_spec.rb +60 -0
- data/spec/models/x_from_spec.rb +42 -0
- data/spec/models/x_reply_to_spec.rb +42 -0
- data/spec/models/xto_spec.rb +60 -0
- data/spec/spec_helper.rb +3 -3
- metadata +202 -28
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#SendX REST API
|
3
3
|
|
4
|
-
## Introduction SendX is
|
4
|
+
## SendX REST API Documentation ## 🚀 Introduction The SendX API is organized around REST principles. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. **Key Features:** - 🔒 **Security**: Team-based authentication with optional member-level access - 🎯 **Resource-Oriented**: RESTful design with clear resource boundaries - 📊 **Rich Data Models**: Three-layer model system (Input/Output/Internal) - 🔗 **Relationships**: Automatic prefix handling for resource relationships - 📈 **Scalable**: Built for high-volume email marketing operations ## 🏗️ Architecture Overview SendX uses a three-layer model architecture: 1. **Input Models** (`RestE*`): For API requests 2. **Output Models** (`RestR*`): For API responses with prefixed IDs 3. **Internal Models**: Core business logic (not exposed in API) ## 🔐 Security & Authentication SendX uses API key authentication: ### Team API Key ```http X-Team-ApiKey: YOUR_TEAM_API_KEY ``` - **Required for all requests** - Team-level access to resources - Available in SendX Settings → Team API Key ## 🆔 Encrypted ID System SendX uses encrypted IDs for security and better developer experience: - **Internal IDs**: Sequential integers (not exposed) - **Encrypted IDs**: 22-character alphanumeric strings - **Prefixed IDs**: Resource-type prefixes in API responses (`contact_<22-char-id>`) ### ID Format **All resource IDs follow this pattern:** ``` <resource_prefix>_<22_character_alphanumeric_string> ``` **Example:** ```json { \"id\": \"contact_BnKjkbBBS500CoBCP0oChQ\", \"lists\": [\"list_OcuxJHdiAvujmwQVJfd3ss\", \"list_0tOFLp5RgV7s3LNiHrjGYs\"], \"tags\": [\"tag_UhsDkjL772Qbj5lWtT62VK\", \"tag_fL7t9lsnZ9swvx2HrtQ9wM\"] } ``` ## 📚 Resource Prefixes | Resource | Prefix | Example | |----------|--------|---------| | Contact | `contact_` | `contact_BnKjkbBBS500CoBCP0oChQ` | | Campaign | `campaign_` | `campaign_LUE9BTxmksSmqHWbh96zsn` | | List | `list_` | `list_OcuxJHdiAvujmwQVJfd3ss` | | Tag | `tag_` | `tag_UhsDkjL772Qbj5lWtT62VK` | | Sender | `sender_` | `sender_4vK3WFhMgvOwUNyaL4QxCD` | | Template | `template_` | `template_f3lJvTEhSjKGVb5Lwc5SWS` | | Custom Field | `field_` | `field_MnuqBAG2NPLm7PZMWbjQxt` | | Webhook | `webhook_` | `webhook_9l154iiXlZoPo7vngmamee` | | Post | `post_` | `post_XyZ123aBc456DeF789GhI` | | Post Category | `post_category_` | `post_category_YzS1wOU20yw87UUHKxMzwn` | | Post Tag | `post_tag_` | `post_tag_123XyZ456AbC` | | Member | `member_` | `member_JkL012MnO345PqR678` | ## 🎯 Best Practices ### Error Handling - **Always check status codes**: 2xx = success, 4xx = client error, 5xx = server error - **Read error messages**: Descriptive messages help debug issues - **Handle rate limits**: Respect API rate limits for optimal performance ### Data Validation - **Email format**: Must be valid email addresses - **Required fields**: Check documentation for mandatory fields - **Field lengths**: Respect maximum length constraints ### Performance - **Pagination**: Use offset/limit for large datasets - **Batch operations**: Process multiple items when supported - **Caching**: Cache responses when appropriate ## 🛠️ SDKs & Integration Official SDKs available for: - [Golang](https://github.com/sendx/sendx-go-sdk) - [Python](https://github.com/sendx/sendx-python-sdk) - [Ruby](https://github.com/sendx/sendx-ruby-sdk) - [Java](https://github.com/sendx/sendx-java-sdk) - [PHP](https://github.com/sendx/sendx-php-sdk) - [JavaScript](https://github.com/sendx/sendx-javascript-sdk) ## 📞 Support Need help? Contact us: - 💬 **Website Chat**: Available on sendx.io - 📧 **Email**: hello@sendx.io - 📚 **Documentation**: Full guides at help.sendx.io --- **API Endpoint:** `https://api.sendx.io/api/v1/rest` [<img src=\"https://run.pstmn.io/button.svg\" alt=\"Run In Postman\" style=\"width: 128px; height: 32px;\">](https://god.gw.postman.com/run-collection/33476323-44b198b0-5219-4619-a01f-cfc24d573885?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D33476323-44b198b0-5219-4619-a01f-cfc24d573885%26entityType%3Dcollection%26workspaceId%3D6b1e4f65-96a9-4136-9512-6266c852517e)
|
5
5
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
|
-
Contact:
|
7
|
+
Contact: hello@sendx.io
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.
|
9
|
+
Generator version: 7.13.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -19,28 +19,28 @@ module SendX
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# Create
|
23
|
-
#
|
24
|
-
# @param
|
22
|
+
# Create sender
|
23
|
+
# Adds a new sender email address.
|
24
|
+
# @param rest_e_sender [RestESender]
|
25
25
|
# @param [Hash] opts the optional parameters
|
26
|
-
# @return [
|
27
|
-
def create_sender(
|
28
|
-
data, _status_code, _headers = create_sender_with_http_info(
|
26
|
+
# @return [RestRSender]
|
27
|
+
def create_sender(rest_e_sender, opts = {})
|
28
|
+
data, _status_code, _headers = create_sender_with_http_info(rest_e_sender, opts)
|
29
29
|
data
|
30
30
|
end
|
31
31
|
|
32
|
-
# Create
|
33
|
-
#
|
34
|
-
# @param
|
32
|
+
# Create sender
|
33
|
+
# Adds a new sender email address.
|
34
|
+
# @param rest_e_sender [RestESender]
|
35
35
|
# @param [Hash] opts the optional parameters
|
36
|
-
# @return [Array<(
|
37
|
-
def create_sender_with_http_info(
|
36
|
+
# @return [Array<(RestRSender, Integer, Hash)>] RestRSender data, response status code and response headers
|
37
|
+
def create_sender_with_http_info(rest_e_sender, opts = {})
|
38
38
|
if @api_client.config.debugging
|
39
39
|
@api_client.config.logger.debug 'Calling API: SenderApi.create_sender ...'
|
40
40
|
end
|
41
|
-
# verify the required parameter '
|
42
|
-
if @api_client.config.client_side_validation &&
|
43
|
-
fail ArgumentError, "Missing the required parameter '
|
41
|
+
# verify the required parameter 'rest_e_sender' is set
|
42
|
+
if @api_client.config.client_side_validation && rest_e_sender.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'rest_e_sender' when calling SenderApi.create_sender"
|
44
44
|
end
|
45
45
|
# resource path
|
46
46
|
local_var_path = '/sender'
|
@@ -62,13 +62,13 @@ module SendX
|
|
62
62
|
form_params = opts[:form_params] || {}
|
63
63
|
|
64
64
|
# http body (model)
|
65
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
65
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(rest_e_sender)
|
66
66
|
|
67
67
|
# return_type
|
68
|
-
return_type = opts[:debug_return_type] || '
|
68
|
+
return_type = opts[:debug_return_type] || 'RestRSender'
|
69
69
|
|
70
70
|
# auth_names
|
71
|
-
auth_names = opts[:debug_auth_names] || ['
|
71
|
+
auth_names = opts[:debug_auth_names] || ['TeamApiKey']
|
72
72
|
|
73
73
|
new_options = opts.merge(
|
74
74
|
:operation => :"SenderApi.create_sender",
|
@@ -87,25 +87,19 @@ module SendX
|
|
87
87
|
return data, status_code, headers
|
88
88
|
end
|
89
89
|
|
90
|
-
# Get
|
91
|
-
#
|
90
|
+
# Get all senders
|
91
|
+
# Retrieves all verified sender addresses.
|
92
92
|
# @param [Hash] opts the optional parameters
|
93
|
-
# @
|
94
|
-
# @option opts [Integer] :limit Maximum number of records to return (default to 10)
|
95
|
-
# @option opts [String] :search Search keyword to filter senders by name or email
|
96
|
-
# @return [Array<SenderResponse>]
|
93
|
+
# @return [Array<RestRSender>]
|
97
94
|
def get_all_senders(opts = {})
|
98
95
|
data, _status_code, _headers = get_all_senders_with_http_info(opts)
|
99
96
|
data
|
100
97
|
end
|
101
98
|
|
102
|
-
# Get
|
103
|
-
#
|
99
|
+
# Get all senders
|
100
|
+
# Retrieves all verified sender addresses.
|
104
101
|
# @param [Hash] opts the optional parameters
|
105
|
-
# @
|
106
|
-
# @option opts [Integer] :limit Maximum number of records to return (default to 10)
|
107
|
-
# @option opts [String] :search Search keyword to filter senders by name or email
|
108
|
-
# @return [Array<(Array<SenderResponse>, Integer, Hash)>] Array<SenderResponse> data, response status code and response headers
|
102
|
+
# @return [Array<(Array<RestRSender>, Integer, Hash)>] Array<RestRSender> data, response status code and response headers
|
109
103
|
def get_all_senders_with_http_info(opts = {})
|
110
104
|
if @api_client.config.debugging
|
111
105
|
@api_client.config.logger.debug 'Calling API: SenderApi.get_all_senders ...'
|
@@ -115,9 +109,6 @@ module SendX
|
|
115
109
|
|
116
110
|
# query parameters
|
117
111
|
query_params = opts[:query_params] || {}
|
118
|
-
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
119
|
-
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
120
|
-
query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
|
121
112
|
|
122
113
|
# header parameters
|
123
114
|
header_params = opts[:header_params] || {}
|
@@ -131,10 +122,10 @@ module SendX
|
|
131
122
|
post_body = opts[:debug_body]
|
132
123
|
|
133
124
|
# return_type
|
134
|
-
return_type = opts[:debug_return_type] || 'Array<
|
125
|
+
return_type = opts[:debug_return_type] || 'Array<RestRSender>'
|
135
126
|
|
136
127
|
# auth_names
|
137
|
-
auth_names = opts[:debug_auth_names] || ['
|
128
|
+
auth_names = opts[:debug_auth_names] || ['TeamApiKey']
|
138
129
|
|
139
130
|
new_options = opts.merge(
|
140
131
|
:operation => :"SenderApi.get_all_senders",
|
@@ -0,0 +1,380 @@
|
|
1
|
+
=begin
|
2
|
+
#SendX REST API
|
3
|
+
|
4
|
+
## SendX REST API Documentation ## 🚀 Introduction The SendX API is organized around REST principles. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. **Key Features:** - 🔒 **Security**: Team-based authentication with optional member-level access - 🎯 **Resource-Oriented**: RESTful design with clear resource boundaries - 📊 **Rich Data Models**: Three-layer model system (Input/Output/Internal) - 🔗 **Relationships**: Automatic prefix handling for resource relationships - 📈 **Scalable**: Built for high-volume email marketing operations ## 🏗️ Architecture Overview SendX uses a three-layer model architecture: 1. **Input Models** (`RestE*`): For API requests 2. **Output Models** (`RestR*`): For API responses with prefixed IDs 3. **Internal Models**: Core business logic (not exposed in API) ## 🔐 Security & Authentication SendX uses API key authentication: ### Team API Key ```http X-Team-ApiKey: YOUR_TEAM_API_KEY ``` - **Required for all requests** - Team-level access to resources - Available in SendX Settings → Team API Key ## 🆔 Encrypted ID System SendX uses encrypted IDs for security and better developer experience: - **Internal IDs**: Sequential integers (not exposed) - **Encrypted IDs**: 22-character alphanumeric strings - **Prefixed IDs**: Resource-type prefixes in API responses (`contact_<22-char-id>`) ### ID Format **All resource IDs follow this pattern:** ``` <resource_prefix>_<22_character_alphanumeric_string> ``` **Example:** ```json { \"id\": \"contact_BnKjkbBBS500CoBCP0oChQ\", \"lists\": [\"list_OcuxJHdiAvujmwQVJfd3ss\", \"list_0tOFLp5RgV7s3LNiHrjGYs\"], \"tags\": [\"tag_UhsDkjL772Qbj5lWtT62VK\", \"tag_fL7t9lsnZ9swvx2HrtQ9wM\"] } ``` ## 📚 Resource Prefixes | Resource | Prefix | Example | |----------|--------|---------| | Contact | `contact_` | `contact_BnKjkbBBS500CoBCP0oChQ` | | Campaign | `campaign_` | `campaign_LUE9BTxmksSmqHWbh96zsn` | | List | `list_` | `list_OcuxJHdiAvujmwQVJfd3ss` | | Tag | `tag_` | `tag_UhsDkjL772Qbj5lWtT62VK` | | Sender | `sender_` | `sender_4vK3WFhMgvOwUNyaL4QxCD` | | Template | `template_` | `template_f3lJvTEhSjKGVb5Lwc5SWS` | | Custom Field | `field_` | `field_MnuqBAG2NPLm7PZMWbjQxt` | | Webhook | `webhook_` | `webhook_9l154iiXlZoPo7vngmamee` | | Post | `post_` | `post_XyZ123aBc456DeF789GhI` | | Post Category | `post_category_` | `post_category_YzS1wOU20yw87UUHKxMzwn` | | Post Tag | `post_tag_` | `post_tag_123XyZ456AbC` | | Member | `member_` | `member_JkL012MnO345PqR678` | ## 🎯 Best Practices ### Error Handling - **Always check status codes**: 2xx = success, 4xx = client error, 5xx = server error - **Read error messages**: Descriptive messages help debug issues - **Handle rate limits**: Respect API rate limits for optimal performance ### Data Validation - **Email format**: Must be valid email addresses - **Required fields**: Check documentation for mandatory fields - **Field lengths**: Respect maximum length constraints ### Performance - **Pagination**: Use offset/limit for large datasets - **Batch operations**: Process multiple items when supported - **Caching**: Cache responses when appropriate ## 🛠️ SDKs & Integration Official SDKs available for: - [Golang](https://github.com/sendx/sendx-go-sdk) - [Python](https://github.com/sendx/sendx-python-sdk) - [Ruby](https://github.com/sendx/sendx-ruby-sdk) - [Java](https://github.com/sendx/sendx-java-sdk) - [PHP](https://github.com/sendx/sendx-php-sdk) - [JavaScript](https://github.com/sendx/sendx-javascript-sdk) ## 📞 Support Need help? Contact us: - 💬 **Website Chat**: Available on sendx.io - 📧 **Email**: hello@sendx.io - 📚 **Documentation**: Full guides at help.sendx.io --- **API Endpoint:** `https://api.sendx.io/api/v1/rest` [<img src=\"https://run.pstmn.io/button.svg\" alt=\"Run In Postman\" style=\"width: 128px; height: 32px;\">](https://god.gw.postman.com/run-collection/33476323-44b198b0-5219-4619-a01f-cfc24d573885?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D33476323-44b198b0-5219-4619-a01f-cfc24d573885%26entityType%3Dcollection%26workspaceId%3D6b1e4f65-96a9-4136-9512-6266c852517e)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: hello@sendx.io
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.13.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module SendX
|
16
|
+
class TagApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Create tag
|
23
|
+
# Creates a new tag for contact categorization.
|
24
|
+
# @param rest_e_tag [RestETag]
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [RestRTag]
|
27
|
+
def create_tag(rest_e_tag, opts = {})
|
28
|
+
data, _status_code, _headers = create_tag_with_http_info(rest_e_tag, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Create tag
|
33
|
+
# Creates a new tag for contact categorization.
|
34
|
+
# @param rest_e_tag [RestETag]
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(RestRTag, Integer, Hash)>] RestRTag data, response status code and response headers
|
37
|
+
def create_tag_with_http_info(rest_e_tag, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: TagApi.create_tag ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'rest_e_tag' is set
|
42
|
+
if @api_client.config.client_side_validation && rest_e_tag.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'rest_e_tag' when calling TagApi.create_tag"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/tag'
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = opts[:query_params] || {}
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = opts[:header_params] || {}
|
53
|
+
# HTTP header 'Accept' (if needed)
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
55
|
+
# HTTP header 'Content-Type'
|
56
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
57
|
+
if !content_type.nil?
|
58
|
+
header_params['Content-Type'] = content_type
|
59
|
+
end
|
60
|
+
|
61
|
+
# form parameters
|
62
|
+
form_params = opts[:form_params] || {}
|
63
|
+
|
64
|
+
# http body (model)
|
65
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(rest_e_tag)
|
66
|
+
|
67
|
+
# return_type
|
68
|
+
return_type = opts[:debug_return_type] || 'RestRTag'
|
69
|
+
|
70
|
+
# auth_names
|
71
|
+
auth_names = opts[:debug_auth_names] || ['TeamApiKey']
|
72
|
+
|
73
|
+
new_options = opts.merge(
|
74
|
+
:operation => :"TagApi.create_tag",
|
75
|
+
:header_params => header_params,
|
76
|
+
:query_params => query_params,
|
77
|
+
:form_params => form_params,
|
78
|
+
:body => post_body,
|
79
|
+
:auth_names => auth_names,
|
80
|
+
:return_type => return_type
|
81
|
+
)
|
82
|
+
|
83
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
84
|
+
if @api_client.config.debugging
|
85
|
+
@api_client.config.logger.debug "API called: TagApi#create_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
86
|
+
end
|
87
|
+
return data, status_code, headers
|
88
|
+
end
|
89
|
+
|
90
|
+
# Delete tag
|
91
|
+
# Deletes a tag from the system.
|
92
|
+
# @param identifier [String] Tag identifier to update
|
93
|
+
# @param [Hash] opts the optional parameters
|
94
|
+
# @return [DeleteResponse]
|
95
|
+
def delete_tag(identifier, opts = {})
|
96
|
+
data, _status_code, _headers = delete_tag_with_http_info(identifier, opts)
|
97
|
+
data
|
98
|
+
end
|
99
|
+
|
100
|
+
# Delete tag
|
101
|
+
# Deletes a tag from the system.
|
102
|
+
# @param identifier [String] Tag identifier to update
|
103
|
+
# @param [Hash] opts the optional parameters
|
104
|
+
# @return [Array<(DeleteResponse, Integer, Hash)>] DeleteResponse data, response status code and response headers
|
105
|
+
def delete_tag_with_http_info(identifier, opts = {})
|
106
|
+
if @api_client.config.debugging
|
107
|
+
@api_client.config.logger.debug 'Calling API: TagApi.delete_tag ...'
|
108
|
+
end
|
109
|
+
# verify the required parameter 'identifier' is set
|
110
|
+
if @api_client.config.client_side_validation && identifier.nil?
|
111
|
+
fail ArgumentError, "Missing the required parameter 'identifier' when calling TagApi.delete_tag"
|
112
|
+
end
|
113
|
+
pattern = Regexp.new(/^(tag_)?[a-zA-Z0-9]{22}$/)
|
114
|
+
if @api_client.config.client_side_validation && identifier !~ pattern
|
115
|
+
fail ArgumentError, "invalid value for 'identifier' when calling TagApi.delete_tag, must conform to the pattern #{pattern}."
|
116
|
+
end
|
117
|
+
|
118
|
+
# resource path
|
119
|
+
local_var_path = '/tag/{identifier}'.sub('{' + 'identifier' + '}', CGI.escape(identifier.to_s))
|
120
|
+
|
121
|
+
# query parameters
|
122
|
+
query_params = opts[:query_params] || {}
|
123
|
+
|
124
|
+
# header parameters
|
125
|
+
header_params = opts[:header_params] || {}
|
126
|
+
# HTTP header 'Accept' (if needed)
|
127
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
128
|
+
|
129
|
+
# form parameters
|
130
|
+
form_params = opts[:form_params] || {}
|
131
|
+
|
132
|
+
# http body (model)
|
133
|
+
post_body = opts[:debug_body]
|
134
|
+
|
135
|
+
# return_type
|
136
|
+
return_type = opts[:debug_return_type] || 'DeleteResponse'
|
137
|
+
|
138
|
+
# auth_names
|
139
|
+
auth_names = opts[:debug_auth_names] || ['TeamApiKey']
|
140
|
+
|
141
|
+
new_options = opts.merge(
|
142
|
+
:operation => :"TagApi.delete_tag",
|
143
|
+
:header_params => header_params,
|
144
|
+
:query_params => query_params,
|
145
|
+
:form_params => form_params,
|
146
|
+
:body => post_body,
|
147
|
+
:auth_names => auth_names,
|
148
|
+
:return_type => return_type
|
149
|
+
)
|
150
|
+
|
151
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
152
|
+
if @api_client.config.debugging
|
153
|
+
@api_client.config.logger.debug "API called: TagApi#delete_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
154
|
+
end
|
155
|
+
return data, status_code, headers
|
156
|
+
end
|
157
|
+
|
158
|
+
# Get all tags
|
159
|
+
# Retrieves all tags in your team.
|
160
|
+
# @param [Hash] opts the optional parameters
|
161
|
+
# @option opts [Integer] :offset Number of tags to skip (default to 0)
|
162
|
+
# @option opts [Integer] :limit Maximum number of tags to return (default to 10)
|
163
|
+
# @return [Array<RestRTag>]
|
164
|
+
def get_all_tags(opts = {})
|
165
|
+
data, _status_code, _headers = get_all_tags_with_http_info(opts)
|
166
|
+
data
|
167
|
+
end
|
168
|
+
|
169
|
+
# Get all tags
|
170
|
+
# Retrieves all tags in your team.
|
171
|
+
# @param [Hash] opts the optional parameters
|
172
|
+
# @option opts [Integer] :offset Number of tags to skip (default to 0)
|
173
|
+
# @option opts [Integer] :limit Maximum number of tags to return (default to 10)
|
174
|
+
# @return [Array<(Array<RestRTag>, Integer, Hash)>] Array<RestRTag> data, response status code and response headers
|
175
|
+
def get_all_tags_with_http_info(opts = {})
|
176
|
+
if @api_client.config.debugging
|
177
|
+
@api_client.config.logger.debug 'Calling API: TagApi.get_all_tags ...'
|
178
|
+
end
|
179
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
|
180
|
+
fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling TagApi.get_all_tags, must be greater than or equal to 0.'
|
181
|
+
end
|
182
|
+
|
183
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
|
184
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TagApi.get_all_tags, must be smaller than or equal to 100.'
|
185
|
+
end
|
186
|
+
|
187
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
188
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TagApi.get_all_tags, must be greater than or equal to 1.'
|
189
|
+
end
|
190
|
+
|
191
|
+
# resource path
|
192
|
+
local_var_path = '/tag'
|
193
|
+
|
194
|
+
# query parameters
|
195
|
+
query_params = opts[:query_params] || {}
|
196
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
197
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
198
|
+
|
199
|
+
# header parameters
|
200
|
+
header_params = opts[:header_params] || {}
|
201
|
+
# HTTP header 'Accept' (if needed)
|
202
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
203
|
+
|
204
|
+
# form parameters
|
205
|
+
form_params = opts[:form_params] || {}
|
206
|
+
|
207
|
+
# http body (model)
|
208
|
+
post_body = opts[:debug_body]
|
209
|
+
|
210
|
+
# return_type
|
211
|
+
return_type = opts[:debug_return_type] || 'Array<RestRTag>'
|
212
|
+
|
213
|
+
# auth_names
|
214
|
+
auth_names = opts[:debug_auth_names] || ['TeamApiKey']
|
215
|
+
|
216
|
+
new_options = opts.merge(
|
217
|
+
:operation => :"TagApi.get_all_tags",
|
218
|
+
:header_params => header_params,
|
219
|
+
:query_params => query_params,
|
220
|
+
:form_params => form_params,
|
221
|
+
:body => post_body,
|
222
|
+
:auth_names => auth_names,
|
223
|
+
:return_type => return_type
|
224
|
+
)
|
225
|
+
|
226
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
227
|
+
if @api_client.config.debugging
|
228
|
+
@api_client.config.logger.debug "API called: TagApi#get_all_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
229
|
+
end
|
230
|
+
return data, status_code, headers
|
231
|
+
end
|
232
|
+
|
233
|
+
# Get tag by ID
|
234
|
+
# Retrieves detailed information about a specific tag.
|
235
|
+
# @param identifier [String] Tag identifier to retrieve
|
236
|
+
# @param [Hash] opts the optional parameters
|
237
|
+
# @return [RestRTag]
|
238
|
+
def get_tag(identifier, opts = {})
|
239
|
+
data, _status_code, _headers = get_tag_with_http_info(identifier, opts)
|
240
|
+
data
|
241
|
+
end
|
242
|
+
|
243
|
+
# Get tag by ID
|
244
|
+
# Retrieves detailed information about a specific tag.
|
245
|
+
# @param identifier [String] Tag identifier to retrieve
|
246
|
+
# @param [Hash] opts the optional parameters
|
247
|
+
# @return [Array<(RestRTag, Integer, Hash)>] RestRTag data, response status code and response headers
|
248
|
+
def get_tag_with_http_info(identifier, opts = {})
|
249
|
+
if @api_client.config.debugging
|
250
|
+
@api_client.config.logger.debug 'Calling API: TagApi.get_tag ...'
|
251
|
+
end
|
252
|
+
# verify the required parameter 'identifier' is set
|
253
|
+
if @api_client.config.client_side_validation && identifier.nil?
|
254
|
+
fail ArgumentError, "Missing the required parameter 'identifier' when calling TagApi.get_tag"
|
255
|
+
end
|
256
|
+
pattern = Regexp.new(/^(tag_)?[a-zA-Z0-9]{22}$/)
|
257
|
+
if @api_client.config.client_side_validation && identifier !~ pattern
|
258
|
+
fail ArgumentError, "invalid value for 'identifier' when calling TagApi.get_tag, must conform to the pattern #{pattern}."
|
259
|
+
end
|
260
|
+
|
261
|
+
# resource path
|
262
|
+
local_var_path = '/tag/{identifier}'.sub('{' + 'identifier' + '}', CGI.escape(identifier.to_s))
|
263
|
+
|
264
|
+
# query parameters
|
265
|
+
query_params = opts[:query_params] || {}
|
266
|
+
|
267
|
+
# header parameters
|
268
|
+
header_params = opts[:header_params] || {}
|
269
|
+
# HTTP header 'Accept' (if needed)
|
270
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
271
|
+
|
272
|
+
# form parameters
|
273
|
+
form_params = opts[:form_params] || {}
|
274
|
+
|
275
|
+
# http body (model)
|
276
|
+
post_body = opts[:debug_body]
|
277
|
+
|
278
|
+
# return_type
|
279
|
+
return_type = opts[:debug_return_type] || 'RestRTag'
|
280
|
+
|
281
|
+
# auth_names
|
282
|
+
auth_names = opts[:debug_auth_names] || ['TeamApiKey']
|
283
|
+
|
284
|
+
new_options = opts.merge(
|
285
|
+
:operation => :"TagApi.get_tag",
|
286
|
+
:header_params => header_params,
|
287
|
+
:query_params => query_params,
|
288
|
+
:form_params => form_params,
|
289
|
+
:body => post_body,
|
290
|
+
:auth_names => auth_names,
|
291
|
+
:return_type => return_type
|
292
|
+
)
|
293
|
+
|
294
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
295
|
+
if @api_client.config.debugging
|
296
|
+
@api_client.config.logger.debug "API called: TagApi#get_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
297
|
+
end
|
298
|
+
return data, status_code, headers
|
299
|
+
end
|
300
|
+
|
301
|
+
# Update tag
|
302
|
+
# Updates an existing tag's name.
|
303
|
+
# @param rest_e_tag [RestETag]
|
304
|
+
# @param identifier [String] Tag identifier to update
|
305
|
+
# @param [Hash] opts the optional parameters
|
306
|
+
# @return [RestRTag]
|
307
|
+
def update_tag(rest_e_tag, identifier, opts = {})
|
308
|
+
data, _status_code, _headers = update_tag_with_http_info(rest_e_tag, identifier, opts)
|
309
|
+
data
|
310
|
+
end
|
311
|
+
|
312
|
+
# Update tag
|
313
|
+
# Updates an existing tag's name.
|
314
|
+
# @param rest_e_tag [RestETag]
|
315
|
+
# @param identifier [String] Tag identifier to update
|
316
|
+
# @param [Hash] opts the optional parameters
|
317
|
+
# @return [Array<(RestRTag, Integer, Hash)>] RestRTag data, response status code and response headers
|
318
|
+
def update_tag_with_http_info(rest_e_tag, identifier, opts = {})
|
319
|
+
if @api_client.config.debugging
|
320
|
+
@api_client.config.logger.debug 'Calling API: TagApi.update_tag ...'
|
321
|
+
end
|
322
|
+
# verify the required parameter 'rest_e_tag' is set
|
323
|
+
if @api_client.config.client_side_validation && rest_e_tag.nil?
|
324
|
+
fail ArgumentError, "Missing the required parameter 'rest_e_tag' when calling TagApi.update_tag"
|
325
|
+
end
|
326
|
+
# verify the required parameter 'identifier' is set
|
327
|
+
if @api_client.config.client_side_validation && identifier.nil?
|
328
|
+
fail ArgumentError, "Missing the required parameter 'identifier' when calling TagApi.update_tag"
|
329
|
+
end
|
330
|
+
pattern = Regexp.new(/^(tag_)?[a-zA-Z0-9]{22}$/)
|
331
|
+
if @api_client.config.client_side_validation && identifier !~ pattern
|
332
|
+
fail ArgumentError, "invalid value for 'identifier' when calling TagApi.update_tag, must conform to the pattern #{pattern}."
|
333
|
+
end
|
334
|
+
|
335
|
+
# resource path
|
336
|
+
local_var_path = '/tag/{identifier}'.sub('{' + 'identifier' + '}', CGI.escape(identifier.to_s))
|
337
|
+
|
338
|
+
# query parameters
|
339
|
+
query_params = opts[:query_params] || {}
|
340
|
+
|
341
|
+
# header parameters
|
342
|
+
header_params = opts[:header_params] || {}
|
343
|
+
# HTTP header 'Accept' (if needed)
|
344
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
345
|
+
# HTTP header 'Content-Type'
|
346
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
347
|
+
if !content_type.nil?
|
348
|
+
header_params['Content-Type'] = content_type
|
349
|
+
end
|
350
|
+
|
351
|
+
# form parameters
|
352
|
+
form_params = opts[:form_params] || {}
|
353
|
+
|
354
|
+
# http body (model)
|
355
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(rest_e_tag)
|
356
|
+
|
357
|
+
# return_type
|
358
|
+
return_type = opts[:debug_return_type] || 'RestRTag'
|
359
|
+
|
360
|
+
# auth_names
|
361
|
+
auth_names = opts[:debug_auth_names] || ['TeamApiKey']
|
362
|
+
|
363
|
+
new_options = opts.merge(
|
364
|
+
:operation => :"TagApi.update_tag",
|
365
|
+
:header_params => header_params,
|
366
|
+
:query_params => query_params,
|
367
|
+
:form_params => form_params,
|
368
|
+
:body => post_body,
|
369
|
+
:auth_names => auth_names,
|
370
|
+
:return_type => return_type
|
371
|
+
)
|
372
|
+
|
373
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
374
|
+
if @api_client.config.debugging
|
375
|
+
@api_client.config.logger.debug "API called: TagApi#update_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
376
|
+
end
|
377
|
+
return data, status_code, headers
|
378
|
+
end
|
379
|
+
end
|
380
|
+
end
|