sendx-ruby-sdk 1.0.1

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.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +156 -0
  3. data/lib/sendx-ruby-sdk/api/campaign_api.rb +356 -0
  4. data/lib/sendx-ruby-sdk/api/contact_api.rb +426 -0
  5. data/lib/sendx-ruby-sdk/api/list_api.rb +356 -0
  6. data/lib/sendx-ruby-sdk/api/reports_api.rb +88 -0
  7. data/lib/sendx-ruby-sdk/api/sender_api.rb +156 -0
  8. data/lib/sendx-ruby-sdk/api/tags_api.rb +356 -0
  9. data/lib/sendx-ruby-sdk/api_client.rb +394 -0
  10. data/lib/sendx-ruby-sdk/api_error.rb +58 -0
  11. data/lib/sendx-ruby-sdk/configuration.rb +316 -0
  12. data/lib/sendx-ruby-sdk/models/campaign.rb +483 -0
  13. data/lib/sendx-ruby-sdk/models/campaign_dashboard_data.rb +255 -0
  14. data/lib/sendx-ruby-sdk/models/campaign_request.rb +441 -0
  15. data/lib/sendx-ruby-sdk/models/contact.rb +425 -0
  16. data/lib/sendx-ruby-sdk/models/contact_request.rb +292 -0
  17. data/lib/sendx-ruby-sdk/models/create_response.rb +232 -0
  18. data/lib/sendx-ruby-sdk/models/dashboard_stats.rb +234 -0
  19. data/lib/sendx-ruby-sdk/models/delete_campaign200_response.rb +225 -0
  20. data/lib/sendx-ruby-sdk/models/delete_request.rb +215 -0
  21. data/lib/sendx-ruby-sdk/models/delete_response.rb +223 -0
  22. data/lib/sendx-ruby-sdk/models/last_sent_campaign_stat.rb +284 -0
  23. data/lib/sendx-ruby-sdk/models/list_model.rb +410 -0
  24. data/lib/sendx-ruby-sdk/models/list_request.rb +379 -0
  25. data/lib/sendx-ruby-sdk/models/report_data.rb +358 -0
  26. data/lib/sendx-ruby-sdk/models/response.rb +235 -0
  27. data/lib/sendx-ruby-sdk/models/sender.rb +256 -0
  28. data/lib/sendx-ruby-sdk/models/sender_request.rb +239 -0
  29. data/lib/sendx-ruby-sdk/models/sender_response.rb +273 -0
  30. data/lib/sendx-ruby-sdk/models/tag.rb +241 -0
  31. data/lib/sendx-ruby-sdk/models/tag_request.rb +214 -0
  32. data/lib/sendx-ruby-sdk/version.rb +15 -0
  33. data/lib/sendx-ruby-sdk.rb +65 -0
  34. data/spec/api/campaign_api_spec.rb +98 -0
  35. data/spec/api/contact_api_spec.rb +111 -0
  36. data/spec/api/list_api_spec.rb +98 -0
  37. data/spec/api/reports_api_spec.rb +48 -0
  38. data/spec/api/sender_api_spec.rb +61 -0
  39. data/spec/api/tags_api_spec.rb +98 -0
  40. data/spec/models/campaign_dashboard_data_spec.rb +60 -0
  41. data/spec/models/campaign_request_spec.rb +148 -0
  42. data/spec/models/campaign_spec.rb +170 -0
  43. data/spec/models/contact_request_spec.rb +78 -0
  44. data/spec/models/contact_spec.rb +142 -0
  45. data/spec/models/create_response_spec.rb +48 -0
  46. data/spec/models/dashboard_stats_spec.rb +48 -0
  47. data/spec/models/delete_campaign200_response_spec.rb +42 -0
  48. data/spec/models/delete_request_spec.rb +36 -0
  49. data/spec/models/delete_response_spec.rb +42 -0
  50. data/spec/models/last_sent_campaign_stat_spec.rb +78 -0
  51. data/spec/models/list_model_spec.rb +136 -0
  52. data/spec/models/list_request_spec.rb +118 -0
  53. data/spec/models/report_data_spec.rb +120 -0
  54. data/spec/models/response_spec.rb +48 -0
  55. data/spec/models/sender_request_spec.rb +42 -0
  56. data/spec/models/sender_response_spec.rb +54 -0
  57. data/spec/models/sender_spec.rb +48 -0
  58. data/spec/models/tag_request_spec.rb +36 -0
  59. data/spec/models/tag_spec.rb +54 -0
  60. data/spec/spec_helper.rb +111 -0
  61. metadata +171 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4066535e320b8ed263c20f167a540080a3cfbaacf8a152197d5c297c46e901b2
4
+ data.tar.gz: 4b0744839d25cb6fa06b94fd8bbf7fdc8bfd944187d02b6adfad54c393e07493
5
+ SHA512:
6
+ metadata.gz: 90c5dc5dbcb638d030ec9da67b25154128c91e59d8506a528a0ff0704489b77a5381483b77419bb86c4a42925c9a468810d261f4c6a838ebeed05acfc6afe97a
7
+ data.tar.gz: 196718d49b9884f6e0cc8fe3b577c3379b04487f01a75b88f3b56b39a8ebc9c22705b9f26835f33b547c445d410483c7f06cfadbb4b727e4d353b8931277580e
data/README.md ADDED
@@ -0,0 +1,156 @@
1
+ # sendx-ruby-sdk
2
+
3
+ SendX - the Ruby gem for the SendX REST API
4
+
5
+ # Introduction
6
+
7
+ SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations.
8
+
9
+ The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
10
+ The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br>
11
+
12
+
13
+ ## Installation
14
+
15
+ ### Build a gem
16
+
17
+ To build the Ruby code into a gem:
18
+
19
+ ```shell
20
+ gem build sendx-ruby-sdk.gemspec
21
+ ```
22
+
23
+ Then either install the gem locally:
24
+
25
+ ```shell
26
+ gem install ./sendx-ruby-sdk-1.0.0.gem
27
+ ```
28
+
29
+ (for development, run `gem install --dev ./sendx-ruby-sdk-1.0.0.gem` to install the development dependencies)
30
+
31
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
32
+
33
+ Finally add this to the Gemfile:
34
+
35
+ gem 'sendx-ruby-sdk', '~> 1.0.0'
36
+
37
+ ### Install from Git
38
+
39
+ If the Ruby gem is hosted at a git repository: https://github.com/sendx/sendx-ruby-sdk, then add the following in the Gemfile:
40
+
41
+ gem 'sendx-ruby-sdk', :git => 'https://github.com/sendx/sendx-ruby-sdk.git'
42
+
43
+ ### Include the Ruby code directly
44
+
45
+ Include the Ruby code directly using `-I` as follows:
46
+
47
+ ```shell
48
+ ruby -Ilib script.rb
49
+ ```
50
+
51
+ ## Getting Started
52
+
53
+ Please follow the [installation](#installation) procedure and then run the following code:
54
+
55
+ ```ruby
56
+ # Load the gem
57
+ require 'time'
58
+ require 'sendx-ruby-sdk'
59
+ # setup authorization
60
+ SendX.configure do |config|
61
+ # Configure API key authorization: apiKeyAuth
62
+ config.api_key['apiKeyAuth'] = 'YOUR API KEY'
63
+ config.server_index = 2
64
+ end
65
+
66
+ api_instance = SendX::ContactApi.new
67
+ contact_request = SendX::ContactRequest.new(
68
+ email: "john@doe.com",
69
+ first_name: "John",
70
+ last_name: "Doe",
71
+ company: "SendX",
72
+ last_tracked_ip: "34.94.159.140",
73
+ tags: ["MKdhTovsTJDetCyrJmRySL"],
74
+ custom_fields: {
75
+ 'fnwfnke23kn4kn' => "VIP",
76
+ "9i0jinjn0ib0"=> "Subscribers"
77
+ },
78
+ )
79
+
80
+ begin
81
+ # Create a contact
82
+ result = api_instance.create_contact(contact_request)
83
+ p result
84
+ rescue SendX::ApiError => e
85
+ puts "Error when calling ContactApi->create_contact: #{e}"
86
+ end
87
+
88
+ ```
89
+
90
+ ## Documentation for API Endpoints
91
+
92
+ All URIs are relative to *https://api.sendx.io/api/v1/rest*
93
+
94
+ Class | Method | HTTP request | Description
95
+ ------------ | ------------- | ------------- | -------------
96
+ *SendX::CampaignApi* | [**create_campaign**](docs/CampaignApi.md#create_campaign) | **POST** /campaign | Create Campaign
97
+ *SendX::CampaignApi* | [**delete_campaign**](docs/CampaignApi.md#delete_campaign) | **DELETE** /campaign/{campaignId} | Delete Campaign
98
+ *SendX::CampaignApi* | [**edit_campaign**](docs/CampaignApi.md#edit_campaign) | **PUT** /campaign/{campaignId} | Edit Campaign
99
+ *SendX::CampaignApi* | [**get_all_campaigns**](docs/CampaignApi.md#get_all_campaigns) | **GET** /campaign | Get All Campaigns
100
+ *SendX::CampaignApi* | [**get_campaign_by_id**](docs/CampaignApi.md#get_campaign_by_id) | **GET** /campaign/{campaignId} | Get Campaign By Id
101
+ *SendX::ContactApi* | [**create_contact**](docs/ContactApi.md#create_contact) | **POST** /contact | Create a contact
102
+ *SendX::ContactApi* | [**delete_contact**](docs/ContactApi.md#delete_contact) | **DELETE** /contact/{contactId} | Delete Contact
103
+ *SendX::ContactApi* | [**get_all_contacts**](docs/ContactApi.md#get_all_contacts) | **GET** /contact | Get All Contacts
104
+ *SendX::ContactApi* | [**get_contact_by_id**](docs/ContactApi.md#get_contact_by_id) | **GET** /contact/{contactId} | Get Contact by ID
105
+ *SendX::ContactApi* | [**unsubscribe_contact**](docs/ContactApi.md#unsubscribe_contact) | **POST** /contact/unsubscribe/{contactId} | Unsubscribe Contact
106
+ *SendX::ContactApi* | [**update_contact**](docs/ContactApi.md#update_contact) | **PUT** /contact/{contactId} | Update Contact
107
+ *SendX::ListApi* | [**create_list**](docs/ListApi.md#create_list) | **POST** /list | Create List
108
+ *SendX::ListApi* | [**delete_list**](docs/ListApi.md#delete_list) | **DELETE** /list/{listId} | Delete List
109
+ *SendX::ListApi* | [**get_all_lists**](docs/ListApi.md#get_all_lists) | **GET** /list | Get All Lists
110
+ *SendX::ListApi* | [**get_list_by_id**](docs/ListApi.md#get_list_by_id) | **GET** /list/{listId} | Get List
111
+ *SendX::ListApi* | [**update_list**](docs/ListApi.md#update_list) | **PUT** /list/{listId} | Update List
112
+ *SendX::ReportsApi* | [**get_campaign_report**](docs/ReportsApi.md#get_campaign_report) | **GET** /report/campaign/{campaignId} | Get CampaignReport Data
113
+ *SendX::SenderApi* | [**create_sender**](docs/SenderApi.md#create_sender) | **POST** /sender | Create Sender
114
+ *SendX::SenderApi* | [**get_all_senders**](docs/SenderApi.md#get_all_senders) | **GET** /sender | Get All Senders
115
+ *SendX::TagsApi* | [**create_tag**](docs/TagsApi.md#create_tag) | **POST** /tag | Create a Tag
116
+ *SendX::TagsApi* | [**delete_tag**](docs/TagsApi.md#delete_tag) | **DELETE** /tag/{tagId} | Delete a Tag
117
+ *SendX::TagsApi* | [**get_all_tags**](docs/TagsApi.md#get_all_tags) | **GET** /tag | Get All Tags
118
+ *SendX::TagsApi* | [**get_tag_by_id**](docs/TagsApi.md#get_tag_by_id) | **GET** /tag/{tagId} | Get a Tag by ID
119
+ *SendX::TagsApi* | [**update_tag**](docs/TagsApi.md#update_tag) | **PUT** /tag/{tagId} | Update a Tag
120
+
121
+
122
+ ## Documentation for Models
123
+
124
+ - [SendX::Campaign](docs/Campaign.md)
125
+ - [SendX::CampaignDashboardData](docs/CampaignDashboardData.md)
126
+ - [SendX::CampaignRequest](docs/CampaignRequest.md)
127
+ - [SendX::Contact](docs/Contact.md)
128
+ - [SendX::ContactRequest](docs/ContactRequest.md)
129
+ - [SendX::CreateResponse](docs/CreateResponse.md)
130
+ - [SendX::DashboardStats](docs/DashboardStats.md)
131
+ - [SendX::DeleteCampaign200Response](docs/DeleteCampaign200Response.md)
132
+ - [SendX::DeleteRequest](docs/DeleteRequest.md)
133
+ - [SendX::DeleteResponse](docs/DeleteResponse.md)
134
+ - [SendX::LastSentCampaignStat](docs/LastSentCampaignStat.md)
135
+ - [SendX::ListModel](docs/ListModel.md)
136
+ - [SendX::ListRequest](docs/ListRequest.md)
137
+ - [SendX::ReportData](docs/ReportData.md)
138
+ - [SendX::Response](docs/Response.md)
139
+ - [SendX::Sender](docs/Sender.md)
140
+ - [SendX::SenderRequest](docs/SenderRequest.md)
141
+ - [SendX::SenderResponse](docs/SenderResponse.md)
142
+ - [SendX::Tag](docs/Tag.md)
143
+ - [SendX::TagRequest](docs/TagRequest.md)
144
+
145
+
146
+ ## Documentation for Authorization
147
+
148
+
149
+ Authentication schemes defined for the API:
150
+ ### apiKeyAuth
151
+
152
+
153
+ - **Type**: API key
154
+ - **API key parameter name**: X-Team-ApiKey
155
+ - **Location**: HTTP header
156
+
@@ -0,0 +1,356 @@
1
+ =begin
2
+ #SendX REST API
3
+
4
+ ## Introduction SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations. The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br>
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: support@sendx.io
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module SendX
16
+ class CampaignApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create Campaign
23
+ # Create a new email campaign
24
+ # @param campaign_request [CampaignRequest] The campaign content
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [CreateResponse]
27
+ def create_campaign(campaign_request, opts = {})
28
+ data, _status_code, _headers = create_campaign_with_http_info(campaign_request, opts)
29
+ data
30
+ end
31
+
32
+ # Create Campaign
33
+ # Create a new email campaign
34
+ # @param campaign_request [CampaignRequest] The campaign content
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(CreateResponse, Integer, Hash)>] CreateResponse data, response status code and response headers
37
+ def create_campaign_with_http_info(campaign_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: CampaignApi.create_campaign ...'
40
+ end
41
+ # verify the required parameter 'campaign_request' is set
42
+ if @api_client.config.client_side_validation && campaign_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'campaign_request' when calling CampaignApi.create_campaign"
44
+ end
45
+ # resource path
46
+ local_var_path = '/campaign'
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(campaign_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'CreateResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"CampaignApi.create_campaign",
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: CampaignApi#create_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Delete Campaign
91
+ # Deletes a specific campaign by its campaignId.
92
+ # @param campaign_id [String] The ID of the campaign to delete
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [DeleteCampaign200Response]
95
+ def delete_campaign(campaign_id, opts = {})
96
+ data, _status_code, _headers = delete_campaign_with_http_info(campaign_id, opts)
97
+ data
98
+ end
99
+
100
+ # Delete Campaign
101
+ # Deletes a specific campaign by its campaignId.
102
+ # @param campaign_id [String] The ID of the campaign to delete
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(DeleteCampaign200Response, Integer, Hash)>] DeleteCampaign200Response data, response status code and response headers
105
+ def delete_campaign_with_http_info(campaign_id, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: CampaignApi.delete_campaign ...'
108
+ end
109
+ # verify the required parameter 'campaign_id' is set
110
+ if @api_client.config.client_side_validation && campaign_id.nil?
111
+ fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignApi.delete_campaign"
112
+ end
113
+ # resource path
114
+ local_var_path = '/campaign/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
123
+
124
+ # form parameters
125
+ form_params = opts[:form_params] || {}
126
+
127
+ # http body (model)
128
+ post_body = opts[:debug_body]
129
+
130
+ # return_type
131
+ return_type = opts[:debug_return_type] || 'DeleteCampaign200Response'
132
+
133
+ # auth_names
134
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
135
+
136
+ new_options = opts.merge(
137
+ :operation => :"CampaignApi.delete_campaign",
138
+ :header_params => header_params,
139
+ :query_params => query_params,
140
+ :form_params => form_params,
141
+ :body => post_body,
142
+ :auth_names => auth_names,
143
+ :return_type => return_type
144
+ )
145
+
146
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
147
+ if @api_client.config.debugging
148
+ @api_client.config.logger.debug "API called: CampaignApi#delete_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
149
+ end
150
+ return data, status_code, headers
151
+ end
152
+
153
+ # Edit Campaign
154
+ # Submit edited content for a specific campaign.
155
+ # @param campaign_request [CampaignRequest]
156
+ # @param campaign_id [String] The ID of the campaign to edit
157
+ # @param [Hash] opts the optional parameters
158
+ # @return [Campaign]
159
+ def edit_campaign(campaign_request, campaign_id, opts = {})
160
+ data, _status_code, _headers = edit_campaign_with_http_info(campaign_request, campaign_id, opts)
161
+ data
162
+ end
163
+
164
+ # Edit Campaign
165
+ # Submit edited content for a specific campaign.
166
+ # @param campaign_request [CampaignRequest]
167
+ # @param campaign_id [String] The ID of the campaign to edit
168
+ # @param [Hash] opts the optional parameters
169
+ # @return [Array<(Campaign, Integer, Hash)>] Campaign data, response status code and response headers
170
+ def edit_campaign_with_http_info(campaign_request, campaign_id, opts = {})
171
+ if @api_client.config.debugging
172
+ @api_client.config.logger.debug 'Calling API: CampaignApi.edit_campaign ...'
173
+ end
174
+ # verify the required parameter 'campaign_request' is set
175
+ if @api_client.config.client_side_validation && campaign_request.nil?
176
+ fail ArgumentError, "Missing the required parameter 'campaign_request' when calling CampaignApi.edit_campaign"
177
+ end
178
+ # verify the required parameter 'campaign_id' is set
179
+ if @api_client.config.client_side_validation && campaign_id.nil?
180
+ fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignApi.edit_campaign"
181
+ end
182
+ # resource path
183
+ local_var_path = '/campaign/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
184
+
185
+ # query parameters
186
+ query_params = opts[:query_params] || {}
187
+
188
+ # header parameters
189
+ header_params = opts[:header_params] || {}
190
+ # HTTP header 'Accept' (if needed)
191
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
192
+ # HTTP header 'Content-Type'
193
+ content_type = @api_client.select_header_content_type(['application/json'])
194
+ if !content_type.nil?
195
+ header_params['Content-Type'] = content_type
196
+ end
197
+
198
+ # form parameters
199
+ form_params = opts[:form_params] || {}
200
+
201
+ # http body (model)
202
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(campaign_request)
203
+
204
+ # return_type
205
+ return_type = opts[:debug_return_type] || 'Campaign'
206
+
207
+ # auth_names
208
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
209
+
210
+ new_options = opts.merge(
211
+ :operation => :"CampaignApi.edit_campaign",
212
+ :header_params => header_params,
213
+ :query_params => query_params,
214
+ :form_params => form_params,
215
+ :body => post_body,
216
+ :auth_names => auth_names,
217
+ :return_type => return_type
218
+ )
219
+
220
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
221
+ if @api_client.config.debugging
222
+ @api_client.config.logger.debug "API called: CampaignApi#edit_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
223
+ end
224
+ return data, status_code, headers
225
+ end
226
+
227
+ # Get All Campaigns
228
+ # Retrieve a list of all campaigns.
229
+ # @param [Hash] opts the optional parameters
230
+ # @option opts [Integer] :offset Offset for pagination (default to 0)
231
+ # @option opts [Integer] :limit Limit for pagination (default to 20)
232
+ # @option opts [String] :search Search term to filter campaigns
233
+ # @return [Array<Campaign>]
234
+ def get_all_campaigns(opts = {})
235
+ data, _status_code, _headers = get_all_campaigns_with_http_info(opts)
236
+ data
237
+ end
238
+
239
+ # Get All Campaigns
240
+ # Retrieve a list of all campaigns.
241
+ # @param [Hash] opts the optional parameters
242
+ # @option opts [Integer] :offset Offset for pagination (default to 0)
243
+ # @option opts [Integer] :limit Limit for pagination (default to 20)
244
+ # @option opts [String] :search Search term to filter campaigns
245
+ # @return [Array<(Array<Campaign>, Integer, Hash)>] Array<Campaign> data, response status code and response headers
246
+ def get_all_campaigns_with_http_info(opts = {})
247
+ if @api_client.config.debugging
248
+ @api_client.config.logger.debug 'Calling API: CampaignApi.get_all_campaigns ...'
249
+ end
250
+ # resource path
251
+ local_var_path = '/campaign'
252
+
253
+ # query parameters
254
+ query_params = opts[:query_params] || {}
255
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
256
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
257
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
258
+
259
+ # header parameters
260
+ header_params = opts[:header_params] || {}
261
+ # HTTP header 'Accept' (if needed)
262
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
263
+
264
+ # form parameters
265
+ form_params = opts[:form_params] || {}
266
+
267
+ # http body (model)
268
+ post_body = opts[:debug_body]
269
+
270
+ # return_type
271
+ return_type = opts[:debug_return_type] || 'Array<Campaign>'
272
+
273
+ # auth_names
274
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
275
+
276
+ new_options = opts.merge(
277
+ :operation => :"CampaignApi.get_all_campaigns",
278
+ :header_params => header_params,
279
+ :query_params => query_params,
280
+ :form_params => form_params,
281
+ :body => post_body,
282
+ :auth_names => auth_names,
283
+ :return_type => return_type
284
+ )
285
+
286
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
287
+ if @api_client.config.debugging
288
+ @api_client.config.logger.debug "API called: CampaignApi#get_all_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
289
+ end
290
+ return data, status_code, headers
291
+ end
292
+
293
+ # Get Campaign By Id
294
+ # Retrieve a specific campaign using its ID.
295
+ # @param campaign_id [String] The ID of the campaign to retrieve.
296
+ # @param [Hash] opts the optional parameters
297
+ # @return [Campaign]
298
+ def get_campaign_by_id(campaign_id, opts = {})
299
+ data, _status_code, _headers = get_campaign_by_id_with_http_info(campaign_id, opts)
300
+ data
301
+ end
302
+
303
+ # Get Campaign By Id
304
+ # Retrieve a specific campaign using its ID.
305
+ # @param campaign_id [String] The ID of the campaign to retrieve.
306
+ # @param [Hash] opts the optional parameters
307
+ # @return [Array<(Campaign, Integer, Hash)>] Campaign data, response status code and response headers
308
+ def get_campaign_by_id_with_http_info(campaign_id, opts = {})
309
+ if @api_client.config.debugging
310
+ @api_client.config.logger.debug 'Calling API: CampaignApi.get_campaign_by_id ...'
311
+ end
312
+ # verify the required parameter 'campaign_id' is set
313
+ if @api_client.config.client_side_validation && campaign_id.nil?
314
+ fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignApi.get_campaign_by_id"
315
+ end
316
+ # resource path
317
+ local_var_path = '/campaign/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
318
+
319
+ # query parameters
320
+ query_params = opts[:query_params] || {}
321
+
322
+ # header parameters
323
+ header_params = opts[:header_params] || {}
324
+ # HTTP header 'Accept' (if needed)
325
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
326
+
327
+ # form parameters
328
+ form_params = opts[:form_params] || {}
329
+
330
+ # http body (model)
331
+ post_body = opts[:debug_body]
332
+
333
+ # return_type
334
+ return_type = opts[:debug_return_type] || 'Campaign'
335
+
336
+ # auth_names
337
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
338
+
339
+ new_options = opts.merge(
340
+ :operation => :"CampaignApi.get_campaign_by_id",
341
+ :header_params => header_params,
342
+ :query_params => query_params,
343
+ :form_params => form_params,
344
+ :body => post_body,
345
+ :auth_names => auth_names,
346
+ :return_type => return_type
347
+ )
348
+
349
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
350
+ if @api_client.config.debugging
351
+ @api_client.config.logger.debug "API called: CampaignApi#get_campaign_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
352
+ end
353
+ return data, status_code, headers
354
+ end
355
+ end
356
+ end