react-native-appwrite 0.3.0 → 0.3.1

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.
@@ -0,0 +1,149 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ import { Browser } from '../enums/browser';
4
+ import { CreditCard } from '../enums/credit-card';
5
+ import { Flag } from '../enums/flag';
6
+ export declare class Avatars extends Service {
7
+ constructor(client: Client);
8
+ /**
9
+ * Get browser icon
10
+ *
11
+ * You can use this endpoint to show different browser icons to your users.
12
+ * The code argument receives the browser code as it appears in your user [GET
13
+ * /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions)
14
+ * endpoint. Use width, height and quality arguments to change the output
15
+ * settings.
16
+ *
17
+ * When one dimension is specified and the other is 0, the image is scaled
18
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
19
+ * image at source quality. If dimensions are not specified, the default size
20
+ * of image returned is 100x100px.
21
+ *
22
+ * @param {Browser} code
23
+ * @param {number} width
24
+ * @param {number} height
25
+ * @param {number} quality
26
+ * @throws {AppwriteException}
27
+ * @returns {URL}
28
+ */
29
+ getBrowser(code: Browser, width?: number, height?: number, quality?: number): URL;
30
+ /**
31
+ * Get credit card icon
32
+ *
33
+ * The credit card endpoint will return you the icon of the credit card
34
+ * provider you need. Use width, height and quality arguments to change the
35
+ * output settings.
36
+ *
37
+ * When one dimension is specified and the other is 0, the image is scaled
38
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
39
+ * image at source quality. If dimensions are not specified, the default size
40
+ * of image returned is 100x100px.
41
+ *
42
+ *
43
+ * @param {CreditCard} code
44
+ * @param {number} width
45
+ * @param {number} height
46
+ * @param {number} quality
47
+ * @throws {AppwriteException}
48
+ * @returns {URL}
49
+ */
50
+ getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): URL;
51
+ /**
52
+ * Get favicon
53
+ *
54
+ * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
55
+ * website URL.
56
+ *
57
+ *
58
+ * @param {string} url
59
+ * @throws {AppwriteException}
60
+ * @returns {URL}
61
+ */
62
+ getFavicon(url: string): URL;
63
+ /**
64
+ * Get country flag
65
+ *
66
+ * You can use this endpoint to show different country flags icons to your
67
+ * users. The code argument receives the 2 letter country code. Use width,
68
+ * height and quality arguments to change the output settings. Country codes
69
+ * follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
70
+ *
71
+ * When one dimension is specified and the other is 0, the image is scaled
72
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
73
+ * image at source quality. If dimensions are not specified, the default size
74
+ * of image returned is 100x100px.
75
+ *
76
+ *
77
+ * @param {Flag} code
78
+ * @param {number} width
79
+ * @param {number} height
80
+ * @param {number} quality
81
+ * @throws {AppwriteException}
82
+ * @returns {URL}
83
+ */
84
+ getFlag(code: Flag, width?: number, height?: number, quality?: number): URL;
85
+ /**
86
+ * Get image from URL
87
+ *
88
+ * Use this endpoint to fetch a remote image URL and crop it to any image size
89
+ * you want. This endpoint is very useful if you need to crop and display
90
+ * remote images in your app or in case you want to make sure a 3rd party
91
+ * image is properly served using a TLS protocol.
92
+ *
93
+ * When one dimension is specified and the other is 0, the image is scaled
94
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
95
+ * image at source quality. If dimensions are not specified, the default size
96
+ * of image returned is 400x400px.
97
+ *
98
+ *
99
+ * @param {string} url
100
+ * @param {number} width
101
+ * @param {number} height
102
+ * @throws {AppwriteException}
103
+ * @returns {URL}
104
+ */
105
+ getImage(url: string, width?: number, height?: number): URL;
106
+ /**
107
+ * Get user initials
108
+ *
109
+ * Use this endpoint to show your user initials avatar icon on your website or
110
+ * app. By default, this route will try to print your logged-in user name or
111
+ * email initials. You can also overwrite the user name if you pass the 'name'
112
+ * parameter. If no name is given and no user is logged, an empty avatar will
113
+ * be returned.
114
+ *
115
+ * You can use the color and background params to change the avatar colors. By
116
+ * default, a random theme will be selected. The random theme will persist for
117
+ * the user's initials when reloading the same theme will always return for
118
+ * the same initials.
119
+ *
120
+ * When one dimension is specified and the other is 0, the image is scaled
121
+ * with preserved aspect ratio. If both dimensions are 0, the API provides an
122
+ * image at source quality. If dimensions are not specified, the default size
123
+ * of image returned is 100x100px.
124
+ *
125
+ *
126
+ * @param {string} name
127
+ * @param {number} width
128
+ * @param {number} height
129
+ * @param {string} background
130
+ * @throws {AppwriteException}
131
+ * @returns {URL}
132
+ */
133
+ getInitials(name?: string, width?: number, height?: number, background?: string): URL;
134
+ /**
135
+ * Get QR code
136
+ *
137
+ * Converts a given plain text to a QR code image. You can use the query
138
+ * parameters to change the size and style of the resulting image.
139
+ *
140
+ *
141
+ * @param {string} text
142
+ * @param {number} size
143
+ * @param {number} margin
144
+ * @param {boolean} download
145
+ * @throws {AppwriteException}
146
+ * @returns {URL}
147
+ */
148
+ getQR(text: string, size?: number, margin?: number, download?: boolean): URL;
149
+ }
@@ -0,0 +1,77 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ import type { Models } from '../models';
4
+ export declare class Databases extends Service {
5
+ constructor(client: Client);
6
+ /**
7
+ * List documents
8
+ *
9
+ * Get a list of all the user's documents in a given collection. You can use
10
+ * the query params to filter your results.
11
+ *
12
+ * @param {string} databaseId
13
+ * @param {string} collectionId
14
+ * @param {string[]} queries
15
+ * @throws {AppwriteException}
16
+ * @returns {Promise}
17
+ */
18
+ listDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>>;
19
+ /**
20
+ * Create document
21
+ *
22
+ * Create a new Document. Before using this route, you should create a new
23
+ * collection resource using either a [server
24
+ * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
25
+ * API or directly from your database console.
26
+ *
27
+ * @param {string} databaseId
28
+ * @param {string} collectionId
29
+ * @param {string} documentId
30
+ * @param {object} data
31
+ * @param {string[]} permissions
32
+ * @throws {AppwriteException}
33
+ * @returns {Promise}
34
+ */
35
+ createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise<Document>;
36
+ /**
37
+ * Get document
38
+ *
39
+ * Get a document by its unique ID. This endpoint response returns a JSON
40
+ * object with the document data.
41
+ *
42
+ * @param {string} databaseId
43
+ * @param {string} collectionId
44
+ * @param {string} documentId
45
+ * @param {string[]} queries
46
+ * @throws {AppwriteException}
47
+ * @returns {Promise}
48
+ */
49
+ getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document>;
50
+ /**
51
+ * Update document
52
+ *
53
+ * Update a document by its unique ID. Using the patch method you can pass
54
+ * only specific fields that will get updated.
55
+ *
56
+ * @param {string} databaseId
57
+ * @param {string} collectionId
58
+ * @param {string} documentId
59
+ * @param {object} data
60
+ * @param {string[]} permissions
61
+ * @throws {AppwriteException}
62
+ * @returns {Promise}
63
+ */
64
+ updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: object, permissions?: string[]): Promise<Document>;
65
+ /**
66
+ * Delete document
67
+ *
68
+ * Delete a document by its unique ID.
69
+ *
70
+ * @param {string} databaseId
71
+ * @param {string} collectionId
72
+ * @param {string} documentId
73
+ * @throws {AppwriteException}
74
+ * @returns {Promise}
75
+ */
76
+ deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}>;
77
+ }
@@ -0,0 +1,49 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ import type { Models } from '../models';
4
+ import { ExecutionMethod } from '../enums/execution-method';
5
+ export declare class Functions extends Service {
6
+ constructor(client: Client);
7
+ /**
8
+ * List executions
9
+ *
10
+ * Get a list of all the current user function execution logs. You can use the
11
+ * query params to filter your results.
12
+ *
13
+ * @param {string} functionId
14
+ * @param {string[]} queries
15
+ * @param {string} search
16
+ * @throws {AppwriteException}
17
+ * @returns {Promise}
18
+ */
19
+ listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList>;
20
+ /**
21
+ * Create execution
22
+ *
23
+ * Trigger a function execution. The returned object will return you the
24
+ * current execution status. You can ping the `Get Execution` endpoint to get
25
+ * updates on the current execution status. Once this endpoint is called, your
26
+ * function execution process will start asynchronously.
27
+ *
28
+ * @param {string} functionId
29
+ * @param {string} body
30
+ * @param {boolean} async
31
+ * @param {string} xpath
32
+ * @param {ExecutionMethod} method
33
+ * @param {object} headers
34
+ * @throws {AppwriteException}
35
+ * @returns {Promise}
36
+ */
37
+ createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object): Promise<Models.Execution>;
38
+ /**
39
+ * Get execution
40
+ *
41
+ * Get a function execution log by its unique ID.
42
+ *
43
+ * @param {string} functionId
44
+ * @param {string} executionId
45
+ * @throws {AppwriteException}
46
+ * @returns {Promise}
47
+ */
48
+ getExecution(functionId: string, executionId: string): Promise<Models.Execution>;
49
+ }
@@ -0,0 +1,25 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ export declare class Graphql extends Service {
4
+ constructor(client: Client);
5
+ /**
6
+ * GraphQL endpoint
7
+ *
8
+ * Execute a GraphQL mutation.
9
+ *
10
+ * @param {object} query
11
+ * @throws {AppwriteException}
12
+ * @returns {Promise}
13
+ */
14
+ query(query: object): Promise<{}>;
15
+ /**
16
+ * GraphQL endpoint
17
+ *
18
+ * Execute a GraphQL mutation.
19
+ *
20
+ * @param {object} query
21
+ * @throws {AppwriteException}
22
+ * @returns {Promise}
23
+ */
24
+ mutation(query: object): Promise<{}>;
25
+ }
@@ -0,0 +1,91 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ import type { Models } from '../models';
4
+ export declare class Locale extends Service {
5
+ constructor(client: Client);
6
+ /**
7
+ * Get user locale
8
+ *
9
+ * Get the current user location based on IP. Returns an object with user
10
+ * country code, country name, continent name, continent code, ip address and
11
+ * suggested currency. You can use the locale header to get the data in a
12
+ * supported language.
13
+ *
14
+ * ([IP Geolocation by DB-IP](https://db-ip.com))
15
+ *
16
+ * @throws {AppwriteException}
17
+ * @returns {Promise}
18
+ */
19
+ get(): Promise<Models.Locale>;
20
+ /**
21
+ * List Locale Codes
22
+ *
23
+ * List of all locale codes in [ISO
24
+ * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
25
+ *
26
+ * @throws {AppwriteException}
27
+ * @returns {Promise}
28
+ */
29
+ listCodes(): Promise<Models.LocaleCodeList>;
30
+ /**
31
+ * List continents
32
+ *
33
+ * List of all continents. You can use the locale header to get the data in a
34
+ * supported language.
35
+ *
36
+ * @throws {AppwriteException}
37
+ * @returns {Promise}
38
+ */
39
+ listContinents(): Promise<Models.ContinentList>;
40
+ /**
41
+ * List countries
42
+ *
43
+ * List of all countries. You can use the locale header to get the data in a
44
+ * supported language.
45
+ *
46
+ * @throws {AppwriteException}
47
+ * @returns {Promise}
48
+ */
49
+ listCountries(): Promise<Models.CountryList>;
50
+ /**
51
+ * List EU countries
52
+ *
53
+ * List of all countries that are currently members of the EU. You can use the
54
+ * locale header to get the data in a supported language.
55
+ *
56
+ * @throws {AppwriteException}
57
+ * @returns {Promise}
58
+ */
59
+ listCountriesEU(): Promise<Models.CountryList>;
60
+ /**
61
+ * List countries phone codes
62
+ *
63
+ * List of all countries phone codes. You can use the locale header to get the
64
+ * data in a supported language.
65
+ *
66
+ * @throws {AppwriteException}
67
+ * @returns {Promise}
68
+ */
69
+ listCountriesPhones(): Promise<Models.PhoneList>;
70
+ /**
71
+ * List currencies
72
+ *
73
+ * List of all currencies, including currency symbol, name, plural, and
74
+ * decimal digits for all major and minor currencies. You can use the locale
75
+ * header to get the data in a supported language.
76
+ *
77
+ * @throws {AppwriteException}
78
+ * @returns {Promise}
79
+ */
80
+ listCurrencies(): Promise<Models.CurrencyList>;
81
+ /**
82
+ * List languages
83
+ *
84
+ * List of all languages classified by ISO 639-1 including 2-letter code, name
85
+ * in English, and name in the respective language.
86
+ *
87
+ * @throws {AppwriteException}
88
+ * @returns {Promise}
89
+ */
90
+ listLanguages(): Promise<Models.LanguageList>;
91
+ }
@@ -0,0 +1,29 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ import type { Models } from '../models';
4
+ export declare class Messaging extends Service {
5
+ constructor(client: Client);
6
+ /**
7
+ * Create subscriber
8
+ *
9
+ * Create a new subscriber.
10
+ *
11
+ * @param {string} topicId
12
+ * @param {string} subscriberId
13
+ * @param {string} targetId
14
+ * @throws {AppwriteException}
15
+ * @returns {Promise}
16
+ */
17
+ createSubscriber(topicId: string, subscriberId: string, targetId: string): Promise<Models.Subscriber>;
18
+ /**
19
+ * Delete subscriber
20
+ *
21
+ * Delete a subscriber by its unique ID.
22
+ *
23
+ * @param {string} topicId
24
+ * @param {string} subscriberId
25
+ * @throws {AppwriteException}
26
+ * @returns {Promise}
27
+ */
28
+ deleteSubscriber(topicId: string, subscriberId: string): Promise<{}>;
29
+ }
@@ -0,0 +1,147 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ import type { Models } from '../models';
4
+ import type { UploadProgress } from '../client';
5
+ import { ImageGravity } from '../enums/image-gravity';
6
+ import { ImageFormat } from '../enums/image-format';
7
+ export declare class Storage extends Service {
8
+ constructor(client: Client);
9
+ /**
10
+ * List files
11
+ *
12
+ * Get a list of all the user files. You can use the query params to filter
13
+ * your results.
14
+ *
15
+ * @param {string} bucketId
16
+ * @param {string[]} queries
17
+ * @param {string} search
18
+ * @throws {AppwriteException}
19
+ * @returns {Promise}
20
+ */
21
+ listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList>;
22
+ /**
23
+ * Create file
24
+ *
25
+ * Create a new file. Before using this route, you should create a new bucket
26
+ * resource using either a [server
27
+ * integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
28
+ * API or directly from your Appwrite console.
29
+ *
30
+ * Larger files should be uploaded using multiple requests with the
31
+ * [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
32
+ * header to send a partial request with a maximum supported chunk of `5MB`.
33
+ * The `content-range` header values should always be in bytes.
34
+ *
35
+ * When the first request is sent, the server will return the **File** object,
36
+ * and the subsequent part request must include the file's **id** in
37
+ * `x-appwrite-id` header to allow the server to know that the partial upload
38
+ * is for the existing file and not for a new one.
39
+ *
40
+ * If you're creating a new file using one of the Appwrite SDKs, all the
41
+ * chunking logic will be managed by the SDK internally.
42
+ *
43
+ *
44
+ * @param {string} bucketId
45
+ * @param {string} fileId
46
+ * @param {{name: string, type: string, size: number, uri: string}} file
47
+ * @param {string[]} permissions
48
+ * @throws {AppwriteException}
49
+ * @returns {Promise}
50
+ */
51
+ createFile(bucketId: string, fileId: string, file: {
52
+ name: string;
53
+ type: string;
54
+ size: number;
55
+ uri: string;
56
+ }, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>;
57
+ /**
58
+ * Get file
59
+ *
60
+ * Get a file by its unique ID. This endpoint response returns a JSON object
61
+ * with the file metadata.
62
+ *
63
+ * @param {string} bucketId
64
+ * @param {string} fileId
65
+ * @throws {AppwriteException}
66
+ * @returns {Promise}
67
+ */
68
+ getFile(bucketId: string, fileId: string): Promise<Models.File>;
69
+ /**
70
+ * Update file
71
+ *
72
+ * Update a file by its unique ID. Only users with write permissions have
73
+ * access to update this resource.
74
+ *
75
+ * @param {string} bucketId
76
+ * @param {string} fileId
77
+ * @param {string} name
78
+ * @param {string[]} permissions
79
+ * @throws {AppwriteException}
80
+ * @returns {Promise}
81
+ */
82
+ updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File>;
83
+ /**
84
+ * Delete File
85
+ *
86
+ * Delete a file by its unique ID. Only users with write permissions have
87
+ * access to delete this resource.
88
+ *
89
+ * @param {string} bucketId
90
+ * @param {string} fileId
91
+ * @throws {AppwriteException}
92
+ * @returns {Promise}
93
+ */
94
+ deleteFile(bucketId: string, fileId: string): Promise<{}>;
95
+ /**
96
+ * Get file for download
97
+ *
98
+ * Get a file content by its unique ID. The endpoint response return with a
99
+ * 'Content-Disposition: attachment' header that tells the browser to start
100
+ * downloading the file to user downloads directory.
101
+ *
102
+ * @param {string} bucketId
103
+ * @param {string} fileId
104
+ * @throws {AppwriteException}
105
+ * @returns {URL}
106
+ */
107
+ getFileDownload(bucketId: string, fileId: string): URL;
108
+ /**
109
+ * Get file preview
110
+ *
111
+ * Get a file preview image. Currently, this method supports preview for image
112
+ * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
113
+ * and spreadsheets, will return the file icon image. You can also pass query
114
+ * string arguments for cutting and resizing your preview image. Preview is
115
+ * supported only for image files smaller than 10MB.
116
+ *
117
+ * @param {string} bucketId
118
+ * @param {string} fileId
119
+ * @param {number} width
120
+ * @param {number} height
121
+ * @param {ImageGravity} gravity
122
+ * @param {number} quality
123
+ * @param {number} borderWidth
124
+ * @param {string} borderColor
125
+ * @param {number} borderRadius
126
+ * @param {number} opacity
127
+ * @param {number} rotation
128
+ * @param {string} background
129
+ * @param {ImageFormat} output
130
+ * @throws {AppwriteException}
131
+ * @returns {URL}
132
+ */
133
+ getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): URL;
134
+ /**
135
+ * Get file for view
136
+ *
137
+ * Get a file content by its unique ID. This endpoint is similar to the
138
+ * download method but returns with no 'Content-Disposition: attachment'
139
+ * header.
140
+ *
141
+ * @param {string} bucketId
142
+ * @param {string} fileId
143
+ * @throws {AppwriteException}
144
+ * @returns {URL}
145
+ */
146
+ getFileView(bucketId: string, fileId: string): URL;
147
+ }