appwrite 23.0.0 → 24.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.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +28 -2
- data/lib/appwrite/enums/build_runtime.rb +1 -0
- data/lib/appwrite/enums/o_auth2_google_prompt.rb +9 -0
- data/lib/appwrite/enums/o_auth_provider.rb +3 -0
- data/lib/appwrite/enums/project_auth_method_id.rb +13 -0
- data/lib/appwrite/enums/project_email_template_id.rb +13 -0
- data/lib/appwrite/enums/project_email_template_locale.rb +137 -0
- data/lib/appwrite/enums/project_key_scopes.rb +100 -0
- data/lib/appwrite/enums/project_o_auth2_google_prompt.rb +9 -0
- data/lib/appwrite/enums/project_o_auth_provider_id.rb +51 -0
- data/lib/appwrite/enums/project_policy_id.rb +15 -0
- data/lib/appwrite/enums/{protocol_id.rb → project_protocol_id.rb} +1 -1
- data/lib/appwrite/enums/{service_id.rb → project_service_id.rb} +2 -1
- data/lib/appwrite/enums/project_smtp_secure.rb +8 -0
- data/lib/appwrite/enums/proxy_resource_type.rb +8 -0
- data/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb +8 -0
- data/lib/appwrite/enums/proxy_rule_status.rb +9 -0
- data/lib/appwrite/enums/runtime.rb +1 -0
- data/lib/appwrite/enums/scopes.rb +51 -31
- data/lib/appwrite/enums/status_code.rb +10 -0
- data/lib/appwrite/models/attribute_bigint.rb +96 -0
- data/lib/appwrite/models/block.rb +28 -3
- data/lib/appwrite/models/column_bigint.rb +96 -0
- data/lib/appwrite/models/database.rb +2 -2
- data/lib/appwrite/models/email_template.rb +62 -0
- data/lib/appwrite/models/email_template_list.rb +32 -0
- data/lib/appwrite/models/ephemeral_key.rb +67 -0
- data/lib/appwrite/models/insight.rb +107 -0
- data/lib/appwrite/models/insight_cta.rb +42 -0
- data/lib/appwrite/models/insight_list.rb +32 -0
- data/lib/appwrite/models/membership.rb +5 -0
- data/lib/appwrite/models/mock_number.rb +18 -8
- data/lib/appwrite/models/mock_number_list.rb +32 -0
- data/lib/appwrite/models/o_auth2_amazon.rb +42 -0
- data/lib/appwrite/models/o_auth2_apple.rb +52 -0
- data/lib/appwrite/models/o_auth2_auth0.rb +47 -0
- data/lib/appwrite/models/o_auth2_authentik.rb +47 -0
- data/lib/appwrite/models/o_auth2_autodesk.rb +42 -0
- data/lib/appwrite/models/o_auth2_bitbucket.rb +42 -0
- data/lib/appwrite/models/o_auth2_bitly.rb +42 -0
- data/lib/appwrite/models/o_auth2_box.rb +42 -0
- data/lib/appwrite/models/o_auth2_dailymotion.rb +42 -0
- data/lib/appwrite/models/o_auth2_discord.rb +42 -0
- data/lib/appwrite/models/o_auth2_disqus.rb +42 -0
- data/lib/appwrite/models/o_auth2_dropbox.rb +42 -0
- data/lib/appwrite/models/o_auth2_etsy.rb +42 -0
- data/lib/appwrite/models/o_auth2_facebook.rb +42 -0
- data/lib/appwrite/models/o_auth2_figma.rb +42 -0
- data/lib/appwrite/models/o_auth2_fusion_auth.rb +47 -0
- data/lib/appwrite/models/o_auth2_github.rb +42 -0
- data/lib/appwrite/models/o_auth2_gitlab.rb +47 -0
- data/lib/appwrite/models/o_auth2_google.rb +47 -0
- data/lib/appwrite/models/o_auth2_keycloak.rb +52 -0
- data/lib/appwrite/models/o_auth2_kick.rb +42 -0
- data/lib/appwrite/models/o_auth2_linkedin.rb +42 -0
- data/lib/appwrite/models/o_auth2_microsoft.rb +47 -0
- data/lib/appwrite/models/o_auth2_notion.rb +42 -0
- data/lib/appwrite/models/o_auth2_oidc.rb +62 -0
- data/lib/appwrite/models/o_auth2_okta.rb +52 -0
- data/lib/appwrite/models/o_auth2_paypal.rb +42 -0
- data/lib/appwrite/models/o_auth2_podio.rb +42 -0
- data/lib/appwrite/models/o_auth2_provider_list.rb +32 -0
- data/lib/appwrite/models/o_auth2_salesforce.rb +42 -0
- data/lib/appwrite/models/o_auth2_slack.rb +42 -0
- data/lib/appwrite/models/o_auth2_spotify.rb +42 -0
- data/lib/appwrite/models/o_auth2_stripe.rb +42 -0
- data/lib/appwrite/models/o_auth2_tradeshift.rb +42 -0
- data/lib/appwrite/models/o_auth2_twitch.rb +42 -0
- data/lib/appwrite/models/o_auth2_word_press.rb +42 -0
- data/lib/appwrite/models/o_auth2_x.rb +42 -0
- data/lib/appwrite/models/o_auth2_yahoo.rb +42 -0
- data/lib/appwrite/models/o_auth2_yandex.rb +42 -0
- data/lib/appwrite/models/o_auth2_zoho.rb +42 -0
- data/lib/appwrite/models/o_auth2_zoom.rb +42 -0
- data/lib/appwrite/models/policy_list.rb +32 -0
- data/lib/appwrite/models/policy_membership_privacy.rb +52 -0
- data/lib/appwrite/models/policy_password_dictionary.rb +32 -0
- data/lib/appwrite/models/policy_password_history.rb +32 -0
- data/lib/appwrite/models/policy_password_personal_data.rb +32 -0
- data/lib/appwrite/models/policy_session_alert.rb +32 -0
- data/lib/appwrite/models/policy_session_duration.rb +32 -0
- data/lib/appwrite/models/policy_session_invalidation.rb +32 -0
- data/lib/appwrite/models/policy_session_limit.rb +32 -0
- data/lib/appwrite/models/policy_user_limit.rb +32 -0
- data/lib/appwrite/models/presence.rb +71 -0
- data/lib/appwrite/models/presence_list.rb +36 -0
- data/lib/appwrite/models/project.rb +25 -280
- data/lib/appwrite/models/project_auth_method.rb +53 -0
- data/lib/appwrite/models/project_protocol.rb +49 -0
- data/lib/appwrite/models/project_service.rb +64 -0
- data/lib/appwrite/models/proxy_rule.rb +127 -0
- data/lib/appwrite/models/proxy_rule_list.rb +32 -0
- data/lib/appwrite/models/report.rb +82 -0
- data/lib/appwrite/models/report_list.rb +32 -0
- data/lib/appwrite/models/usage_event.rb +72 -0
- data/lib/appwrite/models/usage_event_list.rb +32 -0
- data/lib/appwrite/models/usage_gauge.rb +37 -0
- data/lib/appwrite/models/usage_gauge_list.rb +32 -0
- data/lib/appwrite/services/account.rb +1 -1
- data/lib/appwrite/services/advisor.rb +173 -0
- data/lib/appwrite/services/databases.rb +126 -0
- data/lib/appwrite/services/functions.rb +13 -7
- data/lib/appwrite/services/presences.rb +199 -0
- data/lib/appwrite/services/project.rb +2817 -292
- data/lib/appwrite/services/proxy.rb +303 -0
- data/lib/appwrite/services/sites.rb +13 -7
- data/lib/appwrite/services/tables_db.rb +120 -0
- data/lib/appwrite/services/usage.rb +86 -0
- data/lib/appwrite.rb +92 -3
- metadata +94 -5
- data/lib/appwrite/models/auth_provider.rb +0 -47
|
@@ -626,6 +626,132 @@ module Appwrite
|
|
|
626
626
|
|
|
627
627
|
end
|
|
628
628
|
|
|
629
|
+
#
|
|
630
|
+
# @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBigIntColumn` instead.
|
|
631
|
+
#
|
|
632
|
+
# Create a bigint attribute. Optionally, minimum and maximum values can be
|
|
633
|
+
# provided.
|
|
634
|
+
#
|
|
635
|
+
#
|
|
636
|
+
# @param [String] database_id Database ID.
|
|
637
|
+
# @param [String] collection_id Collection ID.
|
|
638
|
+
# @param [String] key Attribute Key.
|
|
639
|
+
# @param [] required Is attribute required?
|
|
640
|
+
# @param [Integer] min Minimum value
|
|
641
|
+
# @param [Integer] max Maximum value
|
|
642
|
+
# @param [Integer] default Default value. Cannot be set when attribute is required.
|
|
643
|
+
# @param [] array Is attribute an array?
|
|
644
|
+
#
|
|
645
|
+
# @return [AttributeBigint]
|
|
646
|
+
def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)
|
|
647
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint'
|
|
648
|
+
.gsub('{databaseId}', database_id)
|
|
649
|
+
.gsub('{collectionId}', collection_id)
|
|
650
|
+
|
|
651
|
+
if database_id.nil?
|
|
652
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
if collection_id.nil?
|
|
656
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
657
|
+
end
|
|
658
|
+
|
|
659
|
+
if key.nil?
|
|
660
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
661
|
+
end
|
|
662
|
+
|
|
663
|
+
if required.nil?
|
|
664
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
|
665
|
+
end
|
|
666
|
+
|
|
667
|
+
api_params = {
|
|
668
|
+
key: key,
|
|
669
|
+
required: required,
|
|
670
|
+
min: min,
|
|
671
|
+
max: max,
|
|
672
|
+
default: default,
|
|
673
|
+
array: array,
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
api_headers = {
|
|
677
|
+
"content-type": 'application/json',
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
@client.call(
|
|
681
|
+
method: 'POST',
|
|
682
|
+
path: api_path,
|
|
683
|
+
headers: api_headers,
|
|
684
|
+
params: api_params,
|
|
685
|
+
response_type: Models::AttributeBigint
|
|
686
|
+
)
|
|
687
|
+
|
|
688
|
+
end
|
|
689
|
+
|
|
690
|
+
#
|
|
691
|
+
# @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBigIntColumn` instead.
|
|
692
|
+
#
|
|
693
|
+
# Update a bigint attribute. Changing the `default` value will not update
|
|
694
|
+
# already existing documents.
|
|
695
|
+
#
|
|
696
|
+
#
|
|
697
|
+
# @param [String] database_id Database ID.
|
|
698
|
+
# @param [String] collection_id Collection ID.
|
|
699
|
+
# @param [String] key Attribute Key.
|
|
700
|
+
# @param [] required Is attribute required?
|
|
701
|
+
# @param [Integer] default Default value. Cannot be set when attribute is required.
|
|
702
|
+
# @param [Integer] min Minimum value
|
|
703
|
+
# @param [Integer] max Maximum value
|
|
704
|
+
# @param [String] new_key New Attribute Key.
|
|
705
|
+
#
|
|
706
|
+
# @return [AttributeBigint]
|
|
707
|
+
def update_big_int_attribute(database_id:, collection_id:, key:, required:, default:, min: nil, max: nil, new_key: nil)
|
|
708
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}'
|
|
709
|
+
.gsub('{databaseId}', database_id)
|
|
710
|
+
.gsub('{collectionId}', collection_id)
|
|
711
|
+
.gsub('{key}', key)
|
|
712
|
+
|
|
713
|
+
if database_id.nil?
|
|
714
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
715
|
+
end
|
|
716
|
+
|
|
717
|
+
if collection_id.nil?
|
|
718
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
719
|
+
end
|
|
720
|
+
|
|
721
|
+
if key.nil?
|
|
722
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
723
|
+
end
|
|
724
|
+
|
|
725
|
+
if required.nil?
|
|
726
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
|
727
|
+
end
|
|
728
|
+
|
|
729
|
+
if default.nil?
|
|
730
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
|
731
|
+
end
|
|
732
|
+
|
|
733
|
+
api_params = {
|
|
734
|
+
required: required,
|
|
735
|
+
min: min,
|
|
736
|
+
max: max,
|
|
737
|
+
default: default,
|
|
738
|
+
newKey: new_key,
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
api_headers = {
|
|
742
|
+
"content-type": 'application/json',
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
@client.call(
|
|
746
|
+
method: 'PATCH',
|
|
747
|
+
path: api_path,
|
|
748
|
+
headers: api_headers,
|
|
749
|
+
params: api_params,
|
|
750
|
+
response_type: Models::AttributeBigint
|
|
751
|
+
)
|
|
752
|
+
|
|
753
|
+
end
|
|
754
|
+
|
|
629
755
|
#
|
|
630
756
|
# @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead.
|
|
631
757
|
#
|
|
@@ -879,9 +879,11 @@ module Appwrite
|
|
|
879
879
|
# Get a list of all variables of a specific function.
|
|
880
880
|
#
|
|
881
881
|
# @param [String] function_id Function unique ID.
|
|
882
|
+
# @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: key, resourceType, resourceId, secret
|
|
883
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
882
884
|
#
|
|
883
885
|
# @return [VariableList]
|
|
884
|
-
def list_variables(function_id:)
|
|
886
|
+
def list_variables(function_id:, queries: nil, total: nil)
|
|
885
887
|
api_path = '/functions/{functionId}/variables'
|
|
886
888
|
.gsub('{functionId}', function_id)
|
|
887
889
|
|
|
@@ -890,6 +892,8 @@ module Appwrite
|
|
|
890
892
|
end
|
|
891
893
|
|
|
892
894
|
api_params = {
|
|
895
|
+
queries: queries,
|
|
896
|
+
total: total,
|
|
893
897
|
}
|
|
894
898
|
|
|
895
899
|
api_headers = {
|
|
@@ -909,12 +913,13 @@ module Appwrite
|
|
|
909
913
|
# in the function at runtime as environment variables.
|
|
910
914
|
#
|
|
911
915
|
# @param [String] function_id Function unique ID.
|
|
916
|
+
# @param [String] variable_id Variable 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.
|
|
912
917
|
# @param [String] key Variable key. Max length: 255 chars.
|
|
913
918
|
# @param [String] value Variable value. Max length: 8192 chars.
|
|
914
919
|
# @param [] secret Secret variables can be updated or deleted, but only functions can read them during build and runtime.
|
|
915
920
|
#
|
|
916
921
|
# @return [Variable]
|
|
917
|
-
def create_variable(function_id:, key:, value:, secret: nil)
|
|
922
|
+
def create_variable(function_id:, variable_id:, key:, value:, secret: nil)
|
|
918
923
|
api_path = '/functions/{functionId}/variables'
|
|
919
924
|
.gsub('{functionId}', function_id)
|
|
920
925
|
|
|
@@ -922,6 +927,10 @@ module Appwrite
|
|
|
922
927
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
923
928
|
end
|
|
924
929
|
|
|
930
|
+
if variable_id.nil?
|
|
931
|
+
raise Appwrite::Exception.new('Missing required parameter: "variableId"')
|
|
932
|
+
end
|
|
933
|
+
|
|
925
934
|
if key.nil?
|
|
926
935
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
927
936
|
end
|
|
@@ -931,6 +940,7 @@ module Appwrite
|
|
|
931
940
|
end
|
|
932
941
|
|
|
933
942
|
api_params = {
|
|
943
|
+
variableId: variable_id,
|
|
934
944
|
key: key,
|
|
935
945
|
value: value,
|
|
936
946
|
secret: secret,
|
|
@@ -994,7 +1004,7 @@ module Appwrite
|
|
|
994
1004
|
# @param [] secret Secret variables can be updated or deleted, but only functions can read them during build and runtime.
|
|
995
1005
|
#
|
|
996
1006
|
# @return [Variable]
|
|
997
|
-
def update_variable(function_id:, variable_id:, key
|
|
1007
|
+
def update_variable(function_id:, variable_id:, key: nil, value: nil, secret: nil)
|
|
998
1008
|
api_path = '/functions/{functionId}/variables/{variableId}'
|
|
999
1009
|
.gsub('{functionId}', function_id)
|
|
1000
1010
|
.gsub('{variableId}', variable_id)
|
|
@@ -1007,10 +1017,6 @@ module Appwrite
|
|
|
1007
1017
|
raise Appwrite::Exception.new('Missing required parameter: "variableId"')
|
|
1008
1018
|
end
|
|
1009
1019
|
|
|
1010
|
-
if key.nil?
|
|
1011
|
-
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
|
1012
|
-
end
|
|
1013
|
-
|
|
1014
1020
|
api_params = {
|
|
1015
1021
|
key: key,
|
|
1016
1022
|
value: value,
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
#frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
class Presences < Service
|
|
5
|
+
|
|
6
|
+
def initialize(client)
|
|
7
|
+
@client = client
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# List presence logs. Expired entries are filtered out automatically.
|
|
11
|
+
#
|
|
12
|
+
#
|
|
13
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK.
|
|
14
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
15
|
+
# @param [Integer] ttl TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours).
|
|
16
|
+
#
|
|
17
|
+
# @return [PresenceList]
|
|
18
|
+
def list(queries: nil, total: nil, ttl: nil)
|
|
19
|
+
api_path = '/presences'
|
|
20
|
+
|
|
21
|
+
api_params = {
|
|
22
|
+
queries: queries,
|
|
23
|
+
total: total,
|
|
24
|
+
ttl: ttl,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
api_headers = {
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@client.call(
|
|
31
|
+
method: 'GET',
|
|
32
|
+
path: api_path,
|
|
33
|
+
headers: api_headers,
|
|
34
|
+
params: api_params,
|
|
35
|
+
response_type: Models::PresenceList
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Get a presence log by its unique ID. Entries whose `expiresAt` is in the
|
|
41
|
+
# past are treated as not found.
|
|
42
|
+
#
|
|
43
|
+
#
|
|
44
|
+
# @param [String] presence_id Presence unique ID.
|
|
45
|
+
#
|
|
46
|
+
# @return [Presence]
|
|
47
|
+
def get(presence_id:)
|
|
48
|
+
api_path = '/presences/{presenceId}'
|
|
49
|
+
.gsub('{presenceId}', presence_id)
|
|
50
|
+
|
|
51
|
+
if presence_id.nil?
|
|
52
|
+
raise Appwrite::Exception.new('Missing required parameter: "presenceId"')
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
api_params = {
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
api_headers = {
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@client.call(
|
|
62
|
+
method: 'GET',
|
|
63
|
+
path: api_path,
|
|
64
|
+
headers: api_headers,
|
|
65
|
+
params: api_params,
|
|
66
|
+
response_type: Models::Presence
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Create or update a presence log by its user ID.
|
|
72
|
+
#
|
|
73
|
+
#
|
|
74
|
+
# @param [String] presence_id Presence unique ID.
|
|
75
|
+
# @param [String] user_id User ID.
|
|
76
|
+
# @param [String] status Presence status.
|
|
77
|
+
# @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
78
|
+
# @param [String] expires_at Presence expiry datetime.
|
|
79
|
+
# @param [Hash] metadata Presence metadata object.
|
|
80
|
+
#
|
|
81
|
+
# @return [Presence]
|
|
82
|
+
def upsert(presence_id:, user_id:, status:, permissions: nil, expires_at: nil, metadata: nil)
|
|
83
|
+
api_path = '/presences/{presenceId}'
|
|
84
|
+
.gsub('{presenceId}', presence_id)
|
|
85
|
+
|
|
86
|
+
if presence_id.nil?
|
|
87
|
+
raise Appwrite::Exception.new('Missing required parameter: "presenceId"')
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if user_id.nil?
|
|
91
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if status.nil?
|
|
95
|
+
raise Appwrite::Exception.new('Missing required parameter: "status"')
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
api_params = {
|
|
99
|
+
userId: user_id,
|
|
100
|
+
status: status,
|
|
101
|
+
permissions: permissions,
|
|
102
|
+
expiresAt: expires_at,
|
|
103
|
+
metadata: metadata,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
api_headers = {
|
|
107
|
+
"content-type": 'application/json',
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@client.call(
|
|
111
|
+
method: 'PUT',
|
|
112
|
+
path: api_path,
|
|
113
|
+
headers: api_headers,
|
|
114
|
+
params: api_params,
|
|
115
|
+
response_type: Models::Presence
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Update a presence log by its unique ID. Using the patch method you can pass
|
|
121
|
+
# only specific fields that will get updated.
|
|
122
|
+
#
|
|
123
|
+
#
|
|
124
|
+
# @param [String] presence_id Presence unique ID.
|
|
125
|
+
# @param [String] user_id User ID.
|
|
126
|
+
# @param [String] status Presence status.
|
|
127
|
+
# @param [String] expires_at Presence expiry datetime.
|
|
128
|
+
# @param [Hash] metadata Presence metadata object.
|
|
129
|
+
# @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
130
|
+
# @param [] purge When true, purge cached responses used by list presences endpoint.
|
|
131
|
+
#
|
|
132
|
+
# @return [Presence]
|
|
133
|
+
def update_presence(presence_id:, user_id:, status: nil, expires_at: nil, metadata: nil, permissions: nil, purge: nil)
|
|
134
|
+
api_path = '/presences/{presenceId}'
|
|
135
|
+
.gsub('{presenceId}', presence_id)
|
|
136
|
+
|
|
137
|
+
if presence_id.nil?
|
|
138
|
+
raise Appwrite::Exception.new('Missing required parameter: "presenceId"')
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if user_id.nil?
|
|
142
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
api_params = {
|
|
146
|
+
userId: user_id,
|
|
147
|
+
status: status,
|
|
148
|
+
expiresAt: expires_at,
|
|
149
|
+
metadata: metadata,
|
|
150
|
+
permissions: permissions,
|
|
151
|
+
purge: purge,
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
api_headers = {
|
|
155
|
+
"content-type": 'application/json',
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@client.call(
|
|
159
|
+
method: 'PATCH',
|
|
160
|
+
path: api_path,
|
|
161
|
+
headers: api_headers,
|
|
162
|
+
params: api_params,
|
|
163
|
+
response_type: Models::Presence
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Delete a presence log by its unique ID.
|
|
169
|
+
#
|
|
170
|
+
#
|
|
171
|
+
# @param [String] presence_id Presence unique ID.
|
|
172
|
+
#
|
|
173
|
+
# @return []
|
|
174
|
+
def delete(presence_id:)
|
|
175
|
+
api_path = '/presences/{presenceId}'
|
|
176
|
+
.gsub('{presenceId}', presence_id)
|
|
177
|
+
|
|
178
|
+
if presence_id.nil?
|
|
179
|
+
raise Appwrite::Exception.new('Missing required parameter: "presenceId"')
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
api_params = {
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
api_headers = {
|
|
186
|
+
"content-type": 'application/json',
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@client.call(
|
|
190
|
+
method: 'DELETE',
|
|
191
|
+
path: api_path,
|
|
192
|
+
headers: api_headers,
|
|
193
|
+
params: api_params,
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
end
|
|
199
|
+
end
|