Updated server SDKs
This commit is contained in:
parent
3588b2e2ca
commit
b5c42ab88e
|
@ -3,6 +3,9 @@
|
|||
![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?v=1)
|
||||
![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1)
|
||||
|
||||
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||
Use the JS SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
||||
|
||||
![Appwrite](https://appwrite.io/images/github.png)
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.database.getCollectionLogs('[COLLECTION_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.health.getCache();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
14
app/sdks/console-javascript/docs/examples/health/get-d-b.md
Normal file
14
app/sdks/console-javascript/docs/examples/health/get-d-b.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.health.getDB();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.health.getQueueCertificates();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.health.getQueueLogs();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.health.getQueueTasks();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.health.getQueueUsage();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.health.getQueueWebhooks();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.health.getStorageAntiVirus();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.health.getStorageLocal();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
14
app/sdks/console-javascript/docs/examples/health/get-time.md
Normal file
14
app/sdks/console-javascript/docs/examples/health/get-time.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.health.getTime();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
14
app/sdks/console-javascript/docs/examples/health/get.md
Normal file
14
app/sdks/console-javascript/docs/examples/health/get.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
let sdk = new Appwrite();
|
||||
|
||||
sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = sdk.health.get();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "appwrite",
|
||||
"homepage": "https://appwrite.io/support",
|
||||
"description": "",
|
||||
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
||||
"version": "1.0.0",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "src/sdk.js",
|
||||
|
|
|
@ -494,7 +494,7 @@
|
|||
}
|
||||
|
||||
if(oldPassword) {
|
||||
payload['old-password'] = oldPassword;
|
||||
payload['oldPassword'] = oldPassword;
|
||||
}
|
||||
|
||||
return http
|
||||
|
@ -608,12 +608,12 @@
|
|||
*
|
||||
* @param {string} userId
|
||||
* @param {string} secret
|
||||
* @param {string} passwordA
|
||||
* @param {string} passwordB
|
||||
* @param {string} password
|
||||
* @param {string} passwordAgain
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
updateRecovery: function(userId, secret, passwordA, passwordB) {
|
||||
updateRecovery: function(userId, secret, password, passwordAgain) {
|
||||
if(userId === undefined) {
|
||||
throw new Error('Missing required parameter: "userId"');
|
||||
}
|
||||
|
@ -622,12 +622,12 @@
|
|||
throw new Error('Missing required parameter: "secret"');
|
||||
}
|
||||
|
||||
if(passwordA === undefined) {
|
||||
throw new Error('Missing required parameter: "passwordA"');
|
||||
if(password === undefined) {
|
||||
throw new Error('Missing required parameter: "password"');
|
||||
}
|
||||
|
||||
if(passwordB === undefined) {
|
||||
throw new Error('Missing required parameter: "passwordB"');
|
||||
if(passwordAgain === undefined) {
|
||||
throw new Error('Missing required parameter: "passwordAgain"');
|
||||
}
|
||||
|
||||
let path = '/account/recovery';
|
||||
|
@ -642,12 +642,12 @@
|
|||
payload['secret'] = secret;
|
||||
}
|
||||
|
||||
if(passwordA) {
|
||||
payload['password-a'] = passwordA;
|
||||
if(password) {
|
||||
payload['password'] = password;
|
||||
}
|
||||
|
||||
if(passwordB) {
|
||||
payload['password-b'] = passwordB;
|
||||
if(passwordAgain) {
|
||||
payload['passwordAgain'] = passwordAgain;
|
||||
}
|
||||
|
||||
return http
|
||||
|
@ -748,7 +748,7 @@
|
|||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure') {
|
||||
createOAuth2Session: function(provider, success = 'https://localhost:2444/auth/oauth2/success', failure = 'https://localhost:2444/auth/oauth2/failure') {
|
||||
if(provider === undefined) {
|
||||
throw new Error('Missing required parameter: "provider"');
|
||||
}
|
||||
|
@ -1371,15 +1371,15 @@
|
|||
}
|
||||
|
||||
if(orderField) {
|
||||
payload['order-field'] = orderField;
|
||||
payload['orderField'] = orderField;
|
||||
}
|
||||
|
||||
if(orderType) {
|
||||
payload['order-type'] = orderType;
|
||||
payload['orderType'] = orderType;
|
||||
}
|
||||
|
||||
if(orderCast) {
|
||||
payload['order-cast'] = orderCast;
|
||||
payload['orderCast'] = orderCast;
|
||||
}
|
||||
|
||||
if(search) {
|
||||
|
@ -1580,6 +1580,254 @@
|
|||
.delete(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get Collection Logs
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getCollectionLogs: function(collectionId) {
|
||||
if(collectionId === undefined) {
|
||||
throw new Error('Missing required parameter: "collectionId"');
|
||||
}
|
||||
|
||||
let path = '/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}', 'g'), collectionId);
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
}
|
||||
};
|
||||
|
||||
let health = {
|
||||
|
||||
/**
|
||||
* Check API HTTP Health
|
||||
*
|
||||
* Check the Appwrite HTTP server is up and responsive.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
get: function() {
|
||||
let path = '/health';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check Cache Health
|
||||
*
|
||||
* Check the Appwrite in-memory cache server is up and connection is
|
||||
* successful.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getCache: function() {
|
||||
let path = '/health/cache';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check DB Health
|
||||
*
|
||||
* Check the Appwrite database server is up and connection is successful.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getDB: function() {
|
||||
let path = '/health/db';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check the number of pending certificate messages
|
||||
*
|
||||
* Get the number of certificates that are waiting to be issued against
|
||||
* [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
|
||||
* server.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getQueueCertificates: function() {
|
||||
let path = '/health/queue/certificates';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check the number of pending log messages
|
||||
*
|
||||
* Get the number of logs that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getQueueLogs: function() {
|
||||
let path = '/health/queue/logs';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check the number of pending task messages
|
||||
*
|
||||
* Get the number of tasks that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getQueueTasks: function() {
|
||||
let path = '/health/queue/tasks';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check the number of pending usage messages
|
||||
*
|
||||
* Get the number of usage stats that are waiting to be processed in the
|
||||
* Appwrite internal queue server.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getQueueUsage: function() {
|
||||
let path = '/health/queue/usage';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check number of pending webhook messages
|
||||
*
|
||||
* Get the number of webhooks that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getQueueWebhooks: function() {
|
||||
let path = '/health/queue/webhooks';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check Anti virus Health
|
||||
*
|
||||
* Check the Appwrite Anti Virus server is up and connection is successful.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getStorageAntiVirus: function() {
|
||||
let path = '/health/storage/anti-virus';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check File System Health
|
||||
*
|
||||
* Check the Appwrite local storage device is up and connection is successful.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getStorageLocal: function() {
|
||||
let path = '/health/storage/local';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check Time Health
|
||||
*
|
||||
* Check the Appwrite server time is synced with Google remote NTP server. We
|
||||
* use this technology to smoothly handle leap seconds with no disruptive
|
||||
* events. The [Network Time
|
||||
* Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is
|
||||
* used by hundreds of millions of computers and devices to synchronize their
|
||||
* clocks over the Internet. If your computer sets its own clock, it likely
|
||||
* uses NTP.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getTime: function() {
|
||||
let path = '/health/time';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2751,10 +2999,11 @@
|
|||
*
|
||||
*
|
||||
* @param {string} projectId
|
||||
* @param {string} range
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getUsage: function(projectId) {
|
||||
getUsage: function(projectId, range = 'last30') {
|
||||
if(projectId === undefined) {
|
||||
throw new Error('Missing required parameter: "projectId"');
|
||||
}
|
||||
|
@ -2763,6 +3012,10 @@
|
|||
|
||||
let payload = {};
|
||||
|
||||
if(range) {
|
||||
payload['range'] = range;
|
||||
}
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
|
@ -3888,14 +4141,10 @@
|
|||
throw new Error('Missing required parameter: "sessionId"');
|
||||
}
|
||||
|
||||
let path = '/users/{userId}/sessions/:session'.replace(new RegExp('{userId}', 'g'), userId);
|
||||
let path = '/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}', 'g'), userId).replace(new RegExp('{sessionId}', 'g'), sessionId);
|
||||
|
||||
let payload = {};
|
||||
|
||||
if(sessionId) {
|
||||
payload['sessionId'] = sessionId;
|
||||
}
|
||||
|
||||
return http
|
||||
.delete(path, {
|
||||
'content-type': 'application/json',
|
||||
|
@ -3945,6 +4194,7 @@
|
|||
account: account,
|
||||
avatars: avatars,
|
||||
database: database,
|
||||
health: health,
|
||||
locale: locale,
|
||||
projects: projects,
|
||||
storage: storage,
|
||||
|
|
33
app/sdks/console-javascript/src/sdk.min.js
vendored
33
app/sdks/console-javascript/src/sdk.min.js
vendored
|
@ -26,26 +26,26 @@ let path='/account/name';let payload={};if(name){payload.name=name}
|
|||
return http.patch(path,{'content-type':'application/json',},payload)},updatePassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||
if(oldPassword===undefined){throw new Error('Missing required parameter: "oldPassword"')}
|
||||
let path='/account/password';let payload={};if(password){payload.password=password}
|
||||
if(oldPassword){payload['old-password']=oldPassword}
|
||||
if(oldPassword){payload.oldPassword=oldPassword}
|
||||
return http.patch(path,{'content-type':'application/json',},payload)},getPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"')}
|
||||
let path='/account/prefs';let payload={};if(prefs){payload.prefs=prefs}
|
||||
return http.patch(path,{'content-type':'application/json',},payload)},createRecovery:function(email,url){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||
if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
let path='/account/recovery';let payload={};if(email){payload.email=email}
|
||||
if(url){payload.url=url}
|
||||
return http.post(path,{'content-type':'application/json',},payload)},updateRecovery:function(userId,secret,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
return http.post(path,{'content-type':'application/json',},payload)},updateRecovery:function(userId,secret,password,passwordAgain){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
if(secret===undefined){throw new Error('Missing required parameter: "secret"')}
|
||||
if(passwordA===undefined){throw new Error('Missing required parameter: "passwordA"')}
|
||||
if(passwordB===undefined){throw new Error('Missing required parameter: "passwordB"')}
|
||||
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||
if(passwordAgain===undefined){throw new Error('Missing required parameter: "passwordAgain"')}
|
||||
let path='/account/recovery';let payload={};if(userId){payload.userId=userId}
|
||||
if(secret){payload.secret=secret}
|
||||
if(passwordA){payload['password-a']=passwordA}
|
||||
if(passwordB){payload['password-b']=passwordB}
|
||||
if(password){payload.password=password}
|
||||
if(passwordAgain){payload.passwordAgain=passwordAgain}
|
||||
return http.put(path,{'content-type':'application/json',},payload)},getSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createSession:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||
let path='/account/sessions';let payload={};if(email){payload.email=email}
|
||||
if(password){payload.password=password}
|
||||
return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||
return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://localhost:2444/auth/oauth2/success',failure='https://localhost:2444/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success}
|
||||
if(failure){payload.failure=failure}
|
||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
|
||||
|
@ -104,9 +104,9 @@ let path='/database/collections/{collectionId}'.replace(new RegExp('{collectionI
|
|||
let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(filters){payload.filters=filters}
|
||||
if(offset){payload.offset=offset}
|
||||
if(limit){payload.limit=limit}
|
||||
if(orderField){payload['order-field']=orderField}
|
||||
if(orderType){payload['order-type']=orderType}
|
||||
if(orderCast){payload['order-cast']=orderCast}
|
||||
if(orderField){payload.orderField=orderField}
|
||||
if(orderType){payload.orderType=orderType}
|
||||
if(orderCast){payload.orderCast=orderCast}
|
||||
if(search){payload.search=search}
|
||||
if(first){payload.first=first}
|
||||
if(last){payload.last=last}
|
||||
|
@ -132,7 +132,8 @@ if(read){payload.read=read}
|
|||
if(write){payload.write=write}
|
||||
return http.patch(path,{'content-type':'application/json',},payload)},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
||||
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')}
|
||||
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"')}
|
||||
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getCollectionLogs:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
||||
let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getStorageAntiVirus:function(){let path='/health/storage/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"')}
|
||||
if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')}
|
||||
let path='/projects';let payload={};if(name){payload.name=name}
|
||||
if(teamId){payload.teamId=teamId}
|
||||
|
@ -250,8 +251,9 @@ if(httpUser){payload.httpUser=httpUser}
|
|||
if(httpPass){payload.httpPass=httpPass}
|
||||
return http.put(path,{'content-type':'application/json',},payload)},deleteTask:function(projectId,taskId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
|
||||
if(taskId===undefined){throw new Error('Missing required parameter: "taskId"')}
|
||||
let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getUsage:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
|
||||
let path='/projects/{projectId}/usage'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},listWebhooks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
|
||||
let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getUsage:function(projectId,range='last30'){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
|
||||
let path='/projects/{projectId}/usage'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(range){payload.range=range}
|
||||
return http.get(path,{'content-type':'application/json',},payload)},listWebhooks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
|
||||
let path='/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},createWebhook:function(projectId,name,events,url,security,httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
|
||||
if(name===undefined){throw new Error('Missing required parameter: "name"')}
|
||||
if(events===undefined){throw new Error('Missing required parameter: "events"')}
|
||||
|
@ -353,8 +355,7 @@ return http.patch(path,{'content-type':'application/json',},payload)},getSession
|
|||
let path='/users/{userId}/sessions'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},deleteSessions:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
let path='/users/{userId}/sessions'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},deleteSession:function(userId,sessionId){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
|
||||
let path='/users/{userId}/sessions/:session'.replace(new RegExp('{userId}','g'),userId);let payload={};if(sessionId){payload.sessionId=sessionId}
|
||||
return http.delete(path,{'content-type':'application/json',},payload)},updateStatus:function(userId,status){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
let path='/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}','g'),userId).replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},updateStatus:function(userId,status){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
if(status===undefined){throw new Error('Missing required parameter: "status"')}
|
||||
let path='/users/{userId}/status'.replace(new RegExp('{userId}','g'),userId);let payload={};if(status){payload.status=status}
|
||||
return http.patch(path,{'content-type':'application/json',},payload)}};return{setEndpoint:setEndpoint,setProject:setProject,setKey:setKey,setLocale:setLocale,setMode:setMode,account:account,avatars:avatars,database:database,locale:locale,projects:projects,storage:storage,teams:teams,users:users}};if(typeof module!=="undefined"){module.exports=window.Appwrite}})((typeof window!=="undefined")?window:{})
|
||||
return http.patch(path,{'content-type':'application/json',},payload)}};return{setEndpoint:setEndpoint,setProject:setProject,setKey:setKey,setLocale:setLocale,setMode:setMode,account:account,avatars:avatars,database:database,health:health,locale:locale,projects:projects,storage:storage,teams:teams,users:users}};if(typeof module!=="undefined"){module.exports=window.Appwrite}})((typeof window!=="undefined")?window:{})
|
147
app/sdks/console-javascript/types/index.d.ts
vendored
147
app/sdks/console-javascript/types/index.d.ts
vendored
|
@ -57,6 +57,7 @@ declare class Appwrite {
|
|||
account:Appwrite.Account;
|
||||
avatars:Appwrite.Avatars;
|
||||
database:Appwrite.Database;
|
||||
health:Appwrite.Health;
|
||||
locale:Appwrite.Locale;
|
||||
projects:Appwrite.Projects;
|
||||
storage:Appwrite.Storage;
|
||||
|
@ -215,12 +216,12 @@ declare namespace Appwrite {
|
|||
*
|
||||
* @param {string} userId
|
||||
* @param {string} secret
|
||||
* @param {string} passwordA
|
||||
* @param {string} passwordB
|
||||
* @param {string} password
|
||||
* @param {string} passwordAgain
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
updateRecovery(userId: string, secret: string, passwordA: string, passwordB: string): Promise<object>;
|
||||
updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* Get Account Sessions
|
||||
|
@ -576,6 +577,143 @@ declare namespace Appwrite {
|
|||
*/
|
||||
deleteDocument(collectionId: string, documentId: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* Get Collection Logs
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getCollectionLogs(collectionId: string): Promise<object>;
|
||||
|
||||
}
|
||||
|
||||
export interface Health {
|
||||
|
||||
/**
|
||||
* Check API HTTP Health
|
||||
*
|
||||
* Check the Appwrite HTTP server is up and responsive.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
get(): Promise<object>;
|
||||
|
||||
/**
|
||||
* Check Cache Health
|
||||
*
|
||||
* Check the Appwrite in-memory cache server is up and connection is
|
||||
* successful.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getCache(): Promise<object>;
|
||||
|
||||
/**
|
||||
* Check DB Health
|
||||
*
|
||||
* Check the Appwrite database server is up and connection is successful.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getDB(): Promise<object>;
|
||||
|
||||
/**
|
||||
* Check the number of pending certificate messages
|
||||
*
|
||||
* Get the number of certificates that are waiting to be issued against
|
||||
* [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
|
||||
* server.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getQueueCertificates(): Promise<object>;
|
||||
|
||||
/**
|
||||
* Check the number of pending log messages
|
||||
*
|
||||
* Get the number of logs that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getQueueLogs(): Promise<object>;
|
||||
|
||||
/**
|
||||
* Check the number of pending task messages
|
||||
*
|
||||
* Get the number of tasks that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getQueueTasks(): Promise<object>;
|
||||
|
||||
/**
|
||||
* Check the number of pending usage messages
|
||||
*
|
||||
* Get the number of usage stats that are waiting to be processed in the
|
||||
* Appwrite internal queue server.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getQueueUsage(): Promise<object>;
|
||||
|
||||
/**
|
||||
* Check number of pending webhook messages
|
||||
*
|
||||
* Get the number of webhooks that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getQueueWebhooks(): Promise<object>;
|
||||
|
||||
/**
|
||||
* Check Anti virus Health
|
||||
*
|
||||
* Check the Appwrite Anti Virus server is up and connection is successful.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getStorageAntiVirus(): Promise<object>;
|
||||
|
||||
/**
|
||||
* Check File System Health
|
||||
*
|
||||
* Check the Appwrite local storage device is up and connection is successful.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getStorageLocal(): Promise<object>;
|
||||
|
||||
/**
|
||||
* Check Time Health
|
||||
*
|
||||
* Check the Appwrite server time is synced with Google remote NTP server. We
|
||||
* use this technology to smoothly handle leap seconds with no disruptive
|
||||
* events. The [Network Time
|
||||
* Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is
|
||||
* used by hundreds of millions of computers and devices to synchronize their
|
||||
* clocks over the Internet. If your computer sets its own clock, it likely
|
||||
* uses NTP.
|
||||
*
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getTime(): Promise<object>;
|
||||
|
||||
}
|
||||
|
||||
export interface Locale {
|
||||
|
@ -987,10 +1125,11 @@ declare namespace Appwrite {
|
|||
*
|
||||
*
|
||||
* @param {string} projectId
|
||||
* @param {string} range
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getUsage(projectId: string): Promise<object>;
|
||||
getUsage(projectId: string, range: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* List Webhooks
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
**This SDK is compatible with Appwrite server version 0.5.3. For older versions, please check previous releases.**
|
||||
|
||||
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||
Use the Dart SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ client
|
|||
Future result = account.updateRecovery(
|
||||
userId: '[USER_ID]',
|
||||
secret: '[SECRET]',
|
||||
passwordA: 'password',
|
||||
passwordB: 'password',
|
||||
password: 'password',
|
||||
passwordAgain: 'password',
|
||||
);
|
||||
|
||||
result
|
||||
|
|
|
@ -143,7 +143,7 @@ class Account extends Service {
|
|||
|
||||
final Map<String, dynamic> params = {
|
||||
'password': password,
|
||||
'old-password': oldPassword,
|
||||
'oldPassword': oldPassword,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
|
@ -225,14 +225,14 @@ class Account extends Service {
|
|||
/// the only valid redirect URLs are the ones from domains you have set when
|
||||
/// adding your platforms in the console interface.
|
||||
///
|
||||
Future<Response> updateRecovery({@required String userId, @required String secret, @required String passwordA, @required String passwordB}) {
|
||||
Future<Response> updateRecovery({@required String userId, @required String secret, @required String password, @required String passwordAgain}) {
|
||||
final String path = '/account/recovery';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
'userId': userId,
|
||||
'secret': secret,
|
||||
'password-a': passwordA,
|
||||
'password-b': passwordB,
|
||||
'password': password,
|
||||
'passwordAgain': passwordAgain,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
|
|
|
@ -17,16 +17,16 @@ class Database extends Service {
|
|||
/// of the project documents. [Learn more about different API
|
||||
/// modes](/docs/admin).
|
||||
///
|
||||
Future<Response> listDocuments({@required String collectionId, List filters = const [], int offset = 0, int limit = 50, String orderField = '\$id', String orderType = 'ASC', String orderCast = 'string', String search = '', int first = 0, int last = 0}) {
|
||||
Future<Response> listDocuments({@required String collectionId, List filters = const [], int offset = 0, int limit = 50, String orderField = '\$id', OrderType orderType = OrderType.asc, String orderCast = 'string', String search = '', int first = 0, int last = 0}) {
|
||||
final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
'filters': filters,
|
||||
'offset': offset,
|
||||
'limit': limit,
|
||||
'order-field': orderField,
|
||||
'order-type': orderType,
|
||||
'order-cast': orderCast,
|
||||
'orderField': orderField,
|
||||
'orderType': orderType.name(),
|
||||
'orderCast': orderCast,
|
||||
'search': search,
|
||||
'first': first,
|
||||
'last': last,
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
**This SDK is compatible with Appwrite server version 0.5.3. For older versions, please check previous releases.**
|
||||
|
||||
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||
Use the Go SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -99,9 +99,9 @@ func (srv *Database) ListDocuments(CollectionId string, Filters []interface{}, O
|
|||
"filters": Filters,
|
||||
"offset": Offset,
|
||||
"limit": Limit,
|
||||
"order-field": OrderField,
|
||||
"order-type": OrderType,
|
||||
"order-cast": OrderCast,
|
||||
"orderField": OrderField,
|
||||
"orderType": OrderType,
|
||||
"orderCast": OrderCast,
|
||||
"search": Search,
|
||||
"first": First,
|
||||
"last": Last,
|
||||
|
@ -165,3 +165,14 @@ func (srv *Database) DeleteDocument(CollectionId string, DocumentId string) (map
|
|||
|
||||
return srv.client.Call("DELETE", path, nil, params)
|
||||
}
|
||||
|
||||
// GetCollectionLogs
|
||||
func (srv *Database) GetCollectionLogs(CollectionId string) (map[string]interface{}, error) {
|
||||
r := strings.NewReplacer("{collectionId}", CollectionId)
|
||||
path := r.Replace("/database/collections/{collectionId}/logs")
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Database{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.GetCollectionLogs("[COLLECTION_ID]")
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
25
app/sdks/server-go/docs/examples/health/get-cache.md
Normal file
25
app/sdks/server-go/docs/examples/health/get-cache.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Health{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.GetCache()
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
25
app/sdks/server-go/docs/examples/health/get-d-b.md
Normal file
25
app/sdks/server-go/docs/examples/health/get-d-b.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Health{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.GetDB()
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Health{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.GetQueueCertificates()
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
25
app/sdks/server-go/docs/examples/health/get-queue-logs.md
Normal file
25
app/sdks/server-go/docs/examples/health/get-queue-logs.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Health{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.GetQueueLogs()
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
25
app/sdks/server-go/docs/examples/health/get-queue-tasks.md
Normal file
25
app/sdks/server-go/docs/examples/health/get-queue-tasks.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Health{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.GetQueueTasks()
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
25
app/sdks/server-go/docs/examples/health/get-queue-usage.md
Normal file
25
app/sdks/server-go/docs/examples/health/get-queue-usage.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Health{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.GetQueueUsage()
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Health{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.GetQueueWebhooks()
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Health{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.GetStorageAntiVirus()
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
25
app/sdks/server-go/docs/examples/health/get-storage-local.md
Normal file
25
app/sdks/server-go/docs/examples/health/get-storage-local.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Health{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.GetStorageLocal()
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
25
app/sdks/server-go/docs/examples/health/get-time.md
Normal file
25
app/sdks/server-go/docs/examples/health/get-time.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Health{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.GetTime()
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
25
app/sdks/server-go/docs/examples/health/get.md
Normal file
25
app/sdks/server-go/docs/examples/health/get.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var client := appwrite.Client{}
|
||||
|
||||
client.SetProject("5df5acd0d48c2") // Your project ID
|
||||
client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
var service := appwrite.Health{
|
||||
client: &client
|
||||
}
|
||||
|
||||
var response, error := service.Get()
|
||||
|
||||
if error != nil {
|
||||
panic(error)
|
||||
}
|
||||
|
||||
fmt.Println(response)
|
||||
}
|
143
app/sdks/server-go/health.go
Normal file
143
app/sdks/server-go/health.go
Normal file
|
@ -0,0 +1,143 @@
|
|||
package appwrite
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
// Health service
|
||||
type Health struct {
|
||||
client Client
|
||||
}
|
||||
|
||||
func NewHealth(clt Client) Health {
|
||||
service := Health{
|
||||
client: clt,
|
||||
}
|
||||
|
||||
return service
|
||||
}
|
||||
|
||||
// Get check the Appwrite HTTP server is up and responsive.
|
||||
func (srv *Health) Get() (map[string]interface{}, error) {
|
||||
path := "/health"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetCache check the Appwrite in-memory cache server is up and connection is
|
||||
// successful.
|
||||
func (srv *Health) GetCache() (map[string]interface{}, error) {
|
||||
path := "/health/cache"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetDB check the Appwrite database server is up and connection is
|
||||
// successful.
|
||||
func (srv *Health) GetDB() (map[string]interface{}, error) {
|
||||
path := "/health/db"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetQueueCertificates get the number of certificates that are waiting to be
|
||||
// issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite
|
||||
// internal queue server.
|
||||
func (srv *Health) GetQueueCertificates() (map[string]interface{}, error) {
|
||||
path := "/health/queue/certificates"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetQueueLogs get the number of logs that are waiting to be processed in the
|
||||
// Appwrite internal queue server.
|
||||
func (srv *Health) GetQueueLogs() (map[string]interface{}, error) {
|
||||
path := "/health/queue/logs"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetQueueTasks get the number of tasks that are waiting to be processed in
|
||||
// the Appwrite internal queue server.
|
||||
func (srv *Health) GetQueueTasks() (map[string]interface{}, error) {
|
||||
path := "/health/queue/tasks"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetQueueUsage get the number of usage stats that are waiting to be
|
||||
// processed in the Appwrite internal queue server.
|
||||
func (srv *Health) GetQueueUsage() (map[string]interface{}, error) {
|
||||
path := "/health/queue/usage"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetQueueWebhooks get the number of webhooks that are waiting to be
|
||||
// processed in the Appwrite internal queue server.
|
||||
func (srv *Health) GetQueueWebhooks() (map[string]interface{}, error) {
|
||||
path := "/health/queue/webhooks"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetStorageAntiVirus check the Appwrite Anti Virus server is up and
|
||||
// connection is successful.
|
||||
func (srv *Health) GetStorageAntiVirus() (map[string]interface{}, error) {
|
||||
path := "/health/storage/anti-virus"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetStorageLocal check the Appwrite local storage device is up and
|
||||
// connection is successful.
|
||||
func (srv *Health) GetStorageLocal() (map[string]interface{}, error) {
|
||||
path := "/health/storage/local"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetTime check the Appwrite server time is synced with Google remote NTP
|
||||
// server. We use this technology to smoothly handle leap seconds with no
|
||||
// disruptive events. The [Network Time
|
||||
// Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is
|
||||
// used by hundreds of millions of computers and devices to synchronize their
|
||||
// clocks over the Internet. If your computer sets its own clock, it likely
|
||||
// uses NTP.
|
||||
func (srv *Health) GetTime() (map[string]interface{}, error) {
|
||||
path := "/health/time"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
|
@ -115,11 +115,10 @@ func (srv *Users) DeleteSessions(UserId string) (map[string]interface{}, error)
|
|||
|
||||
// DeleteSession delete user sessions by its unique ID.
|
||||
func (srv *Users) DeleteSession(UserId string, SessionId string) (map[string]interface{}, error) {
|
||||
r := strings.NewReplacer("{userId}", UserId)
|
||||
path := r.Replace("/users/{userId}/sessions/:session")
|
||||
r := strings.NewReplacer("{userId}", UserId, "{sessionId}", SessionId)
|
||||
path := r.Replace("/users/{userId}/sessions/{sessionId}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
"sessionId": SessionId,
|
||||
}
|
||||
|
||||
return srv.client.Call("DELETE", path, nil, params)
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?v=1)
|
||||
![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1)
|
||||
|
||||
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||
Use the Node.js SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let database = new sdk.Database(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = database.getCollectionLogs('[COLLECTION_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
19
app/sdks/server-nodejs/docs/examples/health/get-cache.md
Normal file
19
app/sdks/server-nodejs/docs/examples/health/get-cache.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let health = new sdk.Health(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = health.getCache();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
19
app/sdks/server-nodejs/docs/examples/health/get-d-b.md
Normal file
19
app/sdks/server-nodejs/docs/examples/health/get-d-b.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let health = new sdk.Health(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = health.getDB();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let health = new sdk.Health(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = health.getQueueCertificates();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let health = new sdk.Health(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = health.getQueueLogs();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let health = new sdk.Health(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = health.getQueueTasks();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let health = new sdk.Health(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = health.getQueueUsage();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let health = new sdk.Health(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = health.getQueueWebhooks();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let health = new sdk.Health(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = health.getStorageAntiVirus();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let health = new sdk.Health(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = health.getStorageLocal();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
19
app/sdks/server-nodejs/docs/examples/health/get-time.md
Normal file
19
app/sdks/server-nodejs/docs/examples/health/get-time.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let health = new sdk.Health(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = health.getTime();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
19
app/sdks/server-nodejs/docs/examples/health/get.md
Normal file
19
app/sdks/server-nodejs/docs/examples/health/get.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let health = new sdk.Health(client);
|
||||
|
||||
client
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = health.get();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
|
@ -1,6 +1,7 @@
|
|||
const Client = require('./lib/client.js');
|
||||
const Avatars = require('./lib/services/avatars.js');
|
||||
const Database = require('./lib/services/database.js');
|
||||
const Health = require('./lib/services/health.js');
|
||||
const Locale = require('./lib/services/locale.js');
|
||||
const Storage = require('./lib/services/storage.js');
|
||||
const Teams = require('./lib/services/teams.js');
|
||||
|
@ -10,6 +11,7 @@ module.exports = {
|
|||
Client,
|
||||
Avatars,
|
||||
Database,
|
||||
Health,
|
||||
Locale,
|
||||
Storage,
|
||||
Teams,
|
||||
|
|
|
@ -155,9 +155,9 @@ class Database extends Service {
|
|||
'filters': filters,
|
||||
'offset': offset,
|
||||
'limit': limit,
|
||||
'order-field': orderField,
|
||||
'order-type': orderType,
|
||||
'order-cast': orderCast,
|
||||
'orderField': orderField,
|
||||
'orderType': orderType,
|
||||
'orderCast': orderCast,
|
||||
'search': search,
|
||||
'first': first,
|
||||
'last': last
|
||||
|
@ -261,6 +261,23 @@ class Database extends Service {
|
|||
{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Collection Logs
|
||||
*
|
||||
* @param string collectionId
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async getCollectionLogs(collectionId) {
|
||||
let path = '/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}', 'g'), collectionId);
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Database;
|
217
app/sdks/server-nodejs/lib/services/health.js
Normal file
217
app/sdks/server-nodejs/lib/services/health.js
Normal file
|
@ -0,0 +1,217 @@
|
|||
const Service = require('../service.js');
|
||||
|
||||
class Health extends Service {
|
||||
|
||||
/**
|
||||
* Check API HTTP Health
|
||||
*
|
||||
* Check the Appwrite HTTP server is up and responsive.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async get() {
|
||||
let path = '/health';
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Cache Health
|
||||
*
|
||||
* Check the Appwrite in-memory cache server is up and connection is
|
||||
* successful.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async getCache() {
|
||||
let path = '/health/cache';
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check DB Health
|
||||
*
|
||||
* Check the Appwrite database server is up and connection is successful.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async getDB() {
|
||||
let path = '/health/db';
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the number of pending certificate messages
|
||||
*
|
||||
* Get the number of certificates that are waiting to be issued against
|
||||
* [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
|
||||
* server.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async getQueueCertificates() {
|
||||
let path = '/health/queue/certificates';
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the number of pending log messages
|
||||
*
|
||||
* Get the number of logs that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async getQueueLogs() {
|
||||
let path = '/health/queue/logs';
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the number of pending task messages
|
||||
*
|
||||
* Get the number of tasks that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async getQueueTasks() {
|
||||
let path = '/health/queue/tasks';
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the number of pending usage messages
|
||||
*
|
||||
* Get the number of usage stats that are waiting to be processed in the
|
||||
* Appwrite internal queue server.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async getQueueUsage() {
|
||||
let path = '/health/queue/usage';
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check number of pending webhook messages
|
||||
*
|
||||
* Get the number of webhooks that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async getQueueWebhooks() {
|
||||
let path = '/health/queue/webhooks';
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Anti virus Health
|
||||
*
|
||||
* Check the Appwrite Anti Virus server is up and connection is successful.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async getStorageAntiVirus() {
|
||||
let path = '/health/storage/anti-virus';
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check File System Health
|
||||
*
|
||||
* Check the Appwrite local storage device is up and connection is successful.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async getStorageLocal() {
|
||||
let path = '/health/storage/local';
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Time Health
|
||||
*
|
||||
* Check the Appwrite server time is synced with Google remote NTP server. We
|
||||
* use this technology to smoothly handle leap seconds with no disruptive
|
||||
* events. The [Network Time
|
||||
* Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is
|
||||
* used by hundreds of millions of computers and devices to synchronize their
|
||||
* clocks over the Internet. If your computer sets its own clock, it likely
|
||||
* uses NTP.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async getTime() {
|
||||
let path = '/health/time';
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Health;
|
|
@ -181,13 +181,12 @@ class Users extends Service {
|
|||
* @return {}
|
||||
*/
|
||||
async deleteSession(userId, sessionId) {
|
||||
let path = '/users/{userId}/sessions/:session'.replace(new RegExp('{userId}', 'g'), userId);
|
||||
let path = '/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}', 'g'), userId).replace(new RegExp('{sessionId}', 'g'), sessionId);
|
||||
|
||||
return await this.client.call('delete', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
'sessionId': sessionId
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "node-appwrite",
|
||||
"homepage": "https://appwrite.io/support",
|
||||
"description": "",
|
||||
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
||||
"version": "1.0.32",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "index.js",
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?v=1)
|
||||
![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1)
|
||||
|
||||
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||
Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"name": "appwrite/appwrite",
|
||||
"description": "",
|
||||
"description": "Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||
Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)",
|
||||
"type": "library",
|
||||
"license": "BSD-3-Clause",
|
||||
"support": {
|
||||
|
|
|
@ -95,6 +95,6 @@ GET https://appwrite.io/v1/avatars/qr
|
|||
| --- | --- | --- | --- |
|
||||
| text | string | **Required** Plain text to be converted to QR code image. | |
|
||||
| size | integer | QR code size. Pass an integer between 0 to 1000. Defaults to 400. | 400 |
|
||||
| margin | integer | Margin From Edge. Pass an integer between 0 to 10. Defaults to 1. | 1 |
|
||||
| margin | integer | Margin from edge. Pass an integer between 0 to 10. Defaults to 1. | 1 |
|
||||
| download | integer | Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. | 0 |
|
||||
|
||||
|
|
|
@ -96,9 +96,9 @@ GET https://appwrite.io/v1/database/collections/{collectionId}/documents
|
|||
| filters | array | Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: 'name=John Doe' or 'category.$id>=5bed2d152c362'. | [] |
|
||||
| offset | integer | Offset value. Use this value to manage pagination. | 0 |
|
||||
| limit | integer | Maximum number of documents to return in response. Use this value to manage pagination. | 50 |
|
||||
| order-field | string | Document field that results will be sorted by. | $id |
|
||||
| order-type | string | Order direction. Possible values are DESC for descending order, or ASC for ascending order. | ASC |
|
||||
| order-cast | string | Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string. | string |
|
||||
| orderField | string | Document field that results will be sorted by. | $id |
|
||||
| orderType | string | Order direction. Possible values are DESC for descending order, or ASC for ascending order. | ASC |
|
||||
| orderCast | string | Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string. | string |
|
||||
| search | string | Search query. Enter any free text search. The database will try to find a match against all document attributes and children. | |
|
||||
| first | integer | Return only the first document. Pass 1 for true or 0 for false. The default value is 0. | 0 |
|
||||
| last | integer | Return only the last document. Pass 1 for true or 0 for false. The default value is 0. | 0 |
|
||||
|
@ -169,3 +169,15 @@ DELETE https://appwrite.io/v1/database/collections/{collectionId}/documents/{doc
|
|||
| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/database?platform=server#createCollection). | |
|
||||
| documentId | string | **Required** Document unique ID. | |
|
||||
|
||||
## Get Collection Logs
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/database/collections/{collectionId}/logs
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Field Name | Type | Description | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| collectionId | string | **Required** Collection unique ID. | |
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Database;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$database = new Database($client);
|
||||
|
||||
$result = $database->getCollectionLogs('[COLLECTION_ID]');
|
15
app/sdks/server-php/docs/examples/health/get-cache.md
Normal file
15
app/sdks/server-php/docs/examples/health/get-cache.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Health;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$health = new Health($client);
|
||||
|
||||
$result = $health->getCache();
|
15
app/sdks/server-php/docs/examples/health/get-d-b.md
Normal file
15
app/sdks/server-php/docs/examples/health/get-d-b.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Health;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$health = new Health($client);
|
||||
|
||||
$result = $health->getDB();
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Health;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$health = new Health($client);
|
||||
|
||||
$result = $health->getQueueCertificates();
|
15
app/sdks/server-php/docs/examples/health/get-queue-logs.md
Normal file
15
app/sdks/server-php/docs/examples/health/get-queue-logs.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Health;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$health = new Health($client);
|
||||
|
||||
$result = $health->getQueueLogs();
|
15
app/sdks/server-php/docs/examples/health/get-queue-tasks.md
Normal file
15
app/sdks/server-php/docs/examples/health/get-queue-tasks.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Health;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$health = new Health($client);
|
||||
|
||||
$result = $health->getQueueTasks();
|
15
app/sdks/server-php/docs/examples/health/get-queue-usage.md
Normal file
15
app/sdks/server-php/docs/examples/health/get-queue-usage.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Health;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$health = new Health($client);
|
||||
|
||||
$result = $health->getQueueUsage();
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Health;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$health = new Health($client);
|
||||
|
||||
$result = $health->getQueueWebhooks();
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Health;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$health = new Health($client);
|
||||
|
||||
$result = $health->getStorageAntiVirus();
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Health;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$health = new Health($client);
|
||||
|
||||
$result = $health->getStorageLocal();
|
15
app/sdks/server-php/docs/examples/health/get-time.md
Normal file
15
app/sdks/server-php/docs/examples/health/get-time.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Health;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$health = new Health($client);
|
||||
|
||||
$result = $health->getTime();
|
15
app/sdks/server-php/docs/examples/health/get.md
Normal file
15
app/sdks/server-php/docs/examples/health/get.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Health;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
$health = new Health($client);
|
||||
|
||||
$result = $health->get();
|
90
app/sdks/server-php/docs/health.md
Normal file
90
app/sdks/server-php/docs/health.md
Normal file
|
@ -0,0 +1,90 @@
|
|||
# Health Service
|
||||
|
||||
## Check API HTTP Health
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/health
|
||||
```
|
||||
|
||||
** Check the Appwrite HTTP server is up and responsive. **
|
||||
|
||||
## Check Cache Health
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/health/cache
|
||||
```
|
||||
|
||||
** Check the Appwrite in-memory cache server is up and connection is successful. **
|
||||
|
||||
## Check DB Health
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/health/db
|
||||
```
|
||||
|
||||
** Check the Appwrite database server is up and connection is successful. **
|
||||
|
||||
## Check the number of pending certificate messages
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/health/queue/certificates
|
||||
```
|
||||
|
||||
** Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. **
|
||||
|
||||
## Check the number of pending log messages
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/health/queue/logs
|
||||
```
|
||||
|
||||
** Get the number of logs that are waiting to be processed in the Appwrite internal queue server. **
|
||||
|
||||
## Check the number of pending task messages
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/health/queue/tasks
|
||||
```
|
||||
|
||||
** Get the number of tasks that are waiting to be processed in the Appwrite internal queue server. **
|
||||
|
||||
## Check the number of pending usage messages
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/health/queue/usage
|
||||
```
|
||||
|
||||
** Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server. **
|
||||
|
||||
## Check number of pending webhook messages
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/health/queue/webhooks
|
||||
```
|
||||
|
||||
** Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. **
|
||||
|
||||
## Check Anti virus Health
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/health/storage/anti-virus
|
||||
```
|
||||
|
||||
** Check the Appwrite Anti Virus server is up and connection is successful. **
|
||||
|
||||
## Check File System Health
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/health/storage/local
|
||||
```
|
||||
|
||||
** Check the Appwrite local storage device is up and connection is successful. **
|
||||
|
||||
## Check Time Health
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/health/time
|
||||
```
|
||||
|
||||
** Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. **
|
||||
|
|
@ -121,7 +121,7 @@ DELETE https://appwrite.io/v1/users/{userId}/sessions
|
|||
## Delete User Session
|
||||
|
||||
```http request
|
||||
DELETE https://appwrite.io/v1/users/{userId}/sessions/:session
|
||||
DELETE https://appwrite.io/v1/users/{userId}/sessions/{sessionId}
|
||||
```
|
||||
|
||||
** Delete user sessions by its unique ID. **
|
||||
|
@ -131,7 +131,7 @@ DELETE https://appwrite.io/v1/users/{userId}/sessions/:session
|
|||
| Field Name | Type | Description | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| userId | string | **Required** User unique ID. | |
|
||||
| sessionId | string | User unique session ID. | |
|
||||
| sessionId | string | **Required** User unique session ID. | |
|
||||
|
||||
## Update User Status
|
||||
|
||||
|
|
|
@ -164,9 +164,9 @@ class Database extends Service
|
|||
$params['filters'] = $filters;
|
||||
$params['offset'] = $offset;
|
||||
$params['limit'] = $limit;
|
||||
$params['order-field'] = $orderField;
|
||||
$params['order-type'] = $orderType;
|
||||
$params['order-cast'] = $orderCast;
|
||||
$params['orderField'] = $orderField;
|
||||
$params['orderType'] = $orderType;
|
||||
$params['orderCast'] = $orderCast;
|
||||
$params['search'] = $search;
|
||||
$params['first'] = $first;
|
||||
$params['last'] = $last;
|
||||
|
@ -278,4 +278,22 @@ class Database extends Service
|
|||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Collection Logs
|
||||
*
|
||||
* @param string $collectionId
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getCollectionLogs(string $collectionId):array
|
||||
{
|
||||
$path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}/logs');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
}
|
233
app/sdks/server-php/src/Appwrite/Services/Health.php
Normal file
233
app/sdks/server-php/src/Appwrite/Services/Health.php
Normal file
|
@ -0,0 +1,233 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Services;
|
||||
|
||||
use Exception;
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Service;
|
||||
|
||||
class Health extends Service
|
||||
{
|
||||
/**
|
||||
* Check API HTTP Health
|
||||
*
|
||||
* Check the Appwrite HTTP server is up and responsive.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function get():array
|
||||
{
|
||||
$path = str_replace([], [], '/health');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Cache Health
|
||||
*
|
||||
* Check the Appwrite in-memory cache server is up and connection is
|
||||
* successful.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getCache():array
|
||||
{
|
||||
$path = str_replace([], [], '/health/cache');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check DB Health
|
||||
*
|
||||
* Check the Appwrite database server is up and connection is successful.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getDB():array
|
||||
{
|
||||
$path = str_replace([], [], '/health/db');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the number of pending certificate messages
|
||||
*
|
||||
* Get the number of certificates that are waiting to be issued against
|
||||
* [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
|
||||
* server.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getQueueCertificates():array
|
||||
{
|
||||
$path = str_replace([], [], '/health/queue/certificates');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the number of pending log messages
|
||||
*
|
||||
* Get the number of logs that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getQueueLogs():array
|
||||
{
|
||||
$path = str_replace([], [], '/health/queue/logs');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the number of pending task messages
|
||||
*
|
||||
* Get the number of tasks that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getQueueTasks():array
|
||||
{
|
||||
$path = str_replace([], [], '/health/queue/tasks');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the number of pending usage messages
|
||||
*
|
||||
* Get the number of usage stats that are waiting to be processed in the
|
||||
* Appwrite internal queue server.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getQueueUsage():array
|
||||
{
|
||||
$path = str_replace([], [], '/health/queue/usage');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check number of pending webhook messages
|
||||
*
|
||||
* Get the number of webhooks that are waiting to be processed in the Appwrite
|
||||
* internal queue server.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getQueueWebhooks():array
|
||||
{
|
||||
$path = str_replace([], [], '/health/queue/webhooks');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Anti virus Health
|
||||
*
|
||||
* Check the Appwrite Anti Virus server is up and connection is successful.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getStorageAntiVirus():array
|
||||
{
|
||||
$path = str_replace([], [], '/health/storage/anti-virus');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check File System Health
|
||||
*
|
||||
* Check the Appwrite local storage device is up and connection is successful.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getStorageLocal():array
|
||||
{
|
||||
$path = str_replace([], [], '/health/storage/local');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Time Health
|
||||
*
|
||||
* Check the Appwrite server time is synced with Google remote NTP server. We
|
||||
* use this technology to smoothly handle leap seconds with no disruptive
|
||||
* events. The [Network Time
|
||||
* Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is
|
||||
* used by hundreds of millions of computers and devices to synchronize their
|
||||
* clocks over the Internet. If your computer sets its own clock, it likely
|
||||
* uses NTP.
|
||||
*
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getTime():array
|
||||
{
|
||||
$path = str_replace([], [], '/health/time');
|
||||
$params = [];
|
||||
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
}
|
|
@ -196,10 +196,9 @@ class Users extends Service
|
|||
*/
|
||||
public function deleteSession(string $userId, string $sessionId):array
|
||||
{
|
||||
$path = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions/:session');
|
||||
$path = str_replace(['{userId}', '{sessionId}'], [$userId, $sessionId], '/users/{userId}/sessions/{sessionId}');
|
||||
$params = [];
|
||||
|
||||
$params['sessionId'] = $sessionId;
|
||||
|
||||
return $this->client->call(Client::METHOD_DELETE, $path, [
|
||||
'content-type' => 'application/json',
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
**This SDK is compatible with Appwrite server version 0.5.3. For older versions, please check previous releases.**
|
||||
|
||||
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||
Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -80,9 +80,9 @@ class Database(Service):
|
|||
params['filters'] = filters
|
||||
params['offset'] = offset
|
||||
params['limit'] = limit
|
||||
params['order-field'] = order_field
|
||||
params['order-type'] = order_type
|
||||
params['order-cast'] = order_cast
|
||||
params['orderField'] = order_field
|
||||
params['orderType'] = order_type
|
||||
params['orderCast'] = order_cast
|
||||
params['search'] = search
|
||||
params['first'] = first
|
||||
params['last'] = last
|
||||
|
@ -146,3 +146,14 @@ class Database(Service):
|
|||
return self.client.call('delete', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def get_collection_logs(self, collection_id):
|
||||
"""Get Collection Logs"""
|
||||
|
||||
params = {}
|
||||
path = '/database/collections/{collectionId}/logs'
|
||||
path = path.replace('{collectionId}', collection_id)
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
|
117
app/sdks/server-python/appwrite/services/health.py
Normal file
117
app/sdks/server-python/appwrite/services/health.py
Normal file
|
@ -0,0 +1,117 @@
|
|||
from ..service import Service
|
||||
|
||||
|
||||
class Health(Service):
|
||||
|
||||
def __init__(self, client):
|
||||
super(Health, self).__init__(client)
|
||||
|
||||
def get(self):
|
||||
"""Check API HTTP Health"""
|
||||
|
||||
params = {}
|
||||
path = '/health'
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def get_cache(self):
|
||||
"""Check Cache Health"""
|
||||
|
||||
params = {}
|
||||
path = '/health/cache'
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def get_d_b(self):
|
||||
"""Check DB Health"""
|
||||
|
||||
params = {}
|
||||
path = '/health/db'
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def get_queue_certificates(self):
|
||||
"""Check the number of pending certificate messages"""
|
||||
|
||||
params = {}
|
||||
path = '/health/queue/certificates'
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def get_queue_logs(self):
|
||||
"""Check the number of pending log messages"""
|
||||
|
||||
params = {}
|
||||
path = '/health/queue/logs'
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def get_queue_tasks(self):
|
||||
"""Check the number of pending task messages"""
|
||||
|
||||
params = {}
|
||||
path = '/health/queue/tasks'
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def get_queue_usage(self):
|
||||
"""Check the number of pending usage messages"""
|
||||
|
||||
params = {}
|
||||
path = '/health/queue/usage'
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def get_queue_webhooks(self):
|
||||
"""Check number of pending webhook messages"""
|
||||
|
||||
params = {}
|
||||
path = '/health/queue/webhooks'
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def get_storage_anti_virus(self):
|
||||
"""Check Anti virus Health"""
|
||||
|
||||
params = {}
|
||||
path = '/health/storage/anti-virus'
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def get_storage_local(self):
|
||||
"""Check File System Health"""
|
||||
|
||||
params = {}
|
||||
path = '/health/storage/local'
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def get_time(self):
|
||||
"""Check Time Health"""
|
||||
|
||||
params = {}
|
||||
path = '/health/time'
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
|
@ -104,9 +104,9 @@ class Users(Service):
|
|||
"""Delete User Session"""
|
||||
|
||||
params = {}
|
||||
path = '/users/{userId}/sessions/:session'
|
||||
path = '/users/{userId}/sessions/{sessionId}'
|
||||
path = path.replace('{userId}', user_id)
|
||||
params['sessionId'] = session_id
|
||||
path = path.replace('{sessionId}', session_id)
|
||||
|
||||
return self.client.call('delete', path, {
|
||||
'content-type': 'application/json',
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.database import Database
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
database = Database(client)
|
||||
|
||||
result = database.get_collection_logs('[COLLECTION_ID]')
|
13
app/sdks/server-python/docs/examples/health/get-cache.md
Normal file
13
app/sdks/server-python/docs/examples/health/get-cache.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.health import Health
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
health = Health(client)
|
||||
|
||||
result = health.get_cache()
|
13
app/sdks/server-python/docs/examples/health/get-d-b.md
Normal file
13
app/sdks/server-python/docs/examples/health/get-d-b.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.health import Health
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
health = Health(client)
|
||||
|
||||
result = health.get_d_b()
|
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.health import Health
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
health = Health(client)
|
||||
|
||||
result = health.get_queue_certificates()
|
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.health import Health
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
health = Health(client)
|
||||
|
||||
result = health.get_queue_logs()
|
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.health import Health
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
health = Health(client)
|
||||
|
||||
result = health.get_queue_tasks()
|
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.health import Health
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
health = Health(client)
|
||||
|
||||
result = health.get_queue_usage()
|
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.health import Health
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
health = Health(client)
|
||||
|
||||
result = health.get_queue_webhooks()
|
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.health import Health
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
health = Health(client)
|
||||
|
||||
result = health.get_storage_anti_virus()
|
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.health import Health
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
health = Health(client)
|
||||
|
||||
result = health.get_storage_local()
|
13
app/sdks/server-python/docs/examples/health/get-time.md
Normal file
13
app/sdks/server-python/docs/examples/health/get-time.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.health import Health
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
health = Health(client)
|
||||
|
||||
result = health.get_time()
|
13
app/sdks/server-python/docs/examples/health/get.md
Normal file
13
app/sdks/server-python/docs/examples/health/get.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
from appwrite.client import Client
|
||||
from appwrite.services.health import Health
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
)
|
||||
|
||||
health = Health(client)
|
||||
|
||||
result = health.get()
|
|
@ -5,7 +5,9 @@ setuptools.setup(
|
|||
packages = ['appwrite', 'appwrite/services'],
|
||||
version = '0.0.4',
|
||||
license='BSD-3-Clause',
|
||||
description = '',
|
||||
description = 'Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||
Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)',
|
||||
author = 'Appwrite Team',
|
||||
author_email = 'team@appwrite.io',
|
||||
maintainer = 'Appwrite Team',
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
**This SDK is compatible with Appwrite server version 0.5.3. For older versions, please check previous releases.**
|
||||
|
||||
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||
Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.name = 'appwrite'
|
||||
s.version = '1.0.9'
|
||||
s.summary = ""
|
||||
s.summary = "Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||
Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)"
|
||||
s.author = 'Appwrite Team'
|
||||
s.homepage = 'https://appwrite.io/support'
|
||||
s.email = 'team@appwrite.io'
|
||||
|
|
|
@ -5,6 +5,7 @@ require_relative 'appwrite/client'
|
|||
require_relative 'appwrite/service'
|
||||
require_relative 'appwrite/services/avatars'
|
||||
require_relative 'appwrite/services/database'
|
||||
require_relative 'appwrite/services/health'
|
||||
require_relative 'appwrite/services/locale'
|
||||
require_relative 'appwrite/services/storage'
|
||||
require_relative 'appwrite/services/teams'
|
||||
|
|
|
@ -79,9 +79,9 @@ module Appwrite
|
|||
'filters': filters,
|
||||
'offset': offset,
|
||||
'limit': limit,
|
||||
'order-field': order_field,
|
||||
'order-type': order_type,
|
||||
'order-cast': order_cast,
|
||||
'orderField': order_field,
|
||||
'orderType': order_type,
|
||||
'orderCast': order_cast,
|
||||
'search': search,
|
||||
'first': first,
|
||||
'last': last
|
||||
|
@ -152,6 +152,18 @@ module Appwrite
|
|||
}, params);
|
||||
end
|
||||
|
||||
def get_collection_logs(collection_id:)
|
||||
path = '/database/collections/{collectionId}/logs'
|
||||
.gsub('{collection_id}', collection_id)
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
|
|
130
app/sdks/server-ruby/lib/appwrite/services/health.rb
Normal file
130
app/sdks/server-ruby/lib/appwrite/services/health.rb
Normal file
|
@ -0,0 +1,130 @@
|
|||
module Appwrite
|
||||
class Health < Service
|
||||
|
||||
def get()
|
||||
path = '/health'
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def get_cache()
|
||||
path = '/health/cache'
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def get_d_b()
|
||||
path = '/health/db'
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def get_queue_certificates()
|
||||
path = '/health/queue/certificates'
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def get_queue_logs()
|
||||
path = '/health/queue/logs'
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def get_queue_tasks()
|
||||
path = '/health/queue/tasks'
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def get_queue_usage()
|
||||
path = '/health/queue/usage'
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def get_queue_webhooks()
|
||||
path = '/health/queue/webhooks'
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def get_storage_anti_virus()
|
||||
path = '/health/storage/anti-virus'
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def get_storage_local()
|
||||
path = '/health/storage/local'
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def get_time()
|
||||
path = '/health/time'
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
private
|
||||
end
|
||||
end
|
|
@ -104,11 +104,11 @@ module Appwrite
|
|||
end
|
||||
|
||||
def delete_session(user_id:, session_id:)
|
||||
path = '/users/{userId}/sessions/:session'
|
||||
path = '/users/{userId}/sessions/{sessionId}'
|
||||
.gsub('{user_id}', user_id)
|
||||
.gsub('{session_id}', session_id)
|
||||
|
||||
params = {
|
||||
'sessionId': session_id
|
||||
}
|
||||
|
||||
return @client.call('delete', path, {
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
![License](https://img.shields.io/github/license/appwrite/sdk-for-js.svg?v=1)
|
||||
![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1)
|
||||
|
||||
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||
Use the JavaScript SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
||||
|
||||
![Appwrite](https://appwrite.io/images/github.png)
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue