import "package:appwrite/service.dart"; import "package:appwrite/client.dart"; import 'package:dio/dio.dart'; class Projects extends Service { Projects(Client client): super(client); Future listProjects() async { String path = '/projects'; Map params = { }; return await this.client.call('get', path: path, params: params); } Future createProject({name, teamId, description = null, logo = null, url = null, legalName = null, legalCountry = null, legalState = null, legalCity = null, legalAddress = null, legalTaxId = null}) async { String path = '/projects'; Map params = { 'name': name, 'teamId': teamId, 'description': description, 'logo': logo, 'url': url, 'legalName': legalName, 'legalCountry': legalCountry, 'legalState': legalState, 'legalCity': legalCity, 'legalAddress': legalAddress, 'legalTaxId': legalTaxId, }; return await this.client.call('post', path: path, params: params); } Future getProject({projectId}) async { String path = '/projects/{projectId}'.replaceAll(RegExp('{projectId}'), projectId); Map params = { }; return await this.client.call('get', path: path, params: params); } Future updateProject({projectId, name, description = null, logo = null, url = null, legalName = null, legalCountry = null, legalState = null, legalCity = null, legalAddress = null, legalTaxId = null}) async { String path = '/projects/{projectId}'.replaceAll(RegExp('{projectId}'), projectId); Map params = { 'name': name, 'description': description, 'logo': logo, 'url': url, 'legalName': legalName, 'legalCountry': legalCountry, 'legalState': legalState, 'legalCity': legalCity, 'legalAddress': legalAddress, 'legalTaxId': legalTaxId, }; return await this.client.call('patch', path: path, params: params); } Future deleteProject({projectId}) async { String path = '/projects/{projectId}'.replaceAll(RegExp('{projectId}'), projectId); Map params = { }; return await this.client.call('delete', path: path, params: params); } Future listKeys({projectId}) async { String path = '/projects/{projectId}/keys'.replaceAll(RegExp('{projectId}'), projectId); Map params = { }; return await this.client.call('get', path: path, params: params); } Future createKey({projectId, name, scopes}) async { String path = '/projects/{projectId}/keys'.replaceAll(RegExp('{projectId}'), projectId); Map params = { 'name': name, 'scopes': scopes, }; return await this.client.call('post', path: path, params: params); } Future getKey({projectId, keyId}) async { String path = '/projects/{projectId}/keys/{keyId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{keyId}'), keyId); Map params = { }; return await this.client.call('get', path: path, params: params); } Future updateKey({projectId, keyId, name, scopes}) async { String path = '/projects/{projectId}/keys/{keyId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{keyId}'), keyId); Map params = { 'name': name, 'scopes': scopes, }; return await this.client.call('put', path: path, params: params); } Future deleteKey({projectId, keyId}) async { String path = '/projects/{projectId}/keys/{keyId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{keyId}'), keyId); Map params = { }; return await this.client.call('delete', path: path, params: params); } Future updateProjectOAuth({projectId, provider, appId = null, secret = null}) async { String path = '/projects/{projectId}/oauth'.replaceAll(RegExp('{projectId}'), projectId); Map params = { 'provider': provider, 'appId': appId, 'secret': secret, }; return await this.client.call('patch', path: path, params: params); } Future listPlatforms({projectId}) async { String path = '/projects/{projectId}/platforms'.replaceAll(RegExp('{projectId}'), projectId); Map params = { }; return await this.client.call('get', path: path, params: params); } Future createPlatform({projectId, type, name, key = null, store = null, url = null}) async { String path = '/projects/{projectId}/platforms'.replaceAll(RegExp('{projectId}'), projectId); Map params = { 'type': type, 'name': name, 'key': key, 'store': store, 'url': url, }; return await this.client.call('post', path: path, params: params); } Future getPlatform({projectId, platformId}) async { String path = '/projects/{projectId}/platforms/{platformId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{platformId}'), platformId); Map params = { }; return await this.client.call('get', path: path, params: params); } Future updatePlatform({projectId, platformId, name, key = null, store = null, url = null}) async { String path = '/projects/{projectId}/platforms/{platformId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{platformId}'), platformId); Map params = { 'name': name, 'key': key, 'store': store, 'url': url, }; return await this.client.call('put', path: path, params: params); } Future deletePlatform({projectId, platformId}) async { String path = '/projects/{projectId}/platforms/{platformId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{platformId}'), platformId); Map params = { }; return await this.client.call('delete', path: path, params: params); } Future listTasks({projectId}) async { String path = '/projects/{projectId}/tasks'.replaceAll(RegExp('{projectId}'), projectId); Map params = { }; return await this.client.call('get', path: path, params: params); } Future createTask({projectId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = null, httpUser = null, httpPass = null}) async { String path = '/projects/{projectId}/tasks'.replaceAll(RegExp('{projectId}'), projectId); Map params = { 'name': name, 'status': status, 'schedule': schedule, 'security': security, 'httpMethod': httpMethod, 'httpUrl': httpUrl, 'httpHeaders': httpHeaders, 'httpUser': httpUser, 'httpPass': httpPass, }; return await this.client.call('post', path: path, params: params); } Future getTask({projectId, taskId}) async { String path = '/projects/{projectId}/tasks/{taskId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{taskId}'), taskId); Map params = { }; return await this.client.call('get', path: path, params: params); } Future updateTask({projectId, taskId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = null, httpUser = null, httpPass = null}) async { String path = '/projects/{projectId}/tasks/{taskId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{taskId}'), taskId); Map params = { 'name': name, 'status': status, 'schedule': schedule, 'security': security, 'httpMethod': httpMethod, 'httpUrl': httpUrl, 'httpHeaders': httpHeaders, 'httpUser': httpUser, 'httpPass': httpPass, }; return await this.client.call('put', path: path, params: params); } Future deleteTask({projectId, taskId}) async { String path = '/projects/{projectId}/tasks/{taskId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{taskId}'), taskId); Map params = { }; return await this.client.call('delete', path: path, params: params); } Future getProjectUsage({projectId}) async { String path = '/projects/{projectId}/usage'.replaceAll(RegExp('{projectId}'), projectId); Map params = { }; return await this.client.call('get', path: path, params: params); } Future listWebhooks({projectId}) async { String path = '/projects/{projectId}/webhooks'.replaceAll(RegExp('{projectId}'), projectId); Map params = { }; return await this.client.call('get', path: path, params: params); } Future createWebhook({projectId, name, events, url, security, httpUser = null, httpPass = null}) async { String path = '/projects/{projectId}/webhooks'.replaceAll(RegExp('{projectId}'), projectId); Map params = { 'name': name, 'events': events, 'url': url, 'security': security, 'httpUser': httpUser, 'httpPass': httpPass, }; return await this.client.call('post', path: path, params: params); } Future getWebhook({projectId, webhookId}) async { String path = '/projects/{projectId}/webhooks/{webhookId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{webhookId}'), webhookId); Map params = { }; return await this.client.call('get', path: path, params: params); } Future updateWebhook({projectId, webhookId, name, events, url, security, httpUser = null, httpPass = null}) async { String path = '/projects/{projectId}/webhooks/{webhookId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{webhookId}'), webhookId); Map params = { 'name': name, 'events': events, 'url': url, 'security': security, 'httpUser': httpUser, 'httpPass': httpPass, }; return await this.client.call('put', path: path, params: params); } Future deleteWebhook({projectId, webhookId}) async { String path = '/projects/{projectId}/webhooks/{webhookId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{webhookId}'), webhookId); Map params = { }; return await this.client.call('delete', path: path, params: params); } }