react-native-appwrite 0.10.0 → 0.10.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.
@@ -39,4 +39,4 @@ jobs:
39
39
  - name: Publish
40
40
  run: npm publish --tag ${{ steps.release_tag.outputs.tag }}
41
41
  env:
42
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_NO_ORG }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## 0.10.1
4
+
5
+ * Fix URL based methods like `getFileViewURL`, `getFilePreviewURL` etc. by adding the missing `projectId` to searchParams
6
+ * Add `gif` to ImageFormat enum
7
+
3
8
  ## 0.10.0
4
9
 
5
10
  * Add generate file URL methods like`getFilePreviewURL`, `getFileViewURL` etc.
package/dist/cjs/sdk.js CHANGED
@@ -100,7 +100,7 @@ class Client {
100
100
  'x-sdk-name': 'React Native',
101
101
  'x-sdk-platform': 'client',
102
102
  'x-sdk-language': 'reactnative',
103
- 'x-sdk-version': '0.10.0',
103
+ 'x-sdk-version': '0.10.1',
104
104
  'X-Appwrite-Response-Format': '1.7.0',
105
105
  };
106
106
  this.realtime = {
@@ -2007,7 +2007,21 @@ class Avatars extends Service {
2007
2007
  */
2008
2008
  getBrowserURL(code, width, height, quality) {
2009
2009
  const apiPath = '/avatars/browsers/{code}'.replace('{code}', code);
2010
+ const payload = {};
2011
+ if (typeof width !== 'undefined') {
2012
+ payload['width'] = width;
2013
+ }
2014
+ if (typeof height !== 'undefined') {
2015
+ payload['height'] = height;
2016
+ }
2017
+ if (typeof quality !== 'undefined') {
2018
+ payload['quality'] = quality;
2019
+ }
2010
2020
  const uri = new URL(this.client.config.endpoint + apiPath);
2021
+ payload['project'] = this.client.config.project;
2022
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2023
+ uri.searchParams.append(key, value);
2024
+ }
2011
2025
  return uri;
2012
2026
  }
2013
2027
  /**
@@ -2030,7 +2044,21 @@ class Avatars extends Service {
2030
2044
  */
2031
2045
  getCreditCardURL(code, width, height, quality) {
2032
2046
  const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);
2047
+ const payload = {};
2048
+ if (typeof width !== 'undefined') {
2049
+ payload['width'] = width;
2050
+ }
2051
+ if (typeof height !== 'undefined') {
2052
+ payload['height'] = height;
2053
+ }
2054
+ if (typeof quality !== 'undefined') {
2055
+ payload['quality'] = quality;
2056
+ }
2033
2057
  const uri = new URL(this.client.config.endpoint + apiPath);
2058
+ payload['project'] = this.client.config.project;
2059
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2060
+ uri.searchParams.append(key, value);
2061
+ }
2034
2062
  return uri;
2035
2063
  }
2036
2064
  /**
@@ -2045,7 +2073,15 @@ class Avatars extends Service {
2045
2073
  */
2046
2074
  getFaviconURL(url) {
2047
2075
  const apiPath = '/avatars/favicon';
2076
+ const payload = {};
2077
+ if (typeof url !== 'undefined') {
2078
+ payload['url'] = url;
2079
+ }
2048
2080
  const uri = new URL(this.client.config.endpoint + apiPath);
2081
+ payload['project'] = this.client.config.project;
2082
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2083
+ uri.searchParams.append(key, value);
2084
+ }
2049
2085
  return uri;
2050
2086
  }
2051
2087
  /**
@@ -2069,7 +2105,21 @@ class Avatars extends Service {
2069
2105
  */
2070
2106
  getFlagURL(code, width, height, quality) {
2071
2107
  const apiPath = '/avatars/flags/{code}'.replace('{code}', code);
2108
+ const payload = {};
2109
+ if (typeof width !== 'undefined') {
2110
+ payload['width'] = width;
2111
+ }
2112
+ if (typeof height !== 'undefined') {
2113
+ payload['height'] = height;
2114
+ }
2115
+ if (typeof quality !== 'undefined') {
2116
+ payload['quality'] = quality;
2117
+ }
2072
2118
  const uri = new URL(this.client.config.endpoint + apiPath);
2119
+ payload['project'] = this.client.config.project;
2120
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2121
+ uri.searchParams.append(key, value);
2122
+ }
2073
2123
  return uri;
2074
2124
  }
2075
2125
  /**
@@ -2093,7 +2143,21 @@ class Avatars extends Service {
2093
2143
  */
2094
2144
  getImageURL(url, width, height) {
2095
2145
  const apiPath = '/avatars/image';
2146
+ const payload = {};
2147
+ if (typeof url !== 'undefined') {
2148
+ payload['url'] = url;
2149
+ }
2150
+ if (typeof width !== 'undefined') {
2151
+ payload['width'] = width;
2152
+ }
2153
+ if (typeof height !== 'undefined') {
2154
+ payload['height'] = height;
2155
+ }
2096
2156
  const uri = new URL(this.client.config.endpoint + apiPath);
2157
+ payload['project'] = this.client.config.project;
2158
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2159
+ uri.searchParams.append(key, value);
2160
+ }
2097
2161
  return uri;
2098
2162
  }
2099
2163
  /**
@@ -2123,7 +2187,24 @@ class Avatars extends Service {
2123
2187
  */
2124
2188
  getInitialsURL(name, width, height, background) {
2125
2189
  const apiPath = '/avatars/initials';
2190
+ const payload = {};
2191
+ if (typeof name !== 'undefined') {
2192
+ payload['name'] = name;
2193
+ }
2194
+ if (typeof width !== 'undefined') {
2195
+ payload['width'] = width;
2196
+ }
2197
+ if (typeof height !== 'undefined') {
2198
+ payload['height'] = height;
2199
+ }
2200
+ if (typeof background !== 'undefined') {
2201
+ payload['background'] = background;
2202
+ }
2126
2203
  const uri = new URL(this.client.config.endpoint + apiPath);
2204
+ payload['project'] = this.client.config.project;
2205
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2206
+ uri.searchParams.append(key, value);
2207
+ }
2127
2208
  return uri;
2128
2209
  }
2129
2210
  /**
@@ -2140,7 +2221,24 @@ class Avatars extends Service {
2140
2221
  */
2141
2222
  getQRURL(text, size, margin, download) {
2142
2223
  const apiPath = '/avatars/qr';
2224
+ const payload = {};
2225
+ if (typeof text !== 'undefined') {
2226
+ payload['text'] = text;
2227
+ }
2228
+ if (typeof size !== 'undefined') {
2229
+ payload['size'] = size;
2230
+ }
2231
+ if (typeof margin !== 'undefined') {
2232
+ payload['margin'] = margin;
2233
+ }
2234
+ if (typeof download !== 'undefined') {
2235
+ payload['download'] = download;
2236
+ }
2143
2237
  const uri = new URL(this.client.config.endpoint + apiPath);
2238
+ payload['project'] = this.client.config.project;
2239
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2240
+ uri.searchParams.append(key, value);
2241
+ }
2144
2242
  return uri;
2145
2243
  }
2146
2244
  }
@@ -2247,6 +2345,10 @@ class Databases extends Service {
2247
2345
  return this.client.call('get', uri, {}, payload);
2248
2346
  }
2249
2347
  /**
2348
+ * **WARNING: Experimental Feature** - This endpoint is experimental and not
2349
+ * yet officially supported. It may be subject to breaking changes or removal
2350
+ * in future versions.
2351
+ *
2250
2352
  * Create or update a Document. Before using this route, you should create a
2251
2353
  * new collection resource using either a [server
2252
2354
  * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
@@ -3019,7 +3121,15 @@ class Storage extends Service {
3019
3121
  */
3020
3122
  getFileDownloadURL(bucketId, fileId, token) {
3021
3123
  const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
3124
+ const payload = {};
3125
+ if (typeof token !== 'undefined') {
3126
+ payload['token'] = token;
3127
+ }
3022
3128
  const uri = new URL(this.client.config.endpoint + apiPath);
3129
+ payload['project'] = this.client.config.project;
3130
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
3131
+ uri.searchParams.append(key, value);
3132
+ }
3023
3133
  return uri;
3024
3134
  }
3025
3135
  /**
@@ -3048,7 +3158,48 @@ class Storage extends Service {
3048
3158
  */
3049
3159
  getFilePreviewURL(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output, token) {
3050
3160
  const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
3161
+ const payload = {};
3162
+ if (typeof width !== 'undefined') {
3163
+ payload['width'] = width;
3164
+ }
3165
+ if (typeof height !== 'undefined') {
3166
+ payload['height'] = height;
3167
+ }
3168
+ if (typeof gravity !== 'undefined') {
3169
+ payload['gravity'] = gravity;
3170
+ }
3171
+ if (typeof quality !== 'undefined') {
3172
+ payload['quality'] = quality;
3173
+ }
3174
+ if (typeof borderWidth !== 'undefined') {
3175
+ payload['borderWidth'] = borderWidth;
3176
+ }
3177
+ if (typeof borderColor !== 'undefined') {
3178
+ payload['borderColor'] = borderColor;
3179
+ }
3180
+ if (typeof borderRadius !== 'undefined') {
3181
+ payload['borderRadius'] = borderRadius;
3182
+ }
3183
+ if (typeof opacity !== 'undefined') {
3184
+ payload['opacity'] = opacity;
3185
+ }
3186
+ if (typeof rotation !== 'undefined') {
3187
+ payload['rotation'] = rotation;
3188
+ }
3189
+ if (typeof background !== 'undefined') {
3190
+ payload['background'] = background;
3191
+ }
3192
+ if (typeof output !== 'undefined') {
3193
+ payload['output'] = output;
3194
+ }
3195
+ if (typeof token !== 'undefined') {
3196
+ payload['token'] = token;
3197
+ }
3051
3198
  const uri = new URL(this.client.config.endpoint + apiPath);
3199
+ payload['project'] = this.client.config.project;
3200
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
3201
+ uri.searchParams.append(key, value);
3202
+ }
3052
3203
  return uri;
3053
3204
  }
3054
3205
  /**
@@ -3064,7 +3215,15 @@ class Storage extends Service {
3064
3215
  */
3065
3216
  getFileViewURL(bucketId, fileId, token) {
3066
3217
  const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
3218
+ const payload = {};
3219
+ if (typeof token !== 'undefined') {
3220
+ payload['token'] = token;
3221
+ }
3067
3222
  const uri = new URL(this.client.config.endpoint + apiPath);
3223
+ payload['project'] = this.client.config.project;
3224
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
3225
+ uri.searchParams.append(key, value);
3226
+ }
3068
3227
  return uri;
3069
3228
  }
3070
3229
  }
@@ -3953,6 +4112,7 @@ exports.ImageFormat = void 0;
3953
4112
  ImageFormat["Webp"] = "webp";
3954
4113
  ImageFormat["Heic"] = "heic";
3955
4114
  ImageFormat["Avif"] = "avif";
4115
+ ImageFormat["Gif"] = "gif";
3956
4116
  })(exports.ImageFormat || (exports.ImageFormat = {}));
3957
4117
 
3958
4118
  exports.Account = Account;