twilio-api-sdk-sdk 1.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.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +155 -0
  4. data/bin/console +15 -0
  5. data/lib/twilio_accounts/api_helper.rb +10 -0
  6. data/lib/twilio_accounts/apis/accounts_v1_auth_token_promotion_api.rb +27 -0
  7. data/lib/twilio_accounts/apis/accounts_v1_aws_api.rb +137 -0
  8. data/lib/twilio_accounts/apis/accounts_v1_bulk_consents_api.rb +41 -0
  9. data/lib/twilio_accounts/apis/accounts_v1_bulk_contacts_api.rb +36 -0
  10. data/lib/twilio_accounts/apis/accounts_v1_messaging_geopermissions_api.rb +54 -0
  11. data/lib/twilio_accounts/apis/accounts_v1_public_key_api.rb +136 -0
  12. data/lib/twilio_accounts/apis/accounts_v1_safelist_api.rb +69 -0
  13. data/lib/twilio_accounts/apis/accounts_v1_secondary_auth_token_api.rb +39 -0
  14. data/lib/twilio_accounts/apis/base_api.rb +67 -0
  15. data/lib/twilio_accounts/client.rb +117 -0
  16. data/lib/twilio_accounts/configuration.rb +165 -0
  17. data/lib/twilio_accounts/exceptions/api_exception.rb +21 -0
  18. data/lib/twilio_accounts/http/api_response.rb +19 -0
  19. data/lib/twilio_accounts/http/auth/basic_auth.rb +62 -0
  20. data/lib/twilio_accounts/http/http_call_back.rb +10 -0
  21. data/lib/twilio_accounts/http/http_method_enum.rb +10 -0
  22. data/lib/twilio_accounts/http/http_request.rb +10 -0
  23. data/lib/twilio_accounts/http/http_response.rb +10 -0
  24. data/lib/twilio_accounts/http/proxy_settings.rb +22 -0
  25. data/lib/twilio_accounts/logging/configuration/api_logging_configuration.rb +186 -0
  26. data/lib/twilio_accounts/logging/sdk_logger.rb +17 -0
  27. data/lib/twilio_accounts/models/accounts_v1_auth_token_promotion.rb +142 -0
  28. data/lib/twilio_accounts/models/accounts_v1_bulk_consents.rb +83 -0
  29. data/lib/twilio_accounts/models/accounts_v1_bulk_contacts.rb +83 -0
  30. data/lib/twilio_accounts/models/accounts_v1_credential_credential_aws.rb +153 -0
  31. data/lib/twilio_accounts/models/accounts_v1_credential_credential_public_key.rb +153 -0
  32. data/lib/twilio_accounts/models/accounts_v1_messaging_geopermissions.rb +86 -0
  33. data/lib/twilio_accounts/models/accounts_v1_safelist.rb +88 -0
  34. data/lib/twilio_accounts/models/accounts_v1_secondary_auth_token.rb +145 -0
  35. data/lib/twilio_accounts/models/base_model.rb +110 -0
  36. data/lib/twilio_accounts/models/list_credential_aws_response.rb +94 -0
  37. data/lib/twilio_accounts/models/list_credential_public_key_response.rb +94 -0
  38. data/lib/twilio_accounts/models/meta.rb +140 -0
  39. data/lib/twilio_accounts/utilities/date_time_helper.rb +11 -0
  40. data/lib/twilio_accounts/utilities/file_wrapper.rb +28 -0
  41. data/lib/twilio_accounts.rb +64 -0
  42. metadata +125 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d5732462773ff3fa9a7b8699b3e91ce5b08f2f5c3ee4984a8818a8fffe535b76
4
+ data.tar.gz: 5cad36ddfd0ab5fd2ab9868dc4978c581bad3c9e1528daf7020260c5c9f878a3
5
+ SHA512:
6
+ metadata.gz: 7c90005412969516450383afc2b3e516e340c41513a67e68f996b05ce183af146a2be4f532a4ddb6c856b4edd85be133304871fd229923317f9ad81bbb735a34
7
+ data.tar.gz: 6c713524cdb2ca3ddd55a3291e2c56007a5e977dc8ef5e517cc9e69c4b14d8244ab7bb606d683df5778adea3dc37d5cc300f378ba0df5477e0c792dd6e32ed11
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2026 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,155 @@
1
+
2
+ # Getting Started with Twilio - Accounts
3
+
4
+ ## Introduction
5
+
6
+ This is the public Twilio REST API.
7
+
8
+ ## Install the Package
9
+
10
+ Install the gem from the command line:
11
+
12
+ ```bash
13
+ gem install twilio-api-sdk-sdk -v 1.0.0
14
+ ```
15
+
16
+ Or add the gem to your Gemfile and run `bundle`:
17
+
18
+ ```ruby
19
+ gem 'twilio-api-sdk-sdk', '1.0.0'
20
+ ```
21
+
22
+ For additional gem details, see the [RubyGems page for the twilio-api-sdk-sdk gem](https://rubygems.org/gems/twilio-api-sdk-sdk/versions/1.0.0).
23
+
24
+ ## IRB Console Usage
25
+
26
+ You can explore the SDK interactively using IRB in two ways
27
+
28
+ ### 1. Use IRB with Installed Gem
29
+
30
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
31
+
32
+ ```bash
33
+ irb
34
+ ```
35
+
36
+ Now you can load the SDK in the IRB
37
+
38
+ ```ruby
39
+ require 'twilio_accounts'
40
+ include TwilioAccounts
41
+ ```
42
+
43
+ ### 2. Use IRB within SDK
44
+
45
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
46
+
47
+ ```
48
+ cd path/to/twilio_accounts
49
+ ```
50
+
51
+ Now you can start the preconfigured irb console by running the following command
52
+
53
+ ```bash
54
+ ruby bin/console
55
+ ```
56
+
57
+ **_Note:_** This automatically loads the SDK from lib/
58
+
59
+ ## Initialize the API Client
60
+
61
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/client.md)
62
+
63
+ The following parameters are configurable for the API Client:
64
+
65
+ | Parameter | Type | Description |
66
+ | --- | --- | --- |
67
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
68
+ | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
69
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
70
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
71
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
72
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
73
+ | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
74
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
75
+ | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
76
+ | proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
77
+ | logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/logging-configuration.md) | The SDK logging configuration for API calls |
78
+ | basic_auth_credentials | [`BasicAuthCredentials`](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/auth/basic-authentication.md) | The credential object for Basic Authentication |
79
+
80
+ The API client can be initialized as follows:
81
+
82
+ ### Code-Based Client Initialization
83
+
84
+ ```ruby
85
+ require 'twilio_accounts'
86
+ include TwilioAccounts
87
+
88
+ client = Client.new(
89
+ basic_auth_credentials: BasicAuthCredentials.new(
90
+ username: 'BasicAuthUserName',
91
+ password: 'BasicAuthPassword'
92
+ ),
93
+ logging_configuration: LoggingConfiguration.new(
94
+ log_level: Logger::INFO,
95
+ request_logging_config: RequestLoggingConfiguration.new(
96
+ log_body: true
97
+ ),
98
+ response_logging_config: ResponseLoggingConfiguration.new(
99
+ log_headers: true
100
+ )
101
+ )
102
+ )
103
+ ```
104
+
105
+ ### Environment-Based Client Initialization
106
+
107
+ ```ruby
108
+ require 'twilio_accounts'
109
+ include TwilioAccounts
110
+
111
+ # Create client from environment
112
+ client = Client.from_env
113
+ ```
114
+
115
+ See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/environment-based-client-initialization.md) section for details.
116
+
117
+ ## Authorization
118
+
119
+ This API uses the following authentication schemes.
120
+
121
+ * [`accountSid_authToken (Basic Authentication)`](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/auth/basic-authentication.md)
122
+
123
+ ## List of APIs
124
+
125
+ * [Accounts V1 Auth Token Promotion](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/controllers/accounts-v1-auth-token-promotion.md)
126
+ * [Accounts V1 Aws](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/controllers/accounts-v1-aws.md)
127
+ * [Accounts V1 Bulk Consents](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/controllers/accounts-v1-bulk-consents.md)
128
+ * [Accounts V1 Bulk Contacts](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/controllers/accounts-v1-bulk-contacts.md)
129
+ * [Accounts V1 Messaging Geopermissions](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/controllers/accounts-v1-messaging-geopermissions.md)
130
+ * [Accounts V1 Public Key](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/controllers/accounts-v1-public-key.md)
131
+ * [Accounts V1 Safelist](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/controllers/accounts-v1-safelist.md)
132
+ * [Accounts V1 Secondary Auth Token](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/controllers/accounts-v1-secondary-auth-token.md)
133
+
134
+ ## SDK Infrastructure
135
+
136
+ ### Configuration
137
+
138
+ * [ProxySettings](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/proxy-settings.md)
139
+ * [Environment-Based Client Initialization](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/environment-based-client-initialization.md)
140
+ * [AbstractLogger](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/abstract-logger.md)
141
+ * [LoggingConfiguration](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/logging-configuration.md)
142
+ * [RequestLoggingConfiguration](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/request-logging-configuration.md)
143
+ * [ResponseLoggingConfiguration](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/response-logging-configuration.md)
144
+
145
+ ### HTTP
146
+
147
+ * [HttpResponse](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/http-response.md)
148
+ * [HttpRequest](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/http-request.md)
149
+
150
+ ### Utilities
151
+
152
+ * [ApiResponse](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/api-response.md)
153
+ * [ApiHelper](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/api-helper.md)
154
+ * [DateTimeHelper](https://www.github.com/sdks-io/twilio-api-sdk-ruby-sdk/tree/1.0.0/doc/date-time-helper.md)
155
+
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Load the lib folder into Ruby's load path
4
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
+
6
+ # Require the gem
7
+ require 'twilio_accounts'
8
+
9
+ puts 'TwilioAccounts SDK loaded!'
10
+ puts 'You can now create a client with: client = TwilioAccounts::Client.new'
11
+ puts 'Or use from_env: client = TwilioAccounts::Client.from_env'
12
+
13
+ # Start an interactive IRB session
14
+ require 'irb'
15
+ IRB.start
@@ -0,0 +1,10 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module TwilioAccounts
7
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,27 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module TwilioAccounts
7
+ # AccountsV1AuthTokenPromotionApi
8
+ class AccountsV1AuthTokenPromotionApi < BaseApi
9
+ # Promote the secondary Auth Token to primary. After promoting the new
10
+ # token, all requests to Twilio using your old primary Auth Token will
11
+ # result in an error.
12
+ # @return [ApiResponse] Complete http response with raw body and status code.
13
+ def update_auth_token_promotion
14
+ @api_call
15
+ .request(new_request_builder(HttpMethodEnum::POST,
16
+ '/v1/AuthTokens/Promote',
17
+ Server::DEFAULT)
18
+ .header_param(new_parameter('application/json', key: 'accept'))
19
+ .auth(Single.new('accountSid_authToken')))
20
+ .response(new_response_handler
21
+ .deserializer(APIHelper.method(:custom_type_deserializer))
22
+ .deserialize_into(AccountsV1AuthTokenPromotion.method(:from_hash))
23
+ .is_api_response(true))
24
+ .execute
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,137 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module TwilioAccounts
7
+ # AccountsV1AwsApi
8
+ class AccountsV1AwsApi < BaseApi
9
+ # Retrieves a collection of AWS Credentials belonging to the account used to
10
+ # make the request
11
+ # @param [Integer] page_size Optional parameter: How many resources to
12
+ # return in each list page. The default is 50, and the maximum is 1000.
13
+ # @param [Integer] page Optional parameter: The page index. This value is
14
+ # simply for client state.
15
+ # @param [String] page_token Optional parameter: The page token. This is
16
+ # provided by the API.
17
+ # @return [ApiResponse] Complete http response with raw body and status code.
18
+ def list_credential_aws(page_size: nil,
19
+ page: nil,
20
+ page_token: nil)
21
+ @api_call
22
+ .request(new_request_builder(HttpMethodEnum::GET,
23
+ '/v1/Credentials/AWS',
24
+ Server::DEFAULT)
25
+ .query_param(new_parameter(page_size, key: 'PageSize'))
26
+ .query_param(new_parameter(page, key: 'Page'))
27
+ .query_param(new_parameter(page_token, key: 'PageToken'))
28
+ .header_param(new_parameter('application/json', key: 'accept'))
29
+ .auth(Single.new('accountSid_authToken')))
30
+ .response(new_response_handler
31
+ .deserializer(APIHelper.method(:custom_type_deserializer))
32
+ .deserialize_into(ListCredentialAwsResponse.method(:from_hash))
33
+ .is_api_response(true))
34
+ .execute
35
+ end
36
+
37
+ # Create a new AWS Credential
38
+ # @param [String] credentials Required parameter: A string that contains the
39
+ # AWS access credentials in the format
40
+ # `<AWS_ACCESS_KEY_ID>:<AWS_SECRET_ACCESS_KEY>`. For example,
41
+ # `AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY`
42
+ # @param [String] friendly_name Optional parameter: A descriptive string
43
+ # that you create to describe the resource. It can be up to 64 characters
44
+ # long.
45
+ # @param [String] account_sid Optional parameter: The SID of the Subaccount
46
+ # that this Credential should be associated with. Must be a valid Subaccount
47
+ # of the account issuing the request.
48
+ # @return [ApiResponse] Complete http response with raw body and status code.
49
+ def create_credential_aws(credentials,
50
+ friendly_name: nil,
51
+ account_sid: nil)
52
+ @api_call
53
+ .request(new_request_builder(HttpMethodEnum::POST,
54
+ '/v1/Credentials/AWS',
55
+ Server::DEFAULT)
56
+ .form_param(new_parameter(credentials, key: 'Credentials')
57
+ .is_required(true))
58
+ .form_param(new_parameter(friendly_name, key: 'FriendlyName'))
59
+ .form_param(new_parameter(account_sid, key: 'AccountSid'))
60
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
61
+ .header_param(new_parameter('application/json', key: 'accept'))
62
+ .auth(Single.new('accountSid_authToken')))
63
+ .response(new_response_handler
64
+ .deserializer(APIHelper.method(:custom_type_deserializer))
65
+ .deserialize_into(AccountsV1CredentialCredentialAws.method(:from_hash))
66
+ .is_api_response(true))
67
+ .execute
68
+ end
69
+
70
+ # Fetch the AWS credentials specified by the provided Credential Sid
71
+ # @param [String] sid Required parameter: The Twilio-provided string that
72
+ # uniquely identifies the AWS resource to fetch.
73
+ # @return [ApiResponse] Complete http response with raw body and status code.
74
+ def fetch_credential_aws(sid)
75
+ @api_call
76
+ .request(new_request_builder(HttpMethodEnum::GET,
77
+ '/v1/Credentials/AWS/{Sid}',
78
+ Server::DEFAULT)
79
+ .template_param(new_parameter(sid, key: 'Sid')
80
+ .is_required(true)
81
+ .should_encode(true))
82
+ .header_param(new_parameter('application/json', key: 'accept'))
83
+ .auth(Single.new('accountSid_authToken')))
84
+ .response(new_response_handler
85
+ .deserializer(APIHelper.method(:custom_type_deserializer))
86
+ .deserialize_into(AccountsV1CredentialCredentialAws.method(:from_hash))
87
+ .is_api_response(true))
88
+ .execute
89
+ end
90
+
91
+ # Modify the properties of a given Account
92
+ # @param [String] sid Required parameter: The Twilio-provided string that
93
+ # uniquely identifies the AWS resource to update.
94
+ # @param [String] friendly_name Optional parameter: A descriptive string
95
+ # that you create to describe the resource. It can be up to 64 characters
96
+ # long.
97
+ # @return [ApiResponse] Complete http response with raw body and status code.
98
+ def update_credential_aws(sid,
99
+ friendly_name: nil)
100
+ @api_call
101
+ .request(new_request_builder(HttpMethodEnum::POST,
102
+ '/v1/Credentials/AWS/{Sid}',
103
+ Server::DEFAULT)
104
+ .template_param(new_parameter(sid, key: 'Sid')
105
+ .is_required(true)
106
+ .should_encode(true))
107
+ .form_param(new_parameter(friendly_name, key: 'FriendlyName'))
108
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
109
+ .header_param(new_parameter('application/json', key: 'accept'))
110
+ .auth(Single.new('accountSid_authToken')))
111
+ .response(new_response_handler
112
+ .deserializer(APIHelper.method(:custom_type_deserializer))
113
+ .deserialize_into(AccountsV1CredentialCredentialAws.method(:from_hash))
114
+ .is_api_response(true))
115
+ .execute
116
+ end
117
+
118
+ # Delete a Credential from your account
119
+ # @param [String] sid Required parameter: The Twilio-provided string that
120
+ # uniquely identifies the AWS resource to delete.
121
+ # @return [ApiResponse] Complete http response with raw body and status code.
122
+ def delete_credential_aws(sid)
123
+ @api_call
124
+ .request(new_request_builder(HttpMethodEnum::DELETE,
125
+ '/v1/Credentials/AWS/{Sid}',
126
+ Server::DEFAULT)
127
+ .template_param(new_parameter(sid, key: 'Sid')
128
+ .is_required(true)
129
+ .should_encode(true))
130
+ .auth(Single.new('accountSid_authToken')))
131
+ .response(new_response_handler
132
+ .is_response_void(true)
133
+ .is_api_response(true))
134
+ .execute
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,41 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module TwilioAccounts
7
+ # AccountsV1BulkConsentsApi
8
+ class AccountsV1BulkConsentsApi < BaseApi
9
+ # TODO: type endpoint description here
10
+ # @param [Array[Object]] items Required parameter: This is a list of objects
11
+ # that describes a contact's opt-in status. Each object contains the
12
+ # following fields: `contact_id`, which must be a string representing phone
13
+ # number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164);
14
+ # `correlation_id`, a unique 32-character UUID used to uniquely map the
15
+ # request item with the response item; `sender_id`, which can be either a
16
+ # valid messaging service SID or a from phone number; `status`, a string
17
+ # representing the consent status. Can be one of [`opt-in`, `opt-out`];
18
+ # `source`, a string indicating the medium through which the consent was
19
+ # collected. Can be one of [`website`, `offline`, `opt-in-message`,
20
+ # `opt-out-message`, `others`]; `date_of_consent`, an optional datetime
21
+ # string field in ISO-8601 format that captures the exact date and time when
22
+ # the user gave or revoked consent. If not provided, it will be empty.
23
+ # @return [ApiResponse] Complete http response with raw body and status code.
24
+ def create_bulk_consents(items)
25
+ @api_call
26
+ .request(new_request_builder(HttpMethodEnum::POST,
27
+ '/v1/Consents/Bulk',
28
+ Server::DEFAULT)
29
+ .form_param(new_parameter(items, key: 'Items')
30
+ .is_required(true))
31
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
32
+ .header_param(new_parameter('application/json', key: 'accept'))
33
+ .auth(Single.new('accountSid_authToken')))
34
+ .response(new_response_handler
35
+ .deserializer(APIHelper.method(:custom_type_deserializer))
36
+ .deserialize_into(AccountsV1BulkConsents.method(:from_hash))
37
+ .is_api_response(true))
38
+ .execute
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,36 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module TwilioAccounts
7
+ # AccountsV1BulkContactsApi
8
+ class AccountsV1BulkContactsApi < BaseApi
9
+ # TODO: type endpoint description here
10
+ # @param [Array[Object]] items Required parameter: A list of objects where
11
+ # each object represents a contact's details. Each object includes the
12
+ # following fields: `contact_id`, which must be a string representing phone
13
+ # number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164);
14
+ # `correlation_id`, a unique 32-character UUID that maps the response to the
15
+ # original request; `country_iso_code`, a string representing the country
16
+ # using the ISO format (e.g., US for the United States); and `zip_code`, a
17
+ # string representing the postal code.
18
+ # @return [ApiResponse] Complete http response with raw body and status code.
19
+ def create_bulk_contacts(items)
20
+ @api_call
21
+ .request(new_request_builder(HttpMethodEnum::POST,
22
+ '/v1/Contacts/Bulk',
23
+ Server::DEFAULT)
24
+ .form_param(new_parameter(items, key: 'Items')
25
+ .is_required(true))
26
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
27
+ .header_param(new_parameter('application/json', key: 'accept'))
28
+ .auth(Single.new('accountSid_authToken')))
29
+ .response(new_response_handler
30
+ .deserializer(APIHelper.method(:custom_type_deserializer))
31
+ .deserialize_into(AccountsV1BulkContacts.method(:from_hash))
32
+ .is_api_response(true))
33
+ .execute
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,54 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module TwilioAccounts
7
+ # AccountsV1MessagingGeopermissionsApi
8
+ class AccountsV1MessagingGeopermissionsApi < BaseApi
9
+ # Manage Geo Permissions for each country.
10
+ # @param [Array[Object]] permissions Required parameter: A list of objects
11
+ # where each object represents the Geo Permission to be updated. Each object
12
+ # contains the following fields: `country_code`, unique code for each
13
+ # country of Geo Permission; `type`, permission type of the Geo Permission
14
+ # i.e. country; `enabled`, configure true for enabling the Geo Permission,
15
+ # false for disabling the Geo Permission.
16
+ # @return [ApiResponse] Complete http response with raw body and status code.
17
+ def update_messaging_geopermissions(permissions)
18
+ @api_call
19
+ .request(new_request_builder(HttpMethodEnum::PATCH,
20
+ '/v1/Messaging/GeoPermissions',
21
+ Server::DEFAULT)
22
+ .form_param(new_parameter(permissions, key: 'Permissions')
23
+ .is_required(true))
24
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
25
+ .header_param(new_parameter('application/json', key: 'accept'))
26
+ .auth(Single.new('accountSid_authToken')))
27
+ .response(new_response_handler
28
+ .deserializer(APIHelper.method(:custom_type_deserializer))
29
+ .deserialize_into(AccountsV1MessagingGeopermissions.method(:from_hash))
30
+ .is_api_response(true))
31
+ .execute
32
+ end
33
+
34
+ # Manage Geo Permissions for each country.
35
+ # @param [String] country_code Optional parameter: The country code to
36
+ # filter the geo permissions. If provided, only the geo permission for the
37
+ # specified country will be returned.
38
+ # @return [ApiResponse] Complete http response with raw body and status code.
39
+ def fetch_messaging_geopermissions(country_code: nil)
40
+ @api_call
41
+ .request(new_request_builder(HttpMethodEnum::GET,
42
+ '/v1/Messaging/GeoPermissions',
43
+ Server::DEFAULT)
44
+ .query_param(new_parameter(country_code, key: 'CountryCode'))
45
+ .header_param(new_parameter('application/json', key: 'accept'))
46
+ .auth(Single.new('accountSid_authToken')))
47
+ .response(new_response_handler
48
+ .deserializer(APIHelper.method(:custom_type_deserializer))
49
+ .deserialize_into(AccountsV1MessagingGeopermissions.method(:from_hash))
50
+ .is_api_response(true))
51
+ .execute
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,136 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module TwilioAccounts
7
+ # AccountsV1PublicKeyApi
8
+ class AccountsV1PublicKeyApi < BaseApi
9
+ # Retrieves a collection of Public Key Credentials belonging to the account
10
+ # used to make the request
11
+ # @param [Integer] page_size Optional parameter: How many resources to
12
+ # return in each list page. The default is 50, and the maximum is 1000.
13
+ # @param [Integer] page Optional parameter: The page index. This value is
14
+ # simply for client state.
15
+ # @param [String] page_token Optional parameter: The page token. This is
16
+ # provided by the API.
17
+ # @return [ApiResponse] Complete http response with raw body and status code.
18
+ def list_credential_public_key(page_size: nil,
19
+ page: nil,
20
+ page_token: nil)
21
+ @api_call
22
+ .request(new_request_builder(HttpMethodEnum::GET,
23
+ '/v1/Credentials/PublicKeys',
24
+ Server::DEFAULT)
25
+ .query_param(new_parameter(page_size, key: 'PageSize'))
26
+ .query_param(new_parameter(page, key: 'Page'))
27
+ .query_param(new_parameter(page_token, key: 'PageToken'))
28
+ .header_param(new_parameter('application/json', key: 'accept'))
29
+ .auth(Single.new('accountSid_authToken')))
30
+ .response(new_response_handler
31
+ .deserializer(APIHelper.method(:custom_type_deserializer))
32
+ .deserialize_into(ListCredentialPublicKeyResponse.method(:from_hash))
33
+ .is_api_response(true))
34
+ .execute
35
+ end
36
+
37
+ # Create a new Public Key Credential
38
+ # @param [String] public_key Required parameter: A URL encoded
39
+ # representation of the public key. For example, `-----BEGIN PUBLIC
40
+ # KEY-----MIIBIjANB.pa9xQIDAQAB-----END PUBLIC KEY-----`
41
+ # @param [String] friendly_name Optional parameter: A descriptive string
42
+ # that you create to describe the resource. It can be up to 64 characters
43
+ # long.
44
+ # @param [String] account_sid Optional parameter: The SID of the Subaccount
45
+ # that this Credential should be associated with. Must be a valid Subaccount
46
+ # of the account issuing the request
47
+ # @return [ApiResponse] Complete http response with raw body and status code.
48
+ def create_credential_public_key(public_key,
49
+ friendly_name: nil,
50
+ account_sid: nil)
51
+ @api_call
52
+ .request(new_request_builder(HttpMethodEnum::POST,
53
+ '/v1/Credentials/PublicKeys',
54
+ Server::DEFAULT)
55
+ .form_param(new_parameter(public_key, key: 'PublicKey')
56
+ .is_required(true))
57
+ .form_param(new_parameter(friendly_name, key: 'FriendlyName'))
58
+ .form_param(new_parameter(account_sid, key: 'AccountSid'))
59
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
60
+ .header_param(new_parameter('application/json', key: 'accept'))
61
+ .auth(Single.new('accountSid_authToken')))
62
+ .response(new_response_handler
63
+ .deserializer(APIHelper.method(:custom_type_deserializer))
64
+ .deserialize_into(AccountsV1CredentialCredentialPublicKey.method(:from_hash))
65
+ .is_api_response(true))
66
+ .execute
67
+ end
68
+
69
+ # Fetch the public key specified by the provided Credential Sid
70
+ # @param [String] sid Required parameter: The Twilio-provided string that
71
+ # uniquely identifies the PublicKey resource to fetch.
72
+ # @return [ApiResponse] Complete http response with raw body and status code.
73
+ def fetch_credential_public_key(sid)
74
+ @api_call
75
+ .request(new_request_builder(HttpMethodEnum::GET,
76
+ '/v1/Credentials/PublicKeys/{Sid}',
77
+ Server::DEFAULT)
78
+ .template_param(new_parameter(sid, key: 'Sid')
79
+ .is_required(true)
80
+ .should_encode(true))
81
+ .header_param(new_parameter('application/json', key: 'accept'))
82
+ .auth(Single.new('accountSid_authToken')))
83
+ .response(new_response_handler
84
+ .deserializer(APIHelper.method(:custom_type_deserializer))
85
+ .deserialize_into(AccountsV1CredentialCredentialPublicKey.method(:from_hash))
86
+ .is_api_response(true))
87
+ .execute
88
+ end
89
+
90
+ # Modify the properties of a given Account
91
+ # @param [String] sid Required parameter: The Twilio-provided string that
92
+ # uniquely identifies the PublicKey resource to update.
93
+ # @param [String] friendly_name Optional parameter: A descriptive string
94
+ # that you create to describe the resource. It can be up to 64 characters
95
+ # long.
96
+ # @return [ApiResponse] Complete http response with raw body and status code.
97
+ def update_credential_public_key(sid,
98
+ friendly_name: nil)
99
+ @api_call
100
+ .request(new_request_builder(HttpMethodEnum::POST,
101
+ '/v1/Credentials/PublicKeys/{Sid}',
102
+ Server::DEFAULT)
103
+ .template_param(new_parameter(sid, key: 'Sid')
104
+ .is_required(true)
105
+ .should_encode(true))
106
+ .form_param(new_parameter(friendly_name, key: 'FriendlyName'))
107
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
108
+ .header_param(new_parameter('application/json', key: 'accept'))
109
+ .auth(Single.new('accountSid_authToken')))
110
+ .response(new_response_handler
111
+ .deserializer(APIHelper.method(:custom_type_deserializer))
112
+ .deserialize_into(AccountsV1CredentialCredentialPublicKey.method(:from_hash))
113
+ .is_api_response(true))
114
+ .execute
115
+ end
116
+
117
+ # Delete a Credential from your account
118
+ # @param [String] sid Required parameter: The Twilio-provided string that
119
+ # uniquely identifies the PublicKey resource to delete.
120
+ # @return [ApiResponse] Complete http response with raw body and status code.
121
+ def delete_credential_public_key(sid)
122
+ @api_call
123
+ .request(new_request_builder(HttpMethodEnum::DELETE,
124
+ '/v1/Credentials/PublicKeys/{Sid}',
125
+ Server::DEFAULT)
126
+ .template_param(new_parameter(sid, key: 'Sid')
127
+ .is_required(true)
128
+ .should_encode(true))
129
+ .auth(Single.new('accountSid_authToken')))
130
+ .response(new_response_handler
131
+ .is_response_void(true)
132
+ .is_api_response(true))
133
+ .execute
134
+ end
135
+ end
136
+ end