Skip to content

Commit bf4bb54

Browse files
committed
Add 1.8.x support
1 parent 6c8db5e commit bf4bb54

File tree

9 files changed

+1167
-595
lines changed

9 files changed

+1167
-595
lines changed

src/services/account.ts

Lines changed: 404 additions & 207 deletions
Large diffs are not rendered by default.

src/services/avatars.ts

Lines changed: 117 additions & 52 deletions
Large diffs are not rendered by default.

src/services/databases.ts

Lines changed: 128 additions & 67 deletions
Large diffs are not rendered by default.

src/services/functions.ts

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,20 @@ export class Functions extends Service {
1717
/**
1818
* Get a list of all the current user function execution logs. You can use the query params to filter your results.
1919
*
20-
* @param {string} functionId - Function ID.
21-
* @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
20+
* @param {string} params.functionId - Function ID.
21+
* @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
2222
* @throws {AppwriteException}
2323
* @returns {Promise}
2424
*/
2525
listExecutions(params: { functionId: string, queries?: string[] }): Promise<Models.ExecutionList>;
2626
/**
27-
* @deprecated Parameter-based methods will be removed in the upcoming version.
28-
* Please use the object based method instead for better developer experience.
27+
* Get a list of all the current user function execution logs. You can use the query params to filter your results.
28+
*
29+
* @param {string} functionId - Function ID.
30+
* @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
31+
* @throws {AppwriteException}
32+
* @returns {Promise} * @deprecated Flat parameter style methods will be removed in a future version.
33+
* Please use the object parameter style method instead for a better developer experience.
2934
*
3035
* @example
3136
* // Old (deprecated)
@@ -41,8 +46,8 @@ export class Functions extends Service {
4146
): Promise<Models.ExecutionList> {
4247
let params: { functionId: string, queries?: string[] };
4348

44-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
45-
params = paramsOrFirst as { functionId: string, queries?: string[] };
49+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
50+
params = (paramsOrFirst || {}) as { functionId: string, queries?: string[] };
4651
} else {
4752
params = {
4853
functionId: paramsOrFirst as string,
@@ -69,6 +74,20 @@ export class Functions extends Service {
6974
}, payload);
7075
}
7176

77+
/**
78+
* 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.
79+
*
80+
* @param {string} params.functionId - Function ID.
81+
* @param {string} params.body - HTTP body of execution. Default value is empty string.
82+
* @param {boolean} params.async - Execute code in the background. Default value is false.
83+
* @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is /
84+
* @param {ExecutionMethod} params.method - HTTP method of execution. Default value is GET.
85+
* @param {object} params.headers - HTTP headers of execution. Defaults to empty.
86+
* @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.
87+
* @throws {AppwriteException}
88+
* @returns {Promise}
89+
*/
90+
createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>;
7291
/**
7392
* 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.
7493
*
@@ -80,12 +99,8 @@ export class Functions extends Service {
8099
* @param {object} headers - HTTP headers of execution. Defaults to empty.
81100
* @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.
82101
* @throws {AppwriteException}
83-
* @returns {Promise}
84-
*/
85-
createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>;
86-
/**
87-
* @deprecated Parameter-based methods will be removed in the upcoming version.
88-
* Please use the object based method instead for better developer experience.
102+
* @returns {Promise} * @deprecated Flat parameter style methods will be removed in a future version.
103+
* Please use the object parameter style method instead for a better developer experience.
89104
*
90105
* @example
91106
* // Old (deprecated)
@@ -101,8 +116,8 @@ export class Functions extends Service {
101116
): Promise<Models.Execution> {
102117
let params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string };
103118

104-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
105-
params = paramsOrFirst as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string };
119+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
120+
params = (paramsOrFirst || {}) as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string };
106121
} else {
107122
params = {
108123
functionId: paramsOrFirst as string,
@@ -163,15 +178,20 @@ export class Functions extends Service {
163178
/**
164179
* Get a function execution log by its unique ID.
165180
*
166-
* @param {string} functionId - Function ID.
167-
* @param {string} executionId - Execution ID.
181+
* @param {string} params.functionId - Function ID.
182+
* @param {string} params.executionId - Execution ID.
168183
* @throws {AppwriteException}
169184
* @returns {Promise}
170185
*/
171186
getExecution(params: { functionId: string, executionId: string }): Promise<Models.Execution>;
172187
/**
173-
* @deprecated Parameter-based methods will be removed in the upcoming version.
174-
* Please use the object based method instead for better developer experience.
188+
* Get a function execution log by its unique ID.
189+
*
190+
* @param {string} functionId - Function ID.
191+
* @param {string} executionId - Execution ID.
192+
* @throws {AppwriteException}
193+
* @returns {Promise} * @deprecated Flat parameter style methods will be removed in a future version.
194+
* Please use the object parameter style method instead for a better developer experience.
175195
*
176196
* @example
177197
* // Old (deprecated)
@@ -187,8 +207,8 @@ export class Functions extends Service {
187207
): Promise<Models.Execution> {
188208
let params: { functionId: string, executionId: string };
189209

190-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
191-
params = paramsOrFirst as { functionId: string, executionId: string };
210+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
211+
params = (paramsOrFirst || {}) as { functionId: string, executionId: string };
192212
} else {
193213
params = {
194214
functionId: paramsOrFirst as string,

src/services/graphql.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ export class Graphql extends Service {
1616
/**
1717
* Execute a GraphQL mutation.
1818
*
19-
* @param {object} query - The query or queries to execute.
19+
* @param {object} params.query - The query or queries to execute.
2020
* @throws {AppwriteException}
2121
* @returns {Promise}
2222
*/
2323
query(params: { query: object }): Promise<{}>;
2424
/**
25-
* @deprecated Parameter-based methods will be removed in the upcoming version.
26-
* Please use the object based method instead for better developer experience.
25+
* Execute a GraphQL mutation.
26+
*
27+
* @param {object} query - The query or queries to execute.
28+
* @throws {AppwriteException}
29+
* @returns {Promise} * @deprecated Flat parameter style methods will be removed in a future version.
30+
* Please use the object parameter style method instead for a better developer experience.
2731
*
2832
* @example
2933
* // Old (deprecated)
@@ -38,8 +42,8 @@ export class Graphql extends Service {
3842
): Promise<{}> {
3943
let params: { query: object };
4044

41-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst) {
42-
params = paramsOrFirst as { query: object };
45+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
46+
params = (paramsOrFirst || {}) as { query: object };
4347
} else {
4448
params = {
4549
query: paramsOrFirst as object
@@ -69,14 +73,18 @@ export class Graphql extends Service {
6973
/**
7074
* Execute a GraphQL mutation.
7175
*
72-
* @param {object} query - The query or queries to execute.
76+
* @param {object} params.query - The query or queries to execute.
7377
* @throws {AppwriteException}
7478
* @returns {Promise}
7579
*/
7680
mutation(params: { query: object }): Promise<{}>;
7781
/**
78-
* @deprecated Parameter-based methods will be removed in the upcoming version.
79-
* Please use the object based method instead for better developer experience.
82+
* Execute a GraphQL mutation.
83+
*
84+
* @param {object} query - The query or queries to execute.
85+
* @throws {AppwriteException}
86+
* @returns {Promise} * @deprecated Flat parameter style methods will be removed in a future version.
87+
* Please use the object parameter style method instead for a better developer experience.
8088
*
8189
* @example
8290
* // Old (deprecated)
@@ -91,8 +99,8 @@ export class Graphql extends Service {
9199
): Promise<{}> {
92100
let params: { query: object };
93101

94-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst) {
95-
params = paramsOrFirst as { query: object };
102+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
103+
params = (paramsOrFirst || {}) as { query: object };
96104
} else {
97105
params = {
98106
query: paramsOrFirst as object

src/services/messaging.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,22 @@ export class Messaging extends Service {
1616
/**
1717
* Create a new subscriber.
1818
*
19-
* @param {string} topicId - Topic ID. The topic ID to subscribe to.
20-
* @param {string} subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
21-
* @param {string} targetId - Target ID. The target ID to link to the specified Topic ID.
19+
* @param {string} params.topicId - Topic ID. The topic ID to subscribe to.
20+
* @param {string} params.subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
21+
* @param {string} params.targetId - Target ID. The target ID to link to the specified Topic ID.
2222
* @throws {AppwriteException}
2323
* @returns {Promise}
2424
*/
2525
createSubscriber(params: { topicId: string, subscriberId: string, targetId: string }): Promise<Models.Subscriber>;
2626
/**
27-
* @deprecated Parameter-based methods will be removed in the upcoming version.
28-
* Please use the object based method instead for better developer experience.
27+
* Create a new subscriber.
28+
*
29+
* @param {string} topicId - Topic ID. The topic ID to subscribe to.
30+
* @param {string} subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
31+
* @param {string} targetId - Target ID. The target ID to link to the specified Topic ID.
32+
* @throws {AppwriteException}
33+
* @returns {Promise} * @deprecated Flat parameter style methods will be removed in a future version.
34+
* Please use the object parameter style method instead for a better developer experience.
2935
*
3036
* @example
3137
* // Old (deprecated)
@@ -41,8 +47,8 @@ export class Messaging extends Service {
4147
): Promise<Models.Subscriber> {
4248
let params: { topicId: string, subscriberId: string, targetId: string };
4349

44-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
45-
params = paramsOrFirst as { topicId: string, subscriberId: string, targetId: string };
50+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
51+
params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string, targetId: string };
4652
} else {
4753
params = {
4854
topicId: paramsOrFirst as string,
@@ -87,15 +93,20 @@ export class Messaging extends Service {
8793
/**
8894
* Delete a subscriber by its unique ID.
8995
*
90-
* @param {string} topicId - Topic ID. The topic ID subscribed to.
91-
* @param {string} subscriberId - Subscriber ID.
96+
* @param {string} params.topicId - Topic ID. The topic ID subscribed to.
97+
* @param {string} params.subscriberId - Subscriber ID.
9298
* @throws {AppwriteException}
9399
* @returns {Promise}
94100
*/
95101
deleteSubscriber(params: { topicId: string, subscriberId: string }): Promise<{}>;
96102
/**
97-
* @deprecated Parameter-based methods will be removed in the upcoming version.
98-
* Please use the object based method instead for better developer experience.
103+
* Delete a subscriber by its unique ID.
104+
*
105+
* @param {string} topicId - Topic ID. The topic ID subscribed to.
106+
* @param {string} subscriberId - Subscriber ID.
107+
* @throws {AppwriteException}
108+
* @returns {Promise} * @deprecated Flat parameter style methods will be removed in a future version.
109+
* Please use the object parameter style method instead for a better developer experience.
99110
*
100111
* @example
101112
* // Old (deprecated)
@@ -111,8 +122,8 @@ export class Messaging extends Service {
111122
): Promise<{}> {
112123
let params: { topicId: string, subscriberId: string };
113124

114-
if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
115-
params = paramsOrFirst as { topicId: string, subscriberId: string };
125+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
126+
params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string };
116127
} else {
117128
params = {
118129
topicId: paramsOrFirst as string,

0 commit comments

Comments
 (0)