Skip to content

Commit e41abcd

Browse files
committed
AP_1068 Handle custom user agent
1 parent 5d7ad07 commit e41abcd

13 files changed

+130
-0
lines changed

lib/sib-api-v3-sdk/api/account_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class AccountApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Get your account information, plan and credits details
2333
# @param [Hash] opts the optional parameters
2434
# @return [GetAccount]

lib/sib-api-v3-sdk/api/attributes_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class AttributesApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Create contact attribute
2333
# @param attribute_category Category of the attribute
2434
# @param attribute_name Name of the attribute

lib/sib-api-v3-sdk/api/contacts_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class ContactsApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Add existing contacts to a list
2333
# @param list_id Id of the list
2434
# @param contact_emails Emails addresses OR IDs of the contacts

lib/sib-api-v3-sdk/api/email_campaigns_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class EmailCampaignsApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Create an email campaign
2333
# @param email_campaigns Values to create a campaign
2434
# @param [Hash] opts the optional parameters

lib/sib-api-v3-sdk/api/folders_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class FoldersApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Create a folder
2333
# @param create_folder Name of the folder
2434
# @param [Hash] opts the optional parameters

lib/sib-api-v3-sdk/api/lists_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class ListsApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Add existing contacts to a list
2333
# @param list_id Id of the list
2434
# @param contact_emails Emails addresses OR IDs of the contacts

lib/sib-api-v3-sdk/api/process_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class ProcessApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Return the informations for a process
2333
# @param process_id Id of the process
2434
# @param [Hash] opts the optional parameters

lib/sib-api-v3-sdk/api/reseller_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class ResellerApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Add Email and/or SMS credits to a specific child account
2333
# @param child_identifier Either auth key or id of reseller's child
2434
# @param add_credits Values to post to add credit to a specific child account

lib/sib-api-v3-sdk/api/senders_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class SendersApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Create a new sender
2333
# @param [Hash] opts the optional parameters
2434
# @option opts [CreateSender] :sender sender's name

lib/sib-api-v3-sdk/api/sms_campaigns_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class SMSCampaignsApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Creates an SMS campaign
2333
# @param create_sms_campaign Values to create an SMS Campaign
2434
# @param [Hash] opts the optional parameters

lib/sib-api-v3-sdk/api/transactional_emails_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class TransactionalEmailsApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Add a new domain to the list of blocked domains
2333
# Blocks a new domain in order to avoid messages being sent to the same
2434
# @param block_domain

lib/sib-api-v3-sdk/api/transactional_sms_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class TransactionalSMSApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Get all your SMS activity (unaggregated events)
2333
# @param [Hash] opts the optional parameters
2434
# @option opts [Integer] :limit Number of documents per page (default to 50)

lib/sib-api-v3-sdk/api/webhooks_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class WebhooksApi
1919
def initialize(api_client = ApiClient.default)
2020
@api_client = api_client
2121
end
22+
23+
# Set custom user_agent if explicitly passed in api
24+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
25+
def setUserAgent(user_agent)
26+
@user_agent = user_agent
27+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
28+
@api_client.default_headers['User-Agent'] = @user_agent
29+
end
30+
end
31+
2232
# Create a webhook
2333
# @param create_webhook Values to create a webhook
2434
# @param [Hash] opts the optional parameters

0 commit comments

Comments
 (0)