@appwrite.io/console 1.7.0 → 1.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # Appwrite Console SDK
2
2
 
3
3
  ![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?style=flat-square)
4
- ![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square)
4
+ ![Version](https://img.shields.io/badge/api%20version-1.7.2-blue.svg?style=flat-square)
5
5
  [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
6
6
  [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
7
7
  [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
@@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
33
33
  To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:
34
34
 
35
35
  ```html
36
- <script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@1.7.0"></script>
36
+ <script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@1.8.0"></script>
37
37
  ```
38
38
 
39
39
 
package/dist/cjs/sdk.js CHANGED
@@ -280,7 +280,7 @@ class Client {
280
280
  'x-sdk-name': 'Console',
281
281
  'x-sdk-platform': 'console',
282
282
  'x-sdk-language': 'web',
283
- 'x-sdk-version': '1.7.0',
283
+ 'x-sdk-version': '1.8.0',
284
284
  'X-Appwrite-Response-Format': '1.7.0',
285
285
  };
286
286
  this.realtime = {
@@ -578,8 +578,10 @@ class Client {
578
578
  let options = {
579
579
  method,
580
580
  headers,
581
- credentials: 'include',
582
581
  };
582
+ if (headers['X-Appwrite-Dev-Key'] === undefined) {
583
+ options.credentials = 'include';
584
+ }
583
585
  if (method === 'GET') {
584
586
  for (const [key, value] of Object.entries(Client.flatten(params))) {
585
587
  url.searchParams.append(key, value);
@@ -4517,6 +4519,44 @@ class Databases {
4517
4519
  const apiHeaders = {};
4518
4520
  return this.client.call('get', uri, apiHeaders, payload);
4519
4521
  }
4522
+ /**
4523
+ * 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.
4524
+ *
4525
+ * @param {string} databaseId
4526
+ * @param {string} collectionId
4527
+ * @param {string} documentId
4528
+ * @param {object} data
4529
+ * @param {string[]} permissions
4530
+ * @throws {AppwriteException}
4531
+ * @returns {Promise<Document>}
4532
+ */
4533
+ upsertDocument(databaseId, collectionId, documentId, data, permissions) {
4534
+ if (typeof databaseId === 'undefined') {
4535
+ throw new AppwriteException('Missing required parameter: "databaseId"');
4536
+ }
4537
+ if (typeof collectionId === 'undefined') {
4538
+ throw new AppwriteException('Missing required parameter: "collectionId"');
4539
+ }
4540
+ if (typeof documentId === 'undefined') {
4541
+ throw new AppwriteException('Missing required parameter: "documentId"');
4542
+ }
4543
+ if (typeof data === 'undefined') {
4544
+ throw new AppwriteException('Missing required parameter: "data"');
4545
+ }
4546
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
4547
+ const payload = {};
4548
+ if (typeof data !== 'undefined') {
4549
+ payload['data'] = data;
4550
+ }
4551
+ if (typeof permissions !== 'undefined') {
4552
+ payload['permissions'] = permissions;
4553
+ }
4554
+ const uri = new URL(this.client.config.endpoint + apiPath);
4555
+ const apiHeaders = {
4556
+ 'content-type': 'application/json',
4557
+ };
4558
+ return this.client.call('put', uri, apiHeaders, payload);
4559
+ }
4520
4560
  /**
4521
4561
  * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
4522
4562
  *
@@ -6381,14 +6421,10 @@ class Functions {
6381
6421
  * @param {boolean} providerSilentMode
6382
6422
  * @param {string} providerRootDirectory
6383
6423
  * @param {string} specification
6384
- * @param {string} templateRepository
6385
- * @param {string} templateOwner
6386
- * @param {string} templateRootDirectory
6387
- * @param {string} templateVersion
6388
6424
  * @throws {AppwriteException}
6389
6425
  * @returns {Promise<Models.Function>}
6390
6426
  */
6391
- create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification, templateRepository, templateOwner, templateRootDirectory, templateVersion) {
6427
+ create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification) {
6392
6428
  if (typeof functionId === 'undefined') {
6393
6429
  throw new AppwriteException('Missing required parameter: "functionId"');
6394
6430
  }
@@ -6454,18 +6490,6 @@ class Functions {
6454
6490
  if (typeof specification !== 'undefined') {
6455
6491
  payload['specification'] = specification;
6456
6492
  }
6457
- if (typeof templateRepository !== 'undefined') {
6458
- payload['templateRepository'] = templateRepository;
6459
- }
6460
- if (typeof templateOwner !== 'undefined') {
6461
- payload['templateOwner'] = templateOwner;
6462
- }
6463
- if (typeof templateRootDirectory !== 'undefined') {
6464
- payload['templateRootDirectory'] = templateRootDirectory;
6465
- }
6466
- if (typeof templateVersion !== 'undefined') {
6467
- payload['templateVersion'] = templateVersion;
6468
- }
6469
6493
  const uri = new URL(this.client.config.endpoint + apiPath);
6470
6494
  const apiHeaders = {
6471
6495
  'content-type': 'application/json',
@@ -14641,7 +14665,7 @@ class Tokens {
14641
14665
  return this.client.call('get', uri, apiHeaders, payload);
14642
14666
  }
14643
14667
  /**
14644
- * Create a new token. A token is linked to a file. Token can be passed as a header or request get parameter.
14668
+ * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
14645
14669
  *
14646
14670
  * @param {string} bucketId
14647
14671
  * @param {string} fileId