authress-sdk 0.1.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/lib/swagger_client.rb +30 -0
  3. data/lib/swagger_client/api/access_records_api.rb +541 -0
  4. data/lib/swagger_client/api/accounts_api.rb +232 -0
  5. data/lib/swagger_client/api/metadata_api.rb +152 -0
  6. data/lib/swagger_client/api/resource_permissions_api.rb +250 -0
  7. data/lib/swagger_client/api/roles_api.rb +252 -0
  8. data/lib/swagger_client/api/service_clients_api.rb +418 -0
  9. data/lib/swagger_client/api/user_permissions_api.rb +340 -0
  10. data/lib/swagger_client/api_client.rb +388 -0
  11. data/lib/swagger_client/api_error.rb +57 -0
  12. data/lib/swagger_client/configuration.rb +205 -0
  13. data/lib/swagger_client/models/access_record.rb +351 -0
  14. data/lib/swagger_client/models/access_record_collection.rb +229 -0
  15. data/lib/swagger_client/models/access_record_collection_records.rb +351 -0
  16. data/lib/swagger_client/models/account.rb +268 -0
  17. data/lib/swagger_client/models/account_collection.rb +211 -0
  18. data/lib/swagger_client/models/account_collection_accounts.rb +268 -0
  19. data/lib/swagger_client/models/body.rb +236 -0
  20. data/lib/swagger_client/models/body_1.rb +229 -0
  21. data/lib/swagger_client/models/body_10.rb +246 -0
  22. data/lib/swagger_client/models/body_11.rb +246 -0
  23. data/lib/swagger_client/models/body_2.rb +213 -0
  24. data/lib/swagger_client/models/body_3.rb +351 -0
  25. data/lib/swagger_client/models/body_4.rb +351 -0
  26. data/lib/swagger_client/models/body_5.rb +225 -0
  27. data/lib/swagger_client/models/body_6.rb +255 -0
  28. data/lib/swagger_client/models/body_7.rb +255 -0
  29. data/lib/swagger_client/models/body_8.rb +227 -0
  30. data/lib/swagger_client/models/body_9.rb +223 -0
  31. data/lib/swagger_client/models/claim_request.rb +227 -0
  32. data/lib/swagger_client/models/claim_response.rb +197 -0
  33. data/lib/swagger_client/models/client.rb +246 -0
  34. data/lib/swagger_client/models/client_access_key.rb +242 -0
  35. data/lib/swagger_client/models/client_collection.rb +229 -0
  36. data/lib/swagger_client/models/client_collection_clients.rb +246 -0
  37. data/lib/swagger_client/models/identity.rb +228 -0
  38. data/lib/swagger_client/models/identity_collection.rb +213 -0
  39. data/lib/swagger_client/models/identity_collection_identities.rb +228 -0
  40. data/lib/swagger_client/models/identity_request.rb +223 -0
  41. data/lib/swagger_client/models/inline_response_200.rb +247 -0
  42. data/lib/swagger_client/models/inline_response_200_1.rb +236 -0
  43. data/lib/swagger_client/models/inline_response_200_10.rb +255 -0
  44. data/lib/swagger_client/models/inline_response_200_11.rb +211 -0
  45. data/lib/swagger_client/models/inline_response_200_12.rb +213 -0
  46. data/lib/swagger_client/models/inline_response_200_13.rb +229 -0
  47. data/lib/swagger_client/models/inline_response_200_14.rb +246 -0
  48. data/lib/swagger_client/models/inline_response_200_15.rb +242 -0
  49. data/lib/swagger_client/models/inline_response_200_2.rb +238 -0
  50. data/lib/swagger_client/models/inline_response_200_3.rb +260 -0
  51. data/lib/swagger_client/models/inline_response_200_4.rb +228 -0
  52. data/lib/swagger_client/models/inline_response_200_5.rb +213 -0
  53. data/lib/swagger_client/models/inline_response_200_6.rb +229 -0
  54. data/lib/swagger_client/models/inline_response_200_7.rb +229 -0
  55. data/lib/swagger_client/models/inline_response_200_8.rb +351 -0
  56. data/lib/swagger_client/models/inline_response_200_9.rb +268 -0
  57. data/lib/swagger_client/models/invite.rb +225 -0
  58. data/lib/swagger_client/models/link.rb +223 -0
  59. data/lib/swagger_client/models/metadata_object.rb +236 -0
  60. data/lib/swagger_client/models/permission_object.rb +258 -0
  61. data/lib/swagger_client/models/permission_response.rb +238 -0
  62. data/lib/swagger_client/models/resource_permission.rb +213 -0
  63. data/lib/swagger_client/models/resource_permission_collection.rb +228 -0
  64. data/lib/swagger_client/models/resource_permission_collection_links.rb +220 -0
  65. data/lib/swagger_client/models/resource_permission_collection_links_next.rb +223 -0
  66. data/lib/swagger_client/models/resource_permission_collection_resources.rb +213 -0
  67. data/lib/swagger_client/models/resource_users_collection.rb +229 -0
  68. data/lib/swagger_client/models/role.rb +255 -0
  69. data/lib/swagger_client/models/statement.rb +229 -0
  70. data/lib/swagger_client/models/token_request.rb +229 -0
  71. data/lib/swagger_client/models/user.rb +212 -0
  72. data/lib/swagger_client/models/user_resources.rb +247 -0
  73. data/lib/swagger_client/models/user_resources_resources.rb +207 -0
  74. data/lib/swagger_client/models/user_token.rb +260 -0
  75. data/lib/swagger_client/models/user_token_links.rb +211 -0
  76. data/lib/swagger_client/models/user_token_links_self.rb +223 -0
  77. data/lib/swagger_client/models/v1clients_options.rb +218 -0
  78. data/lib/swagger_client/models/v1records_account.rb +211 -0
  79. data/lib/swagger_client/models/v1records_links.rb +211 -0
  80. data/lib/swagger_client/models/v1records_links_self.rb +223 -0
  81. data/lib/swagger_client/models/v1records_users.rb +212 -0
  82. data/lib/swagger_client/models/v1resourcesresource_uri_permissions.rb +259 -0
  83. data/lib/swagger_client/models/v1roles_permissions.rb +258 -0
  84. data/lib/swagger_client/models/v1usersuser_idresourcesresource_urimetadata_account.rb +206 -0
  85. data/lib/swagger_client/models/v1usersuser_idtokens_resources.rb +212 -0
  86. data/lib/swagger_client/models/v1usersuser_idtokens_statements.rb +229 -0
  87. data/lib/swagger_client/version.rb +14 -0
  88. metadata +313 -0
@@ -0,0 +1,232 @@
1
+ =begin
2
+ #Authress
3
+
4
+ #<p> <h2>Authorization</h2> <p>Authorization for Authress is handled one of two different ways. Both mechanisms use oauth2 <i>Bearer</i> tokens.</p> <br> <h4>Identity Provider JWT</h4> <p>Hook up your preferred identity provider directly to Authress. Authress will verify JWTs sourced from that identify provider and allow direct integration with these APIs. Any OIDC JWT provider works, Google, Auth0, Okta, etc... With this mechanism your web app can make direct calls to the permissions API on behalf of your users. <br> <a href=\"https://authress.io/app/#/manage?focus=identity\">Link identity provider</a> </p> <br> <h4>Authress Clients</h4> <p>Regardless of using direct identity provider integration, with the API you can create Authress clients which can call any of the methods on the API. Your users won't be able to directly make API calls, all web app integrations must go through a service which stores the Authress private key. <br> <a href=\"https://authress.io/app/#/manage?focus=clients\">Create Authress service client</a> </p> <br> <h2>Usage</h2> <h4>Billable APIs</h4> <p>Most of the api available is completely free. Use it to populate your roles and configure your account. You'll only be charged for the ones marked as Billable.</p> <p><ul> <li><i class=\"far fa-fw fa-money-bill-alt text-primary\"></i> <span class=\"text-primary\">Billable</span> - <small>These APIs count as calls for your account and will be charged.</small></li> <li><i class=\"fas fa-fw fa-angle-double-right text-secondary\"></i> <span class=\"text-secondary\">Free</span> - <small>These are totally free.</small></li> <li><i class=\"fas fa-fw fa-balance-scale text-secondary\"></i> <span class=\"text-secondary\">Condition</span> - <small>Are conditionally free, see api methods for details.</small></li> </ul></p> <br> <h4>API Access</h4> <p>Access to the following APIs is based on Authress permissions, not the application permissions assigned in Authress to the application services. Each resource is tagged with the required permission <span class=\"badge badge-outline-secondary\">Action: Resource</span> </p>
5
+
6
+ OpenAPI spec version: v1
7
+ Contact: support@authress.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.23
10
+ =end
11
+
12
+ module SwaggerClient
13
+ class AccountsApi
14
+ attr_accessor :api_client
15
+
16
+ def initialize(api_client = ApiClient.default)
17
+ @api_client = api_client
18
+ end
19
+ # Get account information.
20
+ # Includes the original configuration information. <br><span class=\"badge badge-outline-secondary\">READ: Authress:Configuration</span>
21
+ # @param account_id The unique identifier for the account
22
+ # @param [Hash] opts the optional parameters
23
+ # @return [InlineResponse2009]
24
+ def get_account(account_id, opts = {})
25
+ data, _status_code, _headers = get_account_with_http_info(account_id, opts)
26
+ data
27
+ end
28
+
29
+ # Get account information.
30
+ # Includes the original configuration information. &lt;br&gt;&lt;span class&#x3D;\&quot;badge badge-outline-secondary\&quot;&gt;READ: Authress:Configuration&lt;/span&gt;
31
+ # @param account_id The unique identifier for the account
32
+ # @param [Hash] opts the optional parameters
33
+ # @return [Array<(InlineResponse2009, Integer, Hash)>] InlineResponse2009 data, response status code and response headers
34
+ def get_account_with_http_info(account_id, opts = {})
35
+ if @api_client.config.debugging
36
+ @api_client.config.logger.debug 'Calling API: AccountsApi.get_account ...'
37
+ end
38
+ # verify the required parameter 'account_id' is set
39
+ if @api_client.config.client_side_validation && account_id.nil?
40
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_account"
41
+ end
42
+ # resource path
43
+ local_var_path = '/v1/accounts/{accountId}'.sub('{' + 'accountId' + '}', account_id.to_s)
44
+
45
+ # query parameters
46
+ query_params = opts[:query_params] || {}
47
+
48
+ # header parameters
49
+ header_params = opts[:header_params] || {}
50
+ # HTTP header 'Accept' (if needed)
51
+ header_params['Accept'] = @api_client.select_header_accept(['application/links+json'])
52
+
53
+ # form parameters
54
+ form_params = opts[:form_params] || {}
55
+
56
+ # http body (model)
57
+ post_body = opts[:body]
58
+
59
+ return_type = opts[:return_type] || 'InlineResponse2009'
60
+
61
+ auth_names = opts[:auth_names] || ['oauth2']
62
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
63
+ :header_params => header_params,
64
+ :query_params => query_params,
65
+ :form_params => form_params,
66
+ :body => post_body,
67
+ :auth_names => auth_names,
68
+ :return_type => return_type)
69
+
70
+ if @api_client.config.debugging
71
+ @api_client.config.logger.debug "API called: AccountsApi#get_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
72
+ end
73
+ return data, status_code, headers
74
+ end
75
+ # Get all linked identities for this account.
76
+ # Returns a list of identities linked for this account. <br><span class=\"badge badge-outline-secondary\">READ: Authress:Configuration</span>
77
+ # @param [Hash] opts the optional parameters
78
+ # @return [InlineResponse20012]
79
+ def get_account_identities(opts = {})
80
+ data, _status_code, _headers = get_account_identities_with_http_info(opts)
81
+ data
82
+ end
83
+
84
+ # Get all linked identities for this account.
85
+ # Returns a list of identities linked for this account. &lt;br&gt;&lt;span class&#x3D;\&quot;badge badge-outline-secondary\&quot;&gt;READ: Authress:Configuration&lt;/span&gt;
86
+ # @param [Hash] opts the optional parameters
87
+ # @return [Array<(InlineResponse20012, Integer, Hash)>] InlineResponse20012 data, response status code and response headers
88
+ def get_account_identities_with_http_info(opts = {})
89
+ if @api_client.config.debugging
90
+ @api_client.config.logger.debug 'Calling API: AccountsApi.get_account_identities ...'
91
+ end
92
+ # resource path
93
+ local_var_path = '/v1/identities'
94
+
95
+ # query parameters
96
+ query_params = opts[:query_params] || {}
97
+
98
+ # header parameters
99
+ header_params = opts[:header_params] || {}
100
+ # HTTP header 'Accept' (if needed)
101
+ header_params['Accept'] = @api_client.select_header_accept(['application/links+json'])
102
+
103
+ # form parameters
104
+ form_params = opts[:form_params] || {}
105
+
106
+ # http body (model)
107
+ post_body = opts[:body]
108
+
109
+ return_type = opts[:return_type] || 'InlineResponse20012'
110
+
111
+ auth_names = opts[:auth_names] || ['oauth2']
112
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
113
+ :header_params => header_params,
114
+ :query_params => query_params,
115
+ :form_params => form_params,
116
+ :body => post_body,
117
+ :auth_names => auth_names,
118
+ :return_type => return_type)
119
+
120
+ if @api_client.config.debugging
121
+ @api_client.config.logger.debug "API called: AccountsApi#get_account_identities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
122
+ end
123
+ return data, status_code, headers
124
+ end
125
+ # Get all accounts user has access to
126
+ # Returns a list of accounts that the user has access to. <br><span class=\"badge badge-outline-secondary\">READ: Authress:Configuration</span>
127
+ # @param [Hash] opts the optional parameters
128
+ # @return [InlineResponse20011]
129
+ def get_accounts(opts = {})
130
+ data, _status_code, _headers = get_accounts_with_http_info(opts)
131
+ data
132
+ end
133
+
134
+ # Get all accounts user has access to
135
+ # Returns a list of accounts that the user has access to. &lt;br&gt;&lt;span class&#x3D;\&quot;badge badge-outline-secondary\&quot;&gt;READ: Authress:Configuration&lt;/span&gt;
136
+ # @param [Hash] opts the optional parameters
137
+ # @return [Array<(InlineResponse20011, Integer, Hash)>] InlineResponse20011 data, response status code and response headers
138
+ def get_accounts_with_http_info(opts = {})
139
+ if @api_client.config.debugging
140
+ @api_client.config.logger.debug 'Calling API: AccountsApi.get_accounts ...'
141
+ end
142
+ # resource path
143
+ local_var_path = '/v1/accounts'
144
+
145
+ # query parameters
146
+ query_params = opts[:query_params] || {}
147
+
148
+ # header parameters
149
+ header_params = opts[:header_params] || {}
150
+ # HTTP header 'Accept' (if needed)
151
+ header_params['Accept'] = @api_client.select_header_accept(['application/links+json'])
152
+
153
+ # form parameters
154
+ form_params = opts[:form_params] || {}
155
+
156
+ # http body (model)
157
+ post_body = opts[:body]
158
+
159
+ return_type = opts[:return_type] || 'InlineResponse20011'
160
+
161
+ auth_names = opts[:auth_names] || ['oauth2']
162
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
163
+ :header_params => header_params,
164
+ :query_params => query_params,
165
+ :form_params => form_params,
166
+ :body => post_body,
167
+ :auth_names => auth_names,
168
+ :return_type => return_type)
169
+
170
+ if @api_client.config.debugging
171
+ @api_client.config.logger.debug "API called: AccountsApi#get_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
172
+ end
173
+ return data, status_code, headers
174
+ end
175
+ # Link a new account identity.
176
+ # An identity is a JWT subscriber *sub* and issuer *iss*. Only one account my be linked to a particular JWT combination. Allows calling the API with a federated token directly instead of using a client access key. <br><span class=\"badge badge-outline-secondary\">UPDATE: Authress:Configuration</span>
177
+ # @param body
178
+ # @param [Hash] opts the optional parameters
179
+ # @return [nil]
180
+ def link_identity(body, opts = {})
181
+ link_identity_with_http_info(body, opts)
182
+ nil
183
+ end
184
+
185
+ # Link a new account identity.
186
+ # An identity is a JWT subscriber *sub* and issuer *iss*. Only one account my be linked to a particular JWT combination. Allows calling the API with a federated token directly instead of using a client access key. &lt;br&gt;&lt;span class&#x3D;\&quot;badge badge-outline-secondary\&quot;&gt;UPDATE: Authress:Configuration&lt;/span&gt;
187
+ # @param body
188
+ # @param [Hash] opts the optional parameters
189
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
190
+ def link_identity_with_http_info(body, opts = {})
191
+ if @api_client.config.debugging
192
+ @api_client.config.logger.debug 'Calling API: AccountsApi.link_identity ...'
193
+ end
194
+ # verify the required parameter 'body' is set
195
+ if @api_client.config.client_side_validation && body.nil?
196
+ fail ArgumentError, "Missing the required parameter 'body' when calling AccountsApi.link_identity"
197
+ end
198
+ # resource path
199
+ local_var_path = '/v1/identities'
200
+
201
+ # query parameters
202
+ query_params = opts[:query_params] || {}
203
+
204
+ # header parameters
205
+ header_params = opts[:header_params] || {}
206
+ # HTTP header 'Content-Type'
207
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
208
+
209
+ # form parameters
210
+ form_params = opts[:form_params] || {}
211
+
212
+ # http body (model)
213
+ post_body = opts[:body] || @api_client.object_to_http_body(body)
214
+
215
+ return_type = opts[:return_type]
216
+
217
+ auth_names = opts[:auth_names] || ['oauth2']
218
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
219
+ :header_params => header_params,
220
+ :query_params => query_params,
221
+ :form_params => form_params,
222
+ :body => post_body,
223
+ :auth_names => auth_names,
224
+ :return_type => return_type)
225
+
226
+ if @api_client.config.debugging
227
+ @api_client.config.logger.debug "API called: AccountsApi#link_identity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
228
+ end
229
+ return data, status_code, headers
230
+ end
231
+ end
232
+ end
@@ -0,0 +1,152 @@
1
+ =begin
2
+ #Authress
3
+
4
+ #<p> <h2>Authorization</h2> <p>Authorization for Authress is handled one of two different ways. Both mechanisms use oauth2 <i>Bearer</i> tokens.</p> <br> <h4>Identity Provider JWT</h4> <p>Hook up your preferred identity provider directly to Authress. Authress will verify JWTs sourced from that identify provider and allow direct integration with these APIs. Any OIDC JWT provider works, Google, Auth0, Okta, etc... With this mechanism your web app can make direct calls to the permissions API on behalf of your users. <br> <a href=\"https://authress.io/app/#/manage?focus=identity\">Link identity provider</a> </p> <br> <h4>Authress Clients</h4> <p>Regardless of using direct identity provider integration, with the API you can create Authress clients which can call any of the methods on the API. Your users won't be able to directly make API calls, all web app integrations must go through a service which stores the Authress private key. <br> <a href=\"https://authress.io/app/#/manage?focus=clients\">Create Authress service client</a> </p> <br> <h2>Usage</h2> <h4>Billable APIs</h4> <p>Most of the api available is completely free. Use it to populate your roles and configure your account. You'll only be charged for the ones marked as Billable.</p> <p><ul> <li><i class=\"far fa-fw fa-money-bill-alt text-primary\"></i> <span class=\"text-primary\">Billable</span> - <small>These APIs count as calls for your account and will be charged.</small></li> <li><i class=\"fas fa-fw fa-angle-double-right text-secondary\"></i> <span class=\"text-secondary\">Free</span> - <small>These are totally free.</small></li> <li><i class=\"fas fa-fw fa-balance-scale text-secondary\"></i> <span class=\"text-secondary\">Condition</span> - <small>Are conditionally free, see api methods for details.</small></li> </ul></p> <br> <h4>API Access</h4> <p>Access to the following APIs is based on Authress permissions, not the application permissions assigned in Authress to the application services. Each resource is tagged with the required permission <span class=\"badge badge-outline-secondary\">Action: Resource</span> </p>
5
+
6
+ OpenAPI spec version: v1
7
+ Contact: support@authress.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.23
10
+ =end
11
+
12
+ module SwaggerClient
13
+ class MetadataApi
14
+ attr_accessor :api_client
15
+
16
+ def initialize(api_client = ApiClient.default)
17
+ @api_client = api_client
18
+ end
19
+ # Get the metadata for a resource.
20
+ # <i class=\"far fa-money-bill-alt text-primary\"></i> <span class=\"text-primary\">Billable</span> Metadata is partitioned by the resource owner, and each can store independent data for a resource. This data is only accessible by identity provider tokens which specify the <strong>sub</strong> property and by service clients which have the <strong>grantMetadataAccess</strong> property. <br><span class=\"badge badge-outline-secondary\">READ: Authress:MetadataResources/{resourceUri}</span>
21
+ # @param user_id The owner of the data.
22
+ # @param resource_uri The resource the data is attached to.
23
+ # @param [Hash] opts the optional parameters
24
+ # @return [InlineResponse2001]
25
+ def get_user_metadata(user_id, resource_uri, opts = {})
26
+ data, _status_code, _headers = get_user_metadata_with_http_info(user_id, resource_uri, opts)
27
+ data
28
+ end
29
+
30
+ # Get the metadata for a resource.
31
+ # &lt;i class&#x3D;\&quot;far fa-money-bill-alt text-primary\&quot;&gt;&lt;/i&gt; &lt;span class&#x3D;\&quot;text-primary\&quot;&gt;Billable&lt;/span&gt; Metadata is partitioned by the resource owner, and each can store independent data for a resource. This data is only accessible by identity provider tokens which specify the &lt;strong&gt;sub&lt;/strong&gt; property and by service clients which have the &lt;strong&gt;grantMetadataAccess&lt;/strong&gt; property. &lt;br&gt;&lt;span class&#x3D;\&quot;badge badge-outline-secondary\&quot;&gt;READ: Authress:MetadataResources/{resourceUri}&lt;/span&gt;
32
+ # @param user_id The owner of the data.
33
+ # @param resource_uri The resource the data is attached to.
34
+ # @param [Hash] opts the optional parameters
35
+ # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
36
+ def get_user_metadata_with_http_info(user_id, resource_uri, opts = {})
37
+ if @api_client.config.debugging
38
+ @api_client.config.logger.debug 'Calling API: MetadataApi.get_user_metadata ...'
39
+ end
40
+ # verify the required parameter 'user_id' is set
41
+ if @api_client.config.client_side_validation && user_id.nil?
42
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling MetadataApi.get_user_metadata"
43
+ end
44
+ # verify the required parameter 'resource_uri' is set
45
+ if @api_client.config.client_side_validation && resource_uri.nil?
46
+ fail ArgumentError, "Missing the required parameter 'resource_uri' when calling MetadataApi.get_user_metadata"
47
+ end
48
+ # resource path
49
+ local_var_path = '/v1/users/{userId}/resources/{resourceUri}/metadata'.sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'resourceUri' + '}', resource_uri.to_s)
50
+
51
+ # query parameters
52
+ query_params = opts[:query_params] || {}
53
+
54
+ # header parameters
55
+ header_params = opts[:header_params] || {}
56
+ # HTTP header 'Accept' (if needed)
57
+ header_params['Accept'] = @api_client.select_header_accept(['application/links+json'])
58
+
59
+ # form parameters
60
+ form_params = opts[:form_params] || {}
61
+
62
+ # http body (model)
63
+ post_body = opts[:body]
64
+
65
+ return_type = opts[:return_type] || 'InlineResponse2001'
66
+
67
+ auth_names = opts[:auth_names] || ['oauth2']
68
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
69
+ :header_params => header_params,
70
+ :query_params => query_params,
71
+ :form_params => form_params,
72
+ :body => post_body,
73
+ :auth_names => auth_names,
74
+ :return_type => return_type)
75
+
76
+ if @api_client.config.debugging
77
+ @api_client.config.logger.debug "API called: MetadataApi#get_user_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
78
+ end
79
+ return data, status_code, headers
80
+ end
81
+ # Update the metadata for a resource.
82
+ # <i class=\"far fa-money-bill-alt text-primary\"></i> <span class=\"text-primary\">Billable</span> Each owner can store independent data for a resource. This data is only accessible by identity provider tokens which specify the <strong>sub</strong> property and by service clients which have the <strong>grantMetadataAccess</strong> property. The underlying resource does not need to actually exist in Authress to manage and update the data. <br><span class=\"badge badge-outline-secondary\">UPDATE: Authress:MetadataResources/{resourceUri}</span>
83
+ # @param body &lt;strong&gt;Important&lt;/strong&gt;: Data request object which contains properties identifying the data as well as the metadata itself. While there is limited access, the data saved here should be considered encrypted with best practices (Encrypted in Transit and Encrypted at Rest only). However, while Authress will to store and access in the data in a safe way, usage of this endpoint affirms this data must be application data and not user data. If there are explicit regulations or compliances regarding the data and how it should be saved here, this endpoint must not be used. That includes, but is not limited to--user personal data, data that is protected by GDPR and similar data protection regulations.
84
+ # @param user_id The owner of the data.
85
+ # @param resource_uri The resource the data is attached to.
86
+ # @param [Hash] opts the optional parameters
87
+ # @return [InlineResponse2001]
88
+ def update_user_metadata(body, user_id, resource_uri, opts = {})
89
+ data, _status_code, _headers = update_user_metadata_with_http_info(body, user_id, resource_uri, opts)
90
+ data
91
+ end
92
+
93
+ # Update the metadata for a resource.
94
+ # &lt;i class&#x3D;\&quot;far fa-money-bill-alt text-primary\&quot;&gt;&lt;/i&gt; &lt;span class&#x3D;\&quot;text-primary\&quot;&gt;Billable&lt;/span&gt; Each owner can store independent data for a resource. This data is only accessible by identity provider tokens which specify the &lt;strong&gt;sub&lt;/strong&gt; property and by service clients which have the &lt;strong&gt;grantMetadataAccess&lt;/strong&gt; property. The underlying resource does not need to actually exist in Authress to manage and update the data. &lt;br&gt;&lt;span class&#x3D;\&quot;badge badge-outline-secondary\&quot;&gt;UPDATE: Authress:MetadataResources/{resourceUri}&lt;/span&gt;
95
+ # @param body &lt;strong&gt;Important&lt;/strong&gt;: Data request object which contains properties identifying the data as well as the metadata itself. While there is limited access, the data saved here should be considered encrypted with best practices (Encrypted in Transit and Encrypted at Rest only). However, while Authress will to store and access in the data in a safe way, usage of this endpoint affirms this data must be application data and not user data. If there are explicit regulations or compliances regarding the data and how it should be saved here, this endpoint must not be used. That includes, but is not limited to--user personal data, data that is protected by GDPR and similar data protection regulations.
96
+ # @param user_id The owner of the data.
97
+ # @param resource_uri The resource the data is attached to.
98
+ # @param [Hash] opts the optional parameters
99
+ # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
100
+ def update_user_metadata_with_http_info(body, user_id, resource_uri, opts = {})
101
+ if @api_client.config.debugging
102
+ @api_client.config.logger.debug 'Calling API: MetadataApi.update_user_metadata ...'
103
+ end
104
+ # verify the required parameter 'body' is set
105
+ if @api_client.config.client_side_validation && body.nil?
106
+ fail ArgumentError, "Missing the required parameter 'body' when calling MetadataApi.update_user_metadata"
107
+ end
108
+ # verify the required parameter 'user_id' is set
109
+ if @api_client.config.client_side_validation && user_id.nil?
110
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling MetadataApi.update_user_metadata"
111
+ end
112
+ # verify the required parameter 'resource_uri' is set
113
+ if @api_client.config.client_side_validation && resource_uri.nil?
114
+ fail ArgumentError, "Missing the required parameter 'resource_uri' when calling MetadataApi.update_user_metadata"
115
+ end
116
+ # resource path
117
+ local_var_path = '/v1/users/{userId}/resources/{resourceUri}/metadata'.sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'resourceUri' + '}', resource_uri.to_s)
118
+
119
+ # query parameters
120
+ query_params = opts[:query_params] || {}
121
+
122
+ # header parameters
123
+ header_params = opts[:header_params] || {}
124
+ # HTTP header 'Accept' (if needed)
125
+ header_params['Accept'] = @api_client.select_header_accept(['application/links+json'])
126
+ # HTTP header 'Content-Type'
127
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
128
+
129
+ # form parameters
130
+ form_params = opts[:form_params] || {}
131
+
132
+ # http body (model)
133
+ post_body = opts[:body] || @api_client.object_to_http_body(body)
134
+
135
+ return_type = opts[:return_type] || 'InlineResponse2001'
136
+
137
+ auth_names = opts[:auth_names] || ['oauth2']
138
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
139
+ :header_params => header_params,
140
+ :query_params => query_params,
141
+ :form_params => form_params,
142
+ :body => post_body,
143
+ :auth_names => auth_names,
144
+ :return_type => return_type)
145
+
146
+ if @api_client.config.debugging
147
+ @api_client.config.logger.debug "API called: MetadataApi#update_user_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
148
+ end
149
+ return data, status_code, headers
150
+ end
151
+ end
152
+ end
@@ -0,0 +1,250 @@
1
+ =begin
2
+ #Authress
3
+
4
+ #<p> <h2>Authorization</h2> <p>Authorization for Authress is handled one of two different ways. Both mechanisms use oauth2 <i>Bearer</i> tokens.</p> <br> <h4>Identity Provider JWT</h4> <p>Hook up your preferred identity provider directly to Authress. Authress will verify JWTs sourced from that identify provider and allow direct integration with these APIs. Any OIDC JWT provider works, Google, Auth0, Okta, etc... With this mechanism your web app can make direct calls to the permissions API on behalf of your users. <br> <a href=\"https://authress.io/app/#/manage?focus=identity\">Link identity provider</a> </p> <br> <h4>Authress Clients</h4> <p>Regardless of using direct identity provider integration, with the API you can create Authress clients which can call any of the methods on the API. Your users won't be able to directly make API calls, all web app integrations must go through a service which stores the Authress private key. <br> <a href=\"https://authress.io/app/#/manage?focus=clients\">Create Authress service client</a> </p> <br> <h2>Usage</h2> <h4>Billable APIs</h4> <p>Most of the api available is completely free. Use it to populate your roles and configure your account. You'll only be charged for the ones marked as Billable.</p> <p><ul> <li><i class=\"far fa-fw fa-money-bill-alt text-primary\"></i> <span class=\"text-primary\">Billable</span> - <small>These APIs count as calls for your account and will be charged.</small></li> <li><i class=\"fas fa-fw fa-angle-double-right text-secondary\"></i> <span class=\"text-secondary\">Free</span> - <small>These are totally free.</small></li> <li><i class=\"fas fa-fw fa-balance-scale text-secondary\"></i> <span class=\"text-secondary\">Condition</span> - <small>Are conditionally free, see api methods for details.</small></li> </ul></p> <br> <h4>API Access</h4> <p>Access to the following APIs is based on Authress permissions, not the application permissions assigned in Authress to the application services. Each resource is tagged with the required permission <span class=\"badge badge-outline-secondary\">Action: Resource</span> </p>
5
+
6
+ OpenAPI spec version: v1
7
+ Contact: support@authress.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.23
10
+ =end
11
+
12
+ module SwaggerClient
13
+ class ResourcePermissionsApi
14
+ attr_accessor :api_client
15
+
16
+ def initialize(api_client = ApiClient.default)
17
+ @api_client = api_client
18
+ end
19
+ # Get a resource permissions object.
20
+ # Permissions can be set globally at a resource level. This will apply to all users in an account. <br><span class=\"badge badge-outline-secondary\">GRANT *: Authress:ResourcePermissions/{resourceUri}</span>
21
+ # @param resource_uri The uri path of a resource to validate, must be URL encoded, uri segments are allowed.
22
+ # @param [Hash] opts the optional parameters
23
+ # @return [InlineResponse2005]
24
+ def get_resource_permissions(resource_uri, opts = {})
25
+ data, _status_code, _headers = get_resource_permissions_with_http_info(resource_uri, opts)
26
+ data
27
+ end
28
+
29
+ # Get a resource permissions object.
30
+ # Permissions can be set globally at a resource level. This will apply to all users in an account. &lt;br&gt;&lt;span class&#x3D;\&quot;badge badge-outline-secondary\&quot;&gt;GRANT *: Authress:ResourcePermissions/{resourceUri}&lt;/span&gt;
31
+ # @param resource_uri The uri path of a resource to validate, must be URL encoded, uri segments are allowed.
32
+ # @param [Hash] opts the optional parameters
33
+ # @return [Array<(InlineResponse2005, Integer, Hash)>] InlineResponse2005 data, response status code and response headers
34
+ def get_resource_permissions_with_http_info(resource_uri, opts = {})
35
+ if @api_client.config.debugging
36
+ @api_client.config.logger.debug 'Calling API: ResourcePermissionsApi.get_resource_permissions ...'
37
+ end
38
+ # verify the required parameter 'resource_uri' is set
39
+ if @api_client.config.client_side_validation && resource_uri.nil?
40
+ fail ArgumentError, "Missing the required parameter 'resource_uri' when calling ResourcePermissionsApi.get_resource_permissions"
41
+ end
42
+ # resource path
43
+ local_var_path = '/v1/resources/{resourceUri}'.sub('{' + 'resourceUri' + '}', resource_uri.to_s)
44
+
45
+ # query parameters
46
+ query_params = opts[:query_params] || {}
47
+
48
+ # header parameters
49
+ header_params = opts[:header_params] || {}
50
+ # HTTP header 'Accept' (if needed)
51
+ header_params['Accept'] = @api_client.select_header_accept(['application/links+json'])
52
+
53
+ # form parameters
54
+ form_params = opts[:form_params] || {}
55
+
56
+ # http body (model)
57
+ post_body = opts[:body]
58
+
59
+ return_type = opts[:return_type] || 'InlineResponse2005'
60
+
61
+ auth_names = opts[:auth_names] || ['oauth2']
62
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
63
+ :header_params => header_params,
64
+ :query_params => query_params,
65
+ :form_params => form_params,
66
+ :body => post_body,
67
+ :auth_names => auth_names,
68
+ :return_type => return_type)
69
+
70
+ if @api_client.config.debugging
71
+ @api_client.config.logger.debug "API called: ResourcePermissionsApi#get_resource_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
72
+ end
73
+ return data, status_code, headers
74
+ end
75
+ # Get the users that have explicit access to this resource.
76
+ # <i class=\"far fa-money-bill-alt text-primary\"></i> <span class=\"text-primary\">Billable</span> Get the resource users. This result is a list of users that have some permission to the resource. Users with access to higher level resources nor users with access only to a sub-resource, will not be returned in this result. In the case that the resource has multiple users, the list will be paginated. <br><span class=\"badge badge-outline-secondary\">READ: Authress:UserPermissions/{userId}</span><span class=\"badge badge-outline-secondary\">GRANT *: Authress:ResourcePermissions/{resourceUri}</span>
77
+ # @param resource_uri The uri path of a resource to validate, must be URL encoded, uri segments are allowed.
78
+ # @param [Hash] opts the optional parameters
79
+ # @option opts [Integer] :limit Max number of results to return (default to 20)
80
+ # @option opts [String] :cursor Continuation cursor for paging (will automatically be set)
81
+ # @return [InlineResponse2006]
82
+ def get_resource_users(resource_uri, opts = {})
83
+ data, _status_code, _headers = get_resource_users_with_http_info(resource_uri, opts)
84
+ data
85
+ end
86
+
87
+ # Get the users that have explicit access to this resource.
88
+ # &lt;i class&#x3D;\&quot;far fa-money-bill-alt text-primary\&quot;&gt;&lt;/i&gt; &lt;span class&#x3D;\&quot;text-primary\&quot;&gt;Billable&lt;/span&gt; Get the resource users. This result is a list of users that have some permission to the resource. Users with access to higher level resources nor users with access only to a sub-resource, will not be returned in this result. In the case that the resource has multiple users, the list will be paginated. &lt;br&gt;&lt;span class&#x3D;\&quot;badge badge-outline-secondary\&quot;&gt;READ: Authress:UserPermissions/{userId}&lt;/span&gt;&lt;span class&#x3D;\&quot;badge badge-outline-secondary\&quot;&gt;GRANT *: Authress:ResourcePermissions/{resourceUri}&lt;/span&gt;
89
+ # @param resource_uri The uri path of a resource to validate, must be URL encoded, uri segments are allowed.
90
+ # @param [Hash] opts the optional parameters
91
+ # @option opts [Integer] :limit Max number of results to return
92
+ # @option opts [String] :cursor Continuation cursor for paging (will automatically be set)
93
+ # @return [Array<(InlineResponse2006, Integer, Hash)>] InlineResponse2006 data, response status code and response headers
94
+ def get_resource_users_with_http_info(resource_uri, opts = {})
95
+ if @api_client.config.debugging
96
+ @api_client.config.logger.debug 'Calling API: ResourcePermissionsApi.get_resource_users ...'
97
+ end
98
+ # verify the required parameter 'resource_uri' is set
99
+ if @api_client.config.client_side_validation && resource_uri.nil?
100
+ fail ArgumentError, "Missing the required parameter 'resource_uri' when calling ResourcePermissionsApi.get_resource_users"
101
+ end
102
+ # resource path
103
+ local_var_path = '/v1/resources/{resourceUri}/users'.sub('{' + 'resourceUri' + '}', resource_uri.to_s)
104
+
105
+ # query parameters
106
+ query_params = opts[:query_params] || {}
107
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
108
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
109
+
110
+ # header parameters
111
+ header_params = opts[:header_params] || {}
112
+ # HTTP header 'Accept' (if needed)
113
+ header_params['Accept'] = @api_client.select_header_accept(['application/links+json'])
114
+
115
+ # form parameters
116
+ form_params = opts[:form_params] || {}
117
+
118
+ # http body (model)
119
+ post_body = opts[:body]
120
+
121
+ return_type = opts[:return_type] || 'InlineResponse2006'
122
+
123
+ auth_names = opts[:auth_names] || ['oauth2']
124
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
125
+ :header_params => header_params,
126
+ :query_params => query_params,
127
+ :form_params => form_params,
128
+ :body => post_body,
129
+ :auth_names => auth_names,
130
+ :return_type => return_type)
131
+
132
+ if @api_client.config.debugging
133
+ @api_client.config.logger.debug "API called: ResourcePermissionsApi#get_resource_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
134
+ end
135
+ return data, status_code, headers
136
+ end
137
+ # List resource configurations.
138
+ # Permissions can be set globally at a resource level. Lists any resources with a globally set resource policy. <br><span class=\"badge badge-outline-secondary\">READ: Authress:ResourcePermissions</span>
139
+ # @param [Hash] opts the optional parameters
140
+ # @return [InlineResponse2004]
141
+ def get_resources(opts = {})
142
+ data, _status_code, _headers = get_resources_with_http_info(opts)
143
+ data
144
+ end
145
+
146
+ # List resource configurations.
147
+ # Permissions can be set globally at a resource level. Lists any resources with a globally set resource policy. &lt;br&gt;&lt;span class&#x3D;\&quot;badge badge-outline-secondary\&quot;&gt;READ: Authress:ResourcePermissions&lt;/span&gt;
148
+ # @param [Hash] opts the optional parameters
149
+ # @return [Array<(InlineResponse2004, Integer, Hash)>] InlineResponse2004 data, response status code and response headers
150
+ def get_resources_with_http_info(opts = {})
151
+ if @api_client.config.debugging
152
+ @api_client.config.logger.debug 'Calling API: ResourcePermissionsApi.get_resources ...'
153
+ end
154
+ # resource path
155
+ local_var_path = '/v1/resources'
156
+
157
+ # query parameters
158
+ query_params = opts[:query_params] || {}
159
+
160
+ # header parameters
161
+ header_params = opts[:header_params] || {}
162
+ # HTTP header 'Accept' (if needed)
163
+ header_params['Accept'] = @api_client.select_header_accept(['application/links+json'])
164
+
165
+ # form parameters
166
+ form_params = opts[:form_params] || {}
167
+
168
+ # http body (model)
169
+ post_body = opts[:body]
170
+
171
+ return_type = opts[:return_type] || 'InlineResponse2004'
172
+
173
+ auth_names = opts[:auth_names] || ['oauth2']
174
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
175
+ :header_params => header_params,
176
+ :query_params => query_params,
177
+ :form_params => form_params,
178
+ :body => post_body,
179
+ :auth_names => auth_names,
180
+ :return_type => return_type)
181
+
182
+ if @api_client.config.debugging
183
+ @api_client.config.logger.debug "API called: ResourcePermissionsApi#get_resources\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
184
+ end
185
+ return data, status_code, headers
186
+ end
187
+ # Update a resource permissions object.
188
+ # Updates the global permissions on a resource. This applies to all users in an account. <br><span class=\"badge badge-outline-secondary\">GRANT *: Authress:ResourcePermissions/{resourceUri}</span>
189
+ # @param body The contents of the permission to set on the resource. Overwrites existing data.
190
+ # @param resource_uri The uri path of a resource to validate, must be URL encoded, uri segments are allowed.
191
+ # @param [Hash] opts the optional parameters
192
+ # @return [nil]
193
+ def update_resource_permissions(body, resource_uri, opts = {})
194
+ update_resource_permissions_with_http_info(body, resource_uri, opts)
195
+ nil
196
+ end
197
+
198
+ # Update a resource permissions object.
199
+ # Updates the global permissions on a resource. This applies to all users in an account. &lt;br&gt;&lt;span class&#x3D;\&quot;badge badge-outline-secondary\&quot;&gt;GRANT *: Authress:ResourcePermissions/{resourceUri}&lt;/span&gt;
200
+ # @param body The contents of the permission to set on the resource. Overwrites existing data.
201
+ # @param resource_uri The uri path of a resource to validate, must be URL encoded, uri segments are allowed.
202
+ # @param [Hash] opts the optional parameters
203
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
204
+ def update_resource_permissions_with_http_info(body, resource_uri, opts = {})
205
+ if @api_client.config.debugging
206
+ @api_client.config.logger.debug 'Calling API: ResourcePermissionsApi.update_resource_permissions ...'
207
+ end
208
+ # verify the required parameter 'body' is set
209
+ if @api_client.config.client_side_validation && body.nil?
210
+ fail ArgumentError, "Missing the required parameter 'body' when calling ResourcePermissionsApi.update_resource_permissions"
211
+ end
212
+ # verify the required parameter 'resource_uri' is set
213
+ if @api_client.config.client_side_validation && resource_uri.nil?
214
+ fail ArgumentError, "Missing the required parameter 'resource_uri' when calling ResourcePermissionsApi.update_resource_permissions"
215
+ end
216
+ # resource path
217
+ local_var_path = '/v1/resources/{resourceUri}'.sub('{' + 'resourceUri' + '}', resource_uri.to_s)
218
+
219
+ # query parameters
220
+ query_params = opts[:query_params] || {}
221
+
222
+ # header parameters
223
+ header_params = opts[:header_params] || {}
224
+ # HTTP header 'Content-Type'
225
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
226
+
227
+ # form parameters
228
+ form_params = opts[:form_params] || {}
229
+
230
+ # http body (model)
231
+ post_body = opts[:body] || @api_client.object_to_http_body(body)
232
+
233
+ return_type = opts[:return_type]
234
+
235
+ auth_names = opts[:auth_names] || ['oauth2']
236
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
237
+ :header_params => header_params,
238
+ :query_params => query_params,
239
+ :form_params => form_params,
240
+ :body => post_body,
241
+ :auth_names => auth_names,
242
+ :return_type => return_type)
243
+
244
+ if @api_client.config.debugging
245
+ @api_client.config.logger.debug "API called: ResourcePermissionsApi#update_resource_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
246
+ end
247
+ return data, status_code, headers
248
+ end
249
+ end
250
+ end