losant_rest 2.1.1 → 2.2.0
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 +4 -4
- data/docs/_schemas.md +2158 -55
- data/docs/flow.md +1 -0
- data/docs/flowVersions.md +1 -0
- data/docs/flows.md +1 -0
- data/docs/userOauthClient.md +125 -0
- data/docs/userOauthClients.md +87 -0
- data/lib/platform_rest/client.rb +10 -2
- data/lib/platform_rest/flow.rb +2 -0
- data/lib/platform_rest/flow_versions.rb +2 -0
- data/lib/platform_rest/flows.rb +2 -0
- data/lib/platform_rest/user_oauth_client.rb +170 -0
- data/lib/platform_rest/user_oauth_clients.rb +132 -0
- data/lib/platform_rest/version.rb +1 -1
- data/lib/platform_rest.rb +2 -0
- data/schemas/apiTokenPost.json +11 -0
- data/schemas/applicationDashboardPost.json +142 -11
- data/schemas/dashboard.json +142 -11
- data/schemas/dashboardPatch.json +142 -11
- data/schemas/dashboardPost.json +142 -11
- data/schemas/dashboards.json +142 -11
- data/schemas/githubLogin.json +11 -0
- data/schemas/instance.json +6 -0
- data/schemas/instanceOrg.json +12 -0
- data/schemas/instanceOrgEntitlement.json +182 -0
- data/schemas/instanceOrgEntitlementSync.json +64 -0
- data/schemas/instanceOrgs.json +12 -0
- data/schemas/instanceSandbox.json +6 -0
- data/schemas/instanceSandboxes.json +6 -0
- data/schemas/instances.json +6 -0
- data/schemas/me.json +15 -0
- data/schemas/meEntitlements.json +194 -0
- data/schemas/mePatch.json +9 -0
- data/schemas/org.json +16 -0
- data/schemas/orgPost.json +4 -0
- data/schemas/orgs.json +16 -0
- data/schemas/samlResponse.json +11 -0
- data/schemas/userCredentials.json +11 -0
- data/schemas/userOauthClient.json +125 -0
- data/schemas/userOauthClientPatch.json +113 -0
- data/schemas/userOauthClientPost.json +117 -0
- data/schemas/userOauthClients.json +166 -0
- data/schemas/userPost.json +20 -0
- data/schemas/validateContextError.json +28 -0
- data/schemas/validateContextSuccess.json +28 -0
- metadata +12 -1
data/docs/flow.md
CHANGED
|
@@ -334,6 +334,7 @@ all.Application, all.Application.bounded, all.Organization, all.Organization.bou
|
|
|
334
334
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
|
335
335
|
| flowId | string | Y | ID associated with the flow | | 575ed18f7ae143cd83dc4aa6 |
|
|
336
336
|
| includeCustomNodes | string | N | If the result of the request should also include the details of any custom nodes referenced by the returned workflows | false | true |
|
|
337
|
+
| strictValidation | string | N | When true, perform stricter validation on node and trigger configuration | false | true |
|
|
337
338
|
| flow | [Workflow Patch](_schemas.md#workflow-patch) | Y | Object containing new properties of the flow | | [Workflow Patch Example](_schemas.md#workflow-patch-example) |
|
|
338
339
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
|
339
340
|
|
data/docs/flowVersions.md
CHANGED
|
@@ -130,6 +130,7 @@ all.Application, all.Application.bounded, all.Organization, all.Organization.bou
|
|
|
130
130
|
| flowVersion | [Workflow Version Post](_schemas.md#workflow-version-post) | Y | New flow version information | | [Workflow Version Post Example](_schemas.md#workflow-version-post-example) |
|
|
131
131
|
| includeCustomNodes | string | N | If the result of the request should also include the details of any custom nodes referenced by the returned workflows | false | true |
|
|
132
132
|
| allowReplacement | string | N | Allow replacement of an existing flow version with same version name | false | true |
|
|
133
|
+
| strictValidation | string | N | When true, perform stricter validation on node and trigger configuration | false | true |
|
|
133
134
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
|
134
135
|
|
|
135
136
|
#### Successful Responses
|
data/docs/flows.md
CHANGED
|
@@ -213,6 +213,7 @@ all.Application, all.Application.bounded, all.Organization, all.Organization.bou
|
|
|
213
213
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
|
214
214
|
| flow | [Workflow Post](_schemas.md#workflow-post) | Y | New flow information | | [Workflow Post Example](_schemas.md#workflow-post-example) |
|
|
215
215
|
| includeCustomNodes | string | N | If the result of the request should also include the details of any custom nodes referenced by the returned workflows | false | true |
|
|
216
|
+
| strictValidation | string | N | When true, perform stricter validation on node and trigger configuration | false | true |
|
|
216
217
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
|
217
218
|
|
|
218
219
|
#### Successful Responses
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# User Oauth Client Actions
|
|
2
|
+
|
|
3
|
+
Details on the various actions that can be performed on the
|
|
4
|
+
User Oauth Client resource, including the expected
|
|
5
|
+
parameters and the potential responses.
|
|
6
|
+
|
|
7
|
+
##### Contents
|
|
8
|
+
|
|
9
|
+
* [Delete](#delete)
|
|
10
|
+
* [Get](#get)
|
|
11
|
+
* [Patch](#patch)
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
## Delete
|
|
16
|
+
|
|
17
|
+
Deletes a private OAuth client
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
result = client.user_oauth_client.delete(clientId: my_client_id)
|
|
21
|
+
|
|
22
|
+
puts result
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
#### Authentication
|
|
26
|
+
The client must be configured with a valid api access token to call this
|
|
27
|
+
action. The token must include at least one of the following scopes:
|
|
28
|
+
all.User, only.User, userOauthClient.*, or userOauthClient.delete.
|
|
29
|
+
|
|
30
|
+
#### Available Parameters
|
|
31
|
+
|
|
32
|
+
| Name | Type | Required | Description | Default | Example |
|
|
33
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
|
34
|
+
| clientId | string | Y | ID associated with the OAuth client | | 575ec7417ae143cd83dc4a95 |
|
|
35
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
|
36
|
+
|
|
37
|
+
#### Successful Responses
|
|
38
|
+
|
|
39
|
+
| Code | Type | Description |
|
|
40
|
+
| ---- | ---- | ----------- |
|
|
41
|
+
| 200 | [Success](_schemas.md#success) | If OAuth client was successfully deleted |
|
|
42
|
+
|
|
43
|
+
#### Error Responses
|
|
44
|
+
|
|
45
|
+
| Code | Type | Description |
|
|
46
|
+
| ---- | ---- | ----------- |
|
|
47
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
|
48
|
+
| 404 | [Error](_schemas.md#error) | Error if OAuth client was not found |
|
|
49
|
+
|
|
50
|
+
<br/>
|
|
51
|
+
|
|
52
|
+
## Get
|
|
53
|
+
|
|
54
|
+
Retrieves information on a private OAuth client
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
result = client.user_oauth_client.get(clientId: my_client_id)
|
|
58
|
+
|
|
59
|
+
puts result
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### Authentication
|
|
63
|
+
The client must be configured with a valid api access token to call this
|
|
64
|
+
action. The token must include at least one of the following scopes:
|
|
65
|
+
all.User, all.User.bounded, all.User.read, only.User, only.User.bounded, only.User.read, userOauthClient.*, or userOauthClient.get.
|
|
66
|
+
|
|
67
|
+
#### Available Parameters
|
|
68
|
+
|
|
69
|
+
| Name | Type | Required | Description | Default | Example |
|
|
70
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
|
71
|
+
| clientId | string | Y | ID associated with the OAuth client | | 575ec7417ae143cd83dc4a95 |
|
|
72
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
|
73
|
+
|
|
74
|
+
#### Successful Responses
|
|
75
|
+
|
|
76
|
+
| Code | Type | Description |
|
|
77
|
+
| ---- | ---- | ----------- |
|
|
78
|
+
| 200 | [User OAuth Client](_schemas.md#user-oauth-client) | OAuth client information |
|
|
79
|
+
|
|
80
|
+
#### Error Responses
|
|
81
|
+
|
|
82
|
+
| Code | Type | Description |
|
|
83
|
+
| ---- | ---- | ----------- |
|
|
84
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
|
85
|
+
| 404 | [Error](_schemas.md#error) | Error if OAuth client was not found |
|
|
86
|
+
|
|
87
|
+
<br/>
|
|
88
|
+
|
|
89
|
+
## Patch
|
|
90
|
+
|
|
91
|
+
Updates information about a private OAuth client
|
|
92
|
+
|
|
93
|
+
```ruby
|
|
94
|
+
result = client.user_oauth_client.patch(
|
|
95
|
+
clientId: my_client_id,
|
|
96
|
+
oauthClient: my_oauth_client)
|
|
97
|
+
|
|
98
|
+
puts result
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Authentication
|
|
102
|
+
The client must be configured with a valid api access token to call this
|
|
103
|
+
action. The token must include at least one of the following scopes:
|
|
104
|
+
all.User, only.User, userOauthClient.*, or userOauthClient.patch.
|
|
105
|
+
|
|
106
|
+
#### Available Parameters
|
|
107
|
+
|
|
108
|
+
| Name | Type | Required | Description | Default | Example |
|
|
109
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
|
110
|
+
| clientId | string | Y | ID associated with the OAuth client | | 575ec7417ae143cd83dc4a95 |
|
|
111
|
+
| oauthClient | [User OAuth Client Patch](_schemas.md#user-oauth-client-patch) | Y | Object containing new properties of the OAuth client | | [User OAuth Client Patch Example](_schemas.md#user-oauth-client-patch-example) |
|
|
112
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
|
113
|
+
|
|
114
|
+
#### Successful Responses
|
|
115
|
+
|
|
116
|
+
| Code | Type | Description |
|
|
117
|
+
| ---- | ---- | ----------- |
|
|
118
|
+
| 200 | [User OAuth Client](_schemas.md#user-oauth-client) | Updated OAuth client information |
|
|
119
|
+
|
|
120
|
+
#### Error Responses
|
|
121
|
+
|
|
122
|
+
| Code | Type | Description |
|
|
123
|
+
| ---- | ---- | ----------- |
|
|
124
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
|
125
|
+
| 404 | [Error](_schemas.md#error) | Error if OAuth client was not found |
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# User Oauth Clients Actions
|
|
2
|
+
|
|
3
|
+
Details on the various actions that can be performed on the
|
|
4
|
+
User Oauth Clients resource, including the expected
|
|
5
|
+
parameters and the potential responses.
|
|
6
|
+
|
|
7
|
+
##### Contents
|
|
8
|
+
|
|
9
|
+
* [Get](#get)
|
|
10
|
+
* [Post](#post)
|
|
11
|
+
|
|
12
|
+
<br/>
|
|
13
|
+
|
|
14
|
+
## Get
|
|
15
|
+
|
|
16
|
+
Returns the private OAuth clients for a user
|
|
17
|
+
|
|
18
|
+
```ruby
|
|
19
|
+
result = client.user_oauth_clients.get(optional_params)
|
|
20
|
+
|
|
21
|
+
puts result
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
#### Authentication
|
|
25
|
+
The client must be configured with a valid api access token to call this
|
|
26
|
+
action. The token must include at least one of the following scopes:
|
|
27
|
+
all.User, all.User.bounded, all.User.read, only.User, only.User.bounded, only.User.read, userOauthClients.*, or userOauthClients.get.
|
|
28
|
+
|
|
29
|
+
#### Available Parameters
|
|
30
|
+
|
|
31
|
+
| Name | Type | Required | Description | Default | Example |
|
|
32
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
|
33
|
+
| sortField | string | N | Field to sort the results by. Accepted values are: client_name, id, creationDate, lastUpdated | client_name | client_name |
|
|
34
|
+
| sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
|
|
35
|
+
| page | string | N | Which page of results to return | 0 | 0 |
|
|
36
|
+
| perPage | string | N | How many items to return per page | 100 | 10 |
|
|
37
|
+
| filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: client_name | | client_name |
|
|
38
|
+
| filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my*app |
|
|
39
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
|
40
|
+
|
|
41
|
+
#### Successful Responses
|
|
42
|
+
|
|
43
|
+
| Code | Type | Description |
|
|
44
|
+
| ---- | ---- | ----------- |
|
|
45
|
+
| 200 | [User OAuth Clients](_schemas.md#user-oauth-clients) | Collection of private OAuth clients |
|
|
46
|
+
|
|
47
|
+
#### Error Responses
|
|
48
|
+
|
|
49
|
+
| Code | Type | Description |
|
|
50
|
+
| ---- | ---- | ----------- |
|
|
51
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
|
52
|
+
|
|
53
|
+
<br/>
|
|
54
|
+
|
|
55
|
+
## Post
|
|
56
|
+
|
|
57
|
+
Create a new private OAuth client for a user
|
|
58
|
+
|
|
59
|
+
```ruby
|
|
60
|
+
result = client.user_oauth_clients.post(oauthClient: my_oauth_client)
|
|
61
|
+
|
|
62
|
+
puts result
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Authentication
|
|
66
|
+
The client must be configured with a valid api access token to call this
|
|
67
|
+
action. The token must include at least one of the following scopes:
|
|
68
|
+
all.User, only.User, userOauthClients.*, or userOauthClients.post.
|
|
69
|
+
|
|
70
|
+
#### Available Parameters
|
|
71
|
+
|
|
72
|
+
| Name | Type | Required | Description | Default | Example |
|
|
73
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
|
74
|
+
| oauthClient | [User OAuth Client Post](_schemas.md#user-oauth-client-post) | Y | OAuth client information | | [User OAuth Client Post Example](_schemas.md#user-oauth-client-post-example) |
|
|
75
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
|
76
|
+
|
|
77
|
+
#### Successful Responses
|
|
78
|
+
|
|
79
|
+
| Code | Type | Description |
|
|
80
|
+
| ---- | ---- | ----------- |
|
|
81
|
+
| 201 | [User OAuth Client](_schemas.md#user-oauth-client) | The successfully created OAuth client. client_secret is only ever returned on this response. |
|
|
82
|
+
|
|
83
|
+
#### Error Responses
|
|
84
|
+
|
|
85
|
+
| Code | Type | Description |
|
|
86
|
+
| ---- | ---- | ----------- |
|
|
87
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
data/lib/platform_rest/client.rb
CHANGED
|
@@ -27,7 +27,7 @@ module PlatformRest
|
|
|
27
27
|
#
|
|
28
28
|
# User API for accessing platform data
|
|
29
29
|
#
|
|
30
|
-
# Built For Version 1.
|
|
30
|
+
# Built For Version 1.31.0
|
|
31
31
|
class Client
|
|
32
32
|
attr_accessor :auth_token, :url
|
|
33
33
|
|
|
@@ -416,6 +416,14 @@ module PlatformRest
|
|
|
416
416
|
@user_api_tokens ||= UserApiTokens.new(self)
|
|
417
417
|
end
|
|
418
418
|
|
|
419
|
+
def user_oauth_client
|
|
420
|
+
@user_oauth_client ||= UserOauthClient.new(self)
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
def user_oauth_clients
|
|
424
|
+
@user_oauth_clients ||= UserOauthClients.new(self)
|
|
425
|
+
end
|
|
426
|
+
|
|
419
427
|
def user_oauth_token
|
|
420
428
|
@user_oauth_token ||= UserOauthToken.new(self)
|
|
421
429
|
end
|
|
@@ -438,7 +446,7 @@ module PlatformRest
|
|
|
438
446
|
|
|
439
447
|
headers["Accept"] = "application/json"
|
|
440
448
|
headers["Content-Type"] = "application/json"
|
|
441
|
-
headers["Accept-Version"] = "^1.
|
|
449
|
+
headers["Accept-Version"] = "^1.31.0"
|
|
442
450
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
|
443
451
|
path = self.url + options.fetch(:path, "")
|
|
444
452
|
|
data/lib/platform_rest/flow.rb
CHANGED
|
@@ -383,6 +383,7 @@ module PlatformRest
|
|
|
383
383
|
# * {string} applicationId - ID associated with the application
|
|
384
384
|
# * {string} flowId - ID associated with the flow
|
|
385
385
|
# * {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
|
|
386
|
+
# * {string} strictValidation - When true, perform stricter validation on node and trigger configuration
|
|
386
387
|
# * {hash} flow - Object containing new properties of the flow (https://api.losant.com/#/definitions/flowPatch)
|
|
387
388
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
|
388
389
|
# * {boolean} _actions - Return resource actions in response
|
|
@@ -406,6 +407,7 @@ module PlatformRest
|
|
|
406
407
|
raise ArgumentError.new("flow is required") unless params.has_key?(:flow)
|
|
407
408
|
|
|
408
409
|
query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes)
|
|
410
|
+
query_params[:strictValidation] = params[:strictValidation] if params.has_key?(:strictValidation)
|
|
409
411
|
body = params[:flow] if params.has_key?(:flow)
|
|
410
412
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
|
411
413
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
@@ -158,6 +158,7 @@ module PlatformRest
|
|
|
158
158
|
# * {hash} flowVersion - New flow version information (https://api.losant.com/#/definitions/flowVersionPost)
|
|
159
159
|
# * {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
|
|
160
160
|
# * {string} allowReplacement - Allow replacement of an existing flow version with same version name
|
|
161
|
+
# * {string} strictValidation - When true, perform stricter validation on node and trigger configuration
|
|
161
162
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
|
162
163
|
# * {boolean} _actions - Return resource actions in response
|
|
163
164
|
# * {boolean} _links - Return resource link in response
|
|
@@ -182,6 +183,7 @@ module PlatformRest
|
|
|
182
183
|
body = params[:flowVersion] if params.has_key?(:flowVersion)
|
|
183
184
|
query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes)
|
|
184
185
|
query_params[:allowReplacement] = params[:allowReplacement] if params.has_key?(:allowReplacement)
|
|
186
|
+
query_params[:strictValidation] = params[:strictValidation] if params.has_key?(:strictValidation)
|
|
185
187
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
|
186
188
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
187
189
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
data/lib/platform_rest/flows.rb
CHANGED
|
@@ -269,6 +269,7 @@ module PlatformRest
|
|
|
269
269
|
# * {string} applicationId - ID associated with the application
|
|
270
270
|
# * {hash} flow - New flow information (https://api.losant.com/#/definitions/flowPost)
|
|
271
271
|
# * {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
|
|
272
|
+
# * {string} strictValidation - When true, perform stricter validation on node and trigger configuration
|
|
272
273
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
|
273
274
|
# * {boolean} _actions - Return resource actions in response
|
|
274
275
|
# * {boolean} _links - Return resource link in response
|
|
@@ -291,6 +292,7 @@ module PlatformRest
|
|
|
291
292
|
|
|
292
293
|
body = params[:flow] if params.has_key?(:flow)
|
|
293
294
|
query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes)
|
|
295
|
+
query_params[:strictValidation] = params[:strictValidation] if params.has_key?(:strictValidation)
|
|
294
296
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
|
295
297
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
296
298
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# The MIT License (MIT)
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2026 SUSE
|
|
4
|
+
#
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
# furnished to do so, subject to the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
# copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
# SOFTWARE.
|
|
22
|
+
|
|
23
|
+
require "json"
|
|
24
|
+
|
|
25
|
+
module PlatformRest
|
|
26
|
+
|
|
27
|
+
# Class containing all the actions for the User Oauth Client Resource
|
|
28
|
+
class UserOauthClient
|
|
29
|
+
|
|
30
|
+
def initialize(client)
|
|
31
|
+
@client = client
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Deletes a private OAuth client
|
|
35
|
+
#
|
|
36
|
+
# Authentication:
|
|
37
|
+
# The client must be configured with a valid api
|
|
38
|
+
# access token to call this action. The token
|
|
39
|
+
# must include at least one of the following scopes:
|
|
40
|
+
# all.User, only.User, userOauthClient.*, or userOauthClient.delete.
|
|
41
|
+
#
|
|
42
|
+
# Parameters:
|
|
43
|
+
# * {string} clientId - ID associated with the OAuth client
|
|
44
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
|
45
|
+
# * {boolean} _actions - Return resource actions in response
|
|
46
|
+
# * {boolean} _links - Return resource link in response
|
|
47
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
48
|
+
#
|
|
49
|
+
# Responses:
|
|
50
|
+
# * 200 - If OAuth client was successfully deleted (https://api.losant.com/#/definitions/success)
|
|
51
|
+
#
|
|
52
|
+
# Errors:
|
|
53
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
54
|
+
# * 404 - Error if OAuth client was not found (https://api.losant.com/#/definitions/error)
|
|
55
|
+
def delete(params = {})
|
|
56
|
+
params = Utils.symbolize_hash_keys(params)
|
|
57
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
58
|
+
headers = {}
|
|
59
|
+
body = nil
|
|
60
|
+
|
|
61
|
+
raise ArgumentError.new("clientId is required") unless params.has_key?(:clientId)
|
|
62
|
+
|
|
63
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
|
64
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
65
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
66
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
67
|
+
|
|
68
|
+
path = "/me/oauth-clients/#{params[:clientId]}"
|
|
69
|
+
|
|
70
|
+
@client.request(
|
|
71
|
+
method: :delete,
|
|
72
|
+
path: path,
|
|
73
|
+
query: query_params,
|
|
74
|
+
headers: headers,
|
|
75
|
+
body: body)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Retrieves information on a private OAuth client
|
|
79
|
+
#
|
|
80
|
+
# Authentication:
|
|
81
|
+
# The client must be configured with a valid api
|
|
82
|
+
# access token to call this action. The token
|
|
83
|
+
# must include at least one of the following scopes:
|
|
84
|
+
# all.User, all.User.bounded, all.User.read, only.User, only.User.bounded, only.User.read, userOauthClient.*, or userOauthClient.get.
|
|
85
|
+
#
|
|
86
|
+
# Parameters:
|
|
87
|
+
# * {string} clientId - ID associated with the OAuth client
|
|
88
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
|
89
|
+
# * {boolean} _actions - Return resource actions in response
|
|
90
|
+
# * {boolean} _links - Return resource link in response
|
|
91
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
92
|
+
#
|
|
93
|
+
# Responses:
|
|
94
|
+
# * 200 - OAuth client information (https://api.losant.com/#/definitions/userOauthClient)
|
|
95
|
+
#
|
|
96
|
+
# Errors:
|
|
97
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
98
|
+
# * 404 - Error if OAuth client was not found (https://api.losant.com/#/definitions/error)
|
|
99
|
+
def get(params = {})
|
|
100
|
+
params = Utils.symbolize_hash_keys(params)
|
|
101
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
102
|
+
headers = {}
|
|
103
|
+
body = nil
|
|
104
|
+
|
|
105
|
+
raise ArgumentError.new("clientId is required") unless params.has_key?(:clientId)
|
|
106
|
+
|
|
107
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
|
108
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
109
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
110
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
111
|
+
|
|
112
|
+
path = "/me/oauth-clients/#{params[:clientId]}"
|
|
113
|
+
|
|
114
|
+
@client.request(
|
|
115
|
+
method: :get,
|
|
116
|
+
path: path,
|
|
117
|
+
query: query_params,
|
|
118
|
+
headers: headers,
|
|
119
|
+
body: body)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Updates information about a private OAuth client
|
|
123
|
+
#
|
|
124
|
+
# Authentication:
|
|
125
|
+
# The client must be configured with a valid api
|
|
126
|
+
# access token to call this action. The token
|
|
127
|
+
# must include at least one of the following scopes:
|
|
128
|
+
# all.User, only.User, userOauthClient.*, or userOauthClient.patch.
|
|
129
|
+
#
|
|
130
|
+
# Parameters:
|
|
131
|
+
# * {string} clientId - ID associated with the OAuth client
|
|
132
|
+
# * {hash} oauthClient - Object containing new properties of the OAuth client (https://api.losant.com/#/definitions/userOauthClientPatch)
|
|
133
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
|
134
|
+
# * {boolean} _actions - Return resource actions in response
|
|
135
|
+
# * {boolean} _links - Return resource link in response
|
|
136
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
137
|
+
#
|
|
138
|
+
# Responses:
|
|
139
|
+
# * 200 - Updated OAuth client information (https://api.losant.com/#/definitions/userOauthClient)
|
|
140
|
+
#
|
|
141
|
+
# Errors:
|
|
142
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
143
|
+
# * 404 - Error if OAuth client was not found (https://api.losant.com/#/definitions/error)
|
|
144
|
+
def patch(params = {})
|
|
145
|
+
params = Utils.symbolize_hash_keys(params)
|
|
146
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
147
|
+
headers = {}
|
|
148
|
+
body = nil
|
|
149
|
+
|
|
150
|
+
raise ArgumentError.new("clientId is required") unless params.has_key?(:clientId)
|
|
151
|
+
raise ArgumentError.new("oauthClient is required") unless params.has_key?(:oauthClient)
|
|
152
|
+
|
|
153
|
+
body = params[:oauthClient] if params.has_key?(:oauthClient)
|
|
154
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
|
155
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
156
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
157
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
158
|
+
|
|
159
|
+
path = "/me/oauth-clients/#{params[:clientId]}"
|
|
160
|
+
|
|
161
|
+
@client.request(
|
|
162
|
+
method: :patch,
|
|
163
|
+
path: path,
|
|
164
|
+
query: query_params,
|
|
165
|
+
headers: headers,
|
|
166
|
+
body: body)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
end
|
|
170
|
+
end
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# The MIT License (MIT)
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2026 SUSE
|
|
4
|
+
#
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
# furnished to do so, subject to the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
# copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
# SOFTWARE.
|
|
22
|
+
|
|
23
|
+
require "json"
|
|
24
|
+
|
|
25
|
+
module PlatformRest
|
|
26
|
+
|
|
27
|
+
# Class containing all the actions for the User Oauth Clients Resource
|
|
28
|
+
class UserOauthClients
|
|
29
|
+
|
|
30
|
+
def initialize(client)
|
|
31
|
+
@client = client
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Returns the private OAuth clients for a user
|
|
35
|
+
#
|
|
36
|
+
# Authentication:
|
|
37
|
+
# The client must be configured with a valid api
|
|
38
|
+
# access token to call this action. The token
|
|
39
|
+
# must include at least one of the following scopes:
|
|
40
|
+
# all.User, all.User.bounded, all.User.read, only.User, only.User.bounded, only.User.read, userOauthClients.*, or userOauthClients.get.
|
|
41
|
+
#
|
|
42
|
+
# Parameters:
|
|
43
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: client_name, id, creationDate, lastUpdated
|
|
44
|
+
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
|
45
|
+
# * {string} page - Which page of results to return
|
|
46
|
+
# * {string} perPage - How many items to return per page
|
|
47
|
+
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: client_name
|
|
48
|
+
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
|
49
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
|
50
|
+
# * {boolean} _actions - Return resource actions in response
|
|
51
|
+
# * {boolean} _links - Return resource link in response
|
|
52
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
53
|
+
#
|
|
54
|
+
# Responses:
|
|
55
|
+
# * 200 - Collection of private OAuth clients (https://api.losant.com/#/definitions/userOauthClients)
|
|
56
|
+
#
|
|
57
|
+
# Errors:
|
|
58
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
59
|
+
def get(params = {})
|
|
60
|
+
params = Utils.symbolize_hash_keys(params)
|
|
61
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
62
|
+
headers = {}
|
|
63
|
+
body = nil
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
|
67
|
+
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
|
68
|
+
query_params[:page] = params[:page] if params.has_key?(:page)
|
|
69
|
+
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
|
70
|
+
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
|
71
|
+
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
|
72
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
|
73
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
74
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
75
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
76
|
+
|
|
77
|
+
path = "/me/oauth-clients"
|
|
78
|
+
|
|
79
|
+
@client.request(
|
|
80
|
+
method: :get,
|
|
81
|
+
path: path,
|
|
82
|
+
query: query_params,
|
|
83
|
+
headers: headers,
|
|
84
|
+
body: body)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Create a new private OAuth client for a user
|
|
88
|
+
#
|
|
89
|
+
# Authentication:
|
|
90
|
+
# The client must be configured with a valid api
|
|
91
|
+
# access token to call this action. The token
|
|
92
|
+
# must include at least one of the following scopes:
|
|
93
|
+
# all.User, only.User, userOauthClients.*, or userOauthClients.post.
|
|
94
|
+
#
|
|
95
|
+
# Parameters:
|
|
96
|
+
# * {hash} oauthClient - OAuth client information (https://api.losant.com/#/definitions/userOauthClientPost)
|
|
97
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
|
98
|
+
# * {boolean} _actions - Return resource actions in response
|
|
99
|
+
# * {boolean} _links - Return resource link in response
|
|
100
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
101
|
+
#
|
|
102
|
+
# Responses:
|
|
103
|
+
# * 201 - The successfully created OAuth client. client_secret is only ever returned on this response. (https://api.losant.com/#/definitions/userOauthClient)
|
|
104
|
+
#
|
|
105
|
+
# Errors:
|
|
106
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
107
|
+
def post(params = {})
|
|
108
|
+
params = Utils.symbolize_hash_keys(params)
|
|
109
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
110
|
+
headers = {}
|
|
111
|
+
body = nil
|
|
112
|
+
|
|
113
|
+
raise ArgumentError.new("oauthClient is required") unless params.has_key?(:oauthClient)
|
|
114
|
+
|
|
115
|
+
body = params[:oauthClient] if params.has_key?(:oauthClient)
|
|
116
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
|
117
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
118
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
119
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
120
|
+
|
|
121
|
+
path = "/me/oauth-clients"
|
|
122
|
+
|
|
123
|
+
@client.request(
|
|
124
|
+
method: :post,
|
|
125
|
+
path: path,
|
|
126
|
+
query: query_params,
|
|
127
|
+
headers: headers,
|
|
128
|
+
body: body)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
end
|
|
132
|
+
end
|
data/lib/platform_rest.rb
CHANGED
|
@@ -118,6 +118,8 @@ require_relative "platform_rest/resource_job"
|
|
|
118
118
|
require_relative "platform_rest/resource_jobs"
|
|
119
119
|
require_relative "platform_rest/user_api_token"
|
|
120
120
|
require_relative "platform_rest/user_api_tokens"
|
|
121
|
+
require_relative "platform_rest/user_oauth_client"
|
|
122
|
+
require_relative "platform_rest/user_oauth_clients"
|
|
121
123
|
require_relative "platform_rest/user_oauth_token"
|
|
122
124
|
require_relative "platform_rest/user_oauth_tokens"
|
|
123
125
|
require_relative "platform_rest/webhook"
|