class SibApiV3Sdk::ListsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/sib-api-v3-sdk/api/lists_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

add_contact_to_list(list_id, contact_emails, opts = {}) click to toggle source

Add existing contacts to a list @param list_id Id of the list @param contact_emails Emails addresses OR IDs of the contacts @param [Hash] opts the optional parameters @return [PostContactInfo]

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 37
def add_contact_to_list(list_id, contact_emails, opts = {})
  data, _status_code, _headers = add_contact_to_list_with_http_info(list_id, contact_emails, opts)
  data
end
add_contact_to_list_with_http_info(list_id, contact_emails, opts = {}) click to toggle source

Add existing contacts to a list @param list_id Id of the list @param contact_emails Emails addresses OR IDs of the contacts @param [Hash] opts the optional parameters @return [Array<(PostContactInfo, Fixnum, Hash)>] PostContactInfo data, response status code and response headers

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 47
def add_contact_to_list_with_http_info(list_id, contact_emails, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsApi.add_contact_to_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsApi.add_contact_to_list"
  end
  # verify the required parameter 'contact_emails' is set
  if @api_client.config.client_side_validation && contact_emails.nil?
    fail ArgumentError, "Missing the required parameter 'contact_emails' when calling ListsApi.add_contact_to_list"
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}/contacts/add'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(contact_emails)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PostContactInfo')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListsApi#add_contact_to_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_list(create_list, opts = {}) click to toggle source

Create a list @param create_list Values to create a list @param [Hash] opts the optional parameters @return [CreateModel]

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 94
def create_list(create_list, opts = {})
  data, _status_code, _headers = create_list_with_http_info(create_list, opts)
  data
end
create_list_with_http_info(create_list, opts = {}) click to toggle source

Create a list @param create_list Values to create a list @param [Hash] opts the optional parameters @return [Array<(CreateModel, Fixnum, Hash)>] CreateModel data, response status code and response headers

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 103
def create_list_with_http_info(create_list, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsApi.create_list ...'
  end
  # verify the required parameter 'create_list' is set
  if @api_client.config.client_side_validation && create_list.nil?
    fail ArgumentError, "Missing the required parameter 'create_list' when calling ListsApi.create_list"
  end
  # resource path
  local_var_path = '/contacts/lists'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(create_list)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CreateModel')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListsApi#create_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_list(list_id, opts = {}) click to toggle source

Delete a list @param list_id Id of the list @param [Hash] opts the optional parameters @return [nil]

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 146
def delete_list(list_id, opts = {})
  delete_list_with_http_info(list_id, opts)
  nil
end
delete_list_with_http_info(list_id, opts = {}) click to toggle source

Delete a list @param list_id Id of the list @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 155
def delete_list_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsApi.delete_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsApi.delete_list"
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListsApi#delete_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_contacts_from_list(list_id, opts = {}) click to toggle source

Get contacts in a list @param list_id Id of the list @param [Hash] opts the optional parameters @option opts [String] :modified_since Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. @option opts [Integer] :limit Number of documents per page (default to 50) @option opts [Integer] :offset Index of the first document of the page (default to 0) @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc) @return [GetContacts]

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 201
def get_contacts_from_list(list_id, opts = {})
  data, _status_code, _headers = get_contacts_from_list_with_http_info(list_id, opts)
  data
end
get_contacts_from_list_with_http_info(list_id, opts = {}) click to toggle source

Get contacts in a list @param list_id Id of the list @param [Hash] opts the optional parameters @option opts [String] :modified_since Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. @option opts [Integer] :limit Number of documents per page @option opts [Integer] :offset Index of the first document of the page @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed @return [Array<(GetContacts, Fixnum, Hash)>] GetContacts data, response status code and response headers

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 214
def get_contacts_from_list_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsApi.get_contacts_from_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsApi.get_contacts_from_list"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ListsApi.get_contacts_from_list, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}/contacts'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'modifiedSince'] = opts[:'modified_since'] if !opts[:'modified_since'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetContacts')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListsApi#get_contacts_from_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_folder_lists(folder_id, opts = {}) click to toggle source

Get lists in a folder @param folder_id Id of the folder @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of documents per page (default to 10) @option opts [Integer] :offset Index of the first document of the page (default to 0) @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc) @return [GetFolderLists]

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 271
def get_folder_lists(folder_id, opts = {})
  data, _status_code, _headers = get_folder_lists_with_http_info(folder_id, opts)
  data
end
get_folder_lists_with_http_info(folder_id, opts = {}) click to toggle source

Get lists in a folder @param folder_id Id of the folder @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of documents per page @option opts [Integer] :offset Index of the first document of the page @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed @return [Array<(GetFolderLists, Fixnum, Hash)>] GetFolderLists data, response status code and response headers

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 283
def get_folder_lists_with_http_info(folder_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsApi.get_folder_lists ...'
  end
  # verify the required parameter 'folder_id' is set
  if @api_client.config.client_side_validation && folder_id.nil?
    fail ArgumentError, "Missing the required parameter 'folder_id' when calling ListsApi.get_folder_lists"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ListsApi.get_folder_lists, must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/contacts/folders/{folderId}/lists'.sub('{' + 'folderId' + '}', folder_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetFolderLists')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListsApi#get_folder_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_list(list_id, opts = {}) click to toggle source

Get a list's details @param list_id Id of the list @param [Hash] opts the optional parameters @return [GetExtendedList]

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 336
def get_list(list_id, opts = {})
  data, _status_code, _headers = get_list_with_http_info(list_id, opts)
  data
end
get_list_with_http_info(list_id, opts = {}) click to toggle source

Get a list&#39;s details @param list_id Id of the list @param [Hash] opts the optional parameters @return [Array<(GetExtendedList, Fixnum, Hash)>] GetExtendedList data, response status code and response headers

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 345
def get_list_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsApi.get_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsApi.get_list"
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetExtendedList')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListsApi#get_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_lists(opts = {}) click to toggle source

Get all the lists @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of documents per page (default to 10) @option opts [Integer] :offset Index of the first document of the page (default to 0) @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc) @return [GetLists]

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 390
def get_lists(opts = {})
  data, _status_code, _headers = get_lists_with_http_info(opts)
  data
end
get_lists_with_http_info(opts = {}) click to toggle source

Get all the lists @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of documents per page @option opts [Integer] :offset Index of the first document of the page @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed @return [Array<(GetLists, Fixnum, Hash)>] GetLists data, response status code and response headers

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 401
def get_lists_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsApi.get_lists ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ListsApi.get_lists, must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/contacts/lists'

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetLists')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListsApi#get_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
remove_contact_from_list(list_id, contact_emails, opts = {}) click to toggle source

Delete a contact from a list @param list_id Id of the list @param contact_emails Emails addresses OR IDs of the contacts @param [Hash] opts the optional parameters @return [PostContactInfo]

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 451
def remove_contact_from_list(list_id, contact_emails, opts = {})
  data, _status_code, _headers = remove_contact_from_list_with_http_info(list_id, contact_emails, opts)
  data
end
remove_contact_from_list_with_http_info(list_id, contact_emails, opts = {}) click to toggle source

Delete a contact from a list @param list_id Id of the list @param contact_emails Emails addresses OR IDs of the contacts @param [Hash] opts the optional parameters @return [Array<(PostContactInfo, Fixnum, Hash)>] PostContactInfo data, response status code and response headers

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 461
def remove_contact_from_list_with_http_info(list_id, contact_emails, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsApi.remove_contact_from_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsApi.remove_contact_from_list"
  end
  # verify the required parameter 'contact_emails' is set
  if @api_client.config.client_side_validation && contact_emails.nil?
    fail ArgumentError, "Missing the required parameter 'contact_emails' when calling ListsApi.remove_contact_from_list"
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}/contacts/remove'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(contact_emails)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PostContactInfo')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListsApi#remove_contact_from_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
setUserAgent(user_agent) click to toggle source

Set custom user_agent if explicitly passed in api default will still remain Swagger-Codegen/#{VERSION}/ruby

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 25
def setUserAgent(user_agent)
  @user_agent = user_agent
  if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
    @api_client.default_headers['User-Agent'] = @user_agent
  end
end
update_list(list_id, update_list, opts = {}) click to toggle source

Update a list @param list_id Id of the list @param update_list Values to update a list @param [Hash] opts the optional parameters @return [nil]

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 509
def update_list(list_id, update_list, opts = {})
  update_list_with_http_info(list_id, update_list, opts)
  nil
end
update_list_with_http_info(list_id, update_list, opts = {}) click to toggle source

Update a list @param list_id Id of the list @param update_list Values to update a list @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/sib-api-v3-sdk/api/lists_api.rb, line 519
def update_list_with_http_info(list_id, update_list, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsApi.update_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsApi.update_list"
  end
  # verify the required parameter 'update_list' is set
  if @api_client.config.client_side_validation && update_list.nil?
    fail ArgumentError, "Missing the required parameter 'update_list' when calling ListsApi.update_list"
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(update_list)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListsApi#update_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end