react-native-appwrite 0.11.0 → 0.13.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 (129) hide show
  1. package/README.md +84 -3
  2. package/dist/cjs/sdk.js +1854 -1121
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +1854 -1122
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/docs/examples/account/create-email-password-session.md +4 -4
  7. package/docs/examples/account/create-email-token.md +5 -5
  8. package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
  9. package/docs/examples/account/create-mfa-authenticator.md +3 -3
  10. package/docs/examples/account/create-mfa-challenge.md +3 -3
  11. package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
  12. package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
  13. package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
  14. package/docs/examples/account/create-phone-token.md +4 -4
  15. package/docs/examples/account/create-push-target.md +5 -5
  16. package/docs/examples/account/create-recovery.md +4 -4
  17. package/docs/examples/account/create-session.md +4 -4
  18. package/docs/examples/account/create-verification.md +3 -3
  19. package/docs/examples/account/create.md +6 -6
  20. package/docs/examples/account/delete-identity.md +3 -3
  21. package/docs/examples/account/delete-mfa-authenticator.md +3 -3
  22. package/docs/examples/account/delete-push-target.md +3 -3
  23. package/docs/examples/account/delete-session.md +3 -3
  24. package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
  25. package/docs/examples/account/get-session.md +3 -3
  26. package/docs/examples/account/list-identities.md +3 -3
  27. package/docs/examples/account/list-logs.md +3 -3
  28. package/docs/examples/account/list-mfa-factors.md +1 -1
  29. package/docs/examples/account/update-email.md +4 -4
  30. package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
  31. package/docs/examples/account/update-mfa-authenticator.md +4 -4
  32. package/docs/examples/account/update-mfa-challenge.md +4 -4
  33. package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
  34. package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
  35. package/docs/examples/account/update-name.md +3 -3
  36. package/docs/examples/account/update-password.md +4 -4
  37. package/docs/examples/account/update-phone-session.md +4 -4
  38. package/docs/examples/account/update-phone-verification.md +4 -4
  39. package/docs/examples/account/update-phone.md +4 -4
  40. package/docs/examples/account/update-prefs.md +7 -3
  41. package/docs/examples/account/update-push-target.md +4 -4
  42. package/docs/examples/account/update-recovery.md +5 -5
  43. package/docs/examples/account/update-session.md +3 -3
  44. package/docs/examples/account/update-verification.md +4 -4
  45. package/docs/examples/avatars/get-browser.md +6 -6
  46. package/docs/examples/avatars/get-credit-card.md +6 -6
  47. package/docs/examples/avatars/get-favicon.md +3 -3
  48. package/docs/examples/avatars/get-flag.md +6 -6
  49. package/docs/examples/avatars/get-image.md +5 -5
  50. package/docs/examples/avatars/get-initials.md +6 -6
  51. package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
  52. package/docs/examples/databases/create-document.md +13 -7
  53. package/docs/examples/databases/decrement-document-attribute.md +8 -8
  54. package/docs/examples/databases/delete-document.md +5 -5
  55. package/docs/examples/databases/get-document.md +6 -6
  56. package/docs/examples/databases/increment-document-attribute.md +8 -8
  57. package/docs/examples/databases/list-documents.md +5 -5
  58. package/docs/examples/databases/update-document.md +7 -7
  59. package/docs/examples/databases/upsert-document.md +7 -7
  60. package/docs/examples/functions/create-execution.md +9 -9
  61. package/docs/examples/functions/get-execution.md +4 -4
  62. package/docs/examples/functions/list-executions.md +4 -4
  63. package/docs/examples/graphql/mutation.md +3 -3
  64. package/docs/examples/graphql/query.md +3 -3
  65. package/docs/examples/messaging/create-subscriber.md +5 -5
  66. package/docs/examples/messaging/delete-subscriber.md +4 -4
  67. package/docs/examples/storage/create-file.md +6 -6
  68. package/docs/examples/storage/delete-file.md +4 -4
  69. package/docs/examples/storage/get-file-download.md +5 -5
  70. package/docs/examples/storage/get-file-preview.md +16 -16
  71. package/docs/examples/storage/get-file-view.md +5 -5
  72. package/docs/examples/storage/get-file.md +4 -4
  73. package/docs/examples/storage/list-files.md +5 -5
  74. package/docs/examples/storage/update-file.md +6 -6
  75. package/docs/examples/tablesdb/create-row.md +23 -0
  76. package/docs/examples/tablesdb/decrement-row-column.md +18 -0
  77. package/docs/examples/tablesdb/delete-row.md +15 -0
  78. package/docs/examples/tablesdb/get-row.md +16 -0
  79. package/docs/examples/tablesdb/increment-row-column.md +18 -0
  80. package/docs/examples/tablesdb/list-rows.md +15 -0
  81. package/docs/examples/tablesdb/update-row.md +17 -0
  82. package/docs/examples/tablesdb/upsert-row.md +17 -0
  83. package/docs/examples/teams/create-membership.md +9 -9
  84. package/docs/examples/teams/create.md +5 -5
  85. package/docs/examples/teams/delete-membership.md +4 -4
  86. package/docs/examples/teams/delete.md +3 -3
  87. package/docs/examples/teams/get-membership.md +4 -4
  88. package/docs/examples/teams/get-prefs.md +3 -3
  89. package/docs/examples/teams/get.md +3 -3
  90. package/docs/examples/teams/list-memberships.md +5 -5
  91. package/docs/examples/teams/list.md +4 -4
  92. package/docs/examples/teams/update-membership-status.md +6 -6
  93. package/docs/examples/teams/update-membership.md +5 -5
  94. package/docs/examples/teams/update-name.md +4 -4
  95. package/docs/examples/teams/update-prefs.md +4 -4
  96. package/package.json +1 -1
  97. package/src/client.ts +2 -2
  98. package/src/enums/credit-card.ts +1 -1
  99. package/src/enums/execution-method.ts +1 -0
  100. package/src/index.ts +1 -0
  101. package/src/models.ts +72 -27
  102. package/src/query.ts +247 -4
  103. package/src/services/account.ts +1469 -315
  104. package/src/services/avatars.ts +289 -80
  105. package/src/services/databases.ts +345 -63
  106. package/src/services/functions.ts +115 -20
  107. package/src/services/graphql.ts +52 -4
  108. package/src/services/locale.ts +8 -19
  109. package/src/services/messaging.ts +66 -7
  110. package/src/services/storage.ts +345 -76
  111. package/src/services/tables-db.ts +621 -0
  112. package/src/services/teams.ts +454 -93
  113. package/types/enums/credit-card.d.ts +1 -1
  114. package/types/enums/execution-method.d.ts +2 -1
  115. package/types/index.d.ts +1 -0
  116. package/types/models.d.ts +69 -25
  117. package/types/query.d.ts +201 -4
  118. package/types/services/account.d.ts +734 -280
  119. package/types/services/avatars.d.ts +168 -73
  120. package/types/services/databases.d.ts +199 -58
  121. package/types/services/functions.d.ts +62 -17
  122. package/types/services/graphql.d.ts +24 -2
  123. package/types/services/locale.d.ts +8 -19
  124. package/types/services/messaging.d.ts +33 -5
  125. package/types/services/storage.d.ts +201 -68
  126. package/types/services/tables-db.d.ts +245 -0
  127. package/types/services/teams.d.ts +242 -80
  128. /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
  129. /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
@@ -15,15 +15,42 @@ export class Functions extends Service {
15
15
  }
16
16
 
17
17
  /**
18
- * Get a list of all the current user function execution logs. You can use the
19
- * query params to filter your results.
18
+ * Get a list of all the current user function execution logs. You can use the query params to filter your results.
20
19
  *
21
- * @param {string} functionId
22
- * @param {string[]} queries
20
+ * @param {string} params.functionId - Function ID.
21
+ * @param {string[]} params.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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
23
22
  * @throws {AppwriteException}
24
23
  * @returns {Promise}
25
24
  */
26
- listExecutions(functionId: string, queries?: string[]): Promise<Models.ExecutionList> {
25
+ listExecutions(params: { functionId: string, queries?: string[] }): Promise<Models.ExecutionList>;
26
+ /**
27
+ * Get a list of all the current user function execution logs. You can use the query params to filter your results.
28
+ *
29
+ * @param {string} functionId - Function ID.
30
+ * @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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
31
+ * @throws {AppwriteException}
32
+ * @returns {Promise<Models.ExecutionList>}
33
+ * @deprecated Use the object parameter style method for a better developer experience.
34
+ */
35
+ listExecutions(functionId: string, queries?: string[]): Promise<Models.ExecutionList>;
36
+ listExecutions(
37
+ paramsOrFirst: { functionId: string, queries?: string[] } | string,
38
+ ...rest: [(string[])?]
39
+ ): Promise<Models.ExecutionList> {
40
+ let params: { functionId: string, queries?: string[] };
41
+
42
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
43
+ params = (paramsOrFirst || {}) as { functionId: string, queries?: string[] };
44
+ } else {
45
+ params = {
46
+ functionId: paramsOrFirst as string,
47
+ queries: rest[0] as string[]
48
+ };
49
+ }
50
+
51
+ const functionId = params.functionId;
52
+ const queries = params.queries;
53
+
27
54
  if (typeof functionId === 'undefined') {
28
55
  throw new AppwriteException('Missing required parameter: "functionId"');
29
56
  }
@@ -41,22 +68,62 @@ export class Functions extends Service {
41
68
  }
42
69
 
43
70
  /**
44
- * Trigger a function execution. The returned object will return you the
45
- * current execution status. You can ping the `Get Execution` endpoint to get
46
- * updates on the current execution status. Once this endpoint is called, your
47
- * function execution process will start asynchronously.
71
+ * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.
48
72
  *
49
- * @param {string} functionId
50
- * @param {string} body
51
- * @param {boolean} async
52
- * @param {string} xpath
53
- * @param {ExecutionMethod} method
54
- * @param {object} headers
55
- * @param {string} scheduledAt
73
+ * @param {string} params.functionId - Function ID.
74
+ * @param {string} params.body - HTTP body of execution. Default value is empty string.
75
+ * @param {boolean} params.async - Execute code in the background. Default value is false.
76
+ * @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is /
77
+ * @param {ExecutionMethod} params.method - HTTP method of execution. Default value is POST.
78
+ * @param {object} params.headers - HTTP headers of execution. Defaults to empty.
79
+ * @param {string} params.scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
56
80
  * @throws {AppwriteException}
57
81
  * @returns {Promise}
58
82
  */
59
- createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution> {
83
+ createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>;
84
+ /**
85
+ * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.
86
+ *
87
+ * @param {string} functionId - Function ID.
88
+ * @param {string} body - HTTP body of execution. Default value is empty string.
89
+ * @param {boolean} async - Execute code in the background. Default value is false.
90
+ * @param {string} xpath - HTTP path of execution. Path can include query params. Default value is /
91
+ * @param {ExecutionMethod} method - HTTP method of execution. Default value is POST.
92
+ * @param {object} headers - HTTP headers of execution. Defaults to empty.
93
+ * @param {string} scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
94
+ * @throws {AppwriteException}
95
+ * @returns {Promise<Models.Execution>}
96
+ * @deprecated Use the object parameter style method for a better developer experience.
97
+ */
98
+ createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution>;
99
+ createExecution(
100
+ paramsOrFirst: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string } | string,
101
+ ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?]
102
+ ): Promise<Models.Execution> {
103
+ let params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string };
104
+
105
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
106
+ params = (paramsOrFirst || {}) as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string };
107
+ } else {
108
+ params = {
109
+ functionId: paramsOrFirst as string,
110
+ body: rest[0] as string,
111
+ async: rest[1] as boolean,
112
+ xpath: rest[2] as string,
113
+ method: rest[3] as ExecutionMethod,
114
+ headers: rest[4] as object,
115
+ scheduledAt: rest[5] as string
116
+ };
117
+ }
118
+
119
+ const functionId = params.functionId;
120
+ const body = params.body;
121
+ const async = params.async;
122
+ const xpath = params.xpath;
123
+ const method = params.method;
124
+ const headers = params.headers;
125
+ const scheduledAt = params.scheduledAt;
126
+
60
127
  if (typeof functionId === 'undefined') {
61
128
  throw new AppwriteException('Missing required parameter: "functionId"');
62
129
  }
@@ -97,12 +164,40 @@ export class Functions extends Service {
97
164
  /**
98
165
  * Get a function execution log by its unique ID.
99
166
  *
100
- * @param {string} functionId
101
- * @param {string} executionId
167
+ * @param {string} params.functionId - Function ID.
168
+ * @param {string} params.executionId - Execution ID.
102
169
  * @throws {AppwriteException}
103
170
  * @returns {Promise}
104
171
  */
105
- getExecution(functionId: string, executionId: string): Promise<Models.Execution> {
172
+ getExecution(params: { functionId: string, executionId: string }): Promise<Models.Execution>;
173
+ /**
174
+ * Get a function execution log by its unique ID.
175
+ *
176
+ * @param {string} functionId - Function ID.
177
+ * @param {string} executionId - Execution ID.
178
+ * @throws {AppwriteException}
179
+ * @returns {Promise<Models.Execution>}
180
+ * @deprecated Use the object parameter style method for a better developer experience.
181
+ */
182
+ getExecution(functionId: string, executionId: string): Promise<Models.Execution>;
183
+ getExecution(
184
+ paramsOrFirst: { functionId: string, executionId: string } | string,
185
+ ...rest: [(string)?]
186
+ ): Promise<Models.Execution> {
187
+ let params: { functionId: string, executionId: string };
188
+
189
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
190
+ params = (paramsOrFirst || {}) as { functionId: string, executionId: string };
191
+ } else {
192
+ params = {
193
+ functionId: paramsOrFirst as string,
194
+ executionId: rest[0] as string
195
+ };
196
+ }
197
+
198
+ const functionId = params.functionId;
199
+ const executionId = params.executionId;
200
+
106
201
  if (typeof functionId === 'undefined') {
107
202
  throw new AppwriteException('Missing required parameter: "functionId"');
108
203
  }
@@ -16,11 +16,35 @@ export class Graphql extends Service {
16
16
  /**
17
17
  * Execute a GraphQL mutation.
18
18
  *
19
- * @param {object} query
19
+ * @param {object} params.query - The query or queries to execute.
20
20
  * @throws {AppwriteException}
21
21
  * @returns {Promise}
22
22
  */
23
- query(query: object): Promise<{}> {
23
+ query(params: { query: object }): Promise<{}>;
24
+ /**
25
+ * Execute a GraphQL mutation.
26
+ *
27
+ * @param {object} query - The query or queries to execute.
28
+ * @throws {AppwriteException}
29
+ * @returns {Promise<{}>}
30
+ * @deprecated Use the object parameter style method for a better developer experience.
31
+ */
32
+ query(query: object): Promise<{}>;
33
+ query(
34
+ paramsOrFirst: { query: object } | object
35
+ ): Promise<{}> {
36
+ let params: { query: object };
37
+
38
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
39
+ params = (paramsOrFirst || {}) as { query: object };
40
+ } else {
41
+ params = {
42
+ query: paramsOrFirst as object
43
+ };
44
+ }
45
+
46
+ const query = params.query;
47
+
24
48
  if (typeof query === 'undefined') {
25
49
  throw new AppwriteException('Missing required parameter: "query"');
26
50
  }
@@ -42,11 +66,35 @@ export class Graphql extends Service {
42
66
  /**
43
67
  * Execute a GraphQL mutation.
44
68
  *
45
- * @param {object} query
69
+ * @param {object} params.query - The query or queries to execute.
46
70
  * @throws {AppwriteException}
47
71
  * @returns {Promise}
48
72
  */
49
- mutation(query: object): Promise<{}> {
73
+ mutation(params: { query: object }): Promise<{}>;
74
+ /**
75
+ * Execute a GraphQL mutation.
76
+ *
77
+ * @param {object} query - The query or queries to execute.
78
+ * @throws {AppwriteException}
79
+ * @returns {Promise<{}>}
80
+ * @deprecated Use the object parameter style method for a better developer experience.
81
+ */
82
+ mutation(query: object): Promise<{}>;
83
+ mutation(
84
+ paramsOrFirst: { query: object } | object
85
+ ): Promise<{}> {
86
+ let params: { query: object };
87
+
88
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
89
+ params = (paramsOrFirst || {}) as { query: object };
90
+ } else {
91
+ params = {
92
+ query: paramsOrFirst as object
93
+ };
94
+ }
95
+
96
+ const query = params.query;
97
+
50
98
  if (typeof query === 'undefined') {
51
99
  throw new AppwriteException('Missing required parameter: "query"');
52
100
  }
@@ -14,10 +14,7 @@ export class Locale extends Service {
14
14
  }
15
15
 
16
16
  /**
17
- * Get the current user location based on IP. Returns an object with user
18
- * country code, country name, continent name, continent code, ip address and
19
- * suggested currency. You can use the locale header to get the data in a
20
- * supported language.
17
+ * Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
21
18
  *
22
19
  * ([IP Geolocation by DB-IP](https://db-ip.com))
23
20
  *
@@ -34,8 +31,7 @@ export class Locale extends Service {
34
31
  }
35
32
 
36
33
  /**
37
- * List of all locale codes in [ISO
38
- * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
34
+ * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
39
35
  *
40
36
  * @throws {AppwriteException}
41
37
  * @returns {Promise}
@@ -50,8 +46,7 @@ export class Locale extends Service {
50
46
  }
51
47
 
52
48
  /**
53
- * List of all continents. You can use the locale header to get the data in a
54
- * supported language.
49
+ * List of all continents. You can use the locale header to get the data in a supported language.
55
50
  *
56
51
  * @throws {AppwriteException}
57
52
  * @returns {Promise}
@@ -66,8 +61,7 @@ export class Locale extends Service {
66
61
  }
67
62
 
68
63
  /**
69
- * List of all countries. You can use the locale header to get the data in a
70
- * supported language.
64
+ * List of all countries. You can use the locale header to get the data in a supported language.
71
65
  *
72
66
  * @throws {AppwriteException}
73
67
  * @returns {Promise}
@@ -82,8 +76,7 @@ export class Locale extends Service {
82
76
  }
83
77
 
84
78
  /**
85
- * List of all countries that are currently members of the EU. You can use the
86
- * locale header to get the data in a supported language.
79
+ * List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.
87
80
  *
88
81
  * @throws {AppwriteException}
89
82
  * @returns {Promise}
@@ -98,8 +91,7 @@ export class Locale extends Service {
98
91
  }
99
92
 
100
93
  /**
101
- * List of all countries phone codes. You can use the locale header to get the
102
- * data in a supported language.
94
+ * List of all countries phone codes. You can use the locale header to get the data in a supported language.
103
95
  *
104
96
  * @throws {AppwriteException}
105
97
  * @returns {Promise}
@@ -114,9 +106,7 @@ export class Locale extends Service {
114
106
  }
115
107
 
116
108
  /**
117
- * List of all currencies, including currency symbol, name, plural, and
118
- * decimal digits for all major and minor currencies. You can use the locale
119
- * header to get the data in a supported language.
109
+ * List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.
120
110
  *
121
111
  * @throws {AppwriteException}
122
112
  * @returns {Promise}
@@ -131,8 +121,7 @@ export class Locale extends Service {
131
121
  }
132
122
 
133
123
  /**
134
- * List of all languages classified by ISO 639-1 including 2-letter code, name
135
- * in English, and name in the respective language.
124
+ * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
136
125
  *
137
126
  * @throws {AppwriteException}
138
127
  * @returns {Promise}
@@ -16,13 +16,44 @@ export class Messaging extends Service {
16
16
  /**
17
17
  * Create a new subscriber.
18
18
  *
19
- * @param {string} topicId
20
- * @param {string} subscriberId
21
- * @param {string} targetId
19
+ * @param {string} params.topicId - Topic ID. The topic ID to subscribe to.
20
+ * @param {string} params.subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
21
+ * @param {string} params.targetId - Target ID. The target ID to link to the specified Topic ID.
22
22
  * @throws {AppwriteException}
23
23
  * @returns {Promise}
24
24
  */
25
- createSubscriber(topicId: string, subscriberId: string, targetId: string): Promise<Models.Subscriber> {
25
+ createSubscriber(params: { topicId: string, subscriberId: string, targetId: string }): Promise<Models.Subscriber>;
26
+ /**
27
+ * Create a new subscriber.
28
+ *
29
+ * @param {string} topicId - Topic ID. The topic ID to subscribe to.
30
+ * @param {string} subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
31
+ * @param {string} targetId - Target ID. The target ID to link to the specified Topic ID.
32
+ * @throws {AppwriteException}
33
+ * @returns {Promise<Models.Subscriber>}
34
+ * @deprecated Use the object parameter style method for a better developer experience.
35
+ */
36
+ createSubscriber(topicId: string, subscriberId: string, targetId: string): Promise<Models.Subscriber>;
37
+ createSubscriber(
38
+ paramsOrFirst: { topicId: string, subscriberId: string, targetId: string } | string,
39
+ ...rest: [(string)?, (string)?]
40
+ ): Promise<Models.Subscriber> {
41
+ let params: { topicId: string, subscriberId: string, targetId: string };
42
+
43
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
44
+ params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string, targetId: string };
45
+ } else {
46
+ params = {
47
+ topicId: paramsOrFirst as string,
48
+ subscriberId: rest[0] as string,
49
+ targetId: rest[1] as string
50
+ };
51
+ }
52
+
53
+ const topicId = params.topicId;
54
+ const subscriberId = params.subscriberId;
55
+ const targetId = params.targetId;
56
+
26
57
  if (typeof topicId === 'undefined') {
27
58
  throw new AppwriteException('Missing required parameter: "topicId"');
28
59
  }
@@ -55,12 +86,40 @@ export class Messaging extends Service {
55
86
  /**
56
87
  * Delete a subscriber by its unique ID.
57
88
  *
58
- * @param {string} topicId
59
- * @param {string} subscriberId
89
+ * @param {string} params.topicId - Topic ID. The topic ID subscribed to.
90
+ * @param {string} params.subscriberId - Subscriber ID.
60
91
  * @throws {AppwriteException}
61
92
  * @returns {Promise}
62
93
  */
63
- deleteSubscriber(topicId: string, subscriberId: string): Promise<{}> {
94
+ deleteSubscriber(params: { topicId: string, subscriberId: string }): Promise<{}>;
95
+ /**
96
+ * Delete a subscriber by its unique ID.
97
+ *
98
+ * @param {string} topicId - Topic ID. The topic ID subscribed to.
99
+ * @param {string} subscriberId - Subscriber ID.
100
+ * @throws {AppwriteException}
101
+ * @returns {Promise<{}>}
102
+ * @deprecated Use the object parameter style method for a better developer experience.
103
+ */
104
+ deleteSubscriber(topicId: string, subscriberId: string): Promise<{}>;
105
+ deleteSubscriber(
106
+ paramsOrFirst: { topicId: string, subscriberId: string } | string,
107
+ ...rest: [(string)?]
108
+ ): Promise<{}> {
109
+ let params: { topicId: string, subscriberId: string };
110
+
111
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
112
+ params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string };
113
+ } else {
114
+ params = {
115
+ topicId: paramsOrFirst as string,
116
+ subscriberId: rest[0] as string
117
+ };
118
+ }
119
+
120
+ const topicId = params.topicId;
121
+ const subscriberId = params.subscriberId;
122
+
64
123
  if (typeof topicId === 'undefined') {
65
124
  throw new AppwriteException('Missing required parameter: "topicId"');
66
125
  }