react-native-appwrite 0.9.2 → 0.10.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/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/dist/cjs/sdk.js +241 -20
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +241 -20
- package/dist/esm/sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +4 -2
- package/src/services/avatars.ts +296 -20
- package/src/services/storage.ts +140 -8
- package/types/client.d.ts +1 -1
- package/types/services/avatars.d.ts +136 -7
- package/types/services/storage.d.ts +52 -3
package/dist/esm/sdk.js
CHANGED
|
@@ -78,7 +78,7 @@ class Client {
|
|
|
78
78
|
'x-sdk-name': 'React Native',
|
|
79
79
|
'x-sdk-platform': 'client',
|
|
80
80
|
'x-sdk-language': 'reactnative',
|
|
81
|
-
'x-sdk-version': '0.
|
|
81
|
+
'x-sdk-version': '0.10.0',
|
|
82
82
|
'X-Appwrite-Response-Format': '1.7.0',
|
|
83
83
|
};
|
|
84
84
|
this.realtime = {
|
|
@@ -370,7 +370,7 @@ class Client {
|
|
|
370
370
|
};
|
|
371
371
|
}
|
|
372
372
|
call(method_1, url_1) {
|
|
373
|
-
return __awaiter(this, arguments, void 0, function* (method, url, headers = {}, params = {}) {
|
|
373
|
+
return __awaiter(this, arguments, void 0, function* (method, url, headers = {}, params = {}, responseType = 'json') {
|
|
374
374
|
var _a, _b;
|
|
375
375
|
method = method.toUpperCase();
|
|
376
376
|
headers = Object.assign({}, this.headers, headers);
|
|
@@ -419,6 +419,9 @@ class Client {
|
|
|
419
419
|
if ((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')) {
|
|
420
420
|
data = yield response.json();
|
|
421
421
|
}
|
|
422
|
+
else if (responseType === 'arrayBuffer') {
|
|
423
|
+
data = yield response.arrayBuffer();
|
|
424
|
+
}
|
|
422
425
|
else {
|
|
423
426
|
data = {
|
|
424
427
|
message: yield response.text()
|
|
@@ -1705,7 +1708,7 @@ class Avatars extends Service {
|
|
|
1705
1708
|
* @param {number} height
|
|
1706
1709
|
* @param {number} quality
|
|
1707
1710
|
* @throws {AppwriteException}
|
|
1708
|
-
* @returns {
|
|
1711
|
+
* @returns {ArrayBuffer}
|
|
1709
1712
|
*/
|
|
1710
1713
|
getBrowser(code, width, height, quality) {
|
|
1711
1714
|
if (typeof code === 'undefined') {
|
|
@@ -1727,7 +1730,7 @@ class Avatars extends Service {
|
|
|
1727
1730
|
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
1728
1731
|
uri.searchParams.append(key, value);
|
|
1729
1732
|
}
|
|
1730
|
-
return uri;
|
|
1733
|
+
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1731
1734
|
}
|
|
1732
1735
|
/**
|
|
1733
1736
|
* The credit card endpoint will return you the icon of the credit card
|
|
@@ -1745,7 +1748,7 @@ class Avatars extends Service {
|
|
|
1745
1748
|
* @param {number} height
|
|
1746
1749
|
* @param {number} quality
|
|
1747
1750
|
* @throws {AppwriteException}
|
|
1748
|
-
* @returns {
|
|
1751
|
+
* @returns {ArrayBuffer}
|
|
1749
1752
|
*/
|
|
1750
1753
|
getCreditCard(code, width, height, quality) {
|
|
1751
1754
|
if (typeof code === 'undefined') {
|
|
@@ -1767,7 +1770,7 @@ class Avatars extends Service {
|
|
|
1767
1770
|
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
1768
1771
|
uri.searchParams.append(key, value);
|
|
1769
1772
|
}
|
|
1770
|
-
return uri;
|
|
1773
|
+
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1771
1774
|
}
|
|
1772
1775
|
/**
|
|
1773
1776
|
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
|
|
@@ -1777,7 +1780,7 @@ class Avatars extends Service {
|
|
|
1777
1780
|
*
|
|
1778
1781
|
* @param {string} url
|
|
1779
1782
|
* @throws {AppwriteException}
|
|
1780
|
-
* @returns {
|
|
1783
|
+
* @returns {ArrayBuffer}
|
|
1781
1784
|
*/
|
|
1782
1785
|
getFavicon(url) {
|
|
1783
1786
|
if (typeof url === 'undefined') {
|
|
@@ -1793,7 +1796,7 @@ class Avatars extends Service {
|
|
|
1793
1796
|
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
1794
1797
|
uri.searchParams.append(key, value);
|
|
1795
1798
|
}
|
|
1796
|
-
return uri;
|
|
1799
|
+
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1797
1800
|
}
|
|
1798
1801
|
/**
|
|
1799
1802
|
* You can use this endpoint to show different country flags icons to your
|
|
@@ -1812,7 +1815,7 @@ class Avatars extends Service {
|
|
|
1812
1815
|
* @param {number} height
|
|
1813
1816
|
* @param {number} quality
|
|
1814
1817
|
* @throws {AppwriteException}
|
|
1815
|
-
* @returns {
|
|
1818
|
+
* @returns {ArrayBuffer}
|
|
1816
1819
|
*/
|
|
1817
1820
|
getFlag(code, width, height, quality) {
|
|
1818
1821
|
if (typeof code === 'undefined') {
|
|
@@ -1834,7 +1837,7 @@ class Avatars extends Service {
|
|
|
1834
1837
|
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
1835
1838
|
uri.searchParams.append(key, value);
|
|
1836
1839
|
}
|
|
1837
|
-
return uri;
|
|
1840
|
+
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1838
1841
|
}
|
|
1839
1842
|
/**
|
|
1840
1843
|
* Use this endpoint to fetch a remote image URL and crop it to any image size
|
|
@@ -1853,7 +1856,7 @@ class Avatars extends Service {
|
|
|
1853
1856
|
* @param {number} width
|
|
1854
1857
|
* @param {number} height
|
|
1855
1858
|
* @throws {AppwriteException}
|
|
1856
|
-
* @returns {
|
|
1859
|
+
* @returns {ArrayBuffer}
|
|
1857
1860
|
*/
|
|
1858
1861
|
getImage(url, width, height) {
|
|
1859
1862
|
if (typeof url === 'undefined') {
|
|
@@ -1875,7 +1878,7 @@ class Avatars extends Service {
|
|
|
1875
1878
|
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
1876
1879
|
uri.searchParams.append(key, value);
|
|
1877
1880
|
}
|
|
1878
|
-
return uri;
|
|
1881
|
+
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1879
1882
|
}
|
|
1880
1883
|
/**
|
|
1881
1884
|
* Use this endpoint to show your user initials avatar icon on your website or
|
|
@@ -1900,7 +1903,7 @@ class Avatars extends Service {
|
|
|
1900
1903
|
* @param {number} height
|
|
1901
1904
|
* @param {string} background
|
|
1902
1905
|
* @throws {AppwriteException}
|
|
1903
|
-
* @returns {
|
|
1906
|
+
* @returns {ArrayBuffer}
|
|
1904
1907
|
*/
|
|
1905
1908
|
getInitials(name, width, height, background) {
|
|
1906
1909
|
const apiPath = '/avatars/initials';
|
|
@@ -1922,7 +1925,7 @@ class Avatars extends Service {
|
|
|
1922
1925
|
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
1923
1926
|
uri.searchParams.append(key, value);
|
|
1924
1927
|
}
|
|
1925
|
-
return uri;
|
|
1928
|
+
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1926
1929
|
}
|
|
1927
1930
|
/**
|
|
1928
1931
|
* Converts a given plain text to a QR code image. You can use the query
|
|
@@ -1934,7 +1937,7 @@ class Avatars extends Service {
|
|
|
1934
1937
|
* @param {number} margin
|
|
1935
1938
|
* @param {boolean} download
|
|
1936
1939
|
* @throws {AppwriteException}
|
|
1937
|
-
* @returns {
|
|
1940
|
+
* @returns {ArrayBuffer}
|
|
1938
1941
|
*/
|
|
1939
1942
|
getQR(text, size, margin, download) {
|
|
1940
1943
|
if (typeof text === 'undefined') {
|
|
@@ -1959,6 +1962,163 @@ class Avatars extends Service {
|
|
|
1959
1962
|
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
1960
1963
|
uri.searchParams.append(key, value);
|
|
1961
1964
|
}
|
|
1965
|
+
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* You can use this endpoint to show different browser icons to your users.
|
|
1969
|
+
* The code argument receives the browser code as it appears in your user [GET
|
|
1970
|
+
* /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions)
|
|
1971
|
+
* endpoint. Use width, height and quality arguments to change the output
|
|
1972
|
+
* settings.
|
|
1973
|
+
*
|
|
1974
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
1975
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
1976
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
1977
|
+
* of image returned is 100x100px.
|
|
1978
|
+
*
|
|
1979
|
+
* @param {Browser} code
|
|
1980
|
+
* @param {number} width
|
|
1981
|
+
* @param {number} height
|
|
1982
|
+
* @param {number} quality
|
|
1983
|
+
* @throws {AppwriteException}
|
|
1984
|
+
* @returns {URL}
|
|
1985
|
+
*/
|
|
1986
|
+
getBrowserURL(code, width, height, quality) {
|
|
1987
|
+
const apiPath = '/avatars/browsers/{code}'.replace('{code}', code);
|
|
1988
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1989
|
+
return uri;
|
|
1990
|
+
}
|
|
1991
|
+
/**
|
|
1992
|
+
* The credit card endpoint will return you the icon of the credit card
|
|
1993
|
+
* provider you need. Use width, height and quality arguments to change the
|
|
1994
|
+
* output settings.
|
|
1995
|
+
*
|
|
1996
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
1997
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
1998
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
1999
|
+
* of image returned is 100x100px.
|
|
2000
|
+
*
|
|
2001
|
+
*
|
|
2002
|
+
* @param {CreditCard} code
|
|
2003
|
+
* @param {number} width
|
|
2004
|
+
* @param {number} height
|
|
2005
|
+
* @param {number} quality
|
|
2006
|
+
* @throws {AppwriteException}
|
|
2007
|
+
* @returns {URL}
|
|
2008
|
+
*/
|
|
2009
|
+
getCreditCardURL(code, width, height, quality) {
|
|
2010
|
+
const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);
|
|
2011
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2012
|
+
return uri;
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
|
|
2016
|
+
* website URL.
|
|
2017
|
+
*
|
|
2018
|
+
* This endpoint does not follow HTTP redirects.
|
|
2019
|
+
*
|
|
2020
|
+
* @param {string} url
|
|
2021
|
+
* @throws {AppwriteException}
|
|
2022
|
+
* @returns {URL}
|
|
2023
|
+
*/
|
|
2024
|
+
getFaviconURL(url) {
|
|
2025
|
+
const apiPath = '/avatars/favicon';
|
|
2026
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2027
|
+
return uri;
|
|
2028
|
+
}
|
|
2029
|
+
/**
|
|
2030
|
+
* You can use this endpoint to show different country flags icons to your
|
|
2031
|
+
* users. The code argument receives the 2 letter country code. Use width,
|
|
2032
|
+
* height and quality arguments to change the output settings. Country codes
|
|
2033
|
+
* follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
|
|
2034
|
+
*
|
|
2035
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
2036
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
2037
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
2038
|
+
* of image returned is 100x100px.
|
|
2039
|
+
*
|
|
2040
|
+
*
|
|
2041
|
+
* @param {Flag} code
|
|
2042
|
+
* @param {number} width
|
|
2043
|
+
* @param {number} height
|
|
2044
|
+
* @param {number} quality
|
|
2045
|
+
* @throws {AppwriteException}
|
|
2046
|
+
* @returns {URL}
|
|
2047
|
+
*/
|
|
2048
|
+
getFlagURL(code, width, height, quality) {
|
|
2049
|
+
const apiPath = '/avatars/flags/{code}'.replace('{code}', code);
|
|
2050
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2051
|
+
return uri;
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Use this endpoint to fetch a remote image URL and crop it to any image size
|
|
2055
|
+
* you want. This endpoint is very useful if you need to crop and display
|
|
2056
|
+
* remote images in your app or in case you want to make sure a 3rd party
|
|
2057
|
+
* image is properly served using a TLS protocol.
|
|
2058
|
+
*
|
|
2059
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
2060
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
2061
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
2062
|
+
* of image returned is 400x400px.
|
|
2063
|
+
*
|
|
2064
|
+
* This endpoint does not follow HTTP redirects.
|
|
2065
|
+
*
|
|
2066
|
+
* @param {string} url
|
|
2067
|
+
* @param {number} width
|
|
2068
|
+
* @param {number} height
|
|
2069
|
+
* @throws {AppwriteException}
|
|
2070
|
+
* @returns {URL}
|
|
2071
|
+
*/
|
|
2072
|
+
getImageURL(url, width, height) {
|
|
2073
|
+
const apiPath = '/avatars/image';
|
|
2074
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2075
|
+
return uri;
|
|
2076
|
+
}
|
|
2077
|
+
/**
|
|
2078
|
+
* Use this endpoint to show your user initials avatar icon on your website or
|
|
2079
|
+
* app. By default, this route will try to print your logged-in user name or
|
|
2080
|
+
* email initials. You can also overwrite the user name if you pass the 'name'
|
|
2081
|
+
* parameter. If no name is given and no user is logged, an empty avatar will
|
|
2082
|
+
* be returned.
|
|
2083
|
+
*
|
|
2084
|
+
* You can use the color and background params to change the avatar colors. By
|
|
2085
|
+
* default, a random theme will be selected. The random theme will persist for
|
|
2086
|
+
* the user's initials when reloading the same theme will always return for
|
|
2087
|
+
* the same initials.
|
|
2088
|
+
*
|
|
2089
|
+
* When one dimension is specified and the other is 0, the image is scaled
|
|
2090
|
+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
2091
|
+
* image at source quality. If dimensions are not specified, the default size
|
|
2092
|
+
* of image returned is 100x100px.
|
|
2093
|
+
*
|
|
2094
|
+
*
|
|
2095
|
+
* @param {string} name
|
|
2096
|
+
* @param {number} width
|
|
2097
|
+
* @param {number} height
|
|
2098
|
+
* @param {string} background
|
|
2099
|
+
* @throws {AppwriteException}
|
|
2100
|
+
* @returns {URL}
|
|
2101
|
+
*/
|
|
2102
|
+
getInitialsURL(name, width, height, background) {
|
|
2103
|
+
const apiPath = '/avatars/initials';
|
|
2104
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2105
|
+
return uri;
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* Converts a given plain text to a QR code image. You can use the query
|
|
2109
|
+
* parameters to change the size and style of the resulting image.
|
|
2110
|
+
*
|
|
2111
|
+
*
|
|
2112
|
+
* @param {string} text
|
|
2113
|
+
* @param {number} size
|
|
2114
|
+
* @param {number} margin
|
|
2115
|
+
* @param {boolean} download
|
|
2116
|
+
* @throws {AppwriteException}
|
|
2117
|
+
* @returns {URL}
|
|
2118
|
+
*/
|
|
2119
|
+
getQRURL(text, size, margin, download) {
|
|
2120
|
+
const apiPath = '/avatars/qr';
|
|
2121
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1962
2122
|
return uri;
|
|
1963
2123
|
}
|
|
1964
2124
|
}
|
|
@@ -2697,7 +2857,7 @@ class Storage extends Service {
|
|
|
2697
2857
|
* @param {string} fileId
|
|
2698
2858
|
* @param {string} token
|
|
2699
2859
|
* @throws {AppwriteException}
|
|
2700
|
-
* @returns {
|
|
2860
|
+
* @returns {ArrayBuffer}
|
|
2701
2861
|
*/
|
|
2702
2862
|
getFileDownload(bucketId, fileId, token) {
|
|
2703
2863
|
if (typeof bucketId === 'undefined') {
|
|
@@ -2716,7 +2876,7 @@ class Storage extends Service {
|
|
|
2716
2876
|
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
2717
2877
|
uri.searchParams.append(key, value);
|
|
2718
2878
|
}
|
|
2719
|
-
return uri;
|
|
2879
|
+
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
2720
2880
|
}
|
|
2721
2881
|
/**
|
|
2722
2882
|
* Get a file preview image. Currently, this method supports preview for image
|
|
@@ -2740,7 +2900,7 @@ class Storage extends Service {
|
|
|
2740
2900
|
* @param {ImageFormat} output
|
|
2741
2901
|
* @param {string} token
|
|
2742
2902
|
* @throws {AppwriteException}
|
|
2743
|
-
* @returns {
|
|
2903
|
+
* @returns {ArrayBuffer}
|
|
2744
2904
|
*/
|
|
2745
2905
|
getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output, token) {
|
|
2746
2906
|
if (typeof bucketId === 'undefined') {
|
|
@@ -2792,7 +2952,7 @@ class Storage extends Service {
|
|
|
2792
2952
|
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
2793
2953
|
uri.searchParams.append(key, value);
|
|
2794
2954
|
}
|
|
2795
|
-
return uri;
|
|
2955
|
+
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
2796
2956
|
}
|
|
2797
2957
|
/**
|
|
2798
2958
|
* Get a file content by its unique ID. This endpoint is similar to the
|
|
@@ -2803,7 +2963,7 @@ class Storage extends Service {
|
|
|
2803
2963
|
* @param {string} fileId
|
|
2804
2964
|
* @param {string} token
|
|
2805
2965
|
* @throws {AppwriteException}
|
|
2806
|
-
* @returns {
|
|
2966
|
+
* @returns {ArrayBuffer}
|
|
2807
2967
|
*/
|
|
2808
2968
|
getFileView(bucketId, fileId, token) {
|
|
2809
2969
|
if (typeof bucketId === 'undefined') {
|
|
@@ -2822,6 +2982,67 @@ class Storage extends Service {
|
|
|
2822
2982
|
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
2823
2983
|
uri.searchParams.append(key, value);
|
|
2824
2984
|
}
|
|
2985
|
+
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
2986
|
+
}
|
|
2987
|
+
/**
|
|
2988
|
+
* Get a file content by its unique ID. The endpoint response return with a
|
|
2989
|
+
* 'Content-Disposition: attachment' header that tells the browser to start
|
|
2990
|
+
* downloading the file to user downloads directory.
|
|
2991
|
+
*
|
|
2992
|
+
* @param {string} bucketId
|
|
2993
|
+
* @param {string} fileId
|
|
2994
|
+
* @param {string} token
|
|
2995
|
+
* @throws {AppwriteException}
|
|
2996
|
+
* @returns {URL}
|
|
2997
|
+
*/
|
|
2998
|
+
getFileDownloadURL(bucketId, fileId, token) {
|
|
2999
|
+
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
3000
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3001
|
+
return uri;
|
|
3002
|
+
}
|
|
3003
|
+
/**
|
|
3004
|
+
* Get a file preview image. Currently, this method supports preview for image
|
|
3005
|
+
* files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
|
|
3006
|
+
* and spreadsheets, will return the file icon image. You can also pass query
|
|
3007
|
+
* string arguments for cutting and resizing your preview image. Preview is
|
|
3008
|
+
* supported only for image files smaller than 10MB.
|
|
3009
|
+
*
|
|
3010
|
+
* @param {string} bucketId
|
|
3011
|
+
* @param {string} fileId
|
|
3012
|
+
* @param {number} width
|
|
3013
|
+
* @param {number} height
|
|
3014
|
+
* @param {ImageGravity} gravity
|
|
3015
|
+
* @param {number} quality
|
|
3016
|
+
* @param {number} borderWidth
|
|
3017
|
+
* @param {string} borderColor
|
|
3018
|
+
* @param {number} borderRadius
|
|
3019
|
+
* @param {number} opacity
|
|
3020
|
+
* @param {number} rotation
|
|
3021
|
+
* @param {string} background
|
|
3022
|
+
* @param {ImageFormat} output
|
|
3023
|
+
* @param {string} token
|
|
3024
|
+
* @throws {AppwriteException}
|
|
3025
|
+
* @returns {URL}
|
|
3026
|
+
*/
|
|
3027
|
+
getFilePreviewURL(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output, token) {
|
|
3028
|
+
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
3029
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3030
|
+
return uri;
|
|
3031
|
+
}
|
|
3032
|
+
/**
|
|
3033
|
+
* Get a file content by its unique ID. This endpoint is similar to the
|
|
3034
|
+
* download method but returns with no 'Content-Disposition: attachment'
|
|
3035
|
+
* header.
|
|
3036
|
+
*
|
|
3037
|
+
* @param {string} bucketId
|
|
3038
|
+
* @param {string} fileId
|
|
3039
|
+
* @param {string} token
|
|
3040
|
+
* @throws {AppwriteException}
|
|
3041
|
+
* @returns {URL}
|
|
3042
|
+
*/
|
|
3043
|
+
getFileViewURL(bucketId, fileId, token) {
|
|
3044
|
+
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
3045
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2825
3046
|
return uri;
|
|
2826
3047
|
}
|
|
2827
3048
|
}
|