1
0
Fork 0
mirror of synced 2024-06-14 08:44:49 +12:00

Updated SDKs

This commit is contained in:
eldadfux 2019-08-06 08:03:18 +03:00
parent 300a907792
commit 1936e20636
96 changed files with 4424 additions and 11 deletions

View file

@ -55,7 +55,7 @@ return [
'v1/projects' => [
'name' => 'Projects',
'controller' => 'controllers/projects.php',
'sdk' => false,
'sdk' => true,
],
'v1/storage' => [
'name' => 'Storage',

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.createKey('[PROJECT_ID]', '[NAME]', []);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.createPlatform('[PROJECT_ID]', 'web', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.createProject('[NAME]', '[TEAM_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 1);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.deleteKey('[PROJECT_ID]', '[KEY_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.deletePlatform('[PROJECT_ID]', '[PLATFORM_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.deleteProject('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.deleteTask('[PROJECT_ID]', '[TASK_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.deleteWebhook('[PROJECT_ID]', '[WEBHOOK_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getKey('[PROJECT_ID]', '[KEY_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getPlatform('[PROJECT_ID]', '[PLATFORM_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getProjectUsage('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getProject('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getTask('[PROJECT_ID]', '[TASK_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getWebhook('[PROJECT_ID]', '[WEBHOOK_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.listKeys('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.listPlatforms('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.listProjects();
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.listTasks('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.listWebhooks('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updateKey('[PROJECT_ID]', '[KEY_ID]', '[NAME]', []);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updatePlatform('[PROJECT_ID]', '[PLATFORM_ID]', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updateProjectOAuth('[PROJECT_ID]', 'bitbucket');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updateProject('[PROJECT_ID]', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updateWebhook('[PROJECT_ID]', '[WEBHOOK_ID]', '[NAME]', [], '[URL]', 0);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -2,7 +2,7 @@
"name": "appwrite",
"homepage": "https://appwrite.io/support",
"description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)",
"version": "v1.0.6",
"version": "v1.0.7",
"license": "BSD-3-Clause",
"main": "src/sdk.js",
"repository": {

View file

@ -132,7 +132,7 @@
globalParams.push({key: key, value: value});
};
addGlobalHeader('x-sdk-version', 'appwrite:javascript:v1.0.6');
addGlobalHeader('x-sdk-version', 'appwrite:javascript:v1.0.7');
addGlobalHeader('content-type', '');
/**
@ -936,7 +936,9 @@
* Get image from and HTTP URL and crop to any size.
*
* Use this endpoint to fetch a remote image URL and crop it to any image size
* you want.
* you want. This endpoint is very useful if you need to crop a remote image
* or in cases, you want to make sure a 3rd party image is properly served
* using a TLS protocol.
*
* @param {string} url
* @param {number} width
@ -1344,6 +1346,861 @@
}
};
let projects = {
/**
* List Projects
*
*
* @throws {Error}
* @return {Promise} */
listProjects: function() {
let path = '/projects';
return http
.get(path, {'content-type': 'application/json'},
{
});
},
/**
* Create Project
*
*
* @param {string} name
* @param {string} teamId
* @param {string} description
* @param {string} logo
* @param {string} url
* @param {array} clients
* @param {string} legalName
* @param {string} legalCountry
* @param {string} legalState
* @param {string} legalCity
* @param {string} legalAddress
* @param {string} legalTaxId
* @throws {Error}
* @return {Promise} */
createProject: function(name, teamId, description = '', logo = '', url = '', clients = [], 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';
return http
.post(path, {'content-type': 'application/json'},
{
'name': name,
'teamId': teamId,
'description': description,
'logo': logo,
'url': url,
'clients': clients,
'legalName': legalName,
'legalCountry': legalCountry,
'legalState': legalState,
'legalCity': legalCity,
'legalAddress': legalAddress,
'legalTaxId': legalTaxId
});
},
/**
* Get Project
*
*
* @param {string} projectId
* @throws {Error}
* @return {Promise} */
getProject: function(projectId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.get(path, {'content-type': 'application/json'},
{
});
},
/**
* Update Project
*
*
* @param {string} projectId
* @param {string} name
* @param {string} description
* @param {string} logo
* @param {string} url
* @param {array} clients
* @param {string} legalName
* @param {string} legalCountry
* @param {string} legalState
* @param {string} legalCity
* @param {string} legalAddress
* @param {string} legalTaxId
* @throws {Error}
* @return {Promise} */
updateProject: function(projectId, name, description = '', logo = '', url = '', clients = [], legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(name === undefined) {
throw new Error('Missing required parameter: "name"');
}
let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.patch(path, {'content-type': 'application/json'},
{
'name': name,
'description': description,
'logo': logo,
'url': url,
'clients': clients,
'legalName': legalName,
'legalCountry': legalCountry,
'legalState': legalState,
'legalCity': legalCity,
'legalAddress': legalAddress,
'legalTaxId': legalTaxId
});
},
/**
* Delete Project
*
*
* @param {string} projectId
* @throws {Error}
* @return {Promise} */
deleteProject: function(projectId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.delete(path, {'content-type': 'application/json'},
{
});
},
/**
* List Keys
*
*
* @param {string} projectId
* @throws {Error}
* @return {Promise} */
listKeys: function(projectId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
let path = '/projects/{projectId}/keys'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.get(path, {'content-type': 'application/json'},
{
});
},
/**
* Create Key
*
*
* @param {string} projectId
* @param {string} name
* @param {array} scopes
* @throws {Error}
* @return {Promise} */
createKey: function(projectId, name, scopes) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(name === undefined) {
throw new Error('Missing required parameter: "name"');
}
if(scopes === undefined) {
throw new Error('Missing required parameter: "scopes"');
}
let path = '/projects/{projectId}/keys'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.post(path, {'content-type': 'application/json'},
{
'name': name,
'scopes': scopes
});
},
/**
* Get Key
*
*
* @param {string} projectId
* @param {string} keyId
* @throws {Error}
* @return {Promise} */
getKey: function(projectId, keyId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(keyId === undefined) {
throw new Error('Missing required parameter: "keyId"');
}
let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId);
return http
.get(path, {'content-type': 'application/json'},
{
});
},
/**
* Update Key
*
*
* @param {string} projectId
* @param {string} keyId
* @param {string} name
* @param {array} scopes
* @throws {Error}
* @return {Promise} */
updateKey: function(projectId, keyId, name, scopes) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(keyId === undefined) {
throw new Error('Missing required parameter: "keyId"');
}
if(name === undefined) {
throw new Error('Missing required parameter: "name"');
}
if(scopes === undefined) {
throw new Error('Missing required parameter: "scopes"');
}
let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId);
return http
.put(path, {'content-type': 'application/json'},
{
'name': name,
'scopes': scopes
});
},
/**
* Delete Key
*
*
* @param {string} projectId
* @param {string} keyId
* @throws {Error}
* @return {Promise} */
deleteKey: function(projectId, keyId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(keyId === undefined) {
throw new Error('Missing required parameter: "keyId"');
}
let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId);
return http
.delete(path, {'content-type': 'application/json'},
{
});
},
/**
* Update Project OAuth
*
*
* @param {string} projectId
* @param {string} provider
* @param {string} appId
* @param {string} secret
* @throws {Error}
* @return {Promise} */
updateProjectOAuth: function(projectId, provider, appId = '', secret = '') {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(provider === undefined) {
throw new Error('Missing required parameter: "provider"');
}
let path = '/projects/{projectId}/oauth'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.patch(path, {'content-type': 'application/json'},
{
'provider': provider,
'appId': appId,
'secret': secret
});
},
/**
* List Platforms
*
*
* @param {string} projectId
* @throws {Error}
* @return {Promise} */
listPlatforms: function(projectId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
let path = '/projects/{projectId}/platforms'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.get(path, {'content-type': 'application/json'},
{
});
},
/**
* Create Platform
*
*
* @param {string} projectId
* @param {string} type
* @param {string} name
* @param {string} key
* @param {string} store
* @param {array} domains
* @throws {Error}
* @return {Promise} */
createPlatform: function(projectId, type, name, key = '', store = '', domains = []) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(type === undefined) {
throw new Error('Missing required parameter: "type"');
}
if(name === undefined) {
throw new Error('Missing required parameter: "name"');
}
let path = '/projects/{projectId}/platforms'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.post(path, {'content-type': 'application/json'},
{
'type': type,
'name': name,
'key': key,
'store': store,
'domains': domains
});
},
/**
* Get Platform
*
*
* @param {string} projectId
* @param {string} platformId
* @throws {Error}
* @return {Promise} */
getPlatform: function(projectId, platformId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(platformId === undefined) {
throw new Error('Missing required parameter: "platformId"');
}
let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId);
return http
.get(path, {'content-type': 'application/json'},
{
});
},
/**
* Update Platform
*
*
* @param {string} projectId
* @param {string} platformId
* @param {string} name
* @param {string} key
* @param {string} store
* @param {array} domains
* @throws {Error}
* @return {Promise} */
updatePlatform: function(projectId, platformId, name, key = '', store = '', domains = []) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(platformId === undefined) {
throw new Error('Missing required parameter: "platformId"');
}
if(name === undefined) {
throw new Error('Missing required parameter: "name"');
}
let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId);
return http
.put(path, {'content-type': 'application/json'},
{
'name': name,
'key': key,
'store': store,
'domains': domains
});
},
/**
* Delete Platform
*
*
* @param {string} projectId
* @param {string} platformId
* @throws {Error}
* @return {Promise} */
deletePlatform: function(projectId, platformId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(platformId === undefined) {
throw new Error('Missing required parameter: "platformId"');
}
let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId);
return http
.delete(path, {'content-type': 'application/json'},
{
});
},
/**
* List Tasks
*
*
* @param {string} projectId
* @throws {Error}
* @return {Promise} */
listTasks: function(projectId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
let path = '/projects/{projectId}/tasks'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.get(path, {'content-type': 'application/json'},
{
});
},
/**
* Create Task
*
*
* @param {string} projectId
* @param {string} name
* @param {string} status
* @param {string} schedule
* @param {number} security
* @param {string} httpMethod
* @param {string} httpUrl
* @param {array} httpHeaders
* @param {string} httpUser
* @param {string} httpPass
* @throws {Error}
* @return {Promise} */
createTask: function(projectId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = [], httpUser = '', httpPass = '') {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(name === undefined) {
throw new Error('Missing required parameter: "name"');
}
if(status === undefined) {
throw new Error('Missing required parameter: "status"');
}
if(schedule === undefined) {
throw new Error('Missing required parameter: "schedule"');
}
if(security === undefined) {
throw new Error('Missing required parameter: "security"');
}
if(httpMethod === undefined) {
throw new Error('Missing required parameter: "httpMethod"');
}
if(httpUrl === undefined) {
throw new Error('Missing required parameter: "httpUrl"');
}
let path = '/projects/{projectId}/tasks'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.post(path, {'content-type': 'application/json'},
{
'name': name,
'status': status,
'schedule': schedule,
'security': security,
'httpMethod': httpMethod,
'httpUrl': httpUrl,
'httpHeaders': httpHeaders,
'httpUser': httpUser,
'httpPass': httpPass
});
},
/**
* Get Task
*
*
* @param {string} projectId
* @param {string} taskId
* @throws {Error}
* @return {Promise} */
getTask: 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);
return http
.get(path, {'content-type': 'application/json'},
{
});
},
/**
* Update Task
*
*
* @param {string} projectId
* @param {string} taskId
* @param {string} name
* @param {string} status
* @param {string} schedule
* @param {number} security
* @param {string} httpMethod
* @param {string} httpUrl
* @param {array} httpHeaders
* @param {string} httpUser
* @param {string} httpPass
* @throws {Error}
* @return {Promise} */
updateTask: function(projectId, taskId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = [], httpUser = '', httpPass = '') {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(taskId === undefined) {
throw new Error('Missing required parameter: "taskId"');
}
if(name === undefined) {
throw new Error('Missing required parameter: "name"');
}
if(status === undefined) {
throw new Error('Missing required parameter: "status"');
}
if(schedule === undefined) {
throw new Error('Missing required parameter: "schedule"');
}
if(security === undefined) {
throw new Error('Missing required parameter: "security"');
}
if(httpMethod === undefined) {
throw new Error('Missing required parameter: "httpMethod"');
}
if(httpUrl === undefined) {
throw new Error('Missing required parameter: "httpUrl"');
}
let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId);
return http
.put(path, {'content-type': 'application/json'},
{
'name': name,
'status': status,
'schedule': schedule,
'security': security,
'httpMethod': httpMethod,
'httpUrl': httpUrl,
'httpHeaders': httpHeaders,
'httpUser': httpUser,
'httpPass': httpPass
});
},
/**
* Delete Task
*
*
* @param {string} projectId
* @param {string} taskId
* @throws {Error}
* @return {Promise} */
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);
return http
.delete(path, {'content-type': 'application/json'},
{
});
},
/**
* Get Project
*
*
* @param {string} projectId
* @throws {Error}
* @return {Promise} */
getProjectUsage: function(projectId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
let path = '/projects/{projectId}/usage'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.get(path, {'content-type': 'application/json'},
{
});
},
/**
* List Webhooks
*
*
* @param {string} projectId
* @throws {Error}
* @return {Promise} */
listWebhooks: function(projectId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
let path = '/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.get(path, {'content-type': 'application/json'},
{
});
},
/**
* Create Webhook
*
*
* @param {string} projectId
* @param {string} name
* @param {array} events
* @param {string} url
* @param {number} security
* @param {string} httpUser
* @param {string} httpPass
* @throws {Error}
* @return {Promise} */
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"');
}
if(url === undefined) {
throw new Error('Missing required parameter: "url"');
}
if(security === undefined) {
throw new Error('Missing required parameter: "security"');
}
let path = '/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}', 'g'), projectId);
return http
.post(path, {'content-type': 'application/json'},
{
'name': name,
'events': events,
'url': url,
'security': security,
'httpUser': httpUser,
'httpPass': httpPass
});
},
/**
* Get Webhook
*
*
* @param {string} projectId
* @param {string} webhookId
* @throws {Error}
* @return {Promise} */
getWebhook: function(projectId, webhookId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(webhookId === undefined) {
throw new Error('Missing required parameter: "webhookId"');
}
let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId);
return http
.get(path, {'content-type': 'application/json'},
{
});
},
/**
* Update Webhook
*
*
* @param {string} projectId
* @param {string} webhookId
* @param {string} name
* @param {array} events
* @param {string} url
* @param {number} security
* @param {string} httpUser
* @param {string} httpPass
* @throws {Error}
* @return {Promise} */
updateWebhook: function(projectId, webhookId, name, events, url, security, httpUser = '', httpPass = '') {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(webhookId === undefined) {
throw new Error('Missing required parameter: "webhookId"');
}
if(name === undefined) {
throw new Error('Missing required parameter: "name"');
}
if(events === undefined) {
throw new Error('Missing required parameter: "events"');
}
if(url === undefined) {
throw new Error('Missing required parameter: "url"');
}
if(security === undefined) {
throw new Error('Missing required parameter: "security"');
}
let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId);
return http
.put(path, {'content-type': 'application/json'},
{
'name': name,
'events': events,
'url': url,
'security': security,
'httpUser': httpUser,
'httpPass': httpPass
});
},
/**
* Delete Webhook
*
*
* @param {string} projectId
* @param {string} webhookId
* @throws {Error}
* @return {Promise} */
deleteWebhook: function(projectId, webhookId) {
if(projectId === undefined) {
throw new Error('Missing required parameter: "projectId"');
}
if(webhookId === undefined) {
throw new Error('Missing required parameter: "webhookId"');
}
let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId);
return http
.delete(path, {'content-type': 'application/json'},
{
});
}
};
let storage = {
/**
@ -2073,6 +2930,7 @@
avatars: avatars,
database: database,
locale: locale,
projects: projects,
storage: storage,
teams: teams,
users: users

View file

@ -1,5 +1,5 @@
(function(window){window.Appwrite=function(){let config={endpoint:'https://appwrite.test/v1',project:'',key:'',locale:'',mode:'',};let setEndpoint=function(endpoint){config.endpoint=endpoint;return this};let setProject=function(value){http.addGlobalHeader('X-Appwrite-Project',value);config.project=value;return this};let setKey=function(value){http.addGlobalHeader('X-Appwrite-Key',value);config.key=value;return this};let setLocale=function(value){http.addGlobalHeader('X-Appwrite-Locale',value);config.locale=value;return this};let setMode=function(value){http.addGlobalHeader('X-Appwrite-Mode',value);config.mode=value;return this};let http=function(document){let globalParams=[],globalHeaders=[];let addParam=function(url,param,value){let a=document.createElement('a'),regex=/(?:\?|&|&)+([^=]+)(?:=([^&]*))*/g;let match,str=[];a.href=url;param=encodeURIComponent(param);while(match=regex.exec(a.search))if(param!==match[1])str.push(match[1]+(match[2]?"="+match[2]:""));str.push(param+(value?"="+encodeURIComponent(value):""));a.search=str.join("&");return a.href};let buildQuery=function(params){let str=[];for(let p in params){if(params.hasOwnProperty(p)){str.push(encodeURIComponent(p)+"="+encodeURIComponent(params[p]))}}
return str.join("&")};let addGlobalHeader=function(key,value){globalHeaders[key]={key:key.toLowerCase(),value:value.toLowerCase()}};let addGlobalParam=function(key,value){globalParams.push({key:key,value:value})};addGlobalHeader('x-sdk-version','appwrite:javascript:v1.0.6');addGlobalHeader('content-type','');let call=function(method,path,headers={},params={},progress=null){let i;path=config.endpoint+path;if(-1===['GET','POST','PUT','DELETE','TRACE','HEAD','OPTIONS','CONNECT','PATCH'].indexOf(method)){throw new Error('var method must contain a valid HTTP method name')}
return str.join("&")};let addGlobalHeader=function(key,value){globalHeaders[key]={key:key.toLowerCase(),value:value.toLowerCase()}};let addGlobalParam=function(key,value){globalParams.push({key:key,value:value})};addGlobalHeader('x-sdk-version','appwrite:javascript:v1.0.7');addGlobalHeader('content-type','');let call=function(method,path,headers={},params={},progress=null){let i;path=config.endpoint+path;if(-1===['GET','POST','PUT','DELETE','TRACE','HEAD','OPTIONS','CONNECT','PATCH'].indexOf(method)){throw new Error('var method must contain a valid HTTP method name')}
if(typeof path!=='string'){throw new Error('var path must be of type string')}
if(typeof headers!=='object'){throw new Error('var headers must be of type object')}
for(i=0;i<globalParams.length;i++){path=addParam(path,globalParams[i].key,globalParams[i].value)}
@ -56,7 +56,75 @@ if(documentId===undefined){throw new Error('Missing required parameter: "documen
if(data===undefined){throw new Error('Missing required parameter: "data"')}
let path='/database/{collectionId}/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);return http.patch(path,{'content-type':'application/json'},{'data':data,'read':read,'write':write})},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/{collectionId}/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);return http.delete(path,{'content-type':'application/json'},{})}};let locale={getLocale:function(){let path='/locale';return http.get(path,{'content-type':'application/json'},{})},getCountries:function(){let path='/locale/countries';return http.get(path,{'content-type':'application/json'},{})},getCountriesEU:function(){let path='/locale/countries/eu';return http.get(path,{'content-type':'application/json'},{})},getCountriesPhones:function(){let path='/locale/countries/phones';return http.get(path,{'content-type':'application/json'},{})}};let storage={listFiles:function(search='',limit=25,offset=0,orderType='ASC'){let path='/storage/files';return http.get(path,{'content-type':'application/json'},{'search':search,'limit':limit,'offset':offset,'orderType':orderType})},createFile:function(files,read=[],write=[],folderId=''){if(files===undefined){throw new Error('Missing required parameter: "files"')}
let path='/database/{collectionId}/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);return http.delete(path,{'content-type':'application/json'},{})}};let locale={getLocale:function(){let path='/locale';return http.get(path,{'content-type':'application/json'},{})},getCountries:function(){let path='/locale/countries';return http.get(path,{'content-type':'application/json'},{})},getCountriesEU:function(){let path='/locale/countries/eu';return http.get(path,{'content-type':'application/json'},{})},getCountriesPhones:function(){let path='/locale/countries/phones';return http.get(path,{'content-type':'application/json'},{})}};let projects={listProjects:function(){let path='/projects';return http.get(path,{'content-type':'application/json'},{})},createProject:function(name,teamId,description='',logo='',url='',clients=[],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';return http.post(path,{'content-type':'application/json'},{'name':name,'teamId':teamId,'description':description,'logo':logo,'url':url,'clients':clients,'legalName':legalName,'legalCountry':legalCountry,'legalState':legalState,'legalCity':legalCity,'legalAddress':legalAddress,'legalTaxId':legalTaxId})},getProject:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
let path='/projects/{projectId}'.replace(new RegExp('{projectId}','g'),projectId);return http.get(path,{'content-type':'application/json'},{})},updateProject:function(projectId,name,description='',logo='',url='',clients=[],legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(name===undefined){throw new Error('Missing required parameter: "name"')}
let path='/projects/{projectId}'.replace(new RegExp('{projectId}','g'),projectId);return http.patch(path,{'content-type':'application/json'},{'name':name,'description':description,'logo':logo,'url':url,'clients':clients,'legalName':legalName,'legalCountry':legalCountry,'legalState':legalState,'legalCity':legalCity,'legalAddress':legalAddress,'legalTaxId':legalTaxId})},deleteProject:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
let path='/projects/{projectId}'.replace(new RegExp('{projectId}','g'),projectId);return http.delete(path,{'content-type':'application/json'},{})},listKeys:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
let path='/projects/{projectId}/keys'.replace(new RegExp('{projectId}','g'),projectId);return http.get(path,{'content-type':'application/json'},{})},createKey:function(projectId,name,scopes){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(name===undefined){throw new Error('Missing required parameter: "name"')}
if(scopes===undefined){throw new Error('Missing required parameter: "scopes"')}
let path='/projects/{projectId}/keys'.replace(new RegExp('{projectId}','g'),projectId);return http.post(path,{'content-type':'application/json'},{'name':name,'scopes':scopes})},getKey:function(projectId,keyId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(keyId===undefined){throw new Error('Missing required parameter: "keyId"')}
let path='/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{keyId}','g'),keyId);return http.get(path,{'content-type':'application/json'},{})},updateKey:function(projectId,keyId,name,scopes){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(keyId===undefined){throw new Error('Missing required parameter: "keyId"')}
if(name===undefined){throw new Error('Missing required parameter: "name"')}
if(scopes===undefined){throw new Error('Missing required parameter: "scopes"')}
let path='/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{keyId}','g'),keyId);return http.put(path,{'content-type':'application/json'},{'name':name,'scopes':scopes})},deleteKey:function(projectId,keyId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(keyId===undefined){throw new Error('Missing required parameter: "keyId"')}
let path='/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{keyId}','g'),keyId);return http.delete(path,{'content-type':'application/json'},{})},updateProjectOAuth:function(projectId,provider,appId='',secret=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
let path='/projects/{projectId}/oauth'.replace(new RegExp('{projectId}','g'),projectId);return http.patch(path,{'content-type':'application/json'},{'provider':provider,'appId':appId,'secret':secret})},listPlatforms:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
let path='/projects/{projectId}/platforms'.replace(new RegExp('{projectId}','g'),projectId);return http.get(path,{'content-type':'application/json'},{})},createPlatform:function(projectId,type,name,key='',store='',domains=[]){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(type===undefined){throw new Error('Missing required parameter: "type"')}
if(name===undefined){throw new Error('Missing required parameter: "name"')}
let path='/projects/{projectId}/platforms'.replace(new RegExp('{projectId}','g'),projectId);return http.post(path,{'content-type':'application/json'},{'type':type,'name':name,'key':key,'store':store,'domains':domains})},getPlatform:function(projectId,platformId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(platformId===undefined){throw new Error('Missing required parameter: "platformId"')}
let path='/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{platformId}','g'),platformId);return http.get(path,{'content-type':'application/json'},{})},updatePlatform:function(projectId,platformId,name,key='',store='',domains=[]){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(platformId===undefined){throw new Error('Missing required parameter: "platformId"')}
if(name===undefined){throw new Error('Missing required parameter: "name"')}
let path='/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{platformId}','g'),platformId);return http.put(path,{'content-type':'application/json'},{'name':name,'key':key,'store':store,'domains':domains})},deletePlatform:function(projectId,platformId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(platformId===undefined){throw new Error('Missing required parameter: "platformId"')}
let path='/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{platformId}','g'),platformId);return http.delete(path,{'content-type':'application/json'},{})},listTasks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
let path='/projects/{projectId}/tasks'.replace(new RegExp('{projectId}','g'),projectId);return http.get(path,{'content-type':'application/json'},{})},createTask:function(projectId,name,status,schedule,security,httpMethod,httpUrl,httpHeaders=[],httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(name===undefined){throw new Error('Missing required parameter: "name"')}
if(status===undefined){throw new Error('Missing required parameter: "status"')}
if(schedule===undefined){throw new Error('Missing required parameter: "schedule"')}
if(security===undefined){throw new Error('Missing required parameter: "security"')}
if(httpMethod===undefined){throw new Error('Missing required parameter: "httpMethod"')}
if(httpUrl===undefined){throw new Error('Missing required parameter: "httpUrl"')}
let path='/projects/{projectId}/tasks'.replace(new RegExp('{projectId}','g'),projectId);return http.post(path,{'content-type':'application/json'},{'name':name,'status':status,'schedule':schedule,'security':security,'httpMethod':httpMethod,'httpUrl':httpUrl,'httpHeaders':httpHeaders,'httpUser':httpUser,'httpPass':httpPass})},getTask: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);return http.get(path,{'content-type':'application/json'},{})},updateTask:function(projectId,taskId,name,status,schedule,security,httpMethod,httpUrl,httpHeaders=[],httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(taskId===undefined){throw new Error('Missing required parameter: "taskId"')}
if(name===undefined){throw new Error('Missing required parameter: "name"')}
if(status===undefined){throw new Error('Missing required parameter: "status"')}
if(schedule===undefined){throw new Error('Missing required parameter: "schedule"')}
if(security===undefined){throw new Error('Missing required parameter: "security"')}
if(httpMethod===undefined){throw new Error('Missing required parameter: "httpMethod"')}
if(httpUrl===undefined){throw new Error('Missing required parameter: "httpUrl"')}
let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);return http.put(path,{'content-type':'application/json'},{'name':name,'status':status,'schedule':schedule,'security':security,'httpMethod':httpMethod,'httpUrl':httpUrl,'httpHeaders':httpHeaders,'httpUser':httpUser,'httpPass':httpPass})},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);return http.delete(path,{'content-type':'application/json'},{})},getProjectUsage:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
let path='/projects/{projectId}/usage'.replace(new RegExp('{projectId}','g'),projectId);return http.get(path,{'content-type':'application/json'},{})},listWebhooks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
let path='/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}','g'),projectId);return http.get(path,{'content-type':'application/json'},{})},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"')}
if(url===undefined){throw new Error('Missing required parameter: "url"')}
if(security===undefined){throw new Error('Missing required parameter: "security"')}
let path='/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}','g'),projectId);return http.post(path,{'content-type':'application/json'},{'name':name,'events':events,'url':url,'security':security,'httpUser':httpUser,'httpPass':httpPass})},getWebhook:function(projectId,webhookId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(webhookId===undefined){throw new Error('Missing required parameter: "webhookId"')}
let path='/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{webhookId}','g'),webhookId);return http.get(path,{'content-type':'application/json'},{})},updateWebhook:function(projectId,webhookId,name,events,url,security,httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(webhookId===undefined){throw new Error('Missing required parameter: "webhookId"')}
if(name===undefined){throw new Error('Missing required parameter: "name"')}
if(events===undefined){throw new Error('Missing required parameter: "events"')}
if(url===undefined){throw new Error('Missing required parameter: "url"')}
if(security===undefined){throw new Error('Missing required parameter: "security"')}
let path='/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{webhookId}','g'),webhookId);return http.put(path,{'content-type':'application/json'},{'name':name,'events':events,'url':url,'security':security,'httpUser':httpUser,'httpPass':httpPass})},deleteWebhook:function(projectId,webhookId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
if(webhookId===undefined){throw new Error('Missing required parameter: "webhookId"')}
let path='/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{webhookId}','g'),webhookId);return http.delete(path,{'content-type':'application/json'},{})}};let storage={listFiles:function(search='',limit=25,offset=0,orderType='ASC'){let path='/storage/files';return http.get(path,{'content-type':'application/json'},{'search':search,'limit':limit,'offset':offset,'orderType':orderType})},createFile:function(files,read=[],write=[],folderId=''){if(files===undefined){throw new Error('Missing required parameter: "files"')}
let path='/storage/files';return http.post(path,{'content-type':'application/json'},{'files':files,'read':read,'write':write,'folderId':folderId})},getFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);return http.get(path,{'content-type':'application/json'},{})},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);return http.delete(path,{'content-type':'application/json'},{})},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
@ -92,4 +160,4 @@ let path='/users/{userId}/sessions'.replace(new RegExp('{userId}','g'),userId);r
if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
let path='/users/{userId}/sessions/:session'.replace(new RegExp('{userId}','g'),userId);return http.delete(path,{'content-type':'application/json'},{'sessionId':sessionId})},updateUserStatus: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);return http.patch(path,{'content-type':'application/json'},{'status':status})}};return{setEndpoint:setEndpoint,setProject:setProject,setKey:setKey,setLocale:setLocale,setMode:setMode,account:account,auth:auth,avatars:avatars,database:database,locale:locale,storage:storage,teams:teams,users:users}}})(window)
let path='/users/{userId}/status'.replace(new RegExp('{userId}','g'),userId);return http.patch(path,{'content-type':'application/json'},{'status':status})}};return{setEndpoint:setEndpoint,setProject:setProject,setKey:setKey,setLocale:setLocale,setMode:setMode,account:account,auth:auth,avatars:avatars,database:database,locale:locale,projects:projects,storage:storage,teams:teams,users:users}}})(window)

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.createKey('[PROJECT_ID]', '[NAME]', []);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.createPlatform('[PROJECT_ID]', 'web', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.createProject('[NAME]', '[TEAM_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 1);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.deleteKey('[PROJECT_ID]', '[KEY_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.deletePlatform('[PROJECT_ID]', '[PLATFORM_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.deleteProject('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.deleteTask('[PROJECT_ID]', '[TASK_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.deleteWebhook('[PROJECT_ID]', '[WEBHOOK_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getKey('[PROJECT_ID]', '[KEY_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getPlatform('[PROJECT_ID]', '[PLATFORM_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getProjectUsage('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getProject('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getTask('[PROJECT_ID]', '[TASK_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.getWebhook('[PROJECT_ID]', '[WEBHOOK_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.listKeys('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.listPlatforms('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.listProjects();
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.listTasks('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.listWebhooks('[PROJECT_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updateKey('[PROJECT_ID]', '[KEY_ID]', '[NAME]', []);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updatePlatform('[PROJECT_ID]', '[PLATFORM_ID]', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updateProjectOAuth('[PROJECT_ID]', 'bitbucket');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updateProject('[PROJECT_ID]', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -0,0 +1,14 @@
let sdk = new Appwrite();
sdk
setProject('')
setKey('')
;
let promise = sdk.projects.updateWebhook('[PROJECT_ID]', '[WEBHOOK_ID]', '[NAME]', [], '[URL]', 0);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

View file

@ -4,6 +4,7 @@ const Auth = require('./lib/services/auth.js');
const Avatars = require('./lib/services/avatars.js');
const Database = require('./lib/services/database.js');
const Locale = require('./lib/services/locale.js');
const Projects = require('./lib/services/projects.js');
const Storage = require('./lib/services/storage.js');
const Teams = require('./lib/services/teams.js');
const Users = require('./lib/services/users.js');
@ -15,6 +16,7 @@ module.exports = {
Avatars,
Database,
Locale,
Projects,
Storage,
Teams,
Users,

View file

@ -102,7 +102,9 @@ class Avatars extends Service {
* Get image from and HTTP URL and crop to any size.
*
* Use this endpoint to fetch a remote image URL and crop it to any image size
* you want.
* you want. This endpoint is very useful if you need to crop a remote image
* or in cases, you want to make sure a 3rd party image is properly served
* using a TLS protocol.
*
* @param string url
* @param number width

View file

@ -0,0 +1,559 @@
const Service = require('../service.js');
class Projects extends Service {
/**
* List Projects
*
* @throws Exception
* @return {}
*/
async listProjects() {
let path = '/projects';
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Create Project
*
* @param string name
* @param string teamId
* @param string description
* @param string logo
* @param string url
* @param array clients
* @param string legalName
* @param string legalCountry
* @param string legalState
* @param string legalCity
* @param string legalAddress
* @param string legalTaxId
* @throws Exception
* @return {}
*/
async createProject(name, teamId, description = '', logo = '', url = '', clients = [], legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') {
let path = '/projects';
return await this.client.call('post', path, {'content-type': 'application/json'},
{
'name': name,
'teamId': teamId,
'description': description,
'logo': logo,
'url': url,
'clients': clients,
'legalName': legalName,
'legalCountry': legalCountry,
'legalState': legalState,
'legalCity': legalCity,
'legalAddress': legalAddress,
'legalTaxId': legalTaxId
});
}
/**
* Get Project
*
* @param string projectId
* @throws Exception
* @return {}
*/
async getProject(projectId) {
let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Update Project
*
* @param string projectId
* @param string name
* @param string description
* @param string logo
* @param string url
* @param array clients
* @param string legalName
* @param string legalCountry
* @param string legalState
* @param string legalCity
* @param string legalAddress
* @param string legalTaxId
* @throws Exception
* @return {}
*/
async updateProject(projectId, name, description = '', logo = '', url = '', clients = [], legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') {
let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('patch', path, {'content-type': 'application/json'},
{
'name': name,
'description': description,
'logo': logo,
'url': url,
'clients': clients,
'legalName': legalName,
'legalCountry': legalCountry,
'legalState': legalState,
'legalCity': legalCity,
'legalAddress': legalAddress,
'legalTaxId': legalTaxId
});
}
/**
* Delete Project
*
* @param string projectId
* @throws Exception
* @return {}
*/
async deleteProject(projectId) {
let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('delete', path, {'content-type': 'application/json'},
{
});
}
/**
* List Keys
*
* @param string projectId
* @throws Exception
* @return {}
*/
async listKeys(projectId) {
let path = '/projects/{projectId}/keys'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Create Key
*
* @param string projectId
* @param string name
* @param array scopes
* @throws Exception
* @return {}
*/
async createKey(projectId, name, scopes) {
let path = '/projects/{projectId}/keys'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('post', path, {'content-type': 'application/json'},
{
'name': name,
'scopes': scopes
});
}
/**
* Get Key
*
* @param string projectId
* @param string keyId
* @throws Exception
* @return {}
*/
async getKey(projectId, keyId) {
let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId);
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Update Key
*
* @param string projectId
* @param string keyId
* @param string name
* @param array scopes
* @throws Exception
* @return {}
*/
async updateKey(projectId, keyId, name, scopes) {
let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId);
return await this.client.call('put', path, {'content-type': 'application/json'},
{
'name': name,
'scopes': scopes
});
}
/**
* Delete Key
*
* @param string projectId
* @param string keyId
* @throws Exception
* @return {}
*/
async deleteKey(projectId, keyId) {
let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId);
return await this.client.call('delete', path, {'content-type': 'application/json'},
{
});
}
/**
* Update Project OAuth
*
* @param string projectId
* @param string provider
* @param string appId
* @param string secret
* @throws Exception
* @return {}
*/
async updateProjectOAuth(projectId, provider, appId = '', secret = '') {
let path = '/projects/{projectId}/oauth'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('patch', path, {'content-type': 'application/json'},
{
'provider': provider,
'appId': appId,
'secret': secret
});
}
/**
* List Platforms
*
* @param string projectId
* @throws Exception
* @return {}
*/
async listPlatforms(projectId) {
let path = '/projects/{projectId}/platforms'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Create Platform
*
* @param string projectId
* @param string type
* @param string name
* @param string key
* @param string store
* @param array domains
* @throws Exception
* @return {}
*/
async createPlatform(projectId, type, name, key = '', store = '', domains = []) {
let path = '/projects/{projectId}/platforms'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('post', path, {'content-type': 'application/json'},
{
'type': type,
'name': name,
'key': key,
'store': store,
'domains': domains
});
}
/**
* Get Platform
*
* @param string projectId
* @param string platformId
* @throws Exception
* @return {}
*/
async getPlatform(projectId, platformId) {
let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId);
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Update Platform
*
* @param string projectId
* @param string platformId
* @param string name
* @param string key
* @param string store
* @param array domains
* @throws Exception
* @return {}
*/
async updatePlatform(projectId, platformId, name, key = '', store = '', domains = []) {
let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId);
return await this.client.call('put', path, {'content-type': 'application/json'},
{
'name': name,
'key': key,
'store': store,
'domains': domains
});
}
/**
* Delete Platform
*
* @param string projectId
* @param string platformId
* @throws Exception
* @return {}
*/
async deletePlatform(projectId, platformId) {
let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId);
return await this.client.call('delete', path, {'content-type': 'application/json'},
{
});
}
/**
* List Tasks
*
* @param string projectId
* @throws Exception
* @return {}
*/
async listTasks(projectId) {
let path = '/projects/{projectId}/tasks'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Create Task
*
* @param string projectId
* @param string name
* @param string status
* @param string schedule
* @param number security
* @param string httpMethod
* @param string httpUrl
* @param array httpHeaders
* @param string httpUser
* @param string httpPass
* @throws Exception
* @return {}
*/
async createTask(projectId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = [], httpUser = '', httpPass = '') {
let path = '/projects/{projectId}/tasks'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('post', path, {'content-type': 'application/json'},
{
'name': name,
'status': status,
'schedule': schedule,
'security': security,
'httpMethod': httpMethod,
'httpUrl': httpUrl,
'httpHeaders': httpHeaders,
'httpUser': httpUser,
'httpPass': httpPass
});
}
/**
* Get Task
*
* @param string projectId
* @param string taskId
* @throws Exception
* @return {}
*/
async getTask(projectId, taskId) {
let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId);
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Update Task
*
* @param string projectId
* @param string taskId
* @param string name
* @param string status
* @param string schedule
* @param number security
* @param string httpMethod
* @param string httpUrl
* @param array httpHeaders
* @param string httpUser
* @param string httpPass
* @throws Exception
* @return {}
*/
async updateTask(projectId, taskId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = [], httpUser = '', httpPass = '') {
let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId);
return await this.client.call('put', path, {'content-type': 'application/json'},
{
'name': name,
'status': status,
'schedule': schedule,
'security': security,
'httpMethod': httpMethod,
'httpUrl': httpUrl,
'httpHeaders': httpHeaders,
'httpUser': httpUser,
'httpPass': httpPass
});
}
/**
* Delete Task
*
* @param string projectId
* @param string taskId
* @throws Exception
* @return {}
*/
async deleteTask(projectId, taskId) {
let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId);
return await this.client.call('delete', path, {'content-type': 'application/json'},
{
});
}
/**
* Get Project
*
* @param string projectId
* @throws Exception
* @return {}
*/
async getProjectUsage(projectId) {
let path = '/projects/{projectId}/usage'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* List Webhooks
*
* @param string projectId
* @throws Exception
* @return {}
*/
async listWebhooks(projectId) {
let path = '/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Create Webhook
*
* @param string projectId
* @param string name
* @param array events
* @param string url
* @param number security
* @param string httpUser
* @param string httpPass
* @throws Exception
* @return {}
*/
async createWebhook(projectId, name, events, url, security, httpUser = '', httpPass = '') {
let path = '/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}', 'g'), projectId);
return await this.client.call('post', path, {'content-type': 'application/json'},
{
'name': name,
'events': events,
'url': url,
'security': security,
'httpUser': httpUser,
'httpPass': httpPass
});
}
/**
* Get Webhook
*
* @param string projectId
* @param string webhookId
* @throws Exception
* @return {}
*/
async getWebhook(projectId, webhookId) {
let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId);
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Update Webhook
*
* @param string projectId
* @param string webhookId
* @param string name
* @param array events
* @param string url
* @param number security
* @param string httpUser
* @param string httpPass
* @throws Exception
* @return {}
*/
async updateWebhook(projectId, webhookId, name, events, url, security, httpUser = '', httpPass = '') {
let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId);
return await this.client.call('put', path, {'content-type': 'application/json'},
{
'name': name,
'events': events,
'url': url,
'security': security,
'httpUser': httpUser,
'httpPass': httpPass
});
}
/**
* Delete Webhook
*
* @param string projectId
* @param string webhookId
* @throws Exception
* @return {}
*/
async deleteWebhook(projectId, webhookId) {
let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId);
return await this.client.call('delete', path, {'content-type': 'application/json'},
{
});
}
}
module.exports = Projects;

View file

@ -71,7 +71,7 @@ GET https://appwrite.test/v1/avatars/flags/{code}
GET https://appwrite.test/v1/avatars/image
```
** Use this endpoint to fetch a remote image URL and crop it to any image size you want. **
** Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop a remote image or in cases, you want to make sure a 3rd party image is properly served using a TLS protocol. **
### Parameters

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->createKey('[PROJECT_ID]', '[NAME]', []);

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->createPlatform('[PROJECT_ID]', 'web', '[NAME]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->createProject('[NAME]', '[TEAM_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->createTask('[PROJECT_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 1);

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->deleteKey('[PROJECT_ID]', '[KEY_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->deletePlatform('[PROJECT_ID]', '[PLATFORM_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->deleteProject('[PROJECT_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->deleteTask('[PROJECT_ID]', '[TASK_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->deleteWebhook('[PROJECT_ID]', '[WEBHOOK_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->getKey('[PROJECT_ID]', '[KEY_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->getPlatform('[PROJECT_ID]', '[PLATFORM_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->getProjectUsage('[PROJECT_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->getProject('[PROJECT_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->getTask('[PROJECT_ID]', '[TASK_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->getWebhook('[PROJECT_ID]', '[WEBHOOK_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->listKeys('[PROJECT_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->listPlatforms('[PROJECT_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->listProjects();

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->listTasks('[PROJECT_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->listWebhooks('[PROJECT_ID]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->updateKey('[PROJECT_ID]', '[KEY_ID]', '[NAME]', []);

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->updatePlatform('[PROJECT_ID]', '[PLATFORM_ID]', '[NAME]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->updateProjectOAuth('[PROJECT_ID]', 'bitbucket');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->updateProject('[PROJECT_ID]', '[NAME]');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');

View file

@ -0,0 +1,15 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Projects;
$client = new Client();
$client
setProject('')
setKey('')
;
$projects = new Projects($client);
$result = $projects->updateWebhook('[PROJECT_ID]', '[WEBHOOK_ID]', '[NAME]', [], '[URL]', 0);

View file

@ -0,0 +1,400 @@
# Projects Service
## List Projects
```http request
GET https://appwrite.test/v1/projects
```
## Create Project
```http request
POST https://appwrite.test/v1/projects
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| name | string | Project name | |
| teamId | string | Team unique ID. | |
| description | string | Project description | |
| logo | string | Project logo | |
| url | string | Project URL | |
| clients | array | Project client domains | [] |
| legalName | string | Project Legal Name | |
| legalCountry | string | Project Legal Country | |
| legalState | string | Project Legal State | |
| legalCity | string | Project Legal City | |
| legalAddress | string | Project Legal Address | |
| legalTaxId | string | Project Legal Tax ID | |
## Get Project
```http request
GET https://appwrite.test/v1/projects/{projectId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
## Update Project
```http request
PATCH https://appwrite.test/v1/projects/{projectId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| name | string | Project name | |
| description | string | Project description | |
| logo | string | Project logo | |
| url | string | Project URL | |
| clients | array | Project client domains | [] |
| legalName | string | Project Legal Name | |
| legalCountry | string | Project Legal Country | |
| legalState | string | Project Legal State | |
| legalCity | string | Project Legal City | |
| legalAddress | string | Project Legal Address | |
| legalTaxId | string | Project Legal Tax ID | |
## Delete Project
```http request
DELETE https://appwrite.test/v1/projects/{projectId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
## List Keys
```http request
GET https://appwrite.test/v1/projects/{projectId}/keys
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
## Create Key
```http request
POST https://appwrite.test/v1/projects/{projectId}/keys
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| name | string | Key name | |
| scopes | array | Key scopes list | |
## Get Key
```http request
GET https://appwrite.test/v1/projects/{projectId}/keys/{keyId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| keyId | string | **Required** Key unique ID. | |
## Update Key
```http request
PUT https://appwrite.test/v1/projects/{projectId}/keys/{keyId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| keyId | string | **Required** Key unique ID. | |
| name | string | Key name | |
| scopes | array | Key scopes list | |
## Delete Key
```http request
DELETE https://appwrite.test/v1/projects/{projectId}/keys/{keyId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| keyId | string | **Required** Key unique ID. | |
## Update Project OAuth
```http request
PATCH https://appwrite.test/v1/projects/{projectId}/oauth
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| provider | string | Provider Name | |
| appId | string | Provider App ID | |
| secret | string | Provider Secret Key | |
## List Platforms
```http request
GET https://appwrite.test/v1/projects/{projectId}/platforms
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
## Create Platform
```http request
POST https://appwrite.test/v1/projects/{projectId}/platforms
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| type | string | Platform name | |
| name | string | Platform name | |
| key | string | Package name for android or bundle ID for iOS | |
| store | string | App store or Google Play store ID | |
| domains | array | Project client domains names | [] |
## Get Platform
```http request
GET https://appwrite.test/v1/projects/{projectId}/platforms/{platformId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| platformId | string | **Required** Platform unique ID. | |
## Update Platform
```http request
PUT https://appwrite.test/v1/projects/{projectId}/platforms/{platformId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| platformId | string | **Required** Platform unique ID. | |
| name | string | Platform name | |
| key | string | Package name for android or bundle ID for iOS | |
| store | string | App store or Google Play store ID | |
| domains | array | Project client domains names | [] |
## Delete Platform
```http request
DELETE https://appwrite.test/v1/projects/{projectId}/platforms/{platformId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| platformId | string | **Required** Platform unique ID. | |
## List Tasks
```http request
GET https://appwrite.test/v1/projects/{projectId}/tasks
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
## Create Task
```http request
POST https://appwrite.test/v1/projects/{projectId}/tasks
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| name | string | Task name | |
| status | string | Task status | |
| schedule | string | Task schedule syntax | |
| security | integer | Certificate verification, 0 for disabled or 1 for enabled | |
| httpMethod | string | Task HTTP method | |
| httpUrl | string | Task HTTP URL | |
| httpHeaders | array | Task HTTP headers list | |
| httpUser | string | Task HTTP user | |
| httpPass | string | Task HTTP password | |
## Get Task
```http request
GET https://appwrite.test/v1/projects/{projectId}/tasks/{taskId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| taskId | string | **Required** Task unique ID. | |
## Update Task
```http request
PUT https://appwrite.test/v1/projects/{projectId}/tasks/{taskId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| taskId | string | **Required** Task unique ID. | |
| name | string | Task name | |
| status | string | Task status | |
| schedule | string | Task schedule syntax | |
| security | integer | Certificate verification, 0 for disabled or 1 for enabled | |
| httpMethod | string | Task HTTP method | |
| httpUrl | string | Task HTTP URL | |
| httpHeaders | array | Task HTTP headers list | |
| httpUser | string | Task HTTP user | |
| httpPass | string | Task HTTP password | |
## Delete Task
```http request
DELETE https://appwrite.test/v1/projects/{projectId}/tasks/{taskId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| taskId | string | **Required** Task unique ID. | |
## Get Project
```http request
GET https://appwrite.test/v1/projects/{projectId}/usage
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
## List Webhooks
```http request
GET https://appwrite.test/v1/projects/{projectId}/webhooks
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
## Create Webhook
```http request
POST https://appwrite.test/v1/projects/{projectId}/webhooks
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| name | string | Webhook name | |
| events | array | Webhook events list | |
| url | string | Webhook URL | |
| security | integer | Certificate verification, 0 for disabled or 1 for enabled | |
| httpUser | string | Webhook HTTP user | |
| httpPass | string | Webhook HTTP password | |
## Get Webhook
```http request
GET https://appwrite.test/v1/projects/{projectId}/webhooks/{webhookId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| webhookId | string | **Required** Webhook unique ID. | |
## Update Webhook
```http request
PUT https://appwrite.test/v1/projects/{projectId}/webhooks/{webhookId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| webhookId | string | **Required** Webhook unique ID. | |
| name | string | Webhook name | |
| events | array | Webhook events list | |
| url | string | Webhook URL | |
| security | integer | Certificate verification, 0 for disabled or 1 for enabled | |
| httpUser | string | Webhook HTTP user | |
| httpPass | string | Webhook HTTP password | |
## Delete Webhook
```http request
DELETE https://appwrite.test/v1/projects/{projectId}/webhooks/{webhookId}
```
### Parameters
| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| projectId | string | **Required** Project unique ID. | |
| webhookId | string | **Required** Webhook unique ID. | |

View file

@ -116,7 +116,9 @@ class Avatars extends Service
* Get image from and HTTP URL and crop to any size.
*
* Use this endpoint to fetch a remote image URL and crop it to any image size
* you want.
* you want. This endpoint is very useful if you need to crop a remote image
* or in cases, you want to make sure a 3rd party image is properly served
* using a TLS protocol.
*
* @param string $url
* @param integer $width

View file

@ -0,0 +1,618 @@
<?php
namespace Appwrite\Services;
use Exception;
use Appwrite\Client;
use Appwrite\Service;
class Projects extends Service
{
/**
* List Projects
*
* @throws Exception
* @return array
*/
public function listProjects()
{
$path = str_replace([], [], '/projects');
$params = [];
return $this->client->call(Client::METHOD_GET, $path, [
], $params);
}
/**
* Create Project
*
* @param string $name
* @param string $teamId
* @param string $description
* @param string $logo
* @param string $url
* @param array $clients
* @param string $legalName
* @param string $legalCountry
* @param string $legalState
* @param string $legalCity
* @param string $legalAddress
* @param string $legalTaxId
* @throws Exception
* @return array
*/
public function createProject($name, $teamId, $description = '', $logo = '', $url = '', $clients = [], $legalName = '', $legalCountry = '', $legalState = '', $legalCity = '', $legalAddress = '', $legalTaxId = '')
{
$path = str_replace([], [], '/projects');
$params = [];
$params['name'] = $name;
$params['teamId'] = $teamId;
$params['description'] = $description;
$params['logo'] = $logo;
$params['url'] = $url;
$params['clients'] = $clients;
$params['legalName'] = $legalName;
$params['legalCountry'] = $legalCountry;
$params['legalState'] = $legalState;
$params['legalCity'] = $legalCity;
$params['legalAddress'] = $legalAddress;
$params['legalTaxId'] = $legalTaxId;
return $this->client->call(Client::METHOD_POST, $path, [
], $params);
}
/**
* Get Project
*
* @param string $projectId
* @throws Exception
* @return array
*/
public function getProject($projectId)
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}');
$params = [];
return $this->client->call(Client::METHOD_GET, $path, [
], $params);
}
/**
* Update Project
*
* @param string $projectId
* @param string $name
* @param string $description
* @param string $logo
* @param string $url
* @param array $clients
* @param string $legalName
* @param string $legalCountry
* @param string $legalState
* @param string $legalCity
* @param string $legalAddress
* @param string $legalTaxId
* @throws Exception
* @return array
*/
public function updateProject($projectId, $name, $description = '', $logo = '', $url = '', $clients = [], $legalName = '', $legalCountry = '', $legalState = '', $legalCity = '', $legalAddress = '', $legalTaxId = '')
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}');
$params = [];
$params['name'] = $name;
$params['description'] = $description;
$params['logo'] = $logo;
$params['url'] = $url;
$params['clients'] = $clients;
$params['legalName'] = $legalName;
$params['legalCountry'] = $legalCountry;
$params['legalState'] = $legalState;
$params['legalCity'] = $legalCity;
$params['legalAddress'] = $legalAddress;
$params['legalTaxId'] = $legalTaxId;
return $this->client->call(Client::METHOD_PATCH, $path, [
], $params);
}
/**
* Delete Project
*
* @param string $projectId
* @throws Exception
* @return array
*/
public function deleteProject($projectId)
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}');
$params = [];
return $this->client->call(Client::METHOD_DELETE, $path, [
], $params);
}
/**
* List Keys
*
* @param string $projectId
* @throws Exception
* @return array
*/
public function listKeys($projectId)
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}/keys');
$params = [];
return $this->client->call(Client::METHOD_GET, $path, [
], $params);
}
/**
* Create Key
*
* @param string $projectId
* @param string $name
* @param array $scopes
* @throws Exception
* @return array
*/
public function createKey($projectId, $name, $scopes)
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}/keys');
$params = [];
$params['name'] = $name;
$params['scopes'] = $scopes;
return $this->client->call(Client::METHOD_POST, $path, [
], $params);
}
/**
* Get Key
*
* @param string $projectId
* @param string $keyId
* @throws Exception
* @return array
*/
public function getKey($projectId, $keyId)
{
$path = str_replace(['{projectId}', '{keyId}'], [$projectId, $keyId], '/projects/{projectId}/keys/{keyId}');
$params = [];
return $this->client->call(Client::METHOD_GET, $path, [
], $params);
}
/**
* Update Key
*
* @param string $projectId
* @param string $keyId
* @param string $name
* @param array $scopes
* @throws Exception
* @return array
*/
public function updateKey($projectId, $keyId, $name, $scopes)
{
$path = str_replace(['{projectId}', '{keyId}'], [$projectId, $keyId], '/projects/{projectId}/keys/{keyId}');
$params = [];
$params['name'] = $name;
$params['scopes'] = $scopes;
return $this->client->call(Client::METHOD_PUT, $path, [
], $params);
}
/**
* Delete Key
*
* @param string $projectId
* @param string $keyId
* @throws Exception
* @return array
*/
public function deleteKey($projectId, $keyId)
{
$path = str_replace(['{projectId}', '{keyId}'], [$projectId, $keyId], '/projects/{projectId}/keys/{keyId}');
$params = [];
return $this->client->call(Client::METHOD_DELETE, $path, [
], $params);
}
/**
* Update Project OAuth
*
* @param string $projectId
* @param string $provider
* @param string $appId
* @param string $secret
* @throws Exception
* @return array
*/
public function updateProjectOAuth($projectId, $provider, $appId = '', $secret = '')
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}/oauth');
$params = [];
$params['provider'] = $provider;
$params['appId'] = $appId;
$params['secret'] = $secret;
return $this->client->call(Client::METHOD_PATCH, $path, [
], $params);
}
/**
* List Platforms
*
* @param string $projectId
* @throws Exception
* @return array
*/
public function listPlatforms($projectId)
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}/platforms');
$params = [];
return $this->client->call(Client::METHOD_GET, $path, [
], $params);
}
/**
* Create Platform
*
* @param string $projectId
* @param string $type
* @param string $name
* @param string $key
* @param string $store
* @param array $domains
* @throws Exception
* @return array
*/
public function createPlatform($projectId, $type, $name, $key = '', $store = '', $domains = [])
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}/platforms');
$params = [];
$params['type'] = $type;
$params['name'] = $name;
$params['key'] = $key;
$params['store'] = $store;
$params['domains'] = $domains;
return $this->client->call(Client::METHOD_POST, $path, [
], $params);
}
/**
* Get Platform
*
* @param string $projectId
* @param string $platformId
* @throws Exception
* @return array
*/
public function getPlatform($projectId, $platformId)
{
$path = str_replace(['{projectId}', '{platformId}'], [$projectId, $platformId], '/projects/{projectId}/platforms/{platformId}');
$params = [];
return $this->client->call(Client::METHOD_GET, $path, [
], $params);
}
/**
* Update Platform
*
* @param string $projectId
* @param string $platformId
* @param string $name
* @param string $key
* @param string $store
* @param array $domains
* @throws Exception
* @return array
*/
public function updatePlatform($projectId, $platformId, $name, $key = '', $store = '', $domains = [])
{
$path = str_replace(['{projectId}', '{platformId}'], [$projectId, $platformId], '/projects/{projectId}/platforms/{platformId}');
$params = [];
$params['name'] = $name;
$params['key'] = $key;
$params['store'] = $store;
$params['domains'] = $domains;
return $this->client->call(Client::METHOD_PUT, $path, [
], $params);
}
/**
* Delete Platform
*
* @param string $projectId
* @param string $platformId
* @throws Exception
* @return array
*/
public function deletePlatform($projectId, $platformId)
{
$path = str_replace(['{projectId}', '{platformId}'], [$projectId, $platformId], '/projects/{projectId}/platforms/{platformId}');
$params = [];
return $this->client->call(Client::METHOD_DELETE, $path, [
], $params);
}
/**
* List Tasks
*
* @param string $projectId
* @throws Exception
* @return array
*/
public function listTasks($projectId)
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}/tasks');
$params = [];
return $this->client->call(Client::METHOD_GET, $path, [
], $params);
}
/**
* Create Task
*
* @param string $projectId
* @param string $name
* @param string $status
* @param string $schedule
* @param integer $security
* @param string $httpMethod
* @param string $httpUrl
* @param array $httpHeaders
* @param string $httpUser
* @param string $httpPass
* @throws Exception
* @return array
*/
public function createTask($projectId, $name, $status, $schedule, $security, $httpMethod, $httpUrl, $httpHeaders = [], $httpUser = '', $httpPass = '')
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}/tasks');
$params = [];
$params['name'] = $name;
$params['status'] = $status;
$params['schedule'] = $schedule;
$params['security'] = $security;
$params['httpMethod'] = $httpMethod;
$params['httpUrl'] = $httpUrl;
$params['httpHeaders'] = $httpHeaders;
$params['httpUser'] = $httpUser;
$params['httpPass'] = $httpPass;
return $this->client->call(Client::METHOD_POST, $path, [
], $params);
}
/**
* Get Task
*
* @param string $projectId
* @param string $taskId
* @throws Exception
* @return array
*/
public function getTask($projectId, $taskId)
{
$path = str_replace(['{projectId}', '{taskId}'], [$projectId, $taskId], '/projects/{projectId}/tasks/{taskId}');
$params = [];
return $this->client->call(Client::METHOD_GET, $path, [
], $params);
}
/**
* Update Task
*
* @param string $projectId
* @param string $taskId
* @param string $name
* @param string $status
* @param string $schedule
* @param integer $security
* @param string $httpMethod
* @param string $httpUrl
* @param array $httpHeaders
* @param string $httpUser
* @param string $httpPass
* @throws Exception
* @return array
*/
public function updateTask($projectId, $taskId, $name, $status, $schedule, $security, $httpMethod, $httpUrl, $httpHeaders = [], $httpUser = '', $httpPass = '')
{
$path = str_replace(['{projectId}', '{taskId}'], [$projectId, $taskId], '/projects/{projectId}/tasks/{taskId}');
$params = [];
$params['name'] = $name;
$params['status'] = $status;
$params['schedule'] = $schedule;
$params['security'] = $security;
$params['httpMethod'] = $httpMethod;
$params['httpUrl'] = $httpUrl;
$params['httpHeaders'] = $httpHeaders;
$params['httpUser'] = $httpUser;
$params['httpPass'] = $httpPass;
return $this->client->call(Client::METHOD_PUT, $path, [
], $params);
}
/**
* Delete Task
*
* @param string $projectId
* @param string $taskId
* @throws Exception
* @return array
*/
public function deleteTask($projectId, $taskId)
{
$path = str_replace(['{projectId}', '{taskId}'], [$projectId, $taskId], '/projects/{projectId}/tasks/{taskId}');
$params = [];
return $this->client->call(Client::METHOD_DELETE, $path, [
], $params);
}
/**
* Get Project
*
* @param string $projectId
* @throws Exception
* @return array
*/
public function getProjectUsage($projectId)
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}/usage');
$params = [];
return $this->client->call(Client::METHOD_GET, $path, [
], $params);
}
/**
* List Webhooks
*
* @param string $projectId
* @throws Exception
* @return array
*/
public function listWebhooks($projectId)
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}/webhooks');
$params = [];
return $this->client->call(Client::METHOD_GET, $path, [
], $params);
}
/**
* Create Webhook
*
* @param string $projectId
* @param string $name
* @param array $events
* @param string $url
* @param integer $security
* @param string $httpUser
* @param string $httpPass
* @throws Exception
* @return array
*/
public function createWebhook($projectId, $name, $events, $url, $security, $httpUser = '', $httpPass = '')
{
$path = str_replace(['{projectId}'], [$projectId], '/projects/{projectId}/webhooks');
$params = [];
$params['name'] = $name;
$params['events'] = $events;
$params['url'] = $url;
$params['security'] = $security;
$params['httpUser'] = $httpUser;
$params['httpPass'] = $httpPass;
return $this->client->call(Client::METHOD_POST, $path, [
], $params);
}
/**
* Get Webhook
*
* @param string $projectId
* @param string $webhookId
* @throws Exception
* @return array
*/
public function getWebhook($projectId, $webhookId)
{
$path = str_replace(['{projectId}', '{webhookId}'], [$projectId, $webhookId], '/projects/{projectId}/webhooks/{webhookId}');
$params = [];
return $this->client->call(Client::METHOD_GET, $path, [
], $params);
}
/**
* Update Webhook
*
* @param string $projectId
* @param string $webhookId
* @param string $name
* @param array $events
* @param string $url
* @param integer $security
* @param string $httpUser
* @param string $httpPass
* @throws Exception
* @return array
*/
public function updateWebhook($projectId, $webhookId, $name, $events, $url, $security, $httpUser = '', $httpPass = '')
{
$path = str_replace(['{projectId}', '{webhookId}'], [$projectId, $webhookId], '/projects/{projectId}/webhooks/{webhookId}');
$params = [];
$params['name'] = $name;
$params['events'] = $events;
$params['url'] = $url;
$params['security'] = $security;
$params['httpUser'] = $httpUser;
$params['httpPass'] = $httpPass;
return $this->client->call(Client::METHOD_PUT, $path, [
], $params);
}
/**
* Delete Webhook
*
* @param string $projectId
* @param string $webhookId
* @throws Exception
* @return array
*/
public function deleteWebhook($projectId, $webhookId)
{
$path = str_replace(['{projectId}', '{webhookId}'], [$projectId, $webhookId], '/projects/{projectId}/webhooks/{webhookId}');
$params = [];
return $this->client->call(Client::METHOD_DELETE, $path, [
], $params);
}
}

View file

@ -0,0 +1,357 @@
from ..service import Service
class Projects(Service):
def list_projects(self):
"""List Projects"""
params = {}
path = '/projects'
return self.client.call('get', path, {
}, params)
def create_project(self, name, team_id, description='', logo='', url='', clientsstring(4) ""[]""
=[], legal_name='', legal_country='', legal_state='', legal_city='', legal_address='', legal_tax_id=''):
"""Create Project"""
params = {}
path = '/projects'
params['name'] = name
params['teamId'] = team_id
params['description'] = description
params['logo'] = logo
params['url'] = url
params['clients'] = clients
params['legalName'] = legal_name
params['legalCountry'] = legal_country
params['legalState'] = legal_state
params['legalCity'] = legal_city
params['legalAddress'] = legal_address
params['legalTaxId'] = legal_tax_id
return self.client.call('post', path, {
}, params)
def get_project(self, project_id):
"""Get Project"""
params = {}
path = '/projects/{projectId}'
path.replace('{projectId}', project_id)
return self.client.call('get', path, {
}, params)
def update_project(self, project_id, name, description='', logo='', url='', clientsstring(4) ""[]""
=[], legal_name='', legal_country='', legal_state='', legal_city='', legal_address='', legal_tax_id=''):
"""Update Project"""
params = {}
path = '/projects/{projectId}'
path.replace('{projectId}', project_id)
params['name'] = name
params['description'] = description
params['logo'] = logo
params['url'] = url
params['clients'] = clients
params['legalName'] = legal_name
params['legalCountry'] = legal_country
params['legalState'] = legal_state
params['legalCity'] = legal_city
params['legalAddress'] = legal_address
params['legalTaxId'] = legal_tax_id
return self.client.call('patch', path, {
}, params)
def delete_project(self, project_id):
"""Delete Project"""
params = {}
path = '/projects/{projectId}'
path.replace('{projectId}', project_id)
return self.client.call('delete', path, {
}, params)
def list_keys(self, project_id):
"""List Keys"""
params = {}
path = '/projects/{projectId}/keys'
path.replace('{projectId}', project_id)
return self.client.call('get', path, {
}, params)
def create_key(self, project_id, name, scopes):
"""Create Key"""
params = {}
path = '/projects/{projectId}/keys'
path.replace('{projectId}', project_id)
params['name'] = name
params['scopes'] = scopes
return self.client.call('post', path, {
}, params)
def get_key(self, project_id, key_id):
"""Get Key"""
params = {}
path = '/projects/{projectId}/keys/{keyId}'
path.replace('{projectId}', project_id)
path.replace('{keyId}', key_id)
return self.client.call('get', path, {
}, params)
def update_key(self, project_id, key_id, name, scopes):
"""Update Key"""
params = {}
path = '/projects/{projectId}/keys/{keyId}'
path.replace('{projectId}', project_id)
path.replace('{keyId}', key_id)
params['name'] = name
params['scopes'] = scopes
return self.client.call('put', path, {
}, params)
def delete_key(self, project_id, key_id):
"""Delete Key"""
params = {}
path = '/projects/{projectId}/keys/{keyId}'
path.replace('{projectId}', project_id)
path.replace('{keyId}', key_id)
return self.client.call('delete', path, {
}, params)
def update_project_o_auth(self, project_id, provider, app_id='', secret=''):
"""Update Project OAuth"""
params = {}
path = '/projects/{projectId}/oauth'
path.replace('{projectId}', project_id)
params['provider'] = provider
params['appId'] = app_id
params['secret'] = secret
return self.client.call('patch', path, {
}, params)
def list_platforms(self, project_id):
"""List Platforms"""
params = {}
path = '/projects/{projectId}/platforms'
path.replace('{projectId}', project_id)
return self.client.call('get', path, {
}, params)
def create_platform(self, project_id, type, name, key='', store='', domainsstring(4) ""[]""
=[]):
"""Create Platform"""
params = {}
path = '/projects/{projectId}/platforms'
path.replace('{projectId}', project_id)
params['type'] = type
params['name'] = name
params['key'] = key
params['store'] = store
params['domains'] = domains
return self.client.call('post', path, {
}, params)
def get_platform(self, project_id, platform_id):
"""Get Platform"""
params = {}
path = '/projects/{projectId}/platforms/{platformId}'
path.replace('{projectId}', project_id)
path.replace('{platformId}', platform_id)
return self.client.call('get', path, {
}, params)
def update_platform(self, project_id, platform_id, name, key='', store='', domainsstring(4) ""[]""
=[]):
"""Update Platform"""
params = {}
path = '/projects/{projectId}/platforms/{platformId}'
path.replace('{projectId}', project_id)
path.replace('{platformId}', platform_id)
params['name'] = name
params['key'] = key
params['store'] = store
params['domains'] = domains
return self.client.call('put', path, {
}, params)
def delete_platform(self, project_id, platform_id):
"""Delete Platform"""
params = {}
path = '/projects/{projectId}/platforms/{platformId}'
path.replace('{projectId}', project_id)
path.replace('{platformId}', platform_id)
return self.client.call('delete', path, {
}, params)
def list_tasks(self, project_id):
"""List Tasks"""
params = {}
path = '/projects/{projectId}/tasks'
path.replace('{projectId}', project_id)
return self.client.call('get', path, {
}, params)
def create_task(self, project_id, name, status, schedule, security, http_method, http_url, http_headers={}, http_user='', http_pass=''):
"""Create Task"""
params = {}
path = '/projects/{projectId}/tasks'
path.replace('{projectId}', project_id)
params['name'] = name
params['status'] = status
params['schedule'] = schedule
params['security'] = security
params['httpMethod'] = http_method
params['httpUrl'] = http_url
params['httpHeaders'] = http_headers
params['httpUser'] = http_user
params['httpPass'] = http_pass
return self.client.call('post', path, {
}, params)
def get_task(self, project_id, task_id):
"""Get Task"""
params = {}
path = '/projects/{projectId}/tasks/{taskId}'
path.replace('{projectId}', project_id)
path.replace('{taskId}', task_id)
return self.client.call('get', path, {
}, params)
def update_task(self, project_id, task_id, name, status, schedule, security, http_method, http_url, http_headers={}, http_user='', http_pass=''):
"""Update Task"""
params = {}
path = '/projects/{projectId}/tasks/{taskId}'
path.replace('{projectId}', project_id)
path.replace('{taskId}', task_id)
params['name'] = name
params['status'] = status
params['schedule'] = schedule
params['security'] = security
params['httpMethod'] = http_method
params['httpUrl'] = http_url
params['httpHeaders'] = http_headers
params['httpUser'] = http_user
params['httpPass'] = http_pass
return self.client.call('put', path, {
}, params)
def delete_task(self, project_id, task_id):
"""Delete Task"""
params = {}
path = '/projects/{projectId}/tasks/{taskId}'
path.replace('{projectId}', project_id)
path.replace('{taskId}', task_id)
return self.client.call('delete', path, {
}, params)
def get_project_usage(self, project_id):
"""Get Project"""
params = {}
path = '/projects/{projectId}/usage'
path.replace('{projectId}', project_id)
return self.client.call('get', path, {
}, params)
def list_webhooks(self, project_id):
"""List Webhooks"""
params = {}
path = '/projects/{projectId}/webhooks'
path.replace('{projectId}', project_id)
return self.client.call('get', path, {
}, params)
def create_webhook(self, project_id, name, events, url, security, http_user='', http_pass=''):
"""Create Webhook"""
params = {}
path = '/projects/{projectId}/webhooks'
path.replace('{projectId}', project_id)
params['name'] = name
params['events'] = events
params['url'] = url
params['security'] = security
params['httpUser'] = http_user
params['httpPass'] = http_pass
return self.client.call('post', path, {
}, params)
def get_webhook(self, project_id, webhook_id):
"""Get Webhook"""
params = {}
path = '/projects/{projectId}/webhooks/{webhookId}'
path.replace('{projectId}', project_id)
path.replace('{webhookId}', webhook_id)
return self.client.call('get', path, {
}, params)
def update_webhook(self, project_id, webhook_id, name, events, url, security, http_user='', http_pass=''):
"""Update Webhook"""
params = {}
path = '/projects/{projectId}/webhooks/{webhookId}'
path.replace('{projectId}', project_id)
path.replace('{webhookId}', webhook_id)
params['name'] = name
params['events'] = events
params['url'] = url
params['security'] = security
params['httpUser'] = http_user
params['httpPass'] = http_pass
return self.client.call('put', path, {
}, params)
def delete_webhook(self, project_id, webhook_id):
"""Delete Webhook"""
params = {}
path = '/projects/{projectId}/webhooks/{webhookId}'
path.replace('{projectId}', project_id)
path.replace('{webhookId}', webhook_id)
return self.client.call('delete', path, {
}, params)

View file

@ -8,6 +8,7 @@ require_relative 'appwrite/services/auth'
require_relative 'appwrite/services/avatars'
require_relative 'appwrite/services/database'
require_relative 'appwrite/services/locale'
require_relative 'appwrite/services/projects'
require_relative 'appwrite/services/storage'
require_relative 'appwrite/services/teams'
require_relative 'appwrite/services/users'

View file

@ -0,0 +1,385 @@
module Appwrite
class Projects < Service
def list_projects()
path = '/projects'
params = {
}
return @client.call('get', path, {
}, params);
end
def create_project(name:, team_id:, description: '', logo: '', url: '', clients: [], legal_name: '', legal_country: '', legal_state: '', legal_city: '', legal_address: '', legal_tax_id: '')
path = '/projects'
params = {
'name': name,
'teamId': team_id,
'description': description,
'logo': logo,
'url': url,
'clients': clients,
'legalName': legal_name,
'legalCountry': legal_country,
'legalState': legal_state,
'legalCity': legal_city,
'legalAddress': legal_address,
'legalTaxId': legal_tax_id
}
return @client.call('post', path, {
}, params);
end
def get_project(project_id:)
path = '/projects/{projectId}'
.gsub('{project_id}', project_id)
params = {
}
return @client.call('get', path, {
}, params);
end
def update_project(project_id:, name:, description: '', logo: '', url: '', clients: [], legal_name: '', legal_country: '', legal_state: '', legal_city: '', legal_address: '', legal_tax_id: '')
path = '/projects/{projectId}'
.gsub('{project_id}', project_id)
params = {
'name': name,
'description': description,
'logo': logo,
'url': url,
'clients': clients,
'legalName': legal_name,
'legalCountry': legal_country,
'legalState': legal_state,
'legalCity': legal_city,
'legalAddress': legal_address,
'legalTaxId': legal_tax_id
}
return @client.call('patch', path, {
}, params);
end
def delete_project(project_id:)
path = '/projects/{projectId}'
.gsub('{project_id}', project_id)
params = {
}
return @client.call('delete', path, {
}, params);
end
def list_keys(project_id:)
path = '/projects/{projectId}/keys'
.gsub('{project_id}', project_id)
params = {
}
return @client.call('get', path, {
}, params);
end
def create_key(project_id:, name:, scopes:)
path = '/projects/{projectId}/keys'
.gsub('{project_id}', project_id)
params = {
'name': name,
'scopes': scopes
}
return @client.call('post', path, {
}, params);
end
def get_key(project_id:, key_id:)
path = '/projects/{projectId}/keys/{keyId}'
.gsub('{project_id}', project_id)
.gsub('{key_id}', key_id)
params = {
}
return @client.call('get', path, {
}, params);
end
def update_key(project_id:, key_id:, name:, scopes:)
path = '/projects/{projectId}/keys/{keyId}'
.gsub('{project_id}', project_id)
.gsub('{key_id}', key_id)
params = {
'name': name,
'scopes': scopes
}
return @client.call('put', path, {
}, params);
end
def delete_key(project_id:, key_id:)
path = '/projects/{projectId}/keys/{keyId}'
.gsub('{project_id}', project_id)
.gsub('{key_id}', key_id)
params = {
}
return @client.call('delete', path, {
}, params);
end
def update_project_o_auth(project_id:, provider:, app_id: '', secret: '')
path = '/projects/{projectId}/oauth'
.gsub('{project_id}', project_id)
params = {
'provider': provider,
'appId': app_id,
'secret': secret
}
return @client.call('patch', path, {
}, params);
end
def list_platforms(project_id:)
path = '/projects/{projectId}/platforms'
.gsub('{project_id}', project_id)
params = {
}
return @client.call('get', path, {
}, params);
end
def create_platform(project_id:, type:, name:, key: '', store: '', domains: [])
path = '/projects/{projectId}/platforms'
.gsub('{project_id}', project_id)
params = {
'type': type,
'name': name,
'key': key,
'store': store,
'domains': domains
}
return @client.call('post', path, {
}, params);
end
def get_platform(project_id:, platform_id:)
path = '/projects/{projectId}/platforms/{platformId}'
.gsub('{project_id}', project_id)
.gsub('{platform_id}', platform_id)
params = {
}
return @client.call('get', path, {
}, params);
end
def update_platform(project_id:, platform_id:, name:, key: '', store: '', domains: [])
path = '/projects/{projectId}/platforms/{platformId}'
.gsub('{project_id}', project_id)
.gsub('{platform_id}', platform_id)
params = {
'name': name,
'key': key,
'store': store,
'domains': domains
}
return @client.call('put', path, {
}, params);
end
def delete_platform(project_id:, platform_id:)
path = '/projects/{projectId}/platforms/{platformId}'
.gsub('{project_id}', project_id)
.gsub('{platform_id}', platform_id)
params = {
}
return @client.call('delete', path, {
}, params);
end
def list_tasks(project_id:)
path = '/projects/{projectId}/tasks'
.gsub('{project_id}', project_id)
params = {
}
return @client.call('get', path, {
}, params);
end
def create_task(project_id:, name:, status:, schedule:, security:, http_method:, http_url:, http_headers: [], http_user: '', http_pass: '')
path = '/projects/{projectId}/tasks'
.gsub('{project_id}', project_id)
params = {
'name': name,
'status': status,
'schedule': schedule,
'security': security,
'httpMethod': http_method,
'httpUrl': http_url,
'httpHeaders': http_headers,
'httpUser': http_user,
'httpPass': http_pass
}
return @client.call('post', path, {
}, params);
end
def get_task(project_id:, task_id:)
path = '/projects/{projectId}/tasks/{taskId}'
.gsub('{project_id}', project_id)
.gsub('{task_id}', task_id)
params = {
}
return @client.call('get', path, {
}, params);
end
def update_task(project_id:, task_id:, name:, status:, schedule:, security:, http_method:, http_url:, http_headers: [], http_user: '', http_pass: '')
path = '/projects/{projectId}/tasks/{taskId}'
.gsub('{project_id}', project_id)
.gsub('{task_id}', task_id)
params = {
'name': name,
'status': status,
'schedule': schedule,
'security': security,
'httpMethod': http_method,
'httpUrl': http_url,
'httpHeaders': http_headers,
'httpUser': http_user,
'httpPass': http_pass
}
return @client.call('put', path, {
}, params);
end
def delete_task(project_id:, task_id:)
path = '/projects/{projectId}/tasks/{taskId}'
.gsub('{project_id}', project_id)
.gsub('{task_id}', task_id)
params = {
}
return @client.call('delete', path, {
}, params);
end
def get_project_usage(project_id:)
path = '/projects/{projectId}/usage'
.gsub('{project_id}', project_id)
params = {
}
return @client.call('get', path, {
}, params);
end
def list_webhooks(project_id:)
path = '/projects/{projectId}/webhooks'
.gsub('{project_id}', project_id)
params = {
}
return @client.call('get', path, {
}, params);
end
def create_webhook(project_id:, name:, events:, url:, security:, http_user: '', http_pass: '')
path = '/projects/{projectId}/webhooks'
.gsub('{project_id}', project_id)
params = {
'name': name,
'events': events,
'url': url,
'security': security,
'httpUser': http_user,
'httpPass': http_pass
}
return @client.call('post', path, {
}, params);
end
def get_webhook(project_id:, webhook_id:)
path = '/projects/{projectId}/webhooks/{webhookId}'
.gsub('{project_id}', project_id)
.gsub('{webhook_id}', webhook_id)
params = {
}
return @client.call('get', path, {
}, params);
end
def update_webhook(project_id:, webhook_id:, name:, events:, url:, security:, http_user: '', http_pass: '')
path = '/projects/{projectId}/webhooks/{webhookId}'
.gsub('{project_id}', project_id)
.gsub('{webhook_id}', webhook_id)
params = {
'name': name,
'events': events,
'url': url,
'security': security,
'httpUser': http_user,
'httpPass': http_pass
}
return @client.call('put', path, {
}, params);
end
def delete_webhook(project_id:, webhook_id:)
path = '/projects/{projectId}/webhooks/{webhookId}'
.gsub('{project_id}', project_id)
.gsub('{webhook_id}', webhook_id)
params = {
}
return @client.call('delete', path, {
}, params);
end
protected
private
end
end

View file

@ -46,7 +46,7 @@ $cli
'gitUserName' => 'appwrite',
],
'js' => [
'version' => 'v1.0.6',
'version' => 'v1.0.7',
'result' => __DIR__ . '/../sdks/js/',
'gitURL' => 'https://github.com/appwrite/sdk-for-js.git',
'gitRepo' => 'git@github.com:appwrite/sdk-for-js.git',