yalla_auth_ruby_client 1.0.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.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +111 -0
  4. data/Rakefile +10 -0
  5. data/docs/App.md +32 -0
  6. data/docs/AppsApi.md +399 -0
  7. data/docs/AuthApi.md +70 -0
  8. data/docs/AuthValidateTokenGet200Response.md +20 -0
  9. data/docs/Role.md +34 -0
  10. data/docs/User.md +30 -0
  11. data/docs/UserAppAdd.md +18 -0
  12. data/docs/UserRoleAdd.md +24 -0
  13. data/docs/UsersApi.md +531 -0
  14. data/git_push.sh +57 -0
  15. data/lib/openapi_client/api/apps_api.rb +439 -0
  16. data/lib/openapi_client/api/auth_api.rb +84 -0
  17. data/lib/openapi_client/api/users_api.rb +587 -0
  18. data/lib/openapi_client/api_client.rb +392 -0
  19. data/lib/openapi_client/api_error.rb +58 -0
  20. data/lib/openapi_client/configuration.rb +311 -0
  21. data/lib/openapi_client/models/app.rb +283 -0
  22. data/lib/openapi_client/models/auth_validate_token_get200_response.rb +229 -0
  23. data/lib/openapi_client/models/role.rb +292 -0
  24. data/lib/openapi_client/models/user.rb +274 -0
  25. data/lib/openapi_client/models/user_app_add.rb +220 -0
  26. data/lib/openapi_client/models/user_role_add.rb +247 -0
  27. data/lib/openapi_client/version.rb +15 -0
  28. data/lib/openapi_client.rb +48 -0
  29. data/spec/api/apps_api_spec.rb +108 -0
  30. data/spec/api/auth_api_spec.rb +46 -0
  31. data/spec/api/users_api_spec.rb +134 -0
  32. data/spec/models/app_spec.rb +78 -0
  33. data/spec/models/auth_validate_token_get200_response_spec.rb +42 -0
  34. data/spec/models/role_spec.rb +84 -0
  35. data/spec/models/user_app_add_spec.rb +36 -0
  36. data/spec/models/user_role_add_spec.rb +54 -0
  37. data/spec/models/user_spec.rb +72 -0
  38. data/spec/spec_helper.rb +111 -0
  39. data/yalla_auth_ruby_client.gemspec +39 -0
  40. metadata +128 -0
data/docs/User.md ADDED
@@ -0,0 +1,30 @@
1
+ # OpenapiClient::User
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **Integer** | | [optional] |
8
+ | **avatar** | **String** | | [optional] |
9
+ | **email** | **String** | | [optional] |
10
+ | **first_name** | **String** | | [optional] |
11
+ | **last_name** | **String** | | [optional] |
12
+ | **phone** | **String** | | [optional] |
13
+ | **confirmed_at** | **String** | | [optional] |
14
+
15
+ ## Example
16
+
17
+ ```ruby
18
+ require 'openapi_client'
19
+
20
+ instance = OpenapiClient::User.new(
21
+ id: 1,
22
+ avatar: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA...,
23
+ email: user@example.com,
24
+ first_name: John,
25
+ last_name: Doe,
26
+ phone: 33611893544,
27
+ confirmed_at: 2025-01-17T16:36:53.664Z
28
+ )
29
+ ```
30
+
@@ -0,0 +1,18 @@
1
+ # OpenapiClient::UserAppAdd
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'openapi_client'
13
+
14
+ instance = OpenapiClient::UserAppAdd.new(
15
+ id: id
16
+ )
17
+ ```
18
+
@@ -0,0 +1,24 @@
1
+ # OpenapiClient::UserRoleAdd
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **role** | **String** | | [optional] |
8
+ | **app** | **String** | | [optional] |
9
+ | **related_user** | **String** | | [optional] |
10
+ | **related_role** | **String** | | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'openapi_client'
16
+
17
+ instance = OpenapiClient::UserRoleAdd.new(
18
+ role: APP_ACCESS,
19
+ app: jsontools,
20
+ related_user: null,
21
+ related_role: null
22
+ )
23
+ ```
24
+
data/docs/UsersApi.md ADDED
@@ -0,0 +1,531 @@
1
+ # OpenapiClient::UsersApi
2
+
3
+ All URIs are relative to *http://127.0.0.1:3085*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**add_role_to_user**](UsersApi.md#add_role_to_user) | **POST** /api/v1/users/{user_id}/roles | add role to user |
8
+ | [**delete_role_from_user**](UsersApi.md#delete_role_from_user) | **DELETE** /api/v1/users/{user_id}/roles/{role_id} | delete role |
9
+ | [**delete_user**](UsersApi.md#delete_user) | **DELETE** /api/v1/users/{id} | delete user |
10
+ | [**get_user**](UsersApi.md#get_user) | **GET** /api/v1/users/{id} | show user |
11
+ | [**get_user_roles**](UsersApi.md#get_user_roles) | **GET** /api/v1/users/{user_id}/roles | list roles of a user |
12
+ | [**get_users**](UsersApi.md#get_users) | **GET** /api/v1/users | list users |
13
+ | [**patch_user**](UsersApi.md#patch_user) | **PATCH** /api/v1/users/{id} | update user |
14
+ | [**update_user**](UsersApi.md#update_user) | **PUT** /api/v1/users/{id} | update user |
15
+
16
+
17
+ ## add_role_to_user
18
+
19
+ > add_role_to_user(user_id, access_token, opts)
20
+
21
+ add role to user
22
+
23
+ ### Examples
24
+
25
+ ```ruby
26
+ require 'time'
27
+ require 'openapi_client'
28
+
29
+ api_instance = OpenapiClient::UsersApi.new
30
+ user_id = 'user_id_example' # String | id
31
+ access_token = 'access_token_example' # String |
32
+ opts = {
33
+ user_role_add: OpenapiClient::UserRoleAdd.new # UserRoleAdd |
34
+ }
35
+
36
+ begin
37
+ # add role to user
38
+ api_instance.add_role_to_user(user_id, access_token, opts)
39
+ rescue OpenapiClient::ApiError => e
40
+ puts "Error when calling UsersApi->add_role_to_user: #{e}"
41
+ end
42
+ ```
43
+
44
+ #### Using the add_role_to_user_with_http_info variant
45
+
46
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
47
+
48
+ > <Array(nil, Integer, Hash)> add_role_to_user_with_http_info(user_id, access_token, opts)
49
+
50
+ ```ruby
51
+ begin
52
+ # add role to user
53
+ data, status_code, headers = api_instance.add_role_to_user_with_http_info(user_id, access_token, opts)
54
+ p status_code # => 2xx
55
+ p headers # => { ... }
56
+ p data # => nil
57
+ rescue OpenapiClient::ApiError => e
58
+ puts "Error when calling UsersApi->add_role_to_user_with_http_info: #{e}"
59
+ end
60
+ ```
61
+
62
+ ### Parameters
63
+
64
+ | Name | Type | Description | Notes |
65
+ | ---- | ---- | ----------- | ----- |
66
+ | **user_id** | **String** | id | |
67
+ | **access_token** | **String** | | |
68
+ | **user_role_add** | [**UserRoleAdd**](UserRoleAdd.md) | | [optional] |
69
+
70
+ ### Return type
71
+
72
+ nil (empty response body)
73
+
74
+ ### Authorization
75
+
76
+ No authorization required
77
+
78
+ ### HTTP request headers
79
+
80
+ - **Content-Type**: application/json
81
+ - **Accept**: application/json
82
+
83
+
84
+ ## delete_role_from_user
85
+
86
+ > delete_role_from_user(access_token, user_id, role_id)
87
+
88
+ delete role
89
+
90
+ ### Examples
91
+
92
+ ```ruby
93
+ require 'time'
94
+ require 'openapi_client'
95
+
96
+ api_instance = OpenapiClient::UsersApi.new
97
+ access_token = 'access_token_example' # String |
98
+ user_id = 'user_id_example' # String | id
99
+ role_id = 'role_id_example' # String | id
100
+
101
+ begin
102
+ # delete role
103
+ api_instance.delete_role_from_user(access_token, user_id, role_id)
104
+ rescue OpenapiClient::ApiError => e
105
+ puts "Error when calling UsersApi->delete_role_from_user: #{e}"
106
+ end
107
+ ```
108
+
109
+ #### Using the delete_role_from_user_with_http_info variant
110
+
111
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
112
+
113
+ > <Array(nil, Integer, Hash)> delete_role_from_user_with_http_info(access_token, user_id, role_id)
114
+
115
+ ```ruby
116
+ begin
117
+ # delete role
118
+ data, status_code, headers = api_instance.delete_role_from_user_with_http_info(access_token, user_id, role_id)
119
+ p status_code # => 2xx
120
+ p headers # => { ... }
121
+ p data # => nil
122
+ rescue OpenapiClient::ApiError => e
123
+ puts "Error when calling UsersApi->delete_role_from_user_with_http_info: #{e}"
124
+ end
125
+ ```
126
+
127
+ ### Parameters
128
+
129
+ | Name | Type | Description | Notes |
130
+ | ---- | ---- | ----------- | ----- |
131
+ | **access_token** | **String** | | |
132
+ | **user_id** | **String** | id | |
133
+ | **role_id** | **String** | id | |
134
+
135
+ ### Return type
136
+
137
+ nil (empty response body)
138
+
139
+ ### Authorization
140
+
141
+ No authorization required
142
+
143
+ ### HTTP request headers
144
+
145
+ - **Content-Type**: Not defined
146
+ - **Accept**: application/json
147
+
148
+
149
+ ## delete_user
150
+
151
+ > delete_user(id, access_token)
152
+
153
+ delete user
154
+
155
+ ### Examples
156
+
157
+ ```ruby
158
+ require 'time'
159
+ require 'openapi_client'
160
+
161
+ api_instance = OpenapiClient::UsersApi.new
162
+ id = 'id_example' # String | id
163
+ access_token = 'access_token_example' # String |
164
+
165
+ begin
166
+ # delete user
167
+ api_instance.delete_user(id, access_token)
168
+ rescue OpenapiClient::ApiError => e
169
+ puts "Error when calling UsersApi->delete_user: #{e}"
170
+ end
171
+ ```
172
+
173
+ #### Using the delete_user_with_http_info variant
174
+
175
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
176
+
177
+ > <Array(nil, Integer, Hash)> delete_user_with_http_info(id, access_token)
178
+
179
+ ```ruby
180
+ begin
181
+ # delete user
182
+ data, status_code, headers = api_instance.delete_user_with_http_info(id, access_token)
183
+ p status_code # => 2xx
184
+ p headers # => { ... }
185
+ p data # => nil
186
+ rescue OpenapiClient::ApiError => e
187
+ puts "Error when calling UsersApi->delete_user_with_http_info: #{e}"
188
+ end
189
+ ```
190
+
191
+ ### Parameters
192
+
193
+ | Name | Type | Description | Notes |
194
+ | ---- | ---- | ----------- | ----- |
195
+ | **id** | **String** | id | |
196
+ | **access_token** | **String** | | |
197
+
198
+ ### Return type
199
+
200
+ nil (empty response body)
201
+
202
+ ### Authorization
203
+
204
+ No authorization required
205
+
206
+ ### HTTP request headers
207
+
208
+ - **Content-Type**: Not defined
209
+ - **Accept**: application/json
210
+
211
+
212
+ ## get_user
213
+
214
+ > get_user(access_token, id)
215
+
216
+ show user
217
+
218
+ ### Examples
219
+
220
+ ```ruby
221
+ require 'time'
222
+ require 'openapi_client'
223
+
224
+ api_instance = OpenapiClient::UsersApi.new
225
+ access_token = 'access_token_example' # String |
226
+ id = 'id_example' # String | id
227
+
228
+ begin
229
+ # show user
230
+ api_instance.get_user(access_token, id)
231
+ rescue OpenapiClient::ApiError => e
232
+ puts "Error when calling UsersApi->get_user: #{e}"
233
+ end
234
+ ```
235
+
236
+ #### Using the get_user_with_http_info variant
237
+
238
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
239
+
240
+ > <Array(nil, Integer, Hash)> get_user_with_http_info(access_token, id)
241
+
242
+ ```ruby
243
+ begin
244
+ # show user
245
+ data, status_code, headers = api_instance.get_user_with_http_info(access_token, id)
246
+ p status_code # => 2xx
247
+ p headers # => { ... }
248
+ p data # => nil
249
+ rescue OpenapiClient::ApiError => e
250
+ puts "Error when calling UsersApi->get_user_with_http_info: #{e}"
251
+ end
252
+ ```
253
+
254
+ ### Parameters
255
+
256
+ | Name | Type | Description | Notes |
257
+ | ---- | ---- | ----------- | ----- |
258
+ | **access_token** | **String** | | |
259
+ | **id** | **String** | id | |
260
+
261
+ ### Return type
262
+
263
+ nil (empty response body)
264
+
265
+ ### Authorization
266
+
267
+ No authorization required
268
+
269
+ ### HTTP request headers
270
+
271
+ - **Content-Type**: Not defined
272
+ - **Accept**: application/json
273
+
274
+
275
+ ## get_user_roles
276
+
277
+ > get_user_roles(access_token, user_id)
278
+
279
+ list roles of a user
280
+
281
+ ### Examples
282
+
283
+ ```ruby
284
+ require 'time'
285
+ require 'openapi_client'
286
+
287
+ api_instance = OpenapiClient::UsersApi.new
288
+ access_token = 'access_token_example' # String |
289
+ user_id = 'user_id_example' # String | id
290
+
291
+ begin
292
+ # list roles of a user
293
+ api_instance.get_user_roles(access_token, user_id)
294
+ rescue OpenapiClient::ApiError => e
295
+ puts "Error when calling UsersApi->get_user_roles: #{e}"
296
+ end
297
+ ```
298
+
299
+ #### Using the get_user_roles_with_http_info variant
300
+
301
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
302
+
303
+ > <Array(nil, Integer, Hash)> get_user_roles_with_http_info(access_token, user_id)
304
+
305
+ ```ruby
306
+ begin
307
+ # list roles of a user
308
+ data, status_code, headers = api_instance.get_user_roles_with_http_info(access_token, user_id)
309
+ p status_code # => 2xx
310
+ p headers # => { ... }
311
+ p data # => nil
312
+ rescue OpenapiClient::ApiError => e
313
+ puts "Error when calling UsersApi->get_user_roles_with_http_info: #{e}"
314
+ end
315
+ ```
316
+
317
+ ### Parameters
318
+
319
+ | Name | Type | Description | Notes |
320
+ | ---- | ---- | ----------- | ----- |
321
+ | **access_token** | **String** | | |
322
+ | **user_id** | **String** | id | |
323
+
324
+ ### Return type
325
+
326
+ nil (empty response body)
327
+
328
+ ### Authorization
329
+
330
+ No authorization required
331
+
332
+ ### HTTP request headers
333
+
334
+ - **Content-Type**: Not defined
335
+ - **Accept**: application/json
336
+
337
+
338
+ ## get_users
339
+
340
+ > get_users(access_token)
341
+
342
+ list users
343
+
344
+ ### Examples
345
+
346
+ ```ruby
347
+ require 'time'
348
+ require 'openapi_client'
349
+
350
+ api_instance = OpenapiClient::UsersApi.new
351
+ access_token = 'access_token_example' # String |
352
+
353
+ begin
354
+ # list users
355
+ api_instance.get_users(access_token)
356
+ rescue OpenapiClient::ApiError => e
357
+ puts "Error when calling UsersApi->get_users: #{e}"
358
+ end
359
+ ```
360
+
361
+ #### Using the get_users_with_http_info variant
362
+
363
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
364
+
365
+ > <Array(nil, Integer, Hash)> get_users_with_http_info(access_token)
366
+
367
+ ```ruby
368
+ begin
369
+ # list users
370
+ data, status_code, headers = api_instance.get_users_with_http_info(access_token)
371
+ p status_code # => 2xx
372
+ p headers # => { ... }
373
+ p data # => nil
374
+ rescue OpenapiClient::ApiError => e
375
+ puts "Error when calling UsersApi->get_users_with_http_info: #{e}"
376
+ end
377
+ ```
378
+
379
+ ### Parameters
380
+
381
+ | Name | Type | Description | Notes |
382
+ | ---- | ---- | ----------- | ----- |
383
+ | **access_token** | **String** | | |
384
+
385
+ ### Return type
386
+
387
+ nil (empty response body)
388
+
389
+ ### Authorization
390
+
391
+ No authorization required
392
+
393
+ ### HTTP request headers
394
+
395
+ - **Content-Type**: Not defined
396
+ - **Accept**: application/json
397
+
398
+
399
+ ## patch_user
400
+
401
+ > patch_user(id, access_token, opts)
402
+
403
+ update user
404
+
405
+ ### Examples
406
+
407
+ ```ruby
408
+ require 'time'
409
+ require 'openapi_client'
410
+
411
+ api_instance = OpenapiClient::UsersApi.new
412
+ id = 'id_example' # String | id
413
+ access_token = 'access_token_example' # String |
414
+ opts = {
415
+ user: OpenapiClient::User.new # User |
416
+ }
417
+
418
+ begin
419
+ # update user
420
+ api_instance.patch_user(id, access_token, opts)
421
+ rescue OpenapiClient::ApiError => e
422
+ puts "Error when calling UsersApi->patch_user: #{e}"
423
+ end
424
+ ```
425
+
426
+ #### Using the patch_user_with_http_info variant
427
+
428
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
429
+
430
+ > <Array(nil, Integer, Hash)> patch_user_with_http_info(id, access_token, opts)
431
+
432
+ ```ruby
433
+ begin
434
+ # update user
435
+ data, status_code, headers = api_instance.patch_user_with_http_info(id, access_token, opts)
436
+ p status_code # => 2xx
437
+ p headers # => { ... }
438
+ p data # => nil
439
+ rescue OpenapiClient::ApiError => e
440
+ puts "Error when calling UsersApi->patch_user_with_http_info: #{e}"
441
+ end
442
+ ```
443
+
444
+ ### Parameters
445
+
446
+ | Name | Type | Description | Notes |
447
+ | ---- | ---- | ----------- | ----- |
448
+ | **id** | **String** | id | |
449
+ | **access_token** | **String** | | |
450
+ | **user** | [**User**](User.md) | | [optional] |
451
+
452
+ ### Return type
453
+
454
+ nil (empty response body)
455
+
456
+ ### Authorization
457
+
458
+ No authorization required
459
+
460
+ ### HTTP request headers
461
+
462
+ - **Content-Type**: application/json
463
+ - **Accept**: application/json
464
+
465
+
466
+ ## update_user
467
+
468
+ > update_user(id, access_token, opts)
469
+
470
+ update user
471
+
472
+ ### Examples
473
+
474
+ ```ruby
475
+ require 'time'
476
+ require 'openapi_client'
477
+
478
+ api_instance = OpenapiClient::UsersApi.new
479
+ id = 'id_example' # String | id
480
+ access_token = 'access_token_example' # String |
481
+ opts = {
482
+ user: OpenapiClient::User.new # User |
483
+ }
484
+
485
+ begin
486
+ # update user
487
+ api_instance.update_user(id, access_token, opts)
488
+ rescue OpenapiClient::ApiError => e
489
+ puts "Error when calling UsersApi->update_user: #{e}"
490
+ end
491
+ ```
492
+
493
+ #### Using the update_user_with_http_info variant
494
+
495
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
496
+
497
+ > <Array(nil, Integer, Hash)> update_user_with_http_info(id, access_token, opts)
498
+
499
+ ```ruby
500
+ begin
501
+ # update user
502
+ data, status_code, headers = api_instance.update_user_with_http_info(id, access_token, opts)
503
+ p status_code # => 2xx
504
+ p headers # => { ... }
505
+ p data # => nil
506
+ rescue OpenapiClient::ApiError => e
507
+ puts "Error when calling UsersApi->update_user_with_http_info: #{e}"
508
+ end
509
+ ```
510
+
511
+ ### Parameters
512
+
513
+ | Name | Type | Description | Notes |
514
+ | ---- | ---- | ----------- | ----- |
515
+ | **id** | **String** | id | |
516
+ | **access_token** | **String** | | |
517
+ | **user** | [**User**](User.md) | | [optional] |
518
+
519
+ ### Return type
520
+
521
+ nil (empty response body)
522
+
523
+ ### Authorization
524
+
525
+ No authorization required
526
+
527
+ ### HTTP request headers
528
+
529
+ - **Content-Type**: application/json
530
+ - **Accept**: application/json
531
+
data/git_push.sh ADDED
@@ -0,0 +1,57 @@
1
+ #!/bin/sh
2
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3
+ #
4
+ # Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
5
+
6
+ git_user_id=$1
7
+ git_repo_id=$2
8
+ release_note=$3
9
+ git_host=$4
10
+
11
+ if [ "$git_host" = "" ]; then
12
+ git_host=""
13
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14
+ fi
15
+
16
+ if [ "$git_user_id" = "" ]; then
17
+ git_user_id=""
18
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
+ fi
20
+
21
+ if [ "$git_repo_id" = "" ]; then
22
+ git_repo_id=""
23
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24
+ fi
25
+
26
+ if [ "$release_note" = "" ]; then
27
+ release_note=""
28
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29
+ fi
30
+
31
+ # Initialize the local directory as a Git repository
32
+ git init
33
+
34
+ # Adds the files in the local repository and stages them for commit.
35
+ git add .
36
+
37
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
38
+ git commit -m "$release_note"
39
+
40
+ # Sets the new remote
41
+ git_remote=$(git remote)
42
+ if [ "$git_remote" = "" ]; then # git remote not defined
43
+
44
+ if [ "$GIT_TOKEN" = "" ]; then
45
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47
+ else
48
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
49
+ fi
50
+
51
+ fi
52
+
53
+ git pull origin master
54
+
55
+ # Pushes (Forces) the changes in the local repository up to the remote repository
56
+ echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57
+ git push origin master 2>&1 | grep -v 'To https'