appwrite 10.1.2 → 11.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +36 -7
  3. data/lib/appwrite/enums/authentication_factor.rb +10 -0
  4. data/lib/appwrite/enums/authenticator_type.rb +7 -0
  5. data/lib/appwrite/enums/browser.rb +20 -0
  6. data/lib/appwrite/enums/compression.rb +9 -0
  7. data/lib/appwrite/enums/credit_card.rb +22 -0
  8. data/lib/appwrite/enums/execution_method.rb +12 -0
  9. data/lib/appwrite/enums/flag.rb +200 -0
  10. data/lib/appwrite/enums/image_format.rb +11 -0
  11. data/lib/appwrite/enums/image_gravity.rb +15 -0
  12. data/lib/appwrite/enums/index_type.rb +9 -0
  13. data/lib/appwrite/enums/messaging_provider_type.rb +9 -0
  14. data/lib/appwrite/enums/name.rb +19 -0
  15. data/lib/appwrite/enums/o_auth_provider.rb +45 -0
  16. data/lib/appwrite/enums/password_hash.rb +17 -0
  17. data/lib/appwrite/enums/relation_mutate.rb +9 -0
  18. data/lib/appwrite/enums/relationship_type.rb +10 -0
  19. data/lib/appwrite/enums/runtime.rb +50 -0
  20. data/lib/appwrite/enums/smtp_encryption.rb +9 -0
  21. data/lib/appwrite/models/health_certificate.rb +52 -0
  22. data/lib/appwrite/models/jwt.rb +27 -0
  23. data/lib/appwrite/models/membership.rb +5 -0
  24. data/lib/appwrite/models/message.rb +87 -0
  25. data/lib/appwrite/models/message_list.rb +32 -0
  26. data/lib/appwrite/models/mfa_challenge.rb +42 -0
  27. data/lib/appwrite/models/mfa_factors.rb +37 -0
  28. data/lib/appwrite/models/mfa_recovery_codes.rb +27 -0
  29. data/lib/appwrite/models/mfa_type.rb +32 -0
  30. data/lib/appwrite/models/provider.rb +67 -0
  31. data/lib/appwrite/models/provider_list.rb +32 -0
  32. data/lib/appwrite/models/session.rb +18 -3
  33. data/lib/appwrite/models/subscriber.rb +67 -0
  34. data/lib/appwrite/models/subscriber_list.rb +32 -0
  35. data/lib/appwrite/models/target.rb +62 -0
  36. data/lib/appwrite/models/target_list.rb +32 -0
  37. data/lib/appwrite/models/token.rb +8 -3
  38. data/lib/appwrite/models/topic.rb +62 -0
  39. data/lib/appwrite/models/topic_list.rb +32 -0
  40. data/lib/appwrite/models/user.rb +10 -0
  41. data/lib/appwrite/query.rb +53 -28
  42. data/lib/appwrite/services/account.rb +935 -168
  43. data/lib/appwrite/services/avatars.rb +3 -3
  44. data/lib/appwrite/services/databases.rb +22 -16
  45. data/lib/appwrite/services/functions.rb +3 -3
  46. data/lib/appwrite/services/health.rb +138 -0
  47. data/lib/appwrite/services/messaging.rb +1886 -0
  48. data/lib/appwrite/services/storage.rb +4 -4
  49. data/lib/appwrite/services/teams.rb +1 -1
  50. data/lib/appwrite/services/users.rb +475 -4
  51. data/lib/appwrite.rb +36 -0
  52. metadata +37 -2
@@ -45,7 +45,7 @@ module Appwrite
45
45
  # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
46
46
  # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB.
47
47
  # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
48
- # @param [String] compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
48
+ # @param [Compression] compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
49
49
  # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
50
50
  # @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
51
51
  #
@@ -128,7 +128,7 @@ module Appwrite
128
128
  # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
129
129
  # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB.
130
130
  # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
131
- # @param [String] compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
131
+ # @param [Compression] compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
132
132
  # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
133
133
  # @param [] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
134
134
  #
@@ -462,7 +462,7 @@ module Appwrite
462
462
  # @param [String] file_id File ID
463
463
  # @param [Integer] width Resize preview image width, Pass an integer between 0 to 4000.
464
464
  # @param [Integer] height Resize preview image height, Pass an integer between 0 to 4000.
465
- # @param [String] gravity Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
465
+ # @param [ImageGravity] gravity Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
466
466
  # @param [Integer] quality Preview image quality. Pass an integer between 0 to 100. Defaults to 100.
467
467
  # @param [Integer] border_width Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
468
468
  # @param [String] border_color Preview image border color. Use a valid HEX color, no # is needed for prefix.
@@ -470,7 +470,7 @@ module Appwrite
470
470
  # @param [Float] opacity Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
471
471
  # @param [Integer] rotation Preview image rotation in degrees. Pass an integer between -360 and 360.
472
472
  # @param [String] background Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
473
- # @param [String] output Output format type (jpeg, jpg, png, gif and webp).
473
+ # @param [ImageFormat] output Output format type (jpeg, jpg, png, gif and webp).
474
474
  #
475
475
  # @return []
476
476
  def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil, quality: nil, border_width: nil, border_color: nil, border_radius: nil, opacity: nil, rotation: nil, background: nil, output: nil)
@@ -10,7 +10,7 @@ module Appwrite
10
10
  # Get a list of all the teams in which the current user is a member. You can
11
11
  # use the parameters to filter your results.
12
12
  #
13
- # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total
13
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan
14
14
  # @param [String] search Search term to filter your list results. Max length: 256 chars.
15
15
  #
16
16
  # @return [TeamList]
@@ -10,7 +10,7 @@ module Appwrite
10
10
  # Get a list of all the project's users. You can use the query params to
11
11
  # filter your results.
12
12
  #
13
- # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification
13
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels
14
14
  # @param [String] search Search term to filter your list results. Max length: 256 chars.
15
15
  #
16
16
  # @return [UserList]
@@ -170,7 +170,7 @@ module Appwrite
170
170
 
171
171
  # Get identities for all users.
172
172
  #
173
- # @param [String] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
173
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
174
174
  # @param [String] search Search term to filter your list results. Max length: 256 chars.
175
175
  #
176
176
  # @return [IdentityList]
@@ -470,7 +470,7 @@ module Appwrite
470
470
  # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
471
471
  # @param [String] email User email.
472
472
  # @param [String] password User password hashed using SHA.
473
- # @param [String] password_version Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'
473
+ # @param [PasswordHash] password_version Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'
474
474
  # @param [String] name User name. Max length: 128 chars.
475
475
  #
476
476
  # @return [User]
@@ -619,7 +619,7 @@ module Appwrite
619
619
  # docs](https://appwrite.io/docs/permissions) for more info.
620
620
  #
621
621
  # @param [String] user_id User ID.
622
- # @param [Array] labels Array of user labels. Replaces the previous labels. Maximum of 100 labels are allowed, each up to 36 alphanumeric characters long.
622
+ # @param [Array] labels Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.
623
623
  #
624
624
  # @return [User]
625
625
  def update_labels(user_id:, labels:)
@@ -714,6 +714,207 @@ module Appwrite
714
714
  end
715
715
 
716
716
 
717
+ # Enable or disable MFA on a user account.
718
+ #
719
+ # @param [String] user_id User ID.
720
+ # @param [] mfa Enable or disable MFA.
721
+ #
722
+ # @return [User]
723
+ def update_mfa(user_id:, mfa:)
724
+ api_path = '/users/{userId}/mfa'
725
+ .gsub('{userId}', user_id)
726
+
727
+ if user_id.nil?
728
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
729
+ end
730
+
731
+ if mfa.nil?
732
+ raise Appwrite::Exception.new('Missing required parameter: "mfa"')
733
+ end
734
+
735
+ api_params = {
736
+ mfa: mfa,
737
+ }
738
+
739
+ api_headers = {
740
+ "content-type": 'application/json',
741
+ }
742
+
743
+ @client.call(
744
+ method: 'PATCH',
745
+ path: api_path,
746
+ headers: api_headers,
747
+ params: api_params,
748
+ response_type: Models::User
749
+ )
750
+ end
751
+
752
+
753
+ # Delete an authenticator app.
754
+ #
755
+ # @param [String] user_id User ID.
756
+ # @param [AuthenticatorType] type Type of authenticator.
757
+ #
758
+ # @return [User]
759
+ def delete_mfa_authenticator(user_id:, type:)
760
+ api_path = '/users/{userId}/mfa/authenticators/{type}'
761
+ .gsub('{userId}', user_id)
762
+ .gsub('{type}', type)
763
+
764
+ if user_id.nil?
765
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
766
+ end
767
+
768
+ if type.nil?
769
+ raise Appwrite::Exception.new('Missing required parameter: "type"')
770
+ end
771
+
772
+ api_params = {
773
+ }
774
+
775
+ api_headers = {
776
+ "content-type": 'application/json',
777
+ }
778
+
779
+ @client.call(
780
+ method: 'DELETE',
781
+ path: api_path,
782
+ headers: api_headers,
783
+ params: api_params,
784
+ response_type: Models::User
785
+ )
786
+ end
787
+
788
+
789
+ # List the factors available on the account to be used as a MFA challange.
790
+ #
791
+ # @param [String] user_id User ID.
792
+ #
793
+ # @return [MfaFactors]
794
+ def list_mfa_factors(user_id:)
795
+ api_path = '/users/{userId}/mfa/factors'
796
+ .gsub('{userId}', user_id)
797
+
798
+ if user_id.nil?
799
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
800
+ end
801
+
802
+ api_params = {
803
+ }
804
+
805
+ api_headers = {
806
+ "content-type": 'application/json',
807
+ }
808
+
809
+ @client.call(
810
+ method: 'GET',
811
+ path: api_path,
812
+ headers: api_headers,
813
+ params: api_params,
814
+ response_type: Models::MfaFactors
815
+ )
816
+ end
817
+
818
+
819
+ # Get recovery codes that can be used as backup for MFA flow by User ID.
820
+ # Before getting codes, they must be generated using
821
+ # [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
822
+ # method.
823
+ #
824
+ # @param [String] user_id User ID.
825
+ #
826
+ # @return [MfaRecoveryCodes]
827
+ def get_mfa_recovery_codes(user_id:)
828
+ api_path = '/users/{userId}/mfa/recovery-codes'
829
+ .gsub('{userId}', user_id)
830
+
831
+ if user_id.nil?
832
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
833
+ end
834
+
835
+ api_params = {
836
+ }
837
+
838
+ api_headers = {
839
+ "content-type": 'application/json',
840
+ }
841
+
842
+ @client.call(
843
+ method: 'GET',
844
+ path: api_path,
845
+ headers: api_headers,
846
+ params: api_params,
847
+ response_type: Models::MfaRecoveryCodes
848
+ )
849
+ end
850
+
851
+
852
+ # Regenerate recovery codes that can be used as backup for MFA flow by User
853
+ # ID. Before regenerating codes, they must be first generated using
854
+ # [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
855
+ # method.
856
+ #
857
+ # @param [String] user_id User ID.
858
+ #
859
+ # @return [MfaRecoveryCodes]
860
+ def update_mfa_recovery_codes(user_id:)
861
+ api_path = '/users/{userId}/mfa/recovery-codes'
862
+ .gsub('{userId}', user_id)
863
+
864
+ if user_id.nil?
865
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
866
+ end
867
+
868
+ api_params = {
869
+ }
870
+
871
+ api_headers = {
872
+ "content-type": 'application/json',
873
+ }
874
+
875
+ @client.call(
876
+ method: 'PUT',
877
+ path: api_path,
878
+ headers: api_headers,
879
+ params: api_params,
880
+ response_type: Models::MfaRecoveryCodes
881
+ )
882
+ end
883
+
884
+
885
+ # Generate recovery codes used as backup for MFA flow for User ID. Recovery
886
+ # codes can be used as a MFA verification type in
887
+ # [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
888
+ # method by client SDK.
889
+ #
890
+ # @param [String] user_id User ID.
891
+ #
892
+ # @return [MfaRecoveryCodes]
893
+ def create_mfa_recovery_codes(user_id:)
894
+ api_path = '/users/{userId}/mfa/recovery-codes'
895
+ .gsub('{userId}', user_id)
896
+
897
+ if user_id.nil?
898
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
899
+ end
900
+
901
+ api_params = {
902
+ }
903
+
904
+ api_headers = {
905
+ "content-type": 'application/json',
906
+ }
907
+
908
+ @client.call(
909
+ method: 'PATCH',
910
+ path: api_path,
911
+ headers: api_headers,
912
+ params: api_params,
913
+ response_type: Models::MfaRecoveryCodes
914
+ )
915
+ end
916
+
917
+
717
918
  # Update the user name by its unique ID.
718
919
  #
719
920
  # @param [String] user_id User ID.
@@ -920,6 +1121,41 @@ module Appwrite
920
1121
  end
921
1122
 
922
1123
 
1124
+ # Creates a session for a user. Returns an immediately usable session object.
1125
+ #
1126
+ # If you want to generate a token for a custom authentication flow, use the
1127
+ # [POST
1128
+ # /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken)
1129
+ # endpoint.
1130
+ #
1131
+ # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1132
+ #
1133
+ # @return [Session]
1134
+ def create_session(user_id:)
1135
+ api_path = '/users/{userId}/sessions'
1136
+ .gsub('{userId}', user_id)
1137
+
1138
+ if user_id.nil?
1139
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
1140
+ end
1141
+
1142
+ api_params = {
1143
+ }
1144
+
1145
+ api_headers = {
1146
+ "content-type": 'application/json',
1147
+ }
1148
+
1149
+ @client.call(
1150
+ method: 'POST',
1151
+ path: api_path,
1152
+ headers: api_headers,
1153
+ params: api_params,
1154
+ response_type: Models::Session
1155
+ )
1156
+ end
1157
+
1158
+
923
1159
  # Delete all user's sessions by using the user's unique ID.
924
1160
  #
925
1161
  # @param [String] user_id User ID.
@@ -1021,6 +1257,241 @@ module Appwrite
1021
1257
  end
1022
1258
 
1023
1259
 
1260
+ # List the messaging targets that are associated with a user.
1261
+ #
1262
+ # @param [String] user_id User ID.
1263
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels
1264
+ #
1265
+ # @return [TargetList]
1266
+ def list_targets(user_id:, queries: nil)
1267
+ api_path = '/users/{userId}/targets'
1268
+ .gsub('{userId}', user_id)
1269
+
1270
+ if user_id.nil?
1271
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
1272
+ end
1273
+
1274
+ api_params = {
1275
+ queries: queries,
1276
+ }
1277
+
1278
+ api_headers = {
1279
+ "content-type": 'application/json',
1280
+ }
1281
+
1282
+ @client.call(
1283
+ method: 'GET',
1284
+ path: api_path,
1285
+ headers: api_headers,
1286
+ params: api_params,
1287
+ response_type: Models::TargetList
1288
+ )
1289
+ end
1290
+
1291
+
1292
+ # Create a messaging target.
1293
+ #
1294
+ # @param [String] user_id User ID.
1295
+ # @param [String] target_id Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1296
+ # @param [MessagingProviderType] provider_type The target provider type. Can be one of the following: `email`, `sms` or `push`.
1297
+ # @param [String] identifier The target identifier (token, email, phone etc.)
1298
+ # @param [String] provider_id Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
1299
+ # @param [String] name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.
1300
+ #
1301
+ # @return [Target]
1302
+ def create_target(user_id:, target_id:, provider_type:, identifier:, provider_id: nil, name: nil)
1303
+ api_path = '/users/{userId}/targets'
1304
+ .gsub('{userId}', user_id)
1305
+
1306
+ if user_id.nil?
1307
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
1308
+ end
1309
+
1310
+ if target_id.nil?
1311
+ raise Appwrite::Exception.new('Missing required parameter: "targetId"')
1312
+ end
1313
+
1314
+ if provider_type.nil?
1315
+ raise Appwrite::Exception.new('Missing required parameter: "providerType"')
1316
+ end
1317
+
1318
+ if identifier.nil?
1319
+ raise Appwrite::Exception.new('Missing required parameter: "identifier"')
1320
+ end
1321
+
1322
+ api_params = {
1323
+ targetId: target_id,
1324
+ providerType: provider_type,
1325
+ identifier: identifier,
1326
+ providerId: provider_id,
1327
+ name: name,
1328
+ }
1329
+
1330
+ api_headers = {
1331
+ "content-type": 'application/json',
1332
+ }
1333
+
1334
+ @client.call(
1335
+ method: 'POST',
1336
+ path: api_path,
1337
+ headers: api_headers,
1338
+ params: api_params,
1339
+ response_type: Models::Target
1340
+ )
1341
+ end
1342
+
1343
+
1344
+ # Get a user's push notification target by ID.
1345
+ #
1346
+ # @param [String] user_id User ID.
1347
+ # @param [String] target_id Target ID.
1348
+ #
1349
+ # @return [Target]
1350
+ def get_target(user_id:, target_id:)
1351
+ api_path = '/users/{userId}/targets/{targetId}'
1352
+ .gsub('{userId}', user_id)
1353
+ .gsub('{targetId}', target_id)
1354
+
1355
+ if user_id.nil?
1356
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
1357
+ end
1358
+
1359
+ if target_id.nil?
1360
+ raise Appwrite::Exception.new('Missing required parameter: "targetId"')
1361
+ end
1362
+
1363
+ api_params = {
1364
+ }
1365
+
1366
+ api_headers = {
1367
+ "content-type": 'application/json',
1368
+ }
1369
+
1370
+ @client.call(
1371
+ method: 'GET',
1372
+ path: api_path,
1373
+ headers: api_headers,
1374
+ params: api_params,
1375
+ response_type: Models::Target
1376
+ )
1377
+ end
1378
+
1379
+
1380
+ # Update a messaging target.
1381
+ #
1382
+ # @param [String] user_id User ID.
1383
+ # @param [String] target_id Target ID.
1384
+ # @param [String] identifier The target identifier (token, email, phone etc.)
1385
+ # @param [String] provider_id Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
1386
+ # @param [String] name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.
1387
+ #
1388
+ # @return [Target]
1389
+ def update_target(user_id:, target_id:, identifier: nil, provider_id: nil, name: nil)
1390
+ api_path = '/users/{userId}/targets/{targetId}'
1391
+ .gsub('{userId}', user_id)
1392
+ .gsub('{targetId}', target_id)
1393
+
1394
+ if user_id.nil?
1395
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
1396
+ end
1397
+
1398
+ if target_id.nil?
1399
+ raise Appwrite::Exception.new('Missing required parameter: "targetId"')
1400
+ end
1401
+
1402
+ api_params = {
1403
+ identifier: identifier,
1404
+ providerId: provider_id,
1405
+ name: name,
1406
+ }
1407
+
1408
+ api_headers = {
1409
+ "content-type": 'application/json',
1410
+ }
1411
+
1412
+ @client.call(
1413
+ method: 'PATCH',
1414
+ path: api_path,
1415
+ headers: api_headers,
1416
+ params: api_params,
1417
+ response_type: Models::Target
1418
+ )
1419
+ end
1420
+
1421
+
1422
+ # Delete a messaging target.
1423
+ #
1424
+ # @param [String] user_id User ID.
1425
+ # @param [String] target_id Target ID.
1426
+ #
1427
+ # @return []
1428
+ def delete_target(user_id:, target_id:)
1429
+ api_path = '/users/{userId}/targets/{targetId}'
1430
+ .gsub('{userId}', user_id)
1431
+ .gsub('{targetId}', target_id)
1432
+
1433
+ if user_id.nil?
1434
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
1435
+ end
1436
+
1437
+ if target_id.nil?
1438
+ raise Appwrite::Exception.new('Missing required parameter: "targetId"')
1439
+ end
1440
+
1441
+ api_params = {
1442
+ }
1443
+
1444
+ api_headers = {
1445
+ "content-type": 'application/json',
1446
+ }
1447
+
1448
+ @client.call(
1449
+ method: 'DELETE',
1450
+ path: api_path,
1451
+ headers: api_headers,
1452
+ params: api_params,
1453
+ )
1454
+ end
1455
+
1456
+
1457
+ # Returns a token with a secret key for creating a session. If the provided
1458
+ # user ID has not be registered, a new user will be created. Use the returned
1459
+ # user ID and secret and submit a request to the [PUT
1460
+ # /account/sessions/custom](https://appwrite.io/docs/references/cloud/client-web/account#updateCustomSession)
1461
+ # endpoint to complete the login process.
1462
+ #
1463
+ # @param [String] user_id User ID.
1464
+ # @param [Integer] length Token length in characters. The default length is 6 characters
1465
+ # @param [Integer] expire Token expiration period in seconds. The default expiration is 15 minutes.
1466
+ #
1467
+ # @return [Token]
1468
+ def create_token(user_id:, length: nil, expire: nil)
1469
+ api_path = '/users/{userId}/tokens'
1470
+ .gsub('{userId}', user_id)
1471
+
1472
+ if user_id.nil?
1473
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
1474
+ end
1475
+
1476
+ api_params = {
1477
+ length: length,
1478
+ expire: expire,
1479
+ }
1480
+
1481
+ api_headers = {
1482
+ "content-type": 'application/json',
1483
+ }
1484
+
1485
+ @client.call(
1486
+ method: 'POST',
1487
+ path: api_path,
1488
+ headers: api_headers,
1489
+ params: api_params,
1490
+ response_type: Models::Token
1491
+ )
1492
+ end
1493
+
1494
+
1024
1495
  # Update the user email verification status by its unique ID.
1025
1496
  #
1026
1497
  # @param [String] user_id User ID.
data/lib/appwrite.rb CHANGED
@@ -35,6 +35,11 @@ require_relative 'appwrite/models/currency_list'
35
35
  require_relative 'appwrite/models/phone_list'
36
36
  require_relative 'appwrite/models/variable_list'
37
37
  require_relative 'appwrite/models/locale_code_list'
38
+ require_relative 'appwrite/models/provider_list'
39
+ require_relative 'appwrite/models/message_list'
40
+ require_relative 'appwrite/models/topic_list'
41
+ require_relative 'appwrite/models/subscriber_list'
42
+ require_relative 'appwrite/models/target_list'
38
43
  require_relative 'appwrite/models/database'
39
44
  require_relative 'appwrite/models/collection'
40
45
  require_relative 'appwrite/models/attribute_list'
@@ -63,6 +68,7 @@ require_relative 'appwrite/models/preferences'
63
68
  require_relative 'appwrite/models/session'
64
69
  require_relative 'appwrite/models/identity'
65
70
  require_relative 'appwrite/models/token'
71
+ require_relative 'appwrite/models/jwt'
66
72
  require_relative 'appwrite/models/locale'
67
73
  require_relative 'appwrite/models/locale_code'
68
74
  require_relative 'appwrite/models/file'
@@ -82,8 +88,37 @@ require_relative 'appwrite/models/phone'
82
88
  require_relative 'appwrite/models/health_antivirus'
83
89
  require_relative 'appwrite/models/health_queue'
84
90
  require_relative 'appwrite/models/health_status'
91
+ require_relative 'appwrite/models/health_certificate'
85
92
  require_relative 'appwrite/models/health_time'
86
93
  require_relative 'appwrite/models/headers'
94
+ require_relative 'appwrite/models/mfa_challenge'
95
+ require_relative 'appwrite/models/mfa_recovery_codes'
96
+ require_relative 'appwrite/models/mfa_type'
97
+ require_relative 'appwrite/models/mfa_factors'
98
+ require_relative 'appwrite/models/provider'
99
+ require_relative 'appwrite/models/message'
100
+ require_relative 'appwrite/models/topic'
101
+ require_relative 'appwrite/models/subscriber'
102
+ require_relative 'appwrite/models/target'
103
+
104
+ require_relative 'appwrite/enums/authenticator_type'
105
+ require_relative 'appwrite/enums/authentication_factor'
106
+ require_relative 'appwrite/enums/o_auth_provider'
107
+ require_relative 'appwrite/enums/browser'
108
+ require_relative 'appwrite/enums/credit_card'
109
+ require_relative 'appwrite/enums/flag'
110
+ require_relative 'appwrite/enums/relationship_type'
111
+ require_relative 'appwrite/enums/relation_mutate'
112
+ require_relative 'appwrite/enums/index_type'
113
+ require_relative 'appwrite/enums/runtime'
114
+ require_relative 'appwrite/enums/execution_method'
115
+ require_relative 'appwrite/enums/name'
116
+ require_relative 'appwrite/enums/smtp_encryption'
117
+ require_relative 'appwrite/enums/compression'
118
+ require_relative 'appwrite/enums/image_gravity'
119
+ require_relative 'appwrite/enums/image_format'
120
+ require_relative 'appwrite/enums/password_hash'
121
+ require_relative 'appwrite/enums/messaging_provider_type'
87
122
 
88
123
  require_relative 'appwrite/services/account'
89
124
  require_relative 'appwrite/services/avatars'
@@ -92,6 +127,7 @@ require_relative 'appwrite/services/functions'
92
127
  require_relative 'appwrite/services/graphql'
93
128
  require_relative 'appwrite/services/health'
94
129
  require_relative 'appwrite/services/locale'
130
+ require_relative 'appwrite/services/messaging'
95
131
  require_relative 'appwrite/services/storage'
96
132
  require_relative 'appwrite/services/teams'
97
133
  require_relative 'appwrite/services/users'