permit-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/api/api.rb +25 -0
- data/lib/api/base.rb +26 -0
- data/lib/api/resources.rb +13 -0
- data/lib/api/tenants.rb +11 -0
- data/lib/api/users.rb +50 -0
- data/lib/api/utils.rb +9 -0
- data/lib/config.rb +23 -0
- data/lib/main.rb +49 -0
- data/lib/openapi_client/api/api_keys_api.rb +413 -0
- data/lib/openapi_client/api/audit_elements_data_api.rb +118 -0
- data/lib/openapi_client/api/audit_logs_api.rb +204 -0
- data/lib/openapi_client/api/authentication_api.rb +512 -0
- data/lib/openapi_client/api/condition_set_rules_api.rb +278 -0
- data/lib/openapi_client/api/condition_sets_api.rb +428 -0
- data/lib/openapi_client/api/decision_logs_api.rb +128 -0
- data/lib/openapi_client/api/decision_logs_ingress_api.rb +90 -0
- data/lib/openapi_client/api/default_api.rb +297 -0
- data/lib/openapi_client/api/elements_configs_api.rb +657 -0
- data/lib/openapi_client/api/environments_api.rb +462 -0
- data/lib/openapi_client/api/instructions_api.rb +91 -0
- data/lib/openapi_client/api/members_api.rb +354 -0
- data/lib/openapi_client/api/opal_data_api.rb +343 -0
- data/lib/openapi_client/api/organizations_api.rb +652 -0
- data/lib/openapi_client/api/policy_api.rb +138 -0
- data/lib/openapi_client/api/policy_decision_points_api.rb +382 -0
- data/lib/openapi_client/api/policy_git_repositories_api.rb +510 -0
- data/lib/openapi_client/api/projects_api.rb +365 -0
- data/lib/openapi_client/api/resource_actions_api.rb +455 -0
- data/lib/openapi_client/api/resource_attributes_api.rb +473 -0
- data/lib/openapi_client/api/resource_instances_api.rb +425 -0
- data/lib/openapi_client/api/resource_roles_api.rb +813 -0
- data/lib/openapi_client/api/resources_api.rb +514 -0
- data/lib/openapi_client/api/role_assignments_api.rb +278 -0
- data/lib/openapi_client/api/roles_api.rb +759 -0
- data/lib/openapi_client/api/tenants_api.rb +603 -0
- data/lib/openapi_client/api/user_attributes_api.rb +458 -0
- data/lib/openapi_client/api/users_api.rb +684 -0
- data/lib/openapi_client/api/users_elements_data_api.rb +638 -0
- data/lib/openapi_client/api_client.rb +392 -0
- data/lib/openapi_client/api_error.rb +57 -0
- data/lib/openapi_client/configuration.rb +280 -0
- data/lib/openapi_client/models/action_block_editable.rb +230 -0
- data/lib/openapi_client/models/action_block_read.rb +255 -0
- data/lib/openapi_client/models/action_object.rb +275 -0
- data/lib/openapi_client/models/actor.rb +57 -0
- data/lib/openapi_client/models/add_role_permissions.rb +227 -0
- data/lib/openapi_client/models/api_key_create.rb +269 -0
- data/lib/openapi_client/models/api_key_owner_type.rb +41 -0
- data/lib/openapi_client/models/api_key_read.rb +329 -0
- data/lib/openapi_client/models/api_key_scope_read.rb +245 -0
- data/lib/openapi_client/models/attribute_block_editable.rb +235 -0
- data/lib/openapi_client/models/attribute_block_read.rb +260 -0
- data/lib/openapi_client/models/attribute_type.rb +44 -0
- data/lib/openapi_client/models/attributes.rb +231 -0
- data/lib/openapi_client/models/audit_log.rb +415 -0
- data/lib/openapi_client/models/audit_log_objects.rb +282 -0
- data/lib/openapi_client/models/authn_me_api_key_read.rb +329 -0
- data/lib/openapi_client/models/authn_me_member_read.rb +352 -0
- data/lib/openapi_client/models/authn_me_read.rb +224 -0
- data/lib/openapi_client/models/authn_me_user_read.rb +440 -0
- data/lib/openapi_client/models/condition_set_create.rb +340 -0
- data/lib/openapi_client/models/condition_set_read.rb +409 -0
- data/lib/openapi_client/models/condition_set_rule_create.rb +279 -0
- data/lib/openapi_client/models/condition_set_rule_read.rb +360 -0
- data/lib/openapi_client/models/condition_set_rule_remove.rb +279 -0
- data/lib/openapi_client/models/condition_set_type.rb +40 -0
- data/lib/openapi_client/models/condition_set_update.rb +255 -0
- data/lib/openapi_client/models/data_source_config.rb +228 -0
- data/lib/openapi_client/models/data_source_entry.rb +272 -0
- data/lib/openapi_client/models/detailed_audit_log.rb +443 -0
- data/lib/openapi_client/models/dev_login.rb +225 -0
- data/lib/openapi_client/models/dummy_engine_model.rb +229 -0
- data/lib/openapi_client/models/elements_config_create.rb +319 -0
- data/lib/openapi_client/models/elements_config_read.rb +402 -0
- data/lib/openapi_client/models/elements_config_runtime_read.rb +238 -0
- data/lib/openapi_client/models/elements_config_update.rb +268 -0
- data/lib/openapi_client/models/elements_env_type_read.rb +242 -0
- data/lib/openapi_client/models/elements_env_type_update.rb +222 -0
- data/lib/openapi_client/models/elements_permission_level.rb +44 -0
- data/lib/openapi_client/models/elements_role_read.rb +378 -0
- data/lib/openapi_client/models/elements_type.rb +41 -0
- data/lib/openapi_client/models/elements_user_create.rb +295 -0
- data/lib/openapi_client/models/elements_user_role_create.rb +225 -0
- data/lib/openapi_client/models/elements_user_role_remove.rb +225 -0
- data/lib/openapi_client/models/embedded_login_request_output.rb +265 -0
- data/lib/openapi_client/models/engine.rb +39 -0
- data/lib/openapi_client/models/environment_create.rb +281 -0
- data/lib/openapi_client/models/environment_object.rb +295 -0
- data/lib/openapi_client/models/environment_read.rb +335 -0
- data/lib/openapi_client/models/environment_stats.rb +365 -0
- data/lib/openapi_client/models/environment_update.rb +240 -0
- data/lib/openapi_client/models/failed_invite.rb +238 -0
- data/lib/openapi_client/models/full_data.rb +258 -0
- data/lib/openapi_client/models/http_validation_error.rb +221 -0
- data/lib/openapi_client/models/identity_read.rb +300 -0
- data/lib/openapi_client/models/invite_attempt_result.rb +232 -0
- data/lib/openapi_client/models/invite_create.rb +240 -0
- data/lib/openapi_client/models/invite_read.rb +325 -0
- data/lib/openapi_client/models/invite_status.rb +42 -0
- data/lib/openapi_client/models/labels.rb +238 -0
- data/lib/openapi_client/models/language_instructions.rb +252 -0
- data/lib/openapi_client/models/location_inner.rb +230 -0
- data/lib/openapi_client/models/login_result.rb +259 -0
- data/lib/openapi_client/models/member_access_level.rb +41 -0
- data/lib/openapi_client/models/member_access_obj.rb +41 -0
- data/lib/openapi_client/models/multi_invite_result.rb +238 -0
- data/lib/openapi_client/models/onboarding_step.rb +46 -0
- data/lib/openapi_client/models/opa_decision_log.rb +288 -0
- data/lib/openapi_client/models/opa_engine_decision_log.rb +345 -0
- data/lib/openapi_client/models/opa_labels.rb +238 -0
- data/lib/openapi_client/models/opa_metrics.rb +273 -0
- data/lib/openapi_client/models/opal_client.rb +305 -0
- data/lib/openapi_client/models/org_member_read.rb +420 -0
- data/lib/openapi_client/models/org_member_update.rb +230 -0
- data/lib/openapi_client/models/organization_create.rb +292 -0
- data/lib/openapi_client/models/organization_object.rb +295 -0
- data/lib/openapi_client/models/organization_read.rb +295 -0
- data/lib/openapi_client/models/organization_read_with_api_key.rb +313 -0
- data/lib/openapi_client/models/organization_update.rb +247 -0
- data/lib/openapi_client/models/paginated_result_api_key_read.rb +285 -0
- data/lib/openapi_client/models/paginated_result_audit_log.rb +285 -0
- data/lib/openapi_client/models/paginated_result_elements_config_read.rb +285 -0
- data/lib/openapi_client/models/paginated_result_opa_decision_log.rb +285 -0
- data/lib/openapi_client/models/paginated_result_user_read.rb +285 -0
- data/lib/openapi_client/models/pdp.rb +259 -0
- data/lib/openapi_client/models/pdp_config_object.rb +258 -0
- data/lib/openapi_client/models/pdp_config_read.rb +292 -0
- data/lib/openapi_client/models/pdp_context.rb +291 -0
- data/lib/openapi_client/models/pdp_state.rb +224 -0
- data/lib/openapi_client/models/pdp_state_update.rb +238 -0
- data/lib/openapi_client/models/pdp_values.rb +252 -0
- data/lib/openapi_client/models/permission_level_role_read.rb +254 -0
- data/lib/openapi_client/models/policy_repo_create.rb +318 -0
- data/lib/openapi_client/models/policy_repo_read.rb +347 -0
- data/lib/openapi_client/models/policy_repo_status.rb +41 -0
- data/lib/openapi_client/models/programming_language.rb +43 -0
- data/lib/openapi_client/models/project_create.rb +318 -0
- data/lib/openapi_client/models/project_object.rb +295 -0
- data/lib/openapi_client/models/project_read.rb +357 -0
- data/lib/openapi_client/models/project_update.rb +250 -0
- data/lib/openapi_client/models/raw_data.rb +329 -0
- data/lib/openapi_client/models/relationship_tuple_object.rb +252 -0
- data/lib/openapi_client/models/remote_config.rb +256 -0
- data/lib/openapi_client/models/remove_role_permissions.rb +227 -0
- data/lib/openapi_client/models/resource_action_create.rb +271 -0
- data/lib/openapi_client/models/resource_action_read.rb +370 -0
- data/lib/openapi_client/models/resource_action_update.rb +230 -0
- data/lib/openapi_client/models/resource_attribute_create.rb +271 -0
- data/lib/openapi_client/models/resource_attribute_read.rb +370 -0
- data/lib/openapi_client/models/resource_attribute_update.rb +230 -0
- data/lib/openapi_client/models/resource_attributes.rb +238 -0
- data/lib/openapi_client/models/resource_create.rb +310 -0
- data/lib/openapi_client/models/resource_id.rb +230 -0
- data/lib/openapi_client/models/resource_instance_create.rb +281 -0
- data/lib/openapi_client/models/resource_instance_read.rb +375 -0
- data/lib/openapi_client/models/resource_instance_update.rb +220 -0
- data/lib/openapi_client/models/resource_read.rb +374 -0
- data/lib/openapi_client/models/resource_replace.rb +274 -0
- data/lib/openapi_client/models/resource_role_create.rb +295 -0
- data/lib/openapi_client/models/resource_role_read.rb +379 -0
- data/lib/openapi_client/models/resource_role_update.rb +254 -0
- data/lib/openapi_client/models/resource_type_object.rb +286 -0
- data/lib/openapi_client/models/resource_update.rb +264 -0
- data/lib/openapi_client/models/role_assignment_create.rb +255 -0
- data/lib/openapi_client/models/role_assignment_read.rb +375 -0
- data/lib/openapi_client/models/role_assignment_remove.rb +255 -0
- data/lib/openapi_client/models/role_block.rb +244 -0
- data/lib/openapi_client/models/role_create.rb +295 -0
- data/lib/openapi_client/models/role_data.rb +221 -0
- data/lib/openapi_client/models/role_read.rb +364 -0
- data/lib/openapi_client/models/role_update.rb +254 -0
- data/lib/openapi_client/models/settings.rb +231 -0
- data/lib/openapi_client/models/ssh_auth_data.rb +295 -0
- data/lib/openapi_client/models/statistics.rb +389 -0
- data/lib/openapi_client/models/tenant_create.rb +281 -0
- data/lib/openapi_client/models/tenant_object.rb +284 -0
- data/lib/openapi_client/models/tenant_read.rb +365 -0
- data/lib/openapi_client/models/tenant_update.rb +240 -0
- data/lib/openapi_client/models/user_create.rb +286 -0
- data/lib/openapi_client/models/user_data.rb +232 -0
- data/lib/openapi_client/models/user_login_request_input.rb +240 -0
- data/lib/openapi_client/models/user_object.rb +313 -0
- data/lib/openapi_client/models/user_read.rb +336 -0
- data/lib/openapi_client/models/user_role.rb +240 -0
- data/lib/openapi_client/models/user_role_create.rb +240 -0
- data/lib/openapi_client/models/user_role_remove.rb +240 -0
- data/lib/openapi_client/models/user_update.rb +250 -0
- data/lib/openapi_client/models/validation_error.rb +254 -0
- data/lib/openapi_client/models/webhook_create.rb +235 -0
- data/lib/openapi_client/models/webhook_read.rb +315 -0
- data/lib/openapi_client/models/webhook_update.rb +230 -0
- data/lib/openapi_client/version.rb +15 -0
- data/lib/openapi_client.rb +220 -0
- data/lib/permit.rb +58 -0
- metadata +251 -0
@@ -0,0 +1,458 @@
|
|
1
|
+
=begin
|
2
|
+
#Permit.io API
|
3
|
+
|
4
|
+
# Authorization as a service
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module OpenapiClient
|
16
|
+
class UserAttributesApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Create User Attribute
|
23
|
+
# Creates a new attribute for the User resource.
|
24
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
25
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
26
|
+
# @param resource_attribute_create [ResourceAttributeCreate]
|
27
|
+
# @param [Hash] opts the optional parameters
|
28
|
+
# @option opts [String] :resource_id (default to '__user')
|
29
|
+
# @return [ResourceAttributeRead]
|
30
|
+
def create_user_attribute(proj_id, env_id, resource_attribute_create, opts = {})
|
31
|
+
data, _status_code, _headers = create_user_attribute_with_http_info(proj_id, env_id, resource_attribute_create, opts)
|
32
|
+
data
|
33
|
+
end
|
34
|
+
|
35
|
+
# Create User Attribute
|
36
|
+
# Creates a new attribute for the User resource.
|
37
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
38
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
39
|
+
# @param resource_attribute_create [ResourceAttributeCreate]
|
40
|
+
# @param [Hash] opts the optional parameters
|
41
|
+
# @option opts [String] :resource_id (default to '__user')
|
42
|
+
# @return [Array<(ResourceAttributeRead, Integer, Hash)>] ResourceAttributeRead data, response status code and response headers
|
43
|
+
def create_user_attribute_with_http_info(proj_id, env_id, resource_attribute_create, opts = {})
|
44
|
+
if @api_client.config.debugging
|
45
|
+
@api_client.config.logger.debug 'Calling API: UserAttributesApi.create_user_attribute ...'
|
46
|
+
end
|
47
|
+
# verify the required parameter 'proj_id' is set
|
48
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
49
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UserAttributesApi.create_user_attribute"
|
50
|
+
end
|
51
|
+
# verify the required parameter 'env_id' is set
|
52
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
53
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UserAttributesApi.create_user_attribute"
|
54
|
+
end
|
55
|
+
# verify the required parameter 'resource_attribute_create' is set
|
56
|
+
if @api_client.config.client_side_validation && resource_attribute_create.nil?
|
57
|
+
fail ArgumentError, "Missing the required parameter 'resource_attribute_create' when calling UserAttributesApi.create_user_attribute"
|
58
|
+
end
|
59
|
+
# resource path
|
60
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/users/attributes'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
|
61
|
+
|
62
|
+
# query parameters
|
63
|
+
query_params = opts[:query_params] || {}
|
64
|
+
query_params[:'resource_id'] = opts[:'resource_id'] if !opts[:'resource_id'].nil?
|
65
|
+
|
66
|
+
# header parameters
|
67
|
+
header_params = opts[:header_params] || {}
|
68
|
+
# HTTP header 'Accept' (if needed)
|
69
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
70
|
+
# HTTP header 'Content-Type'
|
71
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
72
|
+
if !content_type.nil?
|
73
|
+
header_params['Content-Type'] = content_type
|
74
|
+
end
|
75
|
+
|
76
|
+
# form parameters
|
77
|
+
form_params = opts[:form_params] || {}
|
78
|
+
|
79
|
+
# http body (model)
|
80
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(resource_attribute_create)
|
81
|
+
|
82
|
+
# return_type
|
83
|
+
return_type = opts[:debug_return_type] || 'ResourceAttributeRead'
|
84
|
+
|
85
|
+
# auth_names
|
86
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
87
|
+
|
88
|
+
new_options = opts.merge(
|
89
|
+
:operation => :"UserAttributesApi.create_user_attribute",
|
90
|
+
:header_params => header_params,
|
91
|
+
:query_params => query_params,
|
92
|
+
:form_params => form_params,
|
93
|
+
:body => post_body,
|
94
|
+
:auth_names => auth_names,
|
95
|
+
:return_type => return_type
|
96
|
+
)
|
97
|
+
|
98
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
99
|
+
if @api_client.config.debugging
|
100
|
+
@api_client.config.logger.debug "API called: UserAttributesApi#create_user_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
101
|
+
end
|
102
|
+
return data, status_code, headers
|
103
|
+
end
|
104
|
+
|
105
|
+
# Delete User Attribute
|
106
|
+
# Deletes the attribute and all its related data. Note: If the attribute is used by policies, removing it will cause the attribute to evaluate as `undefined`.
|
107
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
108
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
109
|
+
# @param attribute_id [String] Either the unique id of the attribute, or the URL-friendly key of the attribute (i.e: the \"slug\").
|
110
|
+
# @param [Hash] opts the optional parameters
|
111
|
+
# @option opts [String] :resource_id (default to '__user')
|
112
|
+
# @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
|
113
|
+
# @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
|
114
|
+
# @return [nil]
|
115
|
+
def delete_user_attribute(proj_id, env_id, attribute_id, opts = {})
|
116
|
+
delete_user_attribute_with_http_info(proj_id, env_id, attribute_id, opts)
|
117
|
+
nil
|
118
|
+
end
|
119
|
+
|
120
|
+
# Delete User Attribute
|
121
|
+
# Deletes the attribute and all its related data. Note: If the attribute is used by policies, removing it will cause the attribute to evaluate as `undefined`.
|
122
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
123
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
124
|
+
# @param attribute_id [String] Either the unique id of the attribute, or the URL-friendly key of the attribute (i.e: the \"slug\").
|
125
|
+
# @param [Hash] opts the optional parameters
|
126
|
+
# @option opts [String] :resource_id (default to '__user')
|
127
|
+
# @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
|
128
|
+
# @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
|
129
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
130
|
+
def delete_user_attribute_with_http_info(proj_id, env_id, attribute_id, opts = {})
|
131
|
+
if @api_client.config.debugging
|
132
|
+
@api_client.config.logger.debug 'Calling API: UserAttributesApi.delete_user_attribute ...'
|
133
|
+
end
|
134
|
+
# verify the required parameter 'proj_id' is set
|
135
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
136
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UserAttributesApi.delete_user_attribute"
|
137
|
+
end
|
138
|
+
# verify the required parameter 'env_id' is set
|
139
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
140
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UserAttributesApi.delete_user_attribute"
|
141
|
+
end
|
142
|
+
# verify the required parameter 'attribute_id' is set
|
143
|
+
if @api_client.config.client_side_validation && attribute_id.nil?
|
144
|
+
fail ArgumentError, "Missing the required parameter 'attribute_id' when calling UserAttributesApi.delete_user_attribute"
|
145
|
+
end
|
146
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
147
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling UserAttributesApi.delete_user_attribute, must be greater than or equal to 1.'
|
148
|
+
end
|
149
|
+
|
150
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
|
151
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling UserAttributesApi.delete_user_attribute, must be smaller than or equal to 100.'
|
152
|
+
end
|
153
|
+
|
154
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
|
155
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling UserAttributesApi.delete_user_attribute, must be greater than or equal to 1.'
|
156
|
+
end
|
157
|
+
|
158
|
+
# resource path
|
159
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/users/attributes/{attribute_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'attribute_id' + '}', CGI.escape(attribute_id.to_s))
|
160
|
+
|
161
|
+
# query parameters
|
162
|
+
query_params = opts[:query_params] || {}
|
163
|
+
query_params[:'resource_id'] = opts[:'resource_id'] if !opts[:'resource_id'].nil?
|
164
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
165
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
166
|
+
|
167
|
+
# header parameters
|
168
|
+
header_params = opts[:header_params] || {}
|
169
|
+
# HTTP header 'Accept' (if needed)
|
170
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
171
|
+
|
172
|
+
# form parameters
|
173
|
+
form_params = opts[:form_params] || {}
|
174
|
+
|
175
|
+
# http body (model)
|
176
|
+
post_body = opts[:debug_body]
|
177
|
+
|
178
|
+
# return_type
|
179
|
+
return_type = opts[:debug_return_type]
|
180
|
+
|
181
|
+
# auth_names
|
182
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
183
|
+
|
184
|
+
new_options = opts.merge(
|
185
|
+
:operation => :"UserAttributesApi.delete_user_attribute",
|
186
|
+
:header_params => header_params,
|
187
|
+
:query_params => query_params,
|
188
|
+
:form_params => form_params,
|
189
|
+
:body => post_body,
|
190
|
+
:auth_names => auth_names,
|
191
|
+
:return_type => return_type
|
192
|
+
)
|
193
|
+
|
194
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
195
|
+
if @api_client.config.debugging
|
196
|
+
@api_client.config.logger.debug "API called: UserAttributesApi#delete_user_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
197
|
+
end
|
198
|
+
return data, status_code, headers
|
199
|
+
end
|
200
|
+
|
201
|
+
# Get User Attribute
|
202
|
+
# Gets a single attribute defined on the User resource, if such attribute exists.
|
203
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
204
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
205
|
+
# @param attribute_id [String] Either the unique id of the attribute, or the URL-friendly key of the attribute (i.e: the \"slug\").
|
206
|
+
# @param [Hash] opts the optional parameters
|
207
|
+
# @option opts [String] :resource_id (default to '__user')
|
208
|
+
# @return [ResourceAttributeRead]
|
209
|
+
def get_user_attribute(proj_id, env_id, attribute_id, opts = {})
|
210
|
+
data, _status_code, _headers = get_user_attribute_with_http_info(proj_id, env_id, attribute_id, opts)
|
211
|
+
data
|
212
|
+
end
|
213
|
+
|
214
|
+
# Get User Attribute
|
215
|
+
# Gets a single attribute defined on the User resource, if such attribute exists.
|
216
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
217
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
218
|
+
# @param attribute_id [String] Either the unique id of the attribute, or the URL-friendly key of the attribute (i.e: the \"slug\").
|
219
|
+
# @param [Hash] opts the optional parameters
|
220
|
+
# @option opts [String] :resource_id (default to '__user')
|
221
|
+
# @return [Array<(ResourceAttributeRead, Integer, Hash)>] ResourceAttributeRead data, response status code and response headers
|
222
|
+
def get_user_attribute_with_http_info(proj_id, env_id, attribute_id, opts = {})
|
223
|
+
if @api_client.config.debugging
|
224
|
+
@api_client.config.logger.debug 'Calling API: UserAttributesApi.get_user_attribute ...'
|
225
|
+
end
|
226
|
+
# verify the required parameter 'proj_id' is set
|
227
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
228
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UserAttributesApi.get_user_attribute"
|
229
|
+
end
|
230
|
+
# verify the required parameter 'env_id' is set
|
231
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
232
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UserAttributesApi.get_user_attribute"
|
233
|
+
end
|
234
|
+
# verify the required parameter 'attribute_id' is set
|
235
|
+
if @api_client.config.client_side_validation && attribute_id.nil?
|
236
|
+
fail ArgumentError, "Missing the required parameter 'attribute_id' when calling UserAttributesApi.get_user_attribute"
|
237
|
+
end
|
238
|
+
# resource path
|
239
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/users/attributes/{attribute_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'attribute_id' + '}', CGI.escape(attribute_id.to_s))
|
240
|
+
|
241
|
+
# query parameters
|
242
|
+
query_params = opts[:query_params] || {}
|
243
|
+
query_params[:'resource_id'] = opts[:'resource_id'] if !opts[:'resource_id'].nil?
|
244
|
+
|
245
|
+
# header parameters
|
246
|
+
header_params = opts[:header_params] || {}
|
247
|
+
# HTTP header 'Accept' (if needed)
|
248
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
249
|
+
|
250
|
+
# form parameters
|
251
|
+
form_params = opts[:form_params] || {}
|
252
|
+
|
253
|
+
# http body (model)
|
254
|
+
post_body = opts[:debug_body]
|
255
|
+
|
256
|
+
# return_type
|
257
|
+
return_type = opts[:debug_return_type] || 'ResourceAttributeRead'
|
258
|
+
|
259
|
+
# auth_names
|
260
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
261
|
+
|
262
|
+
new_options = opts.merge(
|
263
|
+
:operation => :"UserAttributesApi.get_user_attribute",
|
264
|
+
:header_params => header_params,
|
265
|
+
:query_params => query_params,
|
266
|
+
:form_params => form_params,
|
267
|
+
:body => post_body,
|
268
|
+
:auth_names => auth_names,
|
269
|
+
:return_type => return_type
|
270
|
+
)
|
271
|
+
|
272
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
273
|
+
if @api_client.config.debugging
|
274
|
+
@api_client.config.logger.debug "API called: UserAttributesApi#get_user_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
275
|
+
end
|
276
|
+
return data, status_code, headers
|
277
|
+
end
|
278
|
+
|
279
|
+
# List User Attributes
|
280
|
+
# Lists all the attributes defined on the User resource.
|
281
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
282
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
283
|
+
# @param [Hash] opts the optional parameters
|
284
|
+
# @option opts [String] :resource_id (default to '__user')
|
285
|
+
# @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
|
286
|
+
# @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
|
287
|
+
# @return [Array<ResourceAttributeRead>]
|
288
|
+
def list_user_attributes(proj_id, env_id, opts = {})
|
289
|
+
data, _status_code, _headers = list_user_attributes_with_http_info(proj_id, env_id, opts)
|
290
|
+
data
|
291
|
+
end
|
292
|
+
|
293
|
+
# List User Attributes
|
294
|
+
# Lists all the attributes defined on the User resource.
|
295
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
296
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
297
|
+
# @param [Hash] opts the optional parameters
|
298
|
+
# @option opts [String] :resource_id (default to '__user')
|
299
|
+
# @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
|
300
|
+
# @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
|
301
|
+
# @return [Array<(Array<ResourceAttributeRead>, Integer, Hash)>] Array<ResourceAttributeRead> data, response status code and response headers
|
302
|
+
def list_user_attributes_with_http_info(proj_id, env_id, opts = {})
|
303
|
+
if @api_client.config.debugging
|
304
|
+
@api_client.config.logger.debug 'Calling API: UserAttributesApi.list_user_attributes ...'
|
305
|
+
end
|
306
|
+
# verify the required parameter 'proj_id' is set
|
307
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
308
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UserAttributesApi.list_user_attributes"
|
309
|
+
end
|
310
|
+
# verify the required parameter 'env_id' is set
|
311
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
312
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UserAttributesApi.list_user_attributes"
|
313
|
+
end
|
314
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
315
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling UserAttributesApi.list_user_attributes, must be greater than or equal to 1.'
|
316
|
+
end
|
317
|
+
|
318
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
|
319
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling UserAttributesApi.list_user_attributes, must be smaller than or equal to 100.'
|
320
|
+
end
|
321
|
+
|
322
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
|
323
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling UserAttributesApi.list_user_attributes, must be greater than or equal to 1.'
|
324
|
+
end
|
325
|
+
|
326
|
+
# resource path
|
327
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/users/attributes'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
|
328
|
+
|
329
|
+
# query parameters
|
330
|
+
query_params = opts[:query_params] || {}
|
331
|
+
query_params[:'resource_id'] = opts[:'resource_id'] if !opts[:'resource_id'].nil?
|
332
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
333
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
334
|
+
|
335
|
+
# header parameters
|
336
|
+
header_params = opts[:header_params] || {}
|
337
|
+
# HTTP header 'Accept' (if needed)
|
338
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
339
|
+
|
340
|
+
# form parameters
|
341
|
+
form_params = opts[:form_params] || {}
|
342
|
+
|
343
|
+
# http body (model)
|
344
|
+
post_body = opts[:debug_body]
|
345
|
+
|
346
|
+
# return_type
|
347
|
+
return_type = opts[:debug_return_type] || 'Array<ResourceAttributeRead>'
|
348
|
+
|
349
|
+
# auth_names
|
350
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
351
|
+
|
352
|
+
new_options = opts.merge(
|
353
|
+
:operation => :"UserAttributesApi.list_user_attributes",
|
354
|
+
:header_params => header_params,
|
355
|
+
:query_params => query_params,
|
356
|
+
:form_params => form_params,
|
357
|
+
:body => post_body,
|
358
|
+
:auth_names => auth_names,
|
359
|
+
:return_type => return_type
|
360
|
+
)
|
361
|
+
|
362
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
363
|
+
if @api_client.config.debugging
|
364
|
+
@api_client.config.logger.debug "API called: UserAttributesApi#list_user_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
365
|
+
end
|
366
|
+
return data, status_code, headers
|
367
|
+
end
|
368
|
+
|
369
|
+
# Update User Attribute
|
370
|
+
# Partially updates the attribute defined on the User resource. Fields that will be provided will be completely overwritten.
|
371
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
372
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
373
|
+
# @param attribute_id [String] Either the unique id of the attribute, or the URL-friendly key of the attribute (i.e: the \"slug\").
|
374
|
+
# @param resource_attribute_update [ResourceAttributeUpdate]
|
375
|
+
# @param [Hash] opts the optional parameters
|
376
|
+
# @option opts [String] :resource_id (default to '__user')
|
377
|
+
# @return [ResourceAttributeRead]
|
378
|
+
def update_user_attribute(proj_id, env_id, attribute_id, resource_attribute_update, opts = {})
|
379
|
+
data, _status_code, _headers = update_user_attribute_with_http_info(proj_id, env_id, attribute_id, resource_attribute_update, opts)
|
380
|
+
data
|
381
|
+
end
|
382
|
+
|
383
|
+
# Update User Attribute
|
384
|
+
# Partially updates the attribute defined on the User resource. Fields that will be provided will be completely overwritten.
|
385
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
386
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
387
|
+
# @param attribute_id [String] Either the unique id of the attribute, or the URL-friendly key of the attribute (i.e: the \"slug\").
|
388
|
+
# @param resource_attribute_update [ResourceAttributeUpdate]
|
389
|
+
# @param [Hash] opts the optional parameters
|
390
|
+
# @option opts [String] :resource_id (default to '__user')
|
391
|
+
# @return [Array<(ResourceAttributeRead, Integer, Hash)>] ResourceAttributeRead data, response status code and response headers
|
392
|
+
def update_user_attribute_with_http_info(proj_id, env_id, attribute_id, resource_attribute_update, opts = {})
|
393
|
+
if @api_client.config.debugging
|
394
|
+
@api_client.config.logger.debug 'Calling API: UserAttributesApi.update_user_attribute ...'
|
395
|
+
end
|
396
|
+
# verify the required parameter 'proj_id' is set
|
397
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
398
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UserAttributesApi.update_user_attribute"
|
399
|
+
end
|
400
|
+
# verify the required parameter 'env_id' is set
|
401
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
402
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UserAttributesApi.update_user_attribute"
|
403
|
+
end
|
404
|
+
# verify the required parameter 'attribute_id' is set
|
405
|
+
if @api_client.config.client_side_validation && attribute_id.nil?
|
406
|
+
fail ArgumentError, "Missing the required parameter 'attribute_id' when calling UserAttributesApi.update_user_attribute"
|
407
|
+
end
|
408
|
+
# verify the required parameter 'resource_attribute_update' is set
|
409
|
+
if @api_client.config.client_side_validation && resource_attribute_update.nil?
|
410
|
+
fail ArgumentError, "Missing the required parameter 'resource_attribute_update' when calling UserAttributesApi.update_user_attribute"
|
411
|
+
end
|
412
|
+
# resource path
|
413
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/users/attributes/{attribute_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'attribute_id' + '}', CGI.escape(attribute_id.to_s))
|
414
|
+
|
415
|
+
# query parameters
|
416
|
+
query_params = opts[:query_params] || {}
|
417
|
+
query_params[:'resource_id'] = opts[:'resource_id'] if !opts[:'resource_id'].nil?
|
418
|
+
|
419
|
+
# header parameters
|
420
|
+
header_params = opts[:header_params] || {}
|
421
|
+
# HTTP header 'Accept' (if needed)
|
422
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
423
|
+
# HTTP header 'Content-Type'
|
424
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
425
|
+
if !content_type.nil?
|
426
|
+
header_params['Content-Type'] = content_type
|
427
|
+
end
|
428
|
+
|
429
|
+
# form parameters
|
430
|
+
form_params = opts[:form_params] || {}
|
431
|
+
|
432
|
+
# http body (model)
|
433
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(resource_attribute_update)
|
434
|
+
|
435
|
+
# return_type
|
436
|
+
return_type = opts[:debug_return_type] || 'ResourceAttributeRead'
|
437
|
+
|
438
|
+
# auth_names
|
439
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
440
|
+
|
441
|
+
new_options = opts.merge(
|
442
|
+
:operation => :"UserAttributesApi.update_user_attribute",
|
443
|
+
:header_params => header_params,
|
444
|
+
:query_params => query_params,
|
445
|
+
:form_params => form_params,
|
446
|
+
:body => post_body,
|
447
|
+
:auth_names => auth_names,
|
448
|
+
:return_type => return_type
|
449
|
+
)
|
450
|
+
|
451
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
452
|
+
if @api_client.config.debugging
|
453
|
+
@api_client.config.logger.debug "API called: UserAttributesApi#update_user_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
454
|
+
end
|
455
|
+
return data, status_code, headers
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|