Skip to content

Commit 609c832

Browse files
committed
Updated node docs
1 parent f3df64f commit 609c832

File tree

140 files changed

+1313
-690
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+1313
-690
lines changed

examples/js/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# [Appwrite SDK for Javascript]()   [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=&url=&via=&hashtags=)
22

33
![License](https://img.shields.io/github/license//.svg?v=1)
4-
![Version](https://img.shields.io/badge/api%20version-0.1.3-blue.svg?v=1)
4+
![Version](https://img.shields.io/badge/api%20version-0.1.40.ee-blue.svg?v=1)
55

66
**WORK IN PROGRESS - NOT READY FOR USAGE**
77

@@ -11,7 +11,7 @@ Appwrite backend as a service cuts up to 70% of the time and costs required for
1111

1212
![Appwrite](https://appwrite.io/v1/images/console.png)
1313

14-
**API Version: 0.1.3**
14+
**API Version: 0.1.40.ee**
1515

1616
## Installation
1717

examples/js/docs/examples/projects/create-task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sdk
55
setKey('')
66
;
77

8-
let promise = sdk.projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
8+
let promise = sdk.projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com');
99

1010
promise.then(function (response) {
1111
console.log(response);

examples/js/docs/examples/projects/create-webhook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sdk
55
setKey('')
66
;
77

8-
let promise = sdk.projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 1);
8+
let promise = sdk.projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 0);
99

1010
promise.then(function (response) {
1111
console.log(response);

examples/js/docs/examples/projects/update-webhook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sdk
55
setKey('')
66
;
77

8-
let promise = sdk.projects.updateWebhook('[PROJECT_ID]', '[WEBHOOK_ID]', '[NAME]', [], '[URL]', 0);
8+
let promise = sdk.projects.updateWebhook('[PROJECT_ID]', '[WEBHOOK_ID]', '[NAME]', [], '[URL]', 1);
99

1010
promise.then(function (response) {
1111
console.log(response);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
let sdk = new Appwrite();
2+
3+
sdk
4+
setProject('')
5+
setKey('')
6+
;
7+
8+
let promise = sdk.storage.updateFile('[FILE_ID]');
9+
10+
promise.then(function (response) {
11+
console.log(response);
12+
}, function (error) {
13+
console.log(error);
14+
});

examples/js/src/sdk.js

Lines changed: 96 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
window.Appwrite = function () {
33

44
let config = {
5-
endpoint: 'https://appwrite.test/v1',
5+
endpoint: 'https://appwrite.io/v1',
66
project: '',
77
key: '',
88
locale: '',
@@ -572,6 +572,63 @@
572572
});
573573
},
574574

575+
/**
576+
* OAuth Callback
577+
*
578+
*
579+
* @param {string} projectId
580+
* @param {string} provider
581+
* @param {string} code
582+
* @param {string} state
583+
* @throws {Error}
584+
* @return {Promise} */
585+
oauthCallback: function(projectId, provider, code, state = '') {
586+
if(projectId === undefined) {
587+
throw new Error('Missing required parameter: "projectId"');
588+
}
589+
590+
if(provider === undefined) {
591+
throw new Error('Missing required parameter: "provider"');
592+
}
593+
594+
if(code === undefined) {
595+
throw new Error('Missing required parameter: "code"');
596+
}
597+
598+
let path = '/auth/oauth/callback/{provider}/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{provider}', 'g'), provider);
599+
600+
return http
601+
.get(path, {'content-type': 'application/json'},
602+
{
603+
'code': code,
604+
'state': state
605+
});
606+
},
607+
608+
/**
609+
* OAuth Login
610+
*
611+
*
612+
* @param {string} provider
613+
* @param {string} success
614+
* @param {string} failure
615+
* @throws {Error}
616+
* @return {Promise} */
617+
oauth: function(provider, success = '', failure = '') {
618+
if(provider === undefined) {
619+
throw new Error('Missing required parameter: "provider"');
620+
}
621+
622+
let path = '/auth/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider);
623+
624+
return http
625+
.get(path, {'content-type': 'application/json'},
626+
{
627+
'success': success,
628+
'failure': failure
629+
});
630+
},
631+
575632
/**
576633
* Password Recovery
577634
*
@@ -768,63 +825,6 @@
768825
{
769826
'redirect': redirect
770827
});
771-
},
772-
773-
/**
774-
* OAuth Callback
775-
*
776-
*
777-
* @param {string} projectId
778-
* @param {string} provider
779-
* @param {string} code
780-
* @param {string} state
781-
* @throws {Error}
782-
* @return {Promise} */
783-
oauthCallback: function(projectId, provider, code, state = '') {
784-
if(projectId === undefined) {
785-
throw new Error('Missing required parameter: "projectId"');
786-
}
787-
788-
if(provider === undefined) {
789-
throw new Error('Missing required parameter: "provider"');
790-
}
791-
792-
if(code === undefined) {
793-
throw new Error('Missing required parameter: "code"');
794-
}
795-
796-
let path = '/oauth/callback/{provider}/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{provider}', 'g'), provider);
797-
798-
return http
799-
.get(path, {'content-type': 'application/json'},
800-
{
801-
'code': code,
802-
'state': state
803-
});
804-
},
805-
806-
/**
807-
* OAuth Login
808-
*
809-
*
810-
* @param {string} provider
811-
* @param {string} success
812-
* @param {string} failure
813-
* @throws {Error}
814-
* @return {Promise} */
815-
oauth: function(provider, success = '', failure = '') {
816-
if(provider === undefined) {
817-
throw new Error('Missing required parameter: "provider"');
818-
}
819-
820-
let path = '/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider);
821-
822-
return http
823-
.get(path, {'content-type': 'application/json'},
824-
{
825-
'success': success,
826-
'failure': failure
827-
});
828828
}
829829
};
830830

@@ -943,12 +943,12 @@
943943
},
944944

945945
/**
946-
* Get image from and HTTP URL and crop to any size.
946+
* Get Image from URL
947947
*
948948
* Use this endpoint to fetch a remote image URL and crop it to any image size
949-
* you want. This endpoint is very useful if you need to crop a remote image
950-
* or in cases, you want to make sure a 3rd party image is properly served
951-
* using a TLS protocol.
949+
* you want. This endpoint is very useful if you need to crop and display
950+
* remote images in your app or in cases, you want to make sure a 3rd party
951+
* image is properly served using a TLS protocol.
952952
*
953953
* @param {string} url
954954
* @param {number} width
@@ -1423,7 +1423,6 @@
14231423
* @param {string} description
14241424
* @param {string} logo
14251425
* @param {string} url
1426-
* @param {array} clients
14271426
* @param {string} legalName
14281427
* @param {string} legalCountry
14291428
* @param {string} legalState
@@ -1432,7 +1431,7 @@
14321431
* @param {string} legalTaxId
14331432
* @throws {Error}
14341433
* @return {Promise} */
1435-
createProject: function(name, teamId, description = '', logo = '', url = '', clients = [], legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') {
1434+
createProject: function(name, teamId, description = '', logo = '', url = '', legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') {
14361435
if(name === undefined) {
14371436
throw new Error('Missing required parameter: "name"');
14381437
}
@@ -1451,7 +1450,6 @@
14511450
'description': description,
14521451
'logo': logo,
14531452
'url': url,
1454-
'clients': clients,
14551453
'legalName': legalName,
14561454
'legalCountry': legalCountry,
14571455
'legalState': legalState,
@@ -1490,7 +1488,6 @@
14901488
* @param {string} description
14911489
* @param {string} logo
14921490
* @param {string} url
1493-
* @param {array} clients
14941491
* @param {string} legalName
14951492
* @param {string} legalCountry
14961493
* @param {string} legalState
@@ -1499,7 +1496,7 @@
14991496
* @param {string} legalTaxId
15001497
* @throws {Error}
15011498
* @return {Promise} */
1502-
updateProject: function(projectId, name, description = '', logo = '', url = '', clients = [], legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') {
1499+
updateProject: function(projectId, name, description = '', logo = '', url = '', legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') {
15031500
if(projectId === undefined) {
15041501
throw new Error('Missing required parameter: "projectId"');
15051502
}
@@ -1517,7 +1514,6 @@
15171514
'description': description,
15181515
'logo': logo,
15191516
'url': url,
1520-
'clients': clients,
15211517
'legalName': legalName,
15221518
'legalCountry': legalCountry,
15231519
'legalState': legalState,
@@ -2332,6 +2328,34 @@
23322328
});
23332329
},
23342330

2331+
/**
2332+
* Update File
2333+
*
2334+
* Update file by its unique ID. Only users with write permissions have access
2335+
* to update this resource.
2336+
*
2337+
* @param {string} fileId
2338+
* @param {array} read
2339+
* @param {array} write
2340+
* @param {string} folderId
2341+
* @throws {Error}
2342+
* @return {Promise} */
2343+
updateFile: function(fileId, read = [], write = [], folderId = '') {
2344+
if(fileId === undefined) {
2345+
throw new Error('Missing required parameter: "fileId"');
2346+
}
2347+
2348+
let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId);
2349+
2350+
return http
2351+
.put(path, {'content-type': 'application/json'},
2352+
{
2353+
'read': read,
2354+
'write': write,
2355+
'folderId': folderId
2356+
});
2357+
},
2358+
23352359
/**
23362360
* Delete File
23372361
*
@@ -2355,7 +2379,7 @@
23552379
},
23562380

23572381
/**
2358-
* Download File
2382+
* Get File for Download
23592383
*
23602384
* Get file content by its unique ID. The endpoint response return with a
23612385
* 'Content-Disposition: attachment' header that tells the browser to start
@@ -2378,7 +2402,7 @@
23782402
},
23792403

23802404
/**
2381-
* Preview File
2405+
* Get File Preview
23822406
*
23832407
* Get file preview image. Currently, this method supports preview for image
23842408
* files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
@@ -2412,7 +2436,7 @@
24122436
},
24132437

24142438
/**
2415-
* View File
2439+
* Get File for View
24162440
*
24172441
* Get file content by its unique ID. This endpoint is similar to the download
24182442
* method but returns with no 'Content-Disposition: attachment' header.
@@ -2666,7 +2690,7 @@
26662690
},
26672691

26682692
/**
2669-
* Create Team Membership (Resend Invitation Email)
2693+
* Create Team Membership (Resend)
26702694
*
26712695
* Use this endpoint to resend your invitation email for a user to join a
26722696
* team.

0 commit comments

Comments
 (0)