=begin #Datadog API V2 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: support@datadoghq.com Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020-Present Datadog, Inc. =end require 'cgi' module DatadogAPIClient::V2 class TeamsAPI attr_accessor :api_client def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end # Create a team. # # @see #create_team_with_http_info def create_team(body, opts = {}) data, _status_code, _headers = create_team_with_http_info(body, opts) data end # Create a team. # # Create a new team. # User IDs passed through the `users` relationship field are added to the team. # # @param body [TeamCreateRequest] # @param opts [Hash] the optional parameters # @return [Array<(TeamResponse, Integer, Hash)>] TeamResponse data, response status code and response headers def create_team_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.create_team ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling TeamsAPI.create_team" end # resource path local_var_path = '/api/v2/team' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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 = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'TeamResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :create_team, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#create_team\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a team link. # # @see #create_team_link_with_http_info def create_team_link(team_id, body, opts = {}) data, _status_code, _headers = create_team_link_with_http_info(team_id, body, opts) data end # Create a team link. # # Add a new link to a team. # # @param team_id [String] None # @param body [TeamLinkCreateRequest] # @param opts [Hash] the optional parameters # @return [Array<(TeamLinkResponse, Integer, Hash)>] TeamLinkResponse data, response status code and response headers def create_team_link_with_http_info(team_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.create_team_link ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.create_team_link" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling TeamsAPI.create_team_link" end # resource path local_var_path = '/api/v2/team/{team_id}/links'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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 = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'TeamLinkResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :create_team_link, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#create_team_link\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Add a user to a team. # # @see #create_team_membership_with_http_info def create_team_membership(team_id, body, opts = {}) data, _status_code, _headers = create_team_membership_with_http_info(team_id, body, opts) data end # Add a user to a team. # # Add a user to a team. # # @param team_id [String] None # @param body [UserTeamRequest] # @param opts [Hash] the optional parameters # @return [Array<(UserTeamResponse, Integer, Hash)>] UserTeamResponse data, response status code and response headers def create_team_membership_with_http_info(team_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.create_team_membership ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.create_team_membership" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling TeamsAPI.create_team_membership" end # resource path local_var_path = '/api/v2/team/{team_id}/memberships'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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 = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'UserTeamResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :create_team_membership, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#create_team_membership\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Remove a team. # # @see #delete_team_with_http_info def delete_team(team_id, opts = {}) delete_team_with_http_info(team_id, opts) nil end # Remove a team. # # Remove a team using the team's `id`. # # @param team_id [String] None # @param opts [Hash] the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_team_with_http_info(team_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.delete_team ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.delete_team" end # resource path local_var_path = '/api/v2/team/{team_id}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :delete_team, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#delete_team\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Remove a team link. # # @see #delete_team_link_with_http_info def delete_team_link(team_id, link_id, opts = {}) delete_team_link_with_http_info(team_id, link_id, opts) nil end # Remove a team link. # # Remove a link from a team. # # @param team_id [String] None # @param link_id [String] None # @param opts [Hash] the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_team_link_with_http_info(team_id, link_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.delete_team_link ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.delete_team_link" end # verify the required parameter 'link_id' is set if @api_client.config.client_side_validation && link_id.nil? fail ArgumentError, "Missing the required parameter 'link_id' when calling TeamsAPI.delete_team_link" end # resource path local_var_path = '/api/v2/team/{team_id}/links/{link_id}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')).sub('{link_id}', CGI.escape(link_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :delete_team_link, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#delete_team_link\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Remove a user from a team. # # @see #delete_team_membership_with_http_info def delete_team_membership(team_id, user_id, opts = {}) delete_team_membership_with_http_info(team_id, user_id, opts) nil end # Remove a user from a team. # # Remove a user from a team. # # @param team_id [String] None # @param user_id [String] None # @param opts [Hash] the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_team_membership_with_http_info(team_id, user_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.delete_team_membership ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.delete_team_membership" end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling TeamsAPI.delete_team_membership" end # resource path local_var_path = '/api/v2/team/{team_id}/memberships/{user_id}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')).sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :delete_team_membership, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#delete_team_membership\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a team. # # @see #get_team_with_http_info def get_team(team_id, opts = {}) data, _status_code, _headers = get_team_with_http_info(team_id, opts) data end # Get a team. # # Get a single team using the team's `id`. # # @param team_id [String] None # @param opts [Hash] the optional parameters # @return [Array<(TeamResponse, Integer, Hash)>] TeamResponse data, response status code and response headers def get_team_with_http_info(team_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.get_team ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.get_team" end # resource path local_var_path = '/api/v2/team/{team_id}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'TeamResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :get_team, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#get_team\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a team link. # # @see #get_team_link_with_http_info def get_team_link(team_id, link_id, opts = {}) data, _status_code, _headers = get_team_link_with_http_info(team_id, link_id, opts) data end # Get a team link. # # Get a single link for a team. # # @param team_id [String] None # @param link_id [String] None # @param opts [Hash] the optional parameters # @return [Array<(TeamLinkResponse, Integer, Hash)>] TeamLinkResponse data, response status code and response headers def get_team_link_with_http_info(team_id, link_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.get_team_link ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.get_team_link" end # verify the required parameter 'link_id' is set if @api_client.config.client_side_validation && link_id.nil? fail ArgumentError, "Missing the required parameter 'link_id' when calling TeamsAPI.get_team_link" end # resource path local_var_path = '/api/v2/team/{team_id}/links/{link_id}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')).sub('{link_id}', CGI.escape(link_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'TeamLinkResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :get_team_link, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#get_team_link\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get links for a team. # # @see #get_team_links_with_http_info def get_team_links(team_id, opts = {}) data, _status_code, _headers = get_team_links_with_http_info(team_id, opts) data end # Get links for a team. # # Get all links for a given team. # # @param team_id [String] None # @param opts [Hash] the optional parameters # @return [Array<(TeamLinksResponse, Integer, Hash)>] TeamLinksResponse data, response status code and response headers def get_team_links_with_http_info(team_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.get_team_links ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.get_team_links" end # resource path local_var_path = '/api/v2/team/{team_id}/links'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'TeamLinksResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :get_team_links, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#get_team_links\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get team memberships. # # @see #get_team_memberships_with_http_info def get_team_memberships(team_id, opts = {}) data, _status_code, _headers = get_team_memberships_with_http_info(team_id, opts) data end # Get team memberships. # # Get a paginated list of members for a team # # @param team_id [String] None # @param opts [Hash] the optional parameters # @option opts [Integer] :page_size Size for a given page. The maximum allowed value is 100. # @option opts [Integer] :page_number Specific page number to return. # @option opts [GetTeamMembershipsSort] :sort Specifies the order of returned team memberships # @option opts [String] :filter_keyword Search query, can be user email or name # @return [Array<(UserTeamsResponse, Integer, Hash)>] UserTeamsResponse data, response status code and response headers def get_team_memberships_with_http_info(team_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.get_team_memberships ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.get_team_memberships" end allowable_values = ['manager_name', '-manager_name', 'name', '-name', 'handle', '-handle', 'email', '-email'] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/api/v2/team/{team_id}/memberships'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'filter[keyword]'] = opts[:'filter_keyword'] if !opts[:'filter_keyword'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'UserTeamsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :get_team_memberships, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#get_team_memberships\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get permission settings for a team. # # @see #get_team_permission_settings_with_http_info def get_team_permission_settings(team_id, opts = {}) data, _status_code, _headers = get_team_permission_settings_with_http_info(team_id, opts) data end # Get permission settings for a team. # # Get all permission settings for a given team. # # @param team_id [String] None # @param opts [Hash] the optional parameters # @return [Array<(TeamPermissionSettingsResponse, Integer, Hash)>] TeamPermissionSettingsResponse data, response status code and response headers def get_team_permission_settings_with_http_info(team_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.get_team_permission_settings ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.get_team_permission_settings" end # resource path local_var_path = '/api/v2/team/{team_id}/permission-settings'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'TeamPermissionSettingsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :get_team_permission_settings, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#get_team_permission_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get user memberships. # # @see #get_user_memberships_with_http_info def get_user_memberships(user_uuid, opts = {}) data, _status_code, _headers = get_user_memberships_with_http_info(user_uuid, opts) data end # Get user memberships. # # Get a list of memberships for a user # # @param user_uuid [String] None # @param opts [Hash] the optional parameters # @return [Array<(UserTeamsResponse, Integer, Hash)>] UserTeamsResponse data, response status code and response headers def get_user_memberships_with_http_info(user_uuid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.get_user_memberships ...' end # verify the required parameter 'user_uuid' is set if @api_client.config.client_side_validation && user_uuid.nil? fail ArgumentError, "Missing the required parameter 'user_uuid' when calling TeamsAPI.get_user_memberships" end # resource path local_var_path = '/api/v2/users/{user_uuid}/memberships'.sub('{user_uuid}', CGI.escape(user_uuid.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'UserTeamsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :get_user_memberships, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#get_user_memberships\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all teams. # # @see #list_teams_with_http_info def list_teams(opts = {}) data, _status_code, _headers = list_teams_with_http_info(opts) data end # Get all teams. # # Get all teams. # Can be used to search for teams using the `filter[keyword]` and `filter[me]` query parameters. # # @param opts [Hash] the optional parameters # @option opts [Integer] :page_number Specific page number to return. # @option opts [Integer] :page_size Size for a given page. The maximum allowed value is 100. # @option opts [ListTeamsSort] :sort Specifies the order of the returned teams # @option opts [Array] :include Included related resources optionally requested. Allowed enum values: `team_links, user_team_permissions` # @option opts [String] :filter_keyword Search query. Can be team name, team handle, or email of team member # @option opts [Boolean] :filter_me When true, only returns teams the current user belongs to # @option opts [Array] :fields_team List of fields that need to be fetched. # @return [Array<(TeamsResponse, Integer, Hash)>] TeamsResponse data, response status code and response headers def list_teams_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.list_teams ...' end allowable_values = ['name', '-name', 'user_count', '-user_count'] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/api/v2/team' # query parameters query_params = opts[:query_params] || {} query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil? query_params[:'filter[keyword]'] = opts[:'filter_keyword'] if !opts[:'filter_keyword'].nil? query_params[:'filter[me]'] = opts[:'filter_me'] if !opts[:'filter_me'].nil? query_params[:'fields[team]'] = @api_client.build_collection_param(opts[:'fields_team'], :csv) if !opts[:'fields_team'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'TeamsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :list_teams, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#list_teams\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all teams. # # Provide a paginated version of {#list_teams}, returning all items. # # To use it you need to use a block: list_teams_with_pagination { |item| p item } # # @yield [Team] Paginated items def list_teams_with_pagination(opts = {}) api_version = "V2" page_size = @api_client.get_attribute_from_path(opts, "page_size", 10) @api_client.set_attribute_from_path(api_version, opts, "page_size", Integer, page_size) @api_client.set_attribute_from_path(api_version, opts, "page_number", Integer, 0) while true do response = list_teams(opts) @api_client.get_attribute_from_path(response, "data").each { |item| yield(item) } if @api_client.get_attribute_from_path(response, "data").length < page_size break end @api_client.set_attribute_from_path(api_version, opts, "page_number", Integer, @api_client.get_attribute_from_path(opts, "page_number", 0) + 1) end end # Update a team. # # @see #update_team_with_http_info def update_team(team_id, body, opts = {}) data, _status_code, _headers = update_team_with_http_info(team_id, body, opts) data end # Update a team. # # Update a team using the team's `id`. # If the `team_links` relationship is present, the associated links are updated to be in the order they appear in the array, and any existing team links not present are removed. # # @param team_id [String] None # @param body [TeamUpdateRequest] # @param opts [Hash] the optional parameters # @return [Array<(TeamResponse, Integer, Hash)>] TeamResponse data, response status code and response headers def update_team_with_http_info(team_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.update_team ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.update_team" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling TeamsAPI.update_team" end # resource path local_var_path = '/api/v2/team/{team_id}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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 = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'TeamResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :update_team, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#update_team\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a team link. # # @see #update_team_link_with_http_info def update_team_link(team_id, link_id, body, opts = {}) data, _status_code, _headers = update_team_link_with_http_info(team_id, link_id, body, opts) data end # Update a team link. # # Update a team link. # # @param team_id [String] None # @param link_id [String] None # @param body [TeamLinkCreateRequest] # @param opts [Hash] the optional parameters # @return [Array<(TeamLinkResponse, Integer, Hash)>] TeamLinkResponse data, response status code and response headers def update_team_link_with_http_info(team_id, link_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.update_team_link ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.update_team_link" end # verify the required parameter 'link_id' is set if @api_client.config.client_side_validation && link_id.nil? fail ArgumentError, "Missing the required parameter 'link_id' when calling TeamsAPI.update_team_link" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling TeamsAPI.update_team_link" end # resource path local_var_path = '/api/v2/team/{team_id}/links/{link_id}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')).sub('{link_id}', CGI.escape(link_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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 = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'TeamLinkResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :update_team_link, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#update_team_link\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a user's membership attributes on a team. # # @see #update_team_membership_with_http_info def update_team_membership(team_id, user_id, body, opts = {}) data, _status_code, _headers = update_team_membership_with_http_info(team_id, user_id, body, opts) data end # Update a user's membership attributes on a team. # # Update a user's membership attributes on a team. # # @param team_id [String] None # @param user_id [String] None # @param body [UserTeamUpdateRequest] # @param opts [Hash] the optional parameters # @return [Array<(UserTeamResponse, Integer, Hash)>] UserTeamResponse data, response status code and response headers def update_team_membership_with_http_info(team_id, user_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.update_team_membership ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.update_team_membership" end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling TeamsAPI.update_team_membership" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling TeamsAPI.update_team_membership" end # resource path local_var_path = '/api/v2/team/{team_id}/memberships/{user_id}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')).sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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 = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'UserTeamResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :update_team_membership, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#update_team_membership\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update permission setting for team. # # @see #update_team_permission_setting_with_http_info def update_team_permission_setting(team_id, action, body, opts = {}) data, _status_code, _headers = update_team_permission_setting_with_http_info(team_id, action, body, opts) data end # Update permission setting for team. # # Update a team permission setting for a given team. # # @param team_id [String] None # @param action [String] None # @param body [TeamPermissionSettingUpdateRequest] # @param opts [Hash] the optional parameters # @return [Array<(TeamPermissionSettingResponse, Integer, Hash)>] TeamPermissionSettingResponse data, response status code and response headers def update_team_permission_setting_with_http_info(team_id, action, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TeamsAPI.update_team_permission_setting ...' end # verify the required parameter 'team_id' is set if @api_client.config.client_side_validation && team_id.nil? fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.update_team_permission_setting" end # verify the required parameter 'action' is set if @api_client.config.client_side_validation && action.nil? fail ArgumentError, "Missing the required parameter 'action' when calling TeamsAPI.update_team_permission_setting" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling TeamsAPI.update_team_permission_setting" end # resource path local_var_path = '/api/v2/team/{team_id}/permission-settings/{action}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')).sub('{action}', CGI.escape(action.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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 = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'TeamPermissionSettingResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :update_team_permission_setting, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TeamsAPI#update_team_permission_setting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end