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.
- package/README.md +84 -3
- package/dist/cjs/sdk.js +1854 -1121
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1854 -1122
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/create-email-password-session.md +4 -4
- package/docs/examples/account/create-email-token.md +5 -5
- package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
- package/docs/examples/account/create-mfa-authenticator.md +3 -3
- package/docs/examples/account/create-mfa-challenge.md +3 -3
- package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
- package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
- package/docs/examples/account/create-phone-token.md +4 -4
- package/docs/examples/account/create-push-target.md +5 -5
- package/docs/examples/account/create-recovery.md +4 -4
- package/docs/examples/account/create-session.md +4 -4
- package/docs/examples/account/create-verification.md +3 -3
- package/docs/examples/account/create.md +6 -6
- package/docs/examples/account/delete-identity.md +3 -3
- package/docs/examples/account/delete-mfa-authenticator.md +3 -3
- package/docs/examples/account/delete-push-target.md +3 -3
- package/docs/examples/account/delete-session.md +3 -3
- package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/get-session.md +3 -3
- package/docs/examples/account/list-identities.md +3 -3
- package/docs/examples/account/list-logs.md +3 -3
- package/docs/examples/account/list-mfa-factors.md +1 -1
- package/docs/examples/account/update-email.md +4 -4
- package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
- package/docs/examples/account/update-mfa-authenticator.md +4 -4
- package/docs/examples/account/update-mfa-challenge.md +4 -4
- package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
- package/docs/examples/account/update-name.md +3 -3
- package/docs/examples/account/update-password.md +4 -4
- package/docs/examples/account/update-phone-session.md +4 -4
- package/docs/examples/account/update-phone-verification.md +4 -4
- package/docs/examples/account/update-phone.md +4 -4
- package/docs/examples/account/update-prefs.md +7 -3
- package/docs/examples/account/update-push-target.md +4 -4
- package/docs/examples/account/update-recovery.md +5 -5
- package/docs/examples/account/update-session.md +3 -3
- package/docs/examples/account/update-verification.md +4 -4
- package/docs/examples/avatars/get-browser.md +6 -6
- package/docs/examples/avatars/get-credit-card.md +6 -6
- package/docs/examples/avatars/get-favicon.md +3 -3
- package/docs/examples/avatars/get-flag.md +6 -6
- package/docs/examples/avatars/get-image.md +5 -5
- package/docs/examples/avatars/get-initials.md +6 -6
- package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
- package/docs/examples/databases/create-document.md +13 -7
- package/docs/examples/databases/decrement-document-attribute.md +8 -8
- package/docs/examples/databases/delete-document.md +5 -5
- package/docs/examples/databases/get-document.md +6 -6
- package/docs/examples/databases/increment-document-attribute.md +8 -8
- package/docs/examples/databases/list-documents.md +5 -5
- package/docs/examples/databases/update-document.md +7 -7
- package/docs/examples/databases/upsert-document.md +7 -7
- package/docs/examples/functions/create-execution.md +9 -9
- package/docs/examples/functions/get-execution.md +4 -4
- package/docs/examples/functions/list-executions.md +4 -4
- package/docs/examples/graphql/mutation.md +3 -3
- package/docs/examples/graphql/query.md +3 -3
- package/docs/examples/messaging/create-subscriber.md +5 -5
- package/docs/examples/messaging/delete-subscriber.md +4 -4
- package/docs/examples/storage/create-file.md +6 -6
- package/docs/examples/storage/delete-file.md +4 -4
- package/docs/examples/storage/get-file-download.md +5 -5
- package/docs/examples/storage/get-file-preview.md +16 -16
- package/docs/examples/storage/get-file-view.md +5 -5
- package/docs/examples/storage/get-file.md +4 -4
- package/docs/examples/storage/list-files.md +5 -5
- package/docs/examples/storage/update-file.md +6 -6
- package/docs/examples/tablesdb/create-row.md +23 -0
- package/docs/examples/tablesdb/decrement-row-column.md +18 -0
- package/docs/examples/tablesdb/delete-row.md +15 -0
- package/docs/examples/tablesdb/get-row.md +16 -0
- package/docs/examples/tablesdb/increment-row-column.md +18 -0
- package/docs/examples/tablesdb/list-rows.md +15 -0
- package/docs/examples/tablesdb/update-row.md +17 -0
- package/docs/examples/tablesdb/upsert-row.md +17 -0
- package/docs/examples/teams/create-membership.md +9 -9
- package/docs/examples/teams/create.md +5 -5
- package/docs/examples/teams/delete-membership.md +4 -4
- package/docs/examples/teams/delete.md +3 -3
- package/docs/examples/teams/get-membership.md +4 -4
- package/docs/examples/teams/get-prefs.md +3 -3
- package/docs/examples/teams/get.md +3 -3
- package/docs/examples/teams/list-memberships.md +5 -5
- package/docs/examples/teams/list.md +4 -4
- package/docs/examples/teams/update-membership-status.md +6 -6
- package/docs/examples/teams/update-membership.md +5 -5
- package/docs/examples/teams/update-name.md +4 -4
- package/docs/examples/teams/update-prefs.md +4 -4
- package/package.json +1 -1
- package/src/client.ts +2 -2
- package/src/enums/credit-card.ts +1 -1
- package/src/enums/execution-method.ts +1 -0
- package/src/index.ts +1 -0
- package/src/models.ts +72 -27
- package/src/query.ts +247 -4
- package/src/services/account.ts +1469 -315
- package/src/services/avatars.ts +289 -80
- package/src/services/databases.ts +345 -63
- package/src/services/functions.ts +115 -20
- package/src/services/graphql.ts +52 -4
- package/src/services/locale.ts +8 -19
- package/src/services/messaging.ts +66 -7
- package/src/services/storage.ts +345 -76
- package/src/services/tables-db.ts +621 -0
- package/src/services/teams.ts +454 -93
- package/types/enums/credit-card.d.ts +1 -1
- package/types/enums/execution-method.d.ts +2 -1
- package/types/index.d.ts +1 -0
- package/types/models.d.ts +69 -25
- package/types/query.d.ts +201 -4
- package/types/services/account.d.ts +734 -280
- package/types/services/avatars.d.ts +168 -73
- package/types/services/databases.d.ts +199 -58
- package/types/services/functions.d.ts +62 -17
- package/types/services/graphql.d.ts +24 -2
- package/types/services/locale.d.ts +8 -19
- package/types/services/messaging.d.ts +33 -5
- package/types/services/storage.d.ts +201 -68
- package/types/services/tables-db.d.ts +245 -0
- package/types/services/teams.d.ts +242 -80
- /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
- /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
|
@@ -14,16 +14,47 @@ export class Databases extends Service {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Get a list of all the user's documents in a given collection. You can use
|
|
18
|
-
* the query params to filter your results.
|
|
17
|
+
* Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
|
|
19
18
|
*
|
|
20
|
-
* @param {string} databaseId
|
|
21
|
-
* @param {string} collectionId
|
|
22
|
-
* @param {string[]} queries
|
|
19
|
+
* @param {string} params.databaseId - Database ID.
|
|
20
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
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.
|
|
23
22
|
* @throws {AppwriteException}
|
|
24
23
|
* @returns {Promise}
|
|
24
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead.
|
|
25
25
|
*/
|
|
26
|
-
listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document
|
|
26
|
+
listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[] }): Promise<Models.DocumentList<Document>>;
|
|
27
|
+
/**
|
|
28
|
+
* Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} databaseId - Database ID.
|
|
31
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
32
|
+
* @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.
|
|
33
|
+
* @throws {AppwriteException}
|
|
34
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
35
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
36
|
+
*/
|
|
37
|
+
listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>>;
|
|
38
|
+
listDocuments<Document extends Models.Document = Models.DefaultDocument>(
|
|
39
|
+
paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[] } | string,
|
|
40
|
+
...rest: [(string)?, (string[])?]
|
|
41
|
+
): Promise<Models.DocumentList<Document>> {
|
|
42
|
+
let params: { databaseId: string, collectionId: string, queries?: string[] };
|
|
43
|
+
|
|
44
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
45
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[] };
|
|
46
|
+
} else {
|
|
47
|
+
params = {
|
|
48
|
+
databaseId: paramsOrFirst as string,
|
|
49
|
+
collectionId: rest[0] as string,
|
|
50
|
+
queries: rest[1] as string[]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const databaseId = params.databaseId;
|
|
55
|
+
const collectionId = params.collectionId;
|
|
56
|
+
const queries = params.queries;
|
|
57
|
+
|
|
27
58
|
if (typeof databaseId === 'undefined') {
|
|
28
59
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
29
60
|
}
|
|
@@ -45,20 +76,55 @@ export class Databases extends Service {
|
|
|
45
76
|
}
|
|
46
77
|
|
|
47
78
|
/**
|
|
48
|
-
* Create a new Document. Before using this route, you should create a new
|
|
49
|
-
* collection resource using either a [server
|
|
50
|
-
* integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
|
|
51
|
-
* API or directly from your database console.
|
|
79
|
+
* Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
|
52
80
|
*
|
|
53
|
-
* @param {string} databaseId
|
|
54
|
-
* @param {string} collectionId
|
|
55
|
-
* @param {string} documentId
|
|
56
|
-
* @param {
|
|
57
|
-
* @param {string[]} permissions
|
|
81
|
+
* @param {string} params.databaseId - Database ID.
|
|
82
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
|
|
83
|
+
* @param {string} params.documentId - Document 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.
|
|
84
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} params.data - Document data as JSON object.
|
|
85
|
+
* @param {string[]} params.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).
|
|
58
86
|
* @throws {AppwriteException}
|
|
59
87
|
* @returns {Promise}
|
|
88
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead.
|
|
60
89
|
*/
|
|
61
|
-
createDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data:
|
|
90
|
+
createDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[] }): Promise<Document>;
|
|
91
|
+
/**
|
|
92
|
+
* Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
|
93
|
+
*
|
|
94
|
+
* @param {string} databaseId - Database ID.
|
|
95
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
|
|
96
|
+
* @param {string} documentId - Document 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.
|
|
97
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} data - Document data as JSON object.
|
|
98
|
+
* @param {string[]} 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).
|
|
99
|
+
* @throws {AppwriteException}
|
|
100
|
+
* @returns {Promise<Document>}
|
|
101
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
102
|
+
*/
|
|
103
|
+
createDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document>;
|
|
104
|
+
createDocument<Document extends Models.Document = Models.DefaultDocument>(
|
|
105
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[] } | string,
|
|
106
|
+
...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>)?, (string[])?]
|
|
107
|
+
): Promise<Document> {
|
|
108
|
+
let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[] };
|
|
109
|
+
|
|
110
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
111
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[] };
|
|
112
|
+
} else {
|
|
113
|
+
params = {
|
|
114
|
+
databaseId: paramsOrFirst as string,
|
|
115
|
+
collectionId: rest[0] as string,
|
|
116
|
+
documentId: rest[1] as string,
|
|
117
|
+
data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>,
|
|
118
|
+
permissions: rest[3] as string[]
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const databaseId = params.databaseId;
|
|
123
|
+
const collectionId = params.collectionId;
|
|
124
|
+
const documentId = params.documentId;
|
|
125
|
+
const data = params.data;
|
|
126
|
+
const permissions = params.permissions;
|
|
127
|
+
|
|
62
128
|
if (typeof databaseId === 'undefined') {
|
|
63
129
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
64
130
|
}
|
|
@@ -97,17 +163,51 @@ export class Databases extends Service {
|
|
|
97
163
|
}
|
|
98
164
|
|
|
99
165
|
/**
|
|
100
|
-
* Get a document by its unique ID. This endpoint response returns a JSON
|
|
101
|
-
* object with the document data.
|
|
166
|
+
* Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
|
|
102
167
|
*
|
|
103
|
-
* @param {string} databaseId
|
|
104
|
-
* @param {string} collectionId
|
|
105
|
-
* @param {string} documentId
|
|
106
|
-
* @param {string[]} queries
|
|
168
|
+
* @param {string} params.databaseId - Database ID.
|
|
169
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
170
|
+
* @param {string} params.documentId - Document ID.
|
|
171
|
+
* @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.
|
|
107
172
|
* @throws {AppwriteException}
|
|
108
173
|
* @returns {Promise}
|
|
174
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead.
|
|
175
|
+
*/
|
|
176
|
+
getDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, queries?: string[] }): Promise<Document>;
|
|
177
|
+
/**
|
|
178
|
+
* Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
|
|
179
|
+
*
|
|
180
|
+
* @param {string} databaseId - Database ID.
|
|
181
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
182
|
+
* @param {string} documentId - Document ID.
|
|
183
|
+
* @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.
|
|
184
|
+
* @throws {AppwriteException}
|
|
185
|
+
* @returns {Promise<Document>}
|
|
186
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
109
187
|
*/
|
|
110
|
-
getDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document
|
|
188
|
+
getDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document>;
|
|
189
|
+
getDocument<Document extends Models.Document = Models.DefaultDocument>(
|
|
190
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, queries?: string[] } | string,
|
|
191
|
+
...rest: [(string)?, (string)?, (string[])?]
|
|
192
|
+
): Promise<Document> {
|
|
193
|
+
let params: { databaseId: string, collectionId: string, documentId: string, queries?: string[] };
|
|
194
|
+
|
|
195
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
196
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, queries?: string[] };
|
|
197
|
+
} else {
|
|
198
|
+
params = {
|
|
199
|
+
databaseId: paramsOrFirst as string,
|
|
200
|
+
collectionId: rest[0] as string,
|
|
201
|
+
documentId: rest[1] as string,
|
|
202
|
+
queries: rest[2] as string[]
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const databaseId = params.databaseId;
|
|
207
|
+
const collectionId = params.collectionId;
|
|
208
|
+
const documentId = params.documentId;
|
|
209
|
+
const queries = params.queries;
|
|
210
|
+
|
|
111
211
|
if (typeof databaseId === 'undefined') {
|
|
112
212
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
113
213
|
}
|
|
@@ -133,24 +233,55 @@ export class Databases extends Service {
|
|
|
133
233
|
}
|
|
134
234
|
|
|
135
235
|
/**
|
|
136
|
-
*
|
|
137
|
-
* yet officially supported. It may be subject to breaking changes or removal
|
|
138
|
-
* in future versions.
|
|
139
|
-
*
|
|
140
|
-
* Create or update a Document. Before using this route, you should create a
|
|
141
|
-
* new collection resource using either a [server
|
|
142
|
-
* integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
|
|
143
|
-
* API or directly from your database console.
|
|
236
|
+
* Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
|
144
237
|
*
|
|
145
|
-
* @param {string} databaseId
|
|
146
|
-
* @param {string} collectionId
|
|
147
|
-
* @param {string} documentId
|
|
148
|
-
* @param {
|
|
149
|
-
* @param {string[]} permissions
|
|
238
|
+
* @param {string} params.databaseId - Database ID.
|
|
239
|
+
* @param {string} params.collectionId - Collection ID.
|
|
240
|
+
* @param {string} params.documentId - Document ID.
|
|
241
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} params.data - Document data as JSON object. Include all required attributes of the document to be created or updated.
|
|
242
|
+
* @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
150
243
|
* @throws {AppwriteException}
|
|
151
244
|
* @returns {Promise}
|
|
245
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead.
|
|
152
246
|
*/
|
|
153
|
-
upsertDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data:
|
|
247
|
+
upsertDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[] }): Promise<Document>;
|
|
248
|
+
/**
|
|
249
|
+
* Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
|
250
|
+
*
|
|
251
|
+
* @param {string} databaseId - Database ID.
|
|
252
|
+
* @param {string} collectionId - Collection ID.
|
|
253
|
+
* @param {string} documentId - Document ID.
|
|
254
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} data - Document data as JSON object. Include all required attributes of the document to be created or updated.
|
|
255
|
+
* @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
256
|
+
* @throws {AppwriteException}
|
|
257
|
+
* @returns {Promise<Document>}
|
|
258
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
259
|
+
*/
|
|
260
|
+
upsertDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document>;
|
|
261
|
+
upsertDocument<Document extends Models.Document = Models.DefaultDocument>(
|
|
262
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[] } | string,
|
|
263
|
+
...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>)?, (string[])?]
|
|
264
|
+
): Promise<Document> {
|
|
265
|
+
let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[] };
|
|
266
|
+
|
|
267
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
268
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[] };
|
|
269
|
+
} else {
|
|
270
|
+
params = {
|
|
271
|
+
databaseId: paramsOrFirst as string,
|
|
272
|
+
collectionId: rest[0] as string,
|
|
273
|
+
documentId: rest[1] as string,
|
|
274
|
+
data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>,
|
|
275
|
+
permissions: rest[3] as string[]
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const databaseId = params.databaseId;
|
|
280
|
+
const collectionId = params.collectionId;
|
|
281
|
+
const documentId = params.documentId;
|
|
282
|
+
const data = params.data;
|
|
283
|
+
const permissions = params.permissions;
|
|
284
|
+
|
|
154
285
|
if (typeof databaseId === 'undefined') {
|
|
155
286
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
156
287
|
}
|
|
@@ -185,18 +316,55 @@ export class Databases extends Service {
|
|
|
185
316
|
}
|
|
186
317
|
|
|
187
318
|
/**
|
|
188
|
-
* Update a document by its unique ID. Using the patch method you can pass
|
|
189
|
-
* only specific fields that will get updated.
|
|
319
|
+
* Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
|
|
190
320
|
*
|
|
191
|
-
* @param {string} databaseId
|
|
192
|
-
* @param {string} collectionId
|
|
193
|
-
* @param {string} documentId
|
|
194
|
-
* @param {
|
|
195
|
-
* @param {string[]} permissions
|
|
321
|
+
* @param {string} params.databaseId - Database ID.
|
|
322
|
+
* @param {string} params.collectionId - Collection ID.
|
|
323
|
+
* @param {string} params.documentId - Document ID.
|
|
324
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} params.data - Document data as JSON object. Include only attribute and value pairs to be updated.
|
|
325
|
+
* @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
196
326
|
* @throws {AppwriteException}
|
|
197
327
|
* @returns {Promise}
|
|
328
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead.
|
|
198
329
|
*/
|
|
199
|
-
updateDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?:
|
|
330
|
+
updateDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[] }): Promise<Document>;
|
|
331
|
+
/**
|
|
332
|
+
* Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
|
|
333
|
+
*
|
|
334
|
+
* @param {string} databaseId - Database ID.
|
|
335
|
+
* @param {string} collectionId - Collection ID.
|
|
336
|
+
* @param {string} documentId - Document ID.
|
|
337
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} data - Document data as JSON object. Include only attribute and value pairs to be updated.
|
|
338
|
+
* @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
339
|
+
* @throws {AppwriteException}
|
|
340
|
+
* @returns {Promise<Document>}
|
|
341
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
342
|
+
*/
|
|
343
|
+
updateDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document>;
|
|
344
|
+
updateDocument<Document extends Models.Document = Models.DefaultDocument>(
|
|
345
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[] } | string,
|
|
346
|
+
...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>)?, (string[])?]
|
|
347
|
+
): Promise<Document> {
|
|
348
|
+
let params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[] };
|
|
349
|
+
|
|
350
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
351
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[] };
|
|
352
|
+
} else {
|
|
353
|
+
params = {
|
|
354
|
+
databaseId: paramsOrFirst as string,
|
|
355
|
+
collectionId: rest[0] as string,
|
|
356
|
+
documentId: rest[1] as string,
|
|
357
|
+
data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>,
|
|
358
|
+
permissions: rest[3] as string[]
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const databaseId = params.databaseId;
|
|
363
|
+
const collectionId = params.collectionId;
|
|
364
|
+
const documentId = params.documentId;
|
|
365
|
+
const data = params.data;
|
|
366
|
+
const permissions = params.permissions;
|
|
367
|
+
|
|
200
368
|
if (typeof databaseId === 'undefined') {
|
|
201
369
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
202
370
|
}
|
|
@@ -229,13 +397,45 @@ export class Databases extends Service {
|
|
|
229
397
|
/**
|
|
230
398
|
* Delete a document by its unique ID.
|
|
231
399
|
*
|
|
232
|
-
* @param {string} databaseId
|
|
233
|
-
* @param {string} collectionId
|
|
234
|
-
* @param {string} documentId
|
|
400
|
+
* @param {string} params.databaseId - Database ID.
|
|
401
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
402
|
+
* @param {string} params.documentId - Document ID.
|
|
235
403
|
* @throws {AppwriteException}
|
|
236
404
|
* @returns {Promise}
|
|
405
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead.
|
|
237
406
|
*/
|
|
238
|
-
deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}
|
|
407
|
+
deleteDocument(params: { databaseId: string, collectionId: string, documentId: string }): Promise<{}>;
|
|
408
|
+
/**
|
|
409
|
+
* Delete a document by its unique ID.
|
|
410
|
+
*
|
|
411
|
+
* @param {string} databaseId - Database ID.
|
|
412
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
413
|
+
* @param {string} documentId - Document ID.
|
|
414
|
+
* @throws {AppwriteException}
|
|
415
|
+
* @returns {Promise<{}>}
|
|
416
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
417
|
+
*/
|
|
418
|
+
deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}>;
|
|
419
|
+
deleteDocument(
|
|
420
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string } | string,
|
|
421
|
+
...rest: [(string)?, (string)?]
|
|
422
|
+
): Promise<{}> {
|
|
423
|
+
let params: { databaseId: string, collectionId: string, documentId: string };
|
|
424
|
+
|
|
425
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
426
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string };
|
|
427
|
+
} else {
|
|
428
|
+
params = {
|
|
429
|
+
databaseId: paramsOrFirst as string,
|
|
430
|
+
collectionId: rest[0] as string,
|
|
431
|
+
documentId: rest[1] as string
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const databaseId = params.databaseId;
|
|
436
|
+
const collectionId = params.collectionId;
|
|
437
|
+
const documentId = params.documentId;
|
|
438
|
+
|
|
239
439
|
if (typeof databaseId === 'undefined') {
|
|
240
440
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
241
441
|
}
|
|
@@ -260,16 +460,57 @@ export class Databases extends Service {
|
|
|
260
460
|
/**
|
|
261
461
|
* Decrement a specific attribute of a document by a given value.
|
|
262
462
|
*
|
|
263
|
-
* @param {string} databaseId
|
|
264
|
-
* @param {string} collectionId
|
|
265
|
-
* @param {string} documentId
|
|
266
|
-
* @param {string} attribute
|
|
267
|
-
* @param {number} value
|
|
268
|
-
* @param {number} min
|
|
463
|
+
* @param {string} params.databaseId - Database ID.
|
|
464
|
+
* @param {string} params.collectionId - Collection ID.
|
|
465
|
+
* @param {string} params.documentId - Document ID.
|
|
466
|
+
* @param {string} params.attribute - Attribute key.
|
|
467
|
+
* @param {number} params.value - Value to increment the attribute by. The value must be a number.
|
|
468
|
+
* @param {number} params.min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
|
|
269
469
|
* @throws {AppwriteException}
|
|
270
470
|
* @returns {Promise}
|
|
471
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead.
|
|
271
472
|
*/
|
|
272
|
-
decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number): Promise<Document
|
|
473
|
+
decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number }): Promise<Document>;
|
|
474
|
+
/**
|
|
475
|
+
* Decrement a specific attribute of a document by a given value.
|
|
476
|
+
*
|
|
477
|
+
* @param {string} databaseId - Database ID.
|
|
478
|
+
* @param {string} collectionId - Collection ID.
|
|
479
|
+
* @param {string} documentId - Document ID.
|
|
480
|
+
* @param {string} attribute - Attribute key.
|
|
481
|
+
* @param {number} value - Value to increment the attribute by. The value must be a number.
|
|
482
|
+
* @param {number} min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
|
|
483
|
+
* @throws {AppwriteException}
|
|
484
|
+
* @returns {Promise<Document>}
|
|
485
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
486
|
+
*/
|
|
487
|
+
decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number): Promise<Document>;
|
|
488
|
+
decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(
|
|
489
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number } | string,
|
|
490
|
+
...rest: [(string)?, (string)?, (string)?, (number)?, (number)?]
|
|
491
|
+
): Promise<Document> {
|
|
492
|
+
let params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number };
|
|
493
|
+
|
|
494
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
495
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number };
|
|
496
|
+
} else {
|
|
497
|
+
params = {
|
|
498
|
+
databaseId: paramsOrFirst as string,
|
|
499
|
+
collectionId: rest[0] as string,
|
|
500
|
+
documentId: rest[1] as string,
|
|
501
|
+
attribute: rest[2] as string,
|
|
502
|
+
value: rest[3] as number,
|
|
503
|
+
min: rest[4] as number
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
const databaseId = params.databaseId;
|
|
508
|
+
const collectionId = params.collectionId;
|
|
509
|
+
const documentId = params.documentId;
|
|
510
|
+
const attribute = params.attribute;
|
|
511
|
+
const value = params.value;
|
|
512
|
+
const min = params.min;
|
|
513
|
+
|
|
273
514
|
if (typeof databaseId === 'undefined') {
|
|
274
515
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
275
516
|
}
|
|
@@ -306,16 +547,57 @@ export class Databases extends Service {
|
|
|
306
547
|
/**
|
|
307
548
|
* Increment a specific attribute of a document by a given value.
|
|
308
549
|
*
|
|
309
|
-
* @param {string} databaseId
|
|
310
|
-
* @param {string} collectionId
|
|
311
|
-
* @param {string} documentId
|
|
312
|
-
* @param {string} attribute
|
|
313
|
-
* @param {number} value
|
|
314
|
-
* @param {number} max
|
|
550
|
+
* @param {string} params.databaseId - Database ID.
|
|
551
|
+
* @param {string} params.collectionId - Collection ID.
|
|
552
|
+
* @param {string} params.documentId - Document ID.
|
|
553
|
+
* @param {string} params.attribute - Attribute key.
|
|
554
|
+
* @param {number} params.value - Value to increment the attribute by. The value must be a number.
|
|
555
|
+
* @param {number} params.max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
|
|
315
556
|
* @throws {AppwriteException}
|
|
316
557
|
* @returns {Promise}
|
|
558
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead.
|
|
559
|
+
*/
|
|
560
|
+
incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number }): Promise<Document>;
|
|
561
|
+
/**
|
|
562
|
+
* Increment a specific attribute of a document by a given value.
|
|
563
|
+
*
|
|
564
|
+
* @param {string} databaseId - Database ID.
|
|
565
|
+
* @param {string} collectionId - Collection ID.
|
|
566
|
+
* @param {string} documentId - Document ID.
|
|
567
|
+
* @param {string} attribute - Attribute key.
|
|
568
|
+
* @param {number} value - Value to increment the attribute by. The value must be a number.
|
|
569
|
+
* @param {number} max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
|
|
570
|
+
* @throws {AppwriteException}
|
|
571
|
+
* @returns {Promise<Document>}
|
|
572
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
317
573
|
*/
|
|
318
|
-
incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number): Promise<Document
|
|
574
|
+
incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number): Promise<Document>;
|
|
575
|
+
incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(
|
|
576
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number } | string,
|
|
577
|
+
...rest: [(string)?, (string)?, (string)?, (number)?, (number)?]
|
|
578
|
+
): Promise<Document> {
|
|
579
|
+
let params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number };
|
|
580
|
+
|
|
581
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
582
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number };
|
|
583
|
+
} else {
|
|
584
|
+
params = {
|
|
585
|
+
databaseId: paramsOrFirst as string,
|
|
586
|
+
collectionId: rest[0] as string,
|
|
587
|
+
documentId: rest[1] as string,
|
|
588
|
+
attribute: rest[2] as string,
|
|
589
|
+
value: rest[3] as number,
|
|
590
|
+
max: rest[4] as number
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
const databaseId = params.databaseId;
|
|
595
|
+
const collectionId = params.collectionId;
|
|
596
|
+
const documentId = params.documentId;
|
|
597
|
+
const attribute = params.attribute;
|
|
598
|
+
const value = params.value;
|
|
599
|
+
const max = params.max;
|
|
600
|
+
|
|
319
601
|
if (typeof databaseId === 'undefined') {
|
|
320
602
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
321
603
|
}
|