Skip to content

Commit 9913bad

Browse files
committed
Add 1.8.x support
1 parent 28d9574 commit 9913bad

File tree

9 files changed

+1227
-569
lines changed

9 files changed

+1227
-569
lines changed

src/services/account.ts

Lines changed: 435 additions & 203 deletions
Large diffs are not rendered by default.

src/services/avatars.ts

Lines changed: 119 additions & 47 deletions
Large diffs are not rendered by default.

src/services/databases.ts

Lines changed: 131 additions & 62 deletions
Large diffs are not rendered by default.

src/services/functions.ts

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,21 @@ export class Functions {
1414
/**
1515
* Get a list of all the current user function execution logs. You can use the query params to filter your results.
1616
*
17-
* @param {string} functionId - Function ID.
18-
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
17+
* @param {string} params.functionId - Function ID.
18+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
1919
* @throws {AppwriteException}
2020
* @returns {Promise<Models.ExecutionList>}
2121
*/
2222
listExecutions(params: { functionId: string, queries?: string[] }): Promise<Models.ExecutionList>;
2323
/**
24-
* @deprecated Parameter-based methods will be removed in the upcoming version.
25-
* Please use the object based method instead for better developer experience.
24+
* Get a list of all the current user function execution logs. You can use the query params to filter your results.
25+
*
26+
* @param {string} functionId - Function ID.
27+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
28+
* @throws {AppwriteException}
29+
* @returns {Promise<Models.ExecutionList>}
30+
* @deprecated Flat parameter style methods will be removed in a future version.
31+
* Please use the object parameter style method instead for a better developer experience.
2632
*
2733
* @example
2834
* // Old (deprecated)
@@ -38,8 +44,8 @@ export class Functions {
3844
): Promise<Models.ExecutionList> {
3945
let params: { functionId: string, queries?: string[] };
4046

41-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
42-
params = paramsOrFirst as { functionId: string, queries?: string[] };
47+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
48+
params = (paramsOrFirst || {}) as { functionId: string, queries?: string[] };
4349
} else {
4450
params = {
4551
functionId: paramsOrFirst as string,
@@ -72,6 +78,20 @@ export class Functions {
7278
);
7379
}
7480

81+
/**
82+
* Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.
83+
*
84+
* @param {string} params.functionId - Function ID.
85+
* @param {string} params.body - HTTP body of execution. Default value is empty string.
86+
* @param {boolean} params.async - Execute code in the background. Default value is false.
87+
* @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is /
88+
* @param {ExecutionMethod} params.method - HTTP method of execution. Default value is GET.
89+
* @param {object} params.headers - HTTP headers of execution. Defaults to empty.
90+
* @param {string} params.scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
91+
* @throws {AppwriteException}
92+
* @returns {Promise<Models.Execution>}
93+
*/
94+
createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>;
7595
/**
7696
* Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.
7797
*
@@ -84,11 +104,8 @@ export class Functions {
84104
* @param {string} scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
85105
* @throws {AppwriteException}
86106
* @returns {Promise<Models.Execution>}
87-
*/
88-
createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>;
89-
/**
90-
* @deprecated Parameter-based methods will be removed in the upcoming version.
91-
* Please use the object based method instead for better developer experience.
107+
* @deprecated Flat parameter style methods will be removed in a future version.
108+
* Please use the object parameter style method instead for a better developer experience.
92109
*
93110
* @example
94111
* // Old (deprecated)
@@ -104,8 +121,8 @@ export class Functions {
104121
): Promise<Models.Execution> {
105122
let params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string };
106123

107-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
108-
params = paramsOrFirst as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string };
124+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
125+
params = (paramsOrFirst || {}) as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string };
109126
} else {
110127
params = {
111128
functionId: paramsOrFirst as string,
@@ -167,15 +184,21 @@ export class Functions {
167184
/**
168185
* Get a function execution log by its unique ID.
169186
*
170-
* @param {string} functionId - Function ID.
171-
* @param {string} executionId - Execution ID.
187+
* @param {string} params.functionId - Function ID.
188+
* @param {string} params.executionId - Execution ID.
172189
* @throws {AppwriteException}
173190
* @returns {Promise<Models.Execution>}
174191
*/
175192
getExecution(params: { functionId: string, executionId: string }): Promise<Models.Execution>;
176193
/**
177-
* @deprecated Parameter-based methods will be removed in the upcoming version.
178-
* Please use the object based method instead for better developer experience.
194+
* Get a function execution log by its unique ID.
195+
*
196+
* @param {string} functionId - Function ID.
197+
* @param {string} executionId - Execution ID.
198+
* @throws {AppwriteException}
199+
* @returns {Promise<Models.Execution>}
200+
* @deprecated Flat parameter style methods will be removed in a future version.
201+
* Please use the object parameter style method instead for a better developer experience.
179202
*
180203
* @example
181204
* // Old (deprecated)
@@ -191,8 +214,8 @@ export class Functions {
191214
): Promise<Models.Execution> {
192215
let params: { functionId: string, executionId: string };
193216

194-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
195-
params = paramsOrFirst as { functionId: string, executionId: string };
217+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
218+
params = (paramsOrFirst || {}) as { functionId: string, executionId: string };
196219
} else {
197220
params = {
198221
functionId: paramsOrFirst as string,

src/services/graphql.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@ export class Graphql {
1313
/**
1414
* Execute a GraphQL mutation.
1515
*
16-
* @param {object} query - The query or queries to execute.
16+
* @param {object} params.query - The query or queries to execute.
1717
* @throws {AppwriteException}
1818
* @returns {Promise<{}>}
1919
*/
2020
query(params: { query: object }): Promise<{}>;
2121
/**
22-
* @deprecated Parameter-based methods will be removed in the upcoming version.
23-
* Please use the object based method instead for better developer experience.
22+
* Execute a GraphQL mutation.
23+
*
24+
* @param {object} query - The query or queries to execute.
25+
* @throws {AppwriteException}
26+
* @returns {Promise<{}>}
27+
* @deprecated Flat parameter style methods will be removed in a future version.
28+
* Please use the object parameter style method instead for a better developer experience.
2429
*
2530
* @example
2631
* // Old (deprecated)
@@ -35,8 +40,8 @@ export class Graphql {
3540
): Promise<{}> {
3641
let params: { query: object };
3742

38-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst) {
39-
params = paramsOrFirst as { query: object };
43+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
44+
params = (paramsOrFirst || {}) as { query: object };
4045
} else {
4146
params = {
4247
query: paramsOrFirst as object
@@ -72,14 +77,19 @@ export class Graphql {
7277
/**
7378
* Execute a GraphQL mutation.
7479
*
75-
* @param {object} query - The query or queries to execute.
80+
* @param {object} params.query - The query or queries to execute.
7681
* @throws {AppwriteException}
7782
* @returns {Promise<{}>}
7883
*/
7984
mutation(params: { query: object }): Promise<{}>;
8085
/**
81-
* @deprecated Parameter-based methods will be removed in the upcoming version.
82-
* Please use the object based method instead for better developer experience.
86+
* Execute a GraphQL mutation.
87+
*
88+
* @param {object} query - The query or queries to execute.
89+
* @throws {AppwriteException}
90+
* @returns {Promise<{}>}
91+
* @deprecated Flat parameter style methods will be removed in a future version.
92+
* Please use the object parameter style method instead for a better developer experience.
8393
*
8494
* @example
8595
* // Old (deprecated)
@@ -94,8 +104,8 @@ export class Graphql {
94104
): Promise<{}> {
95105
let params: { query: object };
96106

97-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst) {
98-
params = paramsOrFirst as { query: object };
107+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
108+
params = (paramsOrFirst || {}) as { query: object };
99109
} else {
100110
params = {
101111
query: paramsOrFirst as object

src/services/messaging.ts

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,23 @@ export class Messaging {
1313
/**
1414
* Create a new subscriber.
1515
*
16-
* @param {string} topicId - Topic ID. The topic ID to subscribe to.
17-
* @param {string} subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
18-
* @param {string} targetId - Target ID. The target ID to link to the specified Topic ID.
16+
* @param {string} params.topicId - Topic ID. The topic ID to subscribe to.
17+
* @param {string} params.subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
18+
* @param {string} params.targetId - Target ID. The target ID to link to the specified Topic ID.
1919
* @throws {AppwriteException}
2020
* @returns {Promise<Models.Subscriber>}
2121
*/
2222
createSubscriber(params: { topicId: string, subscriberId: string, targetId: string }): Promise<Models.Subscriber>;
2323
/**
24-
* @deprecated Parameter-based methods will be removed in the upcoming version.
25-
* Please use the object based method instead for better developer experience.
24+
* Create a new subscriber.
25+
*
26+
* @param {string} topicId - Topic ID. The topic ID to subscribe to.
27+
* @param {string} subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
28+
* @param {string} targetId - Target ID. The target ID to link to the specified Topic ID.
29+
* @throws {AppwriteException}
30+
* @returns {Promise<Models.Subscriber>}
31+
* @deprecated Flat parameter style methods will be removed in a future version.
32+
* Please use the object parameter style method instead for a better developer experience.
2633
*
2734
* @example
2835
* // Old (deprecated)
@@ -38,8 +45,8 @@ export class Messaging {
3845
): Promise<Models.Subscriber> {
3946
let params: { topicId: string, subscriberId: string, targetId: string };
4047

41-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
42-
params = paramsOrFirst as { topicId: string, subscriberId: string, targetId: string };
48+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
49+
params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string, targetId: string };
4350
} else {
4451
params = {
4552
topicId: paramsOrFirst as string,
@@ -87,15 +94,21 @@ export class Messaging {
8794
/**
8895
* Delete a subscriber by its unique ID.
8996
*
90-
* @param {string} topicId - Topic ID. The topic ID subscribed to.
91-
* @param {string} subscriberId - Subscriber ID.
97+
* @param {string} params.topicId - Topic ID. The topic ID subscribed to.
98+
* @param {string} params.subscriberId - Subscriber ID.
9299
* @throws {AppwriteException}
93100
* @returns {Promise<{}>}
94101
*/
95102
deleteSubscriber(params: { topicId: string, subscriberId: string }): Promise<{}>;
96103
/**
97-
* @deprecated Parameter-based methods will be removed in the upcoming version.
98-
* Please use the object based method instead for better developer experience.
104+
* Delete a subscriber by its unique ID.
105+
*
106+
* @param {string} topicId - Topic ID. The topic ID subscribed to.
107+
* @param {string} subscriberId - Subscriber ID.
108+
* @throws {AppwriteException}
109+
* @returns {Promise<{}>}
110+
* @deprecated Flat parameter style methods will be removed in a future version.
111+
* Please use the object parameter style method instead for a better developer experience.
99112
*
100113
* @example
101114
* // Old (deprecated)
@@ -111,8 +124,8 @@ export class Messaging {
111124
): Promise<{}> {
112125
let params: { topicId: string, subscriberId: string };
113126

114-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
115-
params = paramsOrFirst as { topicId: string, subscriberId: string };
127+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
128+
params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string };
116129
} else {
117130
params = {
118131
topicId: paramsOrFirst as string,

0 commit comments

Comments
 (0)