Comparing version 9.0.1 to 10.0.0-RC1
@@ -5,3 +5,3 @@ import { Client, Databases } from "appwrite"; | ||
const databases = new Databases(client, '[DATABASE_ID]'); | ||
const databases = new Databases(client); | ||
@@ -13,3 +13,3 @@ client | ||
const promise = databases.createDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', {}); | ||
const promise = databases.createDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]', {}); | ||
@@ -16,0 +16,0 @@ promise.then(function (response) { |
@@ -5,3 +5,3 @@ import { Client, Databases } from "appwrite"; | ||
const databases = new Databases(client, '[DATABASE_ID]'); | ||
const databases = new Databases(client); | ||
@@ -13,3 +13,3 @@ client | ||
const promise = databases.deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); | ||
const promise = databases.deleteDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]'); | ||
@@ -16,0 +16,0 @@ promise.then(function (response) { |
@@ -5,3 +5,3 @@ import { Client, Databases } from "appwrite"; | ||
const databases = new Databases(client, '[DATABASE_ID]'); | ||
const databases = new Databases(client); | ||
@@ -13,3 +13,3 @@ client | ||
const promise = databases.getDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); | ||
const promise = databases.getDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]'); | ||
@@ -16,0 +16,0 @@ promise.then(function (response) { |
@@ -5,3 +5,3 @@ import { Client, Databases } from "appwrite"; | ||
const databases = new Databases(client, '[DATABASE_ID]'); | ||
const databases = new Databases(client); | ||
@@ -13,3 +13,3 @@ client | ||
const promise = databases.listDocuments('[COLLECTION_ID]'); | ||
const promise = databases.listDocuments('[DATABASE_ID]', '[COLLECTION_ID]'); | ||
@@ -16,0 +16,0 @@ promise.then(function (response) { |
@@ -5,3 +5,3 @@ import { Client, Databases } from "appwrite"; | ||
const databases = new Databases(client, '[DATABASE_ID]'); | ||
const databases = new Databases(client); | ||
@@ -13,3 +13,3 @@ client | ||
const promise = databases.updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); | ||
const promise = databases.updateDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]'); | ||
@@ -16,0 +16,0 @@ promise.then(function (response) { |
@@ -5,3 +5,3 @@ { | ||
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", | ||
"version": "9.0.1", | ||
"version": "10.0.0-RC1", | ||
"license": "BSD-3-Clause", | ||
@@ -8,0 +8,0 @@ "main": "dist/cjs/sdk.js", |
# Appwrite Web SDK | ||
 | ||
 | ||
 | ||
[](https://travis-ci.com/appwrite/sdk-generator) | ||
@@ -9,3 +9,3 @@ [](https://twitter.com/appwrite) | ||
**This SDK is compatible with Appwrite server version 0.15.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).** | ||
**This SDK is compatible with Appwrite server version 1.0.0-RC1. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).** | ||
@@ -37,3 +37,3 @@ Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Web SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/appwrite@9.0.1"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/appwrite@10.0.0-RC1"></script> | ||
``` | ||
@@ -40,0 +40,0 @@ |
@@ -102,4 +102,7 @@ import 'isomorphic-form-data'; | ||
headers: Headers = { | ||
'x-sdk-version': 'appwrite:web:9.0.1', | ||
'X-Appwrite-Response-Format': '0.15.0', | ||
'x-sdk-name': 'Web', | ||
'x-sdk-platform': 'client', | ||
'x-sdk-language': 'web', | ||
'x-sdk-version': '10.0.0-RC1', | ||
'X-Appwrite-Response-Format': '1.0.0-RC1', | ||
}; | ||
@@ -106,0 +109,0 @@ |
@@ -10,2 +10,5 @@ export { Client, Query, AppwriteException } from './client'; | ||
export type { Models, Payload, RealtimeResponseEvent, UploadProgress } from './client'; | ||
export type { QueryTypes, QueryTypesList } from './query'; | ||
export type { QueryTypes, QueryTypesList } from './query'; | ||
export { Permission } from './permission'; | ||
export { Role } from './role'; | ||
export { ID } from './id'; |
@@ -171,17 +171,13 @@ export namespace Models { | ||
/** | ||
* Document creation date in Unix timestamp. | ||
* Document creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* Document update date in Unix timestamp. | ||
* Document update date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
* Document read permissions. | ||
* Document permissions. [Learn more about permissions](/docs/permissions). | ||
*/ | ||
$read: string[]; | ||
/** | ||
* Document write permissions. | ||
*/ | ||
$write: string[]; | ||
$permissions: string[]; | ||
[key: string]: any; | ||
@@ -218,5 +214,5 @@ } | ||
/** | ||
* Log creation time in Unix timestamp. | ||
* Log creation date in ISO 8601 format. | ||
*/ | ||
time: number; | ||
time: string; | ||
/** | ||
@@ -280,5 +276,5 @@ * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). | ||
/** | ||
* User | ||
* Account | ||
*/ | ||
export type User<Preferences extends Models.Preferences> = { | ||
export type Account<Preferences extends Models.Preferences> = { | ||
/** | ||
@@ -289,9 +285,9 @@ * User ID. | ||
/** | ||
* User creation date in Unix timestamp. | ||
* User creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* User update date in Unix timestamp. | ||
* User update date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
@@ -302,5 +298,5 @@ * User name. | ||
/** | ||
* User registration date in Unix timestamp. | ||
* User registration date in ISO 8601 format. | ||
*/ | ||
registration: number; | ||
registration: string; | ||
/** | ||
@@ -311,5 +307,5 @@ * User status. Pass `true` for enabled and `false` for disabled. | ||
/** | ||
* Unix timestamp of the most recent password update | ||
* Password update time in ISO 8601 format. | ||
*/ | ||
passwordUpdate: number; | ||
passwordUpdate: string; | ||
/** | ||
@@ -351,5 +347,5 @@ * User email address. | ||
/** | ||
* Session creation date in Unix timestamp. | ||
* Session creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
@@ -360,5 +356,5 @@ * User ID. | ||
/** | ||
* Session expiration date in Unix timestamp. | ||
* Session expiration date in ISO 8601 format. | ||
*/ | ||
expire: number; | ||
expire: string; | ||
/** | ||
@@ -377,5 +373,5 @@ * Session Provider. | ||
/** | ||
* Date, the Unix timestamp of when the access token expires. | ||
* The date of when the access token expires in ISO 8601 format. | ||
*/ | ||
providerAccessTokenExpiry: number; | ||
providerAccessTokenExpiry: string; | ||
/** | ||
@@ -459,5 +455,5 @@ * Session Provider Refresh Token. | ||
/** | ||
* Token creation date in Unix timestamp. | ||
* Token creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
@@ -472,5 +468,5 @@ * User ID. | ||
/** | ||
* Token expiration date in Unix timestamp. | ||
* Token expiration date in ISO 8601 format. | ||
*/ | ||
expire: number; | ||
expire: string; | ||
} | ||
@@ -532,18 +528,14 @@ /** | ||
/** | ||
* File creation date in Unix timestamp. | ||
* File creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* File update date in Unix timestamp. | ||
* File update date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
* File read permissions. | ||
* File permissions. [Learn more about permissions](/docs/permissions). | ||
*/ | ||
$read: string[]; | ||
$permissions: string[]; | ||
/** | ||
* File write permissions. | ||
*/ | ||
$write: string[]; | ||
/** | ||
* File name. | ||
@@ -582,9 +574,9 @@ */ | ||
/** | ||
* Team creation date in Unix timestamp. | ||
* Team creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* Team update date in Unix timestamp. | ||
* Team update date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
@@ -608,9 +600,9 @@ * Team name. | ||
/** | ||
* Membership creation date in Unix timestamp. | ||
* Membership creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* Membership update date in Unix timestamp. | ||
* Membership update date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
@@ -637,9 +629,9 @@ * User ID. | ||
/** | ||
* Date, the user has been invited to join the team in Unix timestamp. | ||
* Date, the user has been invited to join the team in ISO 8601 format. | ||
*/ | ||
invited: number; | ||
invited: string; | ||
/** | ||
* Date, the user has accepted the invitation to join the team in Unix timestamp. | ||
* Date, the user has accepted the invitation to join the team in ISO 8601 format. | ||
*/ | ||
joined: number; | ||
joined: string; | ||
/** | ||
@@ -663,13 +655,13 @@ * User confirmation status, true if the user has joined the team or false otherwise. | ||
/** | ||
* Execution creation date in Unix timestamp. | ||
* Execution creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* Execution update date in Unix timestamp. | ||
* Execution upate date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
* Execution read permissions. | ||
* Execution roles. | ||
*/ | ||
$read: string[]; | ||
$permissions: string[]; | ||
/** | ||
@@ -696,4 +688,8 @@ * Function ID. | ||
/** | ||
* The script stderr output string. Logs the last 4,000 characters of the execution stderr output | ||
* The script stdout output string. Logs the last 4,000 characters of the execution stdout output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. | ||
*/ | ||
stdout: string; | ||
/** | ||
* The script stderr output string. Logs the last 4,000 characters of the execution stderr output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. | ||
*/ | ||
stderr: string; | ||
@@ -700,0 +696,0 @@ /** |
@@ -5,36 +5,53 @@ type QueryTypesSingle = string | number | boolean; | ||
export class Query { | ||
static equal = (attribute: string, value: QueryTypes): string => | ||
Query.addQuery(attribute, 'equal', value); | ||
Query.addQuery(attribute, "equal", value); | ||
static notEqual = (attribute: string, value: QueryTypes): string => | ||
Query.addQuery(attribute, 'notEqual', value); | ||
Query.addQuery(attribute, "notEqual", value); | ||
static lesser = (attribute: string, value: QueryTypes): string => | ||
Query.addQuery(attribute, 'lesser', value); | ||
static lessThan = (attribute: string, value: QueryTypes): string => | ||
Query.addQuery(attribute, "lessThan", value); | ||
static lesserEqual = (attribute: string, value: QueryTypes): string => | ||
Query.addQuery(attribute, 'lesserEqual', value); | ||
static lessThanEqual = (attribute: string, value: QueryTypes): string => | ||
Query.addQuery(attribute, "lessThanEqual", value); | ||
static greater = (attribute: string, value: QueryTypes): string => | ||
Query.addQuery(attribute, 'greater', value); | ||
static greaterThan = (attribute: string, value: QueryTypes): string => | ||
Query.addQuery(attribute, "greaterThan", value); | ||
static greaterEqual = (attribute: string, value: QueryTypes): string => | ||
Query.addQuery(attribute, 'greaterEqual', value); | ||
static greaterThanEqual = (attribute: string, value: QueryTypes): string => | ||
Query.addQuery(attribute, "greaterThanEqual", value); | ||
static search = (attribute: string, value: string): string => | ||
Query.addQuery(attribute, 'search', value); | ||
Query.addQuery(attribute, "search", value); | ||
private static addQuery = (attribute: string, oper: string, value: QueryTypes): string => | ||
static orderDesc = (attribute: string): string => | ||
`orderDesc("${attribute}")`; | ||
static orderAsc = (attribute: string): string => | ||
`orderAsc("${attribute}")`; | ||
static cursorAfter = (documentId: string): string => | ||
`cursorAfter("${documentId}")`; | ||
static cursorBefore = (documentId: string): string => | ||
`cursorBefore("${documentId}")`; | ||
static limit = (limit: number): string => | ||
`limit(${limit})`; | ||
static offset = (offset: number): string => | ||
`offset(${offset})`; | ||
private static addQuery = (attribute: string, method: string, value: QueryTypes): string => | ||
value instanceof Array | ||
? `${attribute}.${oper}(${value | ||
? `${method}("${attribute}", [${value | ||
.map((v: QueryTypesSingle) => Query.parseValues(v)) | ||
.join(',')})` | ||
: `${attribute}.${oper}(${Query.parseValues(value)})`; | ||
.join(",")}])` | ||
: `${method}("${attribute}", [${Query.parseValues(value)}])`; | ||
private static parseValues = (value: QueryTypes): string => | ||
typeof value === 'string' || value instanceof String | ||
typeof value === "string" || value instanceof String | ||
? `"${value}"` | ||
: `${value}`; | ||
} |
import { Service } from '../service'; | ||
import { AppwriteException, Client } from '../client'; | ||
import type { Models } from '../models'; | ||
import type { UploadProgress } from '../client'; | ||
import type { UploadProgress, Payload } from '../client'; | ||
type Payload = { | ||
[key: string]: any; | ||
} | ||
export class Account extends Service { | ||
constructor(client: Client) | ||
{ | ||
super(client); | ||
} | ||
/** | ||
@@ -20,3 +21,3 @@ * Get Account | ||
*/ | ||
async get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> { | ||
async get<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>> { | ||
let path = '/account'; | ||
@@ -48,3 +49,3 @@ let payload: Payload = {}; | ||
*/ | ||
async create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> { | ||
async create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.Account<Preferences>> { | ||
if (typeof userId === 'undefined') { | ||
@@ -104,3 +105,3 @@ throw new AppwriteException('Missing required parameter: "userId"'); | ||
*/ | ||
async updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences>> { | ||
async updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.Account<Preferences>> { | ||
if (typeof email === 'undefined') { | ||
@@ -159,19 +160,14 @@ throw new AppwriteException('Missing required parameter: "email"'); | ||
* | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string[]} queries | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async getLogs(limit?: number, offset?: number): Promise<Models.LogList> { | ||
async getLogs(queries?: string[]): Promise<Models.LogList> { | ||
let path = '/account/logs'; | ||
let payload: Payload = {}; | ||
if (typeof limit !== 'undefined') { | ||
payload['limit'] = limit; | ||
if (typeof queries !== 'undefined') { | ||
payload['queries'] = queries; | ||
} | ||
if (typeof offset !== 'undefined') { | ||
payload['offset'] = offset; | ||
} | ||
const uri = new URL(this.client.config.endpoint + path); | ||
@@ -192,3 +188,3 @@ return await this.client.call('get', uri, { | ||
*/ | ||
async updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences>> { | ||
async updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.Account<Preferences>> { | ||
if (typeof name === 'undefined') { | ||
@@ -223,3 +219,3 @@ throw new AppwriteException('Missing required parameter: "name"'); | ||
*/ | ||
async updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>> { | ||
async updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.Account<Preferences>> { | ||
if (typeof password === 'undefined') { | ||
@@ -255,3 +251,3 @@ throw new AppwriteException('Missing required parameter: "password"'); | ||
* | ||
* @param {string} number | ||
* @param {string} phone | ||
* @param {string} password | ||
@@ -261,5 +257,5 @@ * @throws {AppwriteException} | ||
*/ | ||
async updatePhone<Preferences extends Models.Preferences>(number: string, password: string): Promise<Models.User<Preferences>> { | ||
if (typeof number === 'undefined') { | ||
throw new AppwriteException('Missing required parameter: "number"'); | ||
async updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.Account<Preferences>> { | ||
if (typeof phone === 'undefined') { | ||
throw new AppwriteException('Missing required parameter: "phone"'); | ||
} | ||
@@ -274,4 +270,4 @@ | ||
if (typeof number !== 'undefined') { | ||
payload['number'] = number; | ||
if (typeof phone !== 'undefined') { | ||
payload['phone'] = phone; | ||
} | ||
@@ -314,7 +310,7 @@ | ||
* | ||
* @param {Partial<Preferences>} prefs | ||
* @param {object} prefs | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async updatePrefs<Preferences extends Models.Preferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>> { | ||
async updatePrefs<Preferences extends Models.Preferences>(prefs: object): Promise<Models.Account<Preferences>> { | ||
if (typeof prefs === 'undefined') { | ||
@@ -543,5 +539,6 @@ throw new AppwriteException('Missing required parameter: "prefs"'); | ||
* | ||
* Sends the user an email with a secret key for creating a session. When the | ||
* user clicks the link in the email, the user is redirected back to the URL | ||
* you provided with the secret key and userId values attached to the URL | ||
* Sends the user an email with a secret key for creating a session. If the | ||
* provided user ID has not be registered, a new user will be created. When | ||
* the user clicks the link in the email, the user is redirected back to the | ||
* URL you provided with the secret key and userId values attached to the URL | ||
* query string. Use the query string parameters to submit a request to the | ||
@@ -697,3 +694,4 @@ * [PUT | ||
* | ||
* Sends the user an SMS with a secret key for creating a session. Use the | ||
* Sends the user an SMS with a secret key for creating a session. If the | ||
* provided user ID has not be registered, a new user will be created. Use the | ||
* returned user ID and secret and submit a request to the [PUT | ||
@@ -705,7 +703,7 @@ * /account/sessions/phone](/docs/client/account#accountUpdatePhoneSession) | ||
* @param {string} userId | ||
* @param {string} number | ||
* @param {string} phone | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async createPhoneSession(userId: string, number: string): Promise<Models.Token> { | ||
async createPhoneSession(userId: string, phone: string): Promise<Models.Token> { | ||
if (typeof userId === 'undefined') { | ||
@@ -715,4 +713,4 @@ throw new AppwriteException('Missing required parameter: "userId"'); | ||
if (typeof number === 'undefined') { | ||
throw new AppwriteException('Missing required parameter: "number"'); | ||
if (typeof phone === 'undefined') { | ||
throw new AppwriteException('Missing required parameter: "phone"'); | ||
} | ||
@@ -727,4 +725,4 @@ | ||
if (typeof number !== 'undefined') { | ||
payload['number'] = number; | ||
if (typeof phone !== 'undefined') { | ||
payload['phone'] = phone; | ||
} | ||
@@ -739,3 +737,3 @@ | ||
/** | ||
* Create Phone session (confirmation) | ||
* Create Phone Session (confirmation) | ||
* | ||
@@ -864,3 +862,3 @@ * Use this endpoint to complete creating a session with SMS. Use the | ||
*/ | ||
async updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> { | ||
async updateStatus<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>> { | ||
let path = '/account/status'; | ||
@@ -867,0 +865,0 @@ let payload: Payload = {}; |
import { Service } from '../service'; | ||
import { AppwriteException, Client } from '../client'; | ||
import type { Models } from '../models'; | ||
import type { UploadProgress } from '../client'; | ||
import type { UploadProgress, Payload } from '../client'; | ||
type Payload = { | ||
[key: string]: any; | ||
} | ||
export class Avatars extends Service { | ||
constructor(client: Client) | ||
{ | ||
super(client); | ||
} | ||
/** | ||
@@ -150,3 +151,4 @@ * Get Browser Icon | ||
* users. The code argument receives the 2 letter country code. Use width, | ||
* height and quality arguments to change the output settings. | ||
* height and quality arguments to change the output settings. Country codes | ||
* follow the [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) standard. | ||
* | ||
@@ -269,3 +271,2 @@ * When one dimension is specified and the other is 0, the image is scaled | ||
* @param {number} height | ||
* @param {string} color | ||
* @param {string} background | ||
@@ -275,3 +276,3 @@ * @throws {AppwriteException} | ||
*/ | ||
getInitials(name?: string, width?: number, height?: number, color?: string, background?: string): URL { | ||
getInitials(name?: string, width?: number, height?: number, background?: string): URL { | ||
let path = '/avatars/initials'; | ||
@@ -292,6 +293,2 @@ let payload: Payload = {}; | ||
if (typeof color !== 'undefined') { | ||
payload['color'] = color; | ||
} | ||
if (typeof background !== 'undefined') { | ||
@@ -298,0 +295,0 @@ payload['background'] = background; |
import { Service } from '../service'; | ||
import { AppwriteException, Client } from '../client'; | ||
import type { Models } from '../models'; | ||
import type { UploadProgress } from '../client'; | ||
import type { UploadProgress, Payload } from '../client'; | ||
type Payload = { | ||
[key: string]: any; | ||
} | ||
export class Databases extends Service { | ||
export class Databases extends Service { | ||
protected databaseId: string; | ||
public setDatabaseId(databaseId: string): void | ||
constructor(client: Client) | ||
{ | ||
this.databaseId = databaseId; | ||
} | ||
public getDatabaseId(): string | ||
{ | ||
return this.databaseId; | ||
} | ||
constructor(client: Client, databaseId:string) | ||
{ | ||
super(client); | ||
this.databaseId = databaseId; | ||
} | ||
@@ -30,15 +16,18 @@ | ||
* | ||
* Get a list of all the user's documents in a given collection. You can use | ||
* the query params to filter your results. On admin mode, this endpoint will | ||
* return a list of all of documents belonging to the provided collectionId. | ||
* [Learn more about different API modes](/docs/admin). | ||
* | ||
* @param {string} databaseId | ||
* @param {string} collectionId | ||
* @param {string[]} queries | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string} cursor | ||
* @param {string} cursorDirection | ||
* @param {string[]} orderAttributes | ||
* @param {string[]} orderTypes | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async listDocuments<Document extends Models.Document>(collectionId: string, queries?: string[], limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderAttributes?: string[], orderTypes?: string[]): Promise<Models.DocumentList<Document>> { | ||
async listDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>> { | ||
if (typeof databaseId === 'undefined') { | ||
throw new AppwriteException('Missing required parameter: "databaseId"'); | ||
} | ||
if (typeof collectionId === 'undefined') { | ||
@@ -48,3 +37,3 @@ throw new AppwriteException('Missing required parameter: "collectionId"'); | ||
let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', this.databaseId).replace('{collectionId}', collectionId); | ||
let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); | ||
let payload: Payload = {}; | ||
@@ -56,26 +45,2 @@ | ||
if (typeof limit !== 'undefined') { | ||
payload['limit'] = limit; | ||
} | ||
if (typeof offset !== 'undefined') { | ||
payload['offset'] = offset; | ||
} | ||
if (typeof cursor !== 'undefined') { | ||
payload['cursor'] = cursor; | ||
} | ||
if (typeof cursorDirection !== 'undefined') { | ||
payload['cursorDirection'] = cursorDirection; | ||
} | ||
if (typeof orderAttributes !== 'undefined') { | ||
payload['orderAttributes'] = orderAttributes; | ||
} | ||
if (typeof orderTypes !== 'undefined') { | ||
payload['orderTypes'] = orderTypes; | ||
} | ||
const uri = new URL(this.client.config.endpoint + path); | ||
@@ -90,12 +55,20 @@ return await this.client.call('get', uri, { | ||
* | ||
* Create a new Document. Before using this route, you should create a new | ||
* collection resource using either a [server | ||
* integration](/docs/server/databases#databasesCreateCollection) API or | ||
* directly from your database console. | ||
* | ||
* @param {string} databaseId | ||
* @param {string} collectionId | ||
* @param {string} documentId | ||
* @param {Omit<Document, keyof Models.Document>} data | ||
* @param {string[]} read | ||
* @param {string[]} write | ||
* @param {string[]} permissions | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async createDocument<Document extends Models.Document>(collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, read?: string[], write?: string[]): Promise<Document> { | ||
async createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document> { | ||
if (typeof databaseId === 'undefined') { | ||
throw new AppwriteException('Missing required parameter: "databaseId"'); | ||
} | ||
if (typeof collectionId === 'undefined') { | ||
@@ -113,3 +86,3 @@ throw new AppwriteException('Missing required parameter: "collectionId"'); | ||
let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', this.databaseId).replace('{collectionId}', collectionId); | ||
let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); | ||
let payload: Payload = {}; | ||
@@ -125,10 +98,6 @@ | ||
if (typeof read !== 'undefined') { | ||
payload['read'] = read; | ||
if (typeof permissions !== 'undefined') { | ||
payload['permissions'] = permissions; | ||
} | ||
if (typeof write !== 'undefined') { | ||
payload['write'] = write; | ||
} | ||
const uri = new URL(this.client.config.endpoint + path); | ||
@@ -143,3 +112,6 @@ return await this.client.call('post', uri, { | ||
* | ||
* Get a document by its unique ID. This endpoint response returns a JSON | ||
* object with the document data. | ||
* | ||
* @param {string} databaseId | ||
* @param {string} collectionId | ||
@@ -150,3 +122,7 @@ * @param {string} documentId | ||
*/ | ||
async getDocument<Document extends Models.Document>(collectionId: string, documentId: string): Promise<Document> { | ||
async getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string): Promise<Document> { | ||
if (typeof databaseId === 'undefined') { | ||
throw new AppwriteException('Missing required parameter: "databaseId"'); | ||
} | ||
if (typeof collectionId === 'undefined') { | ||
@@ -160,3 +136,3 @@ throw new AppwriteException('Missing required parameter: "collectionId"'); | ||
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', this.databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); | ||
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); | ||
let payload: Payload = {}; | ||
@@ -173,12 +149,18 @@ | ||
* | ||
* Update a document by its unique ID. Using the patch method you can pass | ||
* only specific fields that will get updated. | ||
* | ||
* @param {string} databaseId | ||
* @param {string} collectionId | ||
* @param {string} documentId | ||
* @param {Partial<Omit<Document, keyof Models.Document>>} data | ||
* @param {string[]} read | ||
* @param {string[]} write | ||
* @param {string[]} permissions | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async updateDocument<Document extends Models.Document>(collectionId: string, documentId: string, data?: Partial<Omit<Document, keyof Models.Document>>, read?: string[], write?: string[]): Promise<Document> { | ||
async updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document> { | ||
if (typeof databaseId === 'undefined') { | ||
throw new AppwriteException('Missing required parameter: "databaseId"'); | ||
} | ||
if (typeof collectionId === 'undefined') { | ||
@@ -192,3 +174,3 @@ throw new AppwriteException('Missing required parameter: "collectionId"'); | ||
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', this.databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); | ||
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); | ||
let payload: Payload = {}; | ||
@@ -200,10 +182,6 @@ | ||
if (typeof read !== 'undefined') { | ||
payload['read'] = read; | ||
if (typeof permissions !== 'undefined') { | ||
payload['permissions'] = permissions; | ||
} | ||
if (typeof write !== 'undefined') { | ||
payload['write'] = write; | ||
} | ||
const uri = new URL(this.client.config.endpoint + path); | ||
@@ -218,3 +196,5 @@ return await this.client.call('patch', uri, { | ||
* | ||
* Delete a document by its unique ID. | ||
* | ||
* @param {string} databaseId | ||
* @param {string} collectionId | ||
@@ -225,3 +205,7 @@ * @param {string} documentId | ||
*/ | ||
async deleteDocument(collectionId: string, documentId: string): Promise<{}> { | ||
async deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> { | ||
if (typeof databaseId === 'undefined') { | ||
throw new AppwriteException('Missing required parameter: "databaseId"'); | ||
} | ||
if (typeof collectionId === 'undefined') { | ||
@@ -235,3 +219,3 @@ throw new AppwriteException('Missing required parameter: "collectionId"'); | ||
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', this.databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); | ||
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); | ||
let payload: Payload = {}; | ||
@@ -238,0 +222,0 @@ |
import { Service } from '../service'; | ||
import { AppwriteException, Client } from '../client'; | ||
import type { Models } from '../models'; | ||
import type { UploadProgress } from '../client'; | ||
import type { UploadProgress, Payload } from '../client'; | ||
type Payload = { | ||
[key: string]: any; | ||
} | ||
export class Functions extends Service { | ||
constructor(client: Client) | ||
{ | ||
super(client); | ||
} | ||
/** | ||
@@ -53,11 +54,8 @@ * Retry Build | ||
* @param {string} functionId | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @param {string} cursor | ||
* @param {string} cursorDirection | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async listExecutions(functionId: string, limit?: number, offset?: number, search?: string, cursor?: string, cursorDirection?: string): Promise<Models.ExecutionList> { | ||
async listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList> { | ||
if (typeof functionId === 'undefined') { | ||
@@ -70,10 +68,6 @@ throw new AppwriteException('Missing required parameter: "functionId"'); | ||
if (typeof limit !== 'undefined') { | ||
payload['limit'] = limit; | ||
if (typeof queries !== 'undefined') { | ||
payload['queries'] = queries; | ||
} | ||
if (typeof offset !== 'undefined') { | ||
payload['offset'] = offset; | ||
} | ||
if (typeof search !== 'undefined') { | ||
@@ -83,10 +77,2 @@ payload['search'] = search; | ||
if (typeof cursor !== 'undefined') { | ||
payload['cursor'] = cursor; | ||
} | ||
if (typeof cursorDirection !== 'undefined') { | ||
payload['cursorDirection'] = cursorDirection; | ||
} | ||
const uri = new URL(this.client.config.endpoint + path); | ||
@@ -93,0 +79,0 @@ return await this.client.call('get', uri, { |
import { Service } from '../service'; | ||
import { AppwriteException, Client } from '../client'; | ||
import type { Models } from '../models'; | ||
import type { UploadProgress } from '../client'; | ||
import type { UploadProgress, Payload } from '../client'; | ||
type Payload = { | ||
[key: string]: any; | ||
} | ||
export class Locale extends Service { | ||
constructor(client: Client) | ||
{ | ||
super(client); | ||
} | ||
/** | ||
@@ -13,0 +14,0 @@ * Get User Locale |
import { Service } from '../service'; | ||
import { AppwriteException, Client } from '../client'; | ||
import type { Models } from '../models'; | ||
import type { UploadProgress } from '../client'; | ||
import type { UploadProgress, Payload } from '../client'; | ||
type Payload = { | ||
[key: string]: any; | ||
} | ||
export class Storage extends Service { | ||
constructor(client: Client) | ||
{ | ||
super(client); | ||
} | ||
/** | ||
@@ -20,12 +21,8 @@ * List Files | ||
* @param {string} bucketId | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string} cursor | ||
* @param {string} cursorDirection | ||
* @param {string} orderType | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async listFiles(bucketId: string, search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.FileList> { | ||
async listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList> { | ||
if (typeof bucketId === 'undefined') { | ||
@@ -38,2 +35,6 @@ throw new AppwriteException('Missing required parameter: "bucketId"'); | ||
if (typeof queries !== 'undefined') { | ||
payload['queries'] = queries; | ||
} | ||
if (typeof search !== 'undefined') { | ||
@@ -43,22 +44,2 @@ payload['search'] = search; | ||
if (typeof limit !== 'undefined') { | ||
payload['limit'] = limit; | ||
} | ||
if (typeof offset !== 'undefined') { | ||
payload['offset'] = offset; | ||
} | ||
if (typeof cursor !== 'undefined') { | ||
payload['cursor'] = cursor; | ||
} | ||
if (typeof cursorDirection !== 'undefined') { | ||
payload['cursorDirection'] = cursorDirection; | ||
} | ||
if (typeof orderType !== 'undefined') { | ||
payload['orderType'] = orderType; | ||
} | ||
const uri = new URL(this.client.config.endpoint + path); | ||
@@ -75,4 +56,4 @@ return await this.client.call('get', uri, { | ||
* resource using either a [server | ||
* integration](/docs/server/database#storageCreateBucket) API or directly | ||
* from your Appwrite console. | ||
* integration](/docs/server/storage#storageCreateBucket) API or directly from | ||
* your Appwrite console. | ||
* | ||
@@ -96,8 +77,7 @@ * Larger files should be uploaded using multiple requests with the | ||
* @param {File} file | ||
* @param {string[]} read | ||
* @param {string[]} write | ||
* @param {string[]} permissions | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async createFile(bucketId: string, fileId: string, file: File, read?: string[], write?: string[], onProgress = (progress: UploadProgress) => {}): Promise<Models.File> { | ||
async createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress = (progress: UploadProgress) => {}): Promise<Models.File> { | ||
if (typeof bucketId === 'undefined') { | ||
@@ -126,10 +106,6 @@ throw new AppwriteException('Missing required parameter: "bucketId"'); | ||
if (typeof read !== 'undefined') { | ||
payload['read'] = read; | ||
if (typeof permissions !== 'undefined') { | ||
payload['permissions'] = permissions; | ||
} | ||
if (typeof write !== 'undefined') { | ||
payload['write'] = write; | ||
} | ||
const uri = new URL(this.client.config.endpoint + path); | ||
@@ -236,8 +212,7 @@ | ||
* @param {string} fileId | ||
* @param {string[]} read | ||
* @param {string[]} write | ||
* @param {string[]} permissions | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async updateFile(bucketId: string, fileId: string, read?: string[], write?: string[]): Promise<Models.File> { | ||
async updateFile(bucketId: string, fileId: string, permissions?: string[]): Promise<Models.File> { | ||
if (typeof bucketId === 'undefined') { | ||
@@ -254,10 +229,6 @@ throw new AppwriteException('Missing required parameter: "bucketId"'); | ||
if (typeof read !== 'undefined') { | ||
payload['read'] = read; | ||
if (typeof permissions !== 'undefined') { | ||
payload['permissions'] = permissions; | ||
} | ||
if (typeof write !== 'undefined') { | ||
payload['write'] = write; | ||
} | ||
const uri = new URL(this.client.config.endpoint + path); | ||
@@ -264,0 +235,0 @@ return await this.client.call('put', uri, { |
import { Service } from '../service'; | ||
import { AppwriteException, Client } from '../client'; | ||
import type { Models } from '../models'; | ||
import type { UploadProgress } from '../client'; | ||
import type { UploadProgress, Payload } from '../client'; | ||
type Payload = { | ||
[key: string]: any; | ||
} | ||
export class Teams extends Service { | ||
constructor(client: Client) | ||
{ | ||
super(client); | ||
} | ||
/** | ||
@@ -21,15 +22,15 @@ * List Teams | ||
* | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string} cursor | ||
* @param {string} cursorDirection | ||
* @param {string} orderType | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async list(search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.TeamList> { | ||
async list(queries?: string[], search?: string): Promise<Models.TeamList> { | ||
let path = '/teams'; | ||
let payload: Payload = {}; | ||
if (typeof queries !== 'undefined') { | ||
payload['queries'] = queries; | ||
} | ||
if (typeof search !== 'undefined') { | ||
@@ -39,22 +40,2 @@ payload['search'] = search; | ||
if (typeof limit !== 'undefined') { | ||
payload['limit'] = limit; | ||
} | ||
if (typeof offset !== 'undefined') { | ||
payload['offset'] = offset; | ||
} | ||
if (typeof cursor !== 'undefined') { | ||
payload['cursor'] = cursor; | ||
} | ||
if (typeof cursorDirection !== 'undefined') { | ||
payload['cursorDirection'] = cursorDirection; | ||
} | ||
if (typeof orderType !== 'undefined') { | ||
payload['orderType'] = orderType; | ||
} | ||
const uri = new URL(this.client.config.endpoint + path); | ||
@@ -196,12 +177,8 @@ return await this.client.call('get', uri, { | ||
* @param {string} teamId | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string} cursor | ||
* @param {string} cursorDirection | ||
* @param {string} orderType | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
async getMemberships(teamId: string, search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.MembershipList> { | ||
async getMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList> { | ||
if (typeof teamId === 'undefined') { | ||
@@ -214,2 +191,6 @@ throw new AppwriteException('Missing required parameter: "teamId"'); | ||
if (typeof queries !== 'undefined') { | ||
payload['queries'] = queries; | ||
} | ||
if (typeof search !== 'undefined') { | ||
@@ -219,22 +200,2 @@ payload['search'] = search; | ||
if (typeof limit !== 'undefined') { | ||
payload['limit'] = limit; | ||
} | ||
if (typeof offset !== 'undefined') { | ||
payload['offset'] = offset; | ||
} | ||
if (typeof cursor !== 'undefined') { | ||
payload['cursor'] = cursor; | ||
} | ||
if (typeof cursorDirection !== 'undefined') { | ||
payload['cursorDirection'] = cursorDirection; | ||
} | ||
if (typeof orderType !== 'undefined') { | ||
payload['orderType'] = orderType; | ||
} | ||
const uri = new URL(this.client.config.endpoint + path); | ||
@@ -241,0 +202,0 @@ return await this.client.call('get', uri, { |
@@ -11,1 +11,4 @@ export { Client, Query, AppwriteException } from './client'; | ||
export type { QueryTypes, QueryTypesList } from './query'; | ||
export { Permission } from './permission'; | ||
export { Role } from './role'; | ||
export { ID } from './id'; |
@@ -171,17 +171,13 @@ export declare namespace Models { | ||
/** | ||
* Document creation date in Unix timestamp. | ||
* Document creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* Document update date in Unix timestamp. | ||
* Document update date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
* Document read permissions. | ||
* Document permissions. [Learn more about permissions](/docs/permissions). | ||
*/ | ||
$read: string[]; | ||
/** | ||
* Document write permissions. | ||
*/ | ||
$write: string[]; | ||
$permissions: string[]; | ||
[key: string]: any; | ||
@@ -218,5 +214,5 @@ }; | ||
/** | ||
* Log creation time in Unix timestamp. | ||
* Log creation date in ISO 8601 format. | ||
*/ | ||
time: number; | ||
time: string; | ||
/** | ||
@@ -280,5 +276,5 @@ * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). | ||
/** | ||
* User | ||
* Account | ||
*/ | ||
type User<Preferences extends Models.Preferences> = { | ||
type Account<Preferences extends Models.Preferences> = { | ||
/** | ||
@@ -289,9 +285,9 @@ * User ID. | ||
/** | ||
* User creation date in Unix timestamp. | ||
* User creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* User update date in Unix timestamp. | ||
* User update date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
@@ -302,5 +298,5 @@ * User name. | ||
/** | ||
* User registration date in Unix timestamp. | ||
* User registration date in ISO 8601 format. | ||
*/ | ||
registration: number; | ||
registration: string; | ||
/** | ||
@@ -311,5 +307,5 @@ * User status. Pass `true` for enabled and `false` for disabled. | ||
/** | ||
* Unix timestamp of the most recent password update | ||
* Password update time in ISO 8601 format. | ||
*/ | ||
passwordUpdate: number; | ||
passwordUpdate: string; | ||
/** | ||
@@ -351,5 +347,5 @@ * User email address. | ||
/** | ||
* Session creation date in Unix timestamp. | ||
* Session creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
@@ -360,5 +356,5 @@ * User ID. | ||
/** | ||
* Session expiration date in Unix timestamp. | ||
* Session expiration date in ISO 8601 format. | ||
*/ | ||
expire: number; | ||
expire: string; | ||
/** | ||
@@ -377,5 +373,5 @@ * Session Provider. | ||
/** | ||
* Date, the Unix timestamp of when the access token expires. | ||
* The date of when the access token expires in ISO 8601 format. | ||
*/ | ||
providerAccessTokenExpiry: number; | ||
providerAccessTokenExpiry: string; | ||
/** | ||
@@ -459,5 +455,5 @@ * Session Provider Refresh Token. | ||
/** | ||
* Token creation date in Unix timestamp. | ||
* Token creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
@@ -472,5 +468,5 @@ * User ID. | ||
/** | ||
* Token expiration date in Unix timestamp. | ||
* Token expiration date in ISO 8601 format. | ||
*/ | ||
expire: number; | ||
expire: string; | ||
}; | ||
@@ -532,18 +528,14 @@ /** | ||
/** | ||
* File creation date in Unix timestamp. | ||
* File creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* File update date in Unix timestamp. | ||
* File update date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
* File read permissions. | ||
* File permissions. [Learn more about permissions](/docs/permissions). | ||
*/ | ||
$read: string[]; | ||
$permissions: string[]; | ||
/** | ||
* File write permissions. | ||
*/ | ||
$write: string[]; | ||
/** | ||
* File name. | ||
@@ -582,9 +574,9 @@ */ | ||
/** | ||
* Team creation date in Unix timestamp. | ||
* Team creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* Team update date in Unix timestamp. | ||
* Team update date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
@@ -608,9 +600,9 @@ * Team name. | ||
/** | ||
* Membership creation date in Unix timestamp. | ||
* Membership creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* Membership update date in Unix timestamp. | ||
* Membership update date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
@@ -637,9 +629,9 @@ * User ID. | ||
/** | ||
* Date, the user has been invited to join the team in Unix timestamp. | ||
* Date, the user has been invited to join the team in ISO 8601 format. | ||
*/ | ||
invited: number; | ||
invited: string; | ||
/** | ||
* Date, the user has accepted the invitation to join the team in Unix timestamp. | ||
* Date, the user has accepted the invitation to join the team in ISO 8601 format. | ||
*/ | ||
joined: number; | ||
joined: string; | ||
/** | ||
@@ -663,13 +655,13 @@ * User confirmation status, true if the user has joined the team or false otherwise. | ||
/** | ||
* Execution creation date in Unix timestamp. | ||
* Execution creation date in ISO 8601 format. | ||
*/ | ||
$createdAt: number; | ||
$createdAt: string; | ||
/** | ||
* Execution update date in Unix timestamp. | ||
* Execution upate date in ISO 8601 format. | ||
*/ | ||
$updatedAt: number; | ||
$updatedAt: string; | ||
/** | ||
* Execution read permissions. | ||
* Execution roles. | ||
*/ | ||
$read: string[]; | ||
$permissions: string[]; | ||
/** | ||
@@ -696,4 +688,8 @@ * Function ID. | ||
/** | ||
* The script stderr output string. Logs the last 4,000 characters of the execution stderr output | ||
* The script stdout output string. Logs the last 4,000 characters of the execution stdout output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. | ||
*/ | ||
stdout: string; | ||
/** | ||
* The script stderr output string. Logs the last 4,000 characters of the execution stderr output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. | ||
*/ | ||
stderr: string; | ||
@@ -700,0 +696,0 @@ /** |
@@ -7,7 +7,13 @@ declare type QueryTypesSingle = string | number | boolean; | ||
static notEqual: (attribute: string, value: QueryTypes) => string; | ||
static lesser: (attribute: string, value: QueryTypes) => string; | ||
static lesserEqual: (attribute: string, value: QueryTypes) => string; | ||
static greater: (attribute: string, value: QueryTypes) => string; | ||
static greaterEqual: (attribute: string, value: QueryTypes) => string; | ||
static lessThan: (attribute: string, value: QueryTypes) => string; | ||
static lessThanEqual: (attribute: string, value: QueryTypes) => string; | ||
static greaterThan: (attribute: string, value: QueryTypes) => string; | ||
static greaterThanEqual: (attribute: string, value: QueryTypes) => string; | ||
static search: (attribute: string, value: string) => string; | ||
static orderDesc: (attribute: string) => string; | ||
static orderAsc: (attribute: string) => string; | ||
static cursorAfter: (documentId: string) => string; | ||
static cursorBefore: (documentId: string) => string; | ||
static limit: (limit: number) => string; | ||
static offset: (offset: number) => string; | ||
private static addQuery; | ||
@@ -14,0 +20,0 @@ private static parseValues; |
import { Service } from '../service'; | ||
import { Client } from '../client'; | ||
import type { Models } from '../models'; | ||
export declare class Account extends Service { | ||
constructor(client: Client); | ||
/** | ||
@@ -12,3 +14,3 @@ * Get Account | ||
*/ | ||
get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>; | ||
get<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>>; | ||
/** | ||
@@ -31,3 +33,3 @@ * Create Account | ||
*/ | ||
create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; | ||
create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.Account<Preferences>>; | ||
/** | ||
@@ -50,3 +52,3 @@ * Update Account Email | ||
*/ | ||
updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences>>; | ||
updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.Account<Preferences>>; | ||
/** | ||
@@ -71,8 +73,7 @@ * Create Account JWT | ||
* | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string[]} queries | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
getLogs(limit?: number, offset?: number): Promise<Models.LogList>; | ||
getLogs(queries?: string[]): Promise<Models.LogList>; | ||
/** | ||
@@ -87,3 +88,3 @@ * Update Account Name | ||
*/ | ||
updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences>>; | ||
updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.Account<Preferences>>; | ||
/** | ||
@@ -101,3 +102,3 @@ * Update Account Password | ||
*/ | ||
updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>; | ||
updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.Account<Preferences>>; | ||
/** | ||
@@ -112,3 +113,3 @@ * Update Account Phone | ||
* | ||
* @param {string} number | ||
* @param {string} phone | ||
* @param {string} password | ||
@@ -118,3 +119,3 @@ * @throws {AppwriteException} | ||
*/ | ||
updatePhone<Preferences extends Models.Preferences>(number: string, password: string): Promise<Models.User<Preferences>>; | ||
updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.Account<Preferences>>; | ||
/** | ||
@@ -136,7 +137,7 @@ * Get Account Preferences | ||
* | ||
* @param {Partial<Preferences>} prefs | ||
* @param {object} prefs | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
updatePrefs<Preferences extends Models.Preferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>>; | ||
updatePrefs<Preferences extends Models.Preferences>(prefs: object): Promise<Models.Account<Preferences>>; | ||
/** | ||
@@ -230,5 +231,6 @@ * Create Password Recovery | ||
* | ||
* Sends the user an email with a secret key for creating a session. When the | ||
* user clicks the link in the email, the user is redirected back to the URL | ||
* you provided with the secret key and userId values attached to the URL | ||
* Sends the user an email with a secret key for creating a session. If the | ||
* provided user ID has not be registered, a new user will be created. When | ||
* the user clicks the link in the email, the user is redirected back to the | ||
* URL you provided with the secret key and userId values attached to the URL | ||
* query string. Use the query string parameters to submit a request to the | ||
@@ -297,3 +299,4 @@ * [PUT | ||
* | ||
* Sends the user an SMS with a secret key for creating a session. Use the | ||
* Sends the user an SMS with a secret key for creating a session. If the | ||
* provided user ID has not be registered, a new user will be created. Use the | ||
* returned user ID and secret and submit a request to the [PUT | ||
@@ -305,9 +308,9 @@ * /account/sessions/phone](/docs/client/account#accountUpdatePhoneSession) | ||
* @param {string} userId | ||
* @param {string} number | ||
* @param {string} phone | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
createPhoneSession(userId: string, number: string): Promise<Models.Token>; | ||
createPhoneSession(userId: string, phone: string): Promise<Models.Token>; | ||
/** | ||
* Create Phone session (confirmation) | ||
* Create Phone Session (confirmation) | ||
* | ||
@@ -372,3 +375,3 @@ * Use this endpoint to complete creating a session with SMS. Use the | ||
*/ | ||
updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>; | ||
updateStatus<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>>; | ||
/** | ||
@@ -375,0 +378,0 @@ * Create Email Verification |
import { Service } from '../service'; | ||
import { Client } from '../client'; | ||
export declare class Avatars extends Service { | ||
constructor(client: Client); | ||
/** | ||
@@ -62,3 +64,4 @@ * Get Browser Icon | ||
* users. The code argument receives the 2 letter country code. Use width, | ||
* height and quality arguments to change the output settings. | ||
* height and quality arguments to change the output settings. Country codes | ||
* follow the [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) standard. | ||
* | ||
@@ -123,3 +126,2 @@ * When one dimension is specified and the other is 0, the image is scaled | ||
* @param {number} height | ||
* @param {string} color | ||
* @param {string} background | ||
@@ -129,3 +131,3 @@ * @throws {AppwriteException} | ||
*/ | ||
getInitials(name?: string, width?: number, height?: number, color?: string, background?: string): URL; | ||
getInitials(name?: string, width?: number, height?: number, background?: string): URL; | ||
/** | ||
@@ -132,0 +134,0 @@ * Get QR Code |
@@ -5,39 +5,42 @@ import { Service } from '../service'; | ||
export declare class Databases extends Service { | ||
protected databaseId: string; | ||
setDatabaseId(databaseId: string): void; | ||
getDatabaseId(): string; | ||
constructor(client: Client, databaseId: string); | ||
constructor(client: Client); | ||
/** | ||
* List Documents | ||
* | ||
* Get a list of all the user's documents in a given collection. You can use | ||
* the query params to filter your results. On admin mode, this endpoint will | ||
* return a list of all of documents belonging to the provided collectionId. | ||
* [Learn more about different API modes](/docs/admin). | ||
* | ||
* @param {string} databaseId | ||
* @param {string} collectionId | ||
* @param {string[]} queries | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string} cursor | ||
* @param {string} cursorDirection | ||
* @param {string[]} orderAttributes | ||
* @param {string[]} orderTypes | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
listDocuments<Document extends Models.Document>(collectionId: string, queries?: string[], limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderAttributes?: string[], orderTypes?: string[]): Promise<Models.DocumentList<Document>>; | ||
listDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>>; | ||
/** | ||
* Create Document | ||
* | ||
* Create a new Document. Before using this route, you should create a new | ||
* collection resource using either a [server | ||
* integration](/docs/server/databases#databasesCreateCollection) API or | ||
* directly from your database console. | ||
* | ||
* @param {string} databaseId | ||
* @param {string} collectionId | ||
* @param {string} documentId | ||
* @param {Omit<Document, keyof Models.Document>} data | ||
* @param {string[]} read | ||
* @param {string[]} write | ||
* @param {string[]} permissions | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
createDocument<Document extends Models.Document>(collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, read?: string[], write?: string[]): Promise<Document>; | ||
createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document>; | ||
/** | ||
* Get Document | ||
* | ||
* Get a document by its unique ID. This endpoint response returns a JSON | ||
* object with the document data. | ||
* | ||
* @param {string} databaseId | ||
* @param {string} collectionId | ||
@@ -48,20 +51,24 @@ * @param {string} documentId | ||
*/ | ||
getDocument<Document extends Models.Document>(collectionId: string, documentId: string): Promise<Document>; | ||
getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string): Promise<Document>; | ||
/** | ||
* Update Document | ||
* | ||
* Update a document by its unique ID. Using the patch method you can pass | ||
* only specific fields that will get updated. | ||
* | ||
* @param {string} databaseId | ||
* @param {string} collectionId | ||
* @param {string} documentId | ||
* @param {Partial<Omit<Document, keyof Models.Document>>} data | ||
* @param {string[]} read | ||
* @param {string[]} write | ||
* @param {string[]} permissions | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
updateDocument<Document extends Models.Document>(collectionId: string, documentId: string, data?: Partial<Omit<Document, keyof Models.Document>>, read?: string[], write?: string[]): Promise<Document>; | ||
updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document>; | ||
/** | ||
* Delete Document | ||
* | ||
* Delete a document by its unique ID. | ||
* | ||
* @param {string} databaseId | ||
* @param {string} collectionId | ||
@@ -72,3 +79,3 @@ * @param {string} documentId | ||
*/ | ||
deleteDocument(collectionId: string, documentId: string): Promise<{}>; | ||
deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}>; | ||
} |
import { Service } from '../service'; | ||
import { Client } from '../client'; | ||
import type { Models } from '../models'; | ||
export declare class Functions extends Service { | ||
constructor(client: Client); | ||
/** | ||
@@ -24,11 +26,8 @@ * Retry Build | ||
* @param {string} functionId | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @param {string} cursor | ||
* @param {string} cursorDirection | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
listExecutions(functionId: string, limit?: number, offset?: number, search?: string, cursor?: string, cursorDirection?: string): Promise<Models.ExecutionList>; | ||
listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList>; | ||
/** | ||
@@ -35,0 +34,0 @@ * Create Execution |
import { Service } from '../service'; | ||
import { Client } from '../client'; | ||
import type { Models } from '../models'; | ||
export declare class Locale extends Service { | ||
constructor(client: Client); | ||
/** | ||
@@ -5,0 +7,0 @@ * Get User Locale |
import { Service } from '../service'; | ||
import { Client } from '../client'; | ||
import type { Models } from '../models'; | ||
import type { UploadProgress } from '../client'; | ||
export declare class Storage extends Service { | ||
constructor(client: Client); | ||
/** | ||
@@ -13,12 +15,8 @@ * List Files | ||
* @param {string} bucketId | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string} cursor | ||
* @param {string} cursorDirection | ||
* @param {string} orderType | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
listFiles(bucketId: string, search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.FileList>; | ||
listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList>; | ||
/** | ||
@@ -29,4 +27,4 @@ * Create File | ||
* resource using either a [server | ||
* integration](/docs/server/database#storageCreateBucket) API or directly | ||
* from your Appwrite console. | ||
* integration](/docs/server/storage#storageCreateBucket) API or directly from | ||
* your Appwrite console. | ||
* | ||
@@ -50,8 +48,7 @@ * Larger files should be uploaded using multiple requests with the | ||
* @param {File} file | ||
* @param {string[]} read | ||
* @param {string[]} write | ||
* @param {string[]} permissions | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
createFile(bucketId: string, fileId: string, file: File, read?: string[], write?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>; | ||
createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>; | ||
/** | ||
@@ -77,8 +74,7 @@ * Get File | ||
* @param {string} fileId | ||
* @param {string[]} read | ||
* @param {string[]} write | ||
* @param {string[]} permissions | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
updateFile(bucketId: string, fileId: string, read?: string[], write?: string[]): Promise<Models.File>; | ||
updateFile(bucketId: string, fileId: string, permissions?: string[]): Promise<Models.File>; | ||
/** | ||
@@ -85,0 +81,0 @@ * Delete File |
import { Service } from '../service'; | ||
import { Client } from '../client'; | ||
import type { Models } from '../models'; | ||
export declare class Teams extends Service { | ||
constructor(client: Client); | ||
/** | ||
@@ -13,12 +15,8 @@ * List Teams | ||
* | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string} cursor | ||
* @param {string} cursorDirection | ||
* @param {string} orderType | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
list(search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.TeamList>; | ||
list(queries?: string[], search?: string): Promise<Models.TeamList>; | ||
/** | ||
@@ -78,12 +76,8 @@ * Create Team | ||
* @param {string} teamId | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @param {number} limit | ||
* @param {number} offset | ||
* @param {string} cursor | ||
* @param {string} cursorDirection | ||
* @param {string} orderType | ||
* @throws {AppwriteException} | ||
* @returns {Promise} | ||
*/ | ||
getMemberships(teamId: string, search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.MembershipList>; | ||
getMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList>; | ||
/** | ||
@@ -90,0 +84,0 @@ * Create Team Membership |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
118
14216
1001936
1