node-appwrite 17.2.0 → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +67 -2
  2. package/dist/client.js +3 -3
  3. package/dist/client.js.map +1 -1
  4. package/dist/client.mjs +3 -3
  5. package/dist/client.mjs.map +1 -1
  6. package/dist/enums/credit-card.d.mts +1 -1
  7. package/dist/enums/credit-card.d.ts +1 -1
  8. package/dist/enums/credit-card.js +1 -1
  9. package/dist/enums/credit-card.js.map +1 -1
  10. package/dist/enums/credit-card.mjs +1 -1
  11. package/dist/enums/credit-card.mjs.map +1 -1
  12. package/dist/enums/execution-method.d.mts +2 -1
  13. package/dist/enums/execution-method.d.ts +2 -1
  14. package/dist/enums/execution-method.js +1 -0
  15. package/dist/enums/execution-method.js.map +1 -1
  16. package/dist/enums/execution-method.mjs +1 -0
  17. package/dist/enums/execution-method.mjs.map +1 -1
  18. package/dist/enums/index-type.d.mts +2 -1
  19. package/dist/enums/index-type.d.ts +2 -1
  20. package/dist/enums/index-type.js +1 -0
  21. package/dist/enums/index-type.js.map +1 -1
  22. package/dist/enums/index-type.mjs +1 -0
  23. package/dist/enums/index-type.mjs.map +1 -1
  24. package/dist/enums/{v-c-s-deployment-type.js → vcs-deployment-type.js} +1 -1
  25. package/dist/enums/vcs-deployment-type.js.map +1 -0
  26. package/dist/enums/{v-c-s-deployment-type.mjs → vcs-deployment-type.mjs} +2 -2
  27. package/dist/enums/vcs-deployment-type.mjs.map +1 -0
  28. package/dist/index.d.mts +2 -1
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.js +7 -2
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +2 -1
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/models.d.mts +1058 -153
  35. package/dist/models.d.ts +1058 -153
  36. package/dist/query.d.mts +196 -6
  37. package/dist/query.d.ts +196 -6
  38. package/dist/query.js +192 -2
  39. package/dist/query.js.map +1 -1
  40. package/dist/query.mjs +192 -2
  41. package/dist/query.mjs.map +1 -1
  42. package/dist/services/account.d.mts +625 -70
  43. package/dist/services/account.d.ts +625 -70
  44. package/dist/services/account.js +592 -292
  45. package/dist/services/account.js.map +1 -1
  46. package/dist/services/account.mjs +592 -292
  47. package/dist/services/account.mjs.map +1 -1
  48. package/dist/services/avatars.d.mts +157 -26
  49. package/dist/services/avatars.d.ts +157 -26
  50. package/dist/services/avatars.js +104 -93
  51. package/dist/services/avatars.js.map +1 -1
  52. package/dist/services/avatars.mjs +104 -93
  53. package/dist/services/avatars.mjs.map +1 -1
  54. package/dist/services/databases.d.mts +1425 -248
  55. package/dist/services/databases.d.ts +1425 -248
  56. package/dist/services/databases.js +1186 -611
  57. package/dist/services/databases.js.map +1 -1
  58. package/dist/services/databases.mjs +1186 -611
  59. package/dist/services/databases.mjs.map +1 -1
  60. package/dist/services/functions.d.mts +530 -107
  61. package/dist/services/functions.d.ts +530 -107
  62. package/dist/services/functions.js +393 -276
  63. package/dist/services/functions.js.map +1 -1
  64. package/dist/services/functions.mjs +393 -276
  65. package/dist/services/functions.mjs.map +1 -1
  66. package/dist/services/graphql.d.mts +24 -2
  67. package/dist/services/graphql.d.ts +24 -2
  68. package/dist/services/graphql.js +20 -16
  69. package/dist/services/graphql.js.map +1 -1
  70. package/dist/services/graphql.mjs +20 -16
  71. package/dist/services/graphql.mjs.map +1 -1
  72. package/dist/services/health.d.mts +175 -16
  73. package/dist/services/health.d.ts +175 -16
  74. package/dist/services/health.js +144 -115
  75. package/dist/services/health.js.map +1 -1
  76. package/dist/services/health.mjs +144 -115
  77. package/dist/services/health.mjs.map +1 -1
  78. package/dist/services/locale.js.map +1 -1
  79. package/dist/services/locale.mjs.map +1 -1
  80. package/dist/services/messaging.d.mts +1544 -262
  81. package/dist/services/messaging.d.ts +1544 -262
  82. package/dist/services/messaging.js +1417 -592
  83. package/dist/services/messaging.js.map +1 -1
  84. package/dist/services/messaging.mjs +1417 -592
  85. package/dist/services/messaging.mjs.map +1 -1
  86. package/dist/services/sites.d.mts +495 -99
  87. package/dist/services/sites.d.ts +495 -99
  88. package/dist/services/sites.js +371 -258
  89. package/dist/services/sites.js.map +1 -1
  90. package/dist/services/sites.mjs +371 -258
  91. package/dist/services/sites.mjs.map +1 -1
  92. package/dist/services/storage.d.mts +306 -63
  93. package/dist/services/storage.d.ts +306 -63
  94. package/dist/services/storage.js +225 -158
  95. package/dist/services/storage.js.map +1 -1
  96. package/dist/services/storage.mjs +225 -158
  97. package/dist/services/storage.mjs.map +1 -1
  98. package/dist/services/tables-db.d.mts +1744 -0
  99. package/dist/services/tables-db.d.ts +1744 -0
  100. package/dist/services/tables-db.js +2692 -0
  101. package/dist/services/tables-db.js.map +1 -0
  102. package/dist/services/tables-db.mjs +2691 -0
  103. package/dist/services/tables-db.mjs.map +1 -0
  104. package/dist/services/teams.d.mts +233 -39
  105. package/dist/services/teams.d.ts +233 -39
  106. package/dist/services/teams.js +170 -135
  107. package/dist/services/teams.js.map +1 -1
  108. package/dist/services/teams.mjs +170 -135
  109. package/dist/services/teams.mjs.map +1 -1
  110. package/dist/services/tokens.d.mts +76 -11
  111. package/dist/services/tokens.d.ts +76 -11
  112. package/dist/services/tokens.js +60 -45
  113. package/dist/services/tokens.js.map +1 -1
  114. package/dist/services/tokens.mjs +60 -45
  115. package/dist/services/tokens.mjs.map +1 -1
  116. package/dist/services/users.d.mts +842 -115
  117. package/dist/services/users.d.ts +842 -115
  118. package/dist/services/users.js +719 -408
  119. package/dist/services/users.js.map +1 -1
  120. package/dist/services/users.mjs +719 -408
  121. package/dist/services/users.mjs.map +1 -1
  122. package/package.json +1 -1
  123. package/dist/enums/v-c-s-deployment-type.js.map +0 -1
  124. package/dist/enums/v-c-s-deployment-type.mjs.map +0 -1
  125. /package/dist/enums/{v-c-s-deployment-type.d.mts → vcs-deployment-type.d.mts} +0 -0
  126. /package/dist/enums/{v-c-s-deployment-type.d.ts → vcs-deployment-type.d.ts} +0 -0
@@ -8,46 +8,111 @@ declare class Tokens {
8
8
  /**
9
9
  * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.
10
10
  *
11
- * @param {string} bucketId
12
- * @param {string} fileId
13
- * @param {string[]} queries
11
+ * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
12
+ * @param {string} params.fileId - File unique ID.
13
+ * @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: expire
14
14
  * @throws {AppwriteException}
15
15
  * @returns {Promise<Models.ResourceTokenList>}
16
16
  */
17
+ list(params: {
18
+ bucketId: string;
19
+ fileId: string;
20
+ queries?: string[];
21
+ }): Promise<Models.ResourceTokenList>;
22
+ /**
23
+ * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.
24
+ *
25
+ * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
26
+ * @param {string} fileId - File unique 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: expire
28
+ * @throws {AppwriteException}
29
+ * @returns {Promise<Models.ResourceTokenList>}
30
+ * @deprecated Use the object parameter style method for a better developer experience.
31
+ */
17
32
  list(bucketId: string, fileId: string, queries?: string[]): Promise<Models.ResourceTokenList>;
18
33
  /**
19
34
  * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
20
35
  *
21
- * @param {string} bucketId
22
- * @param {string} fileId
23
- * @param {string} expire
36
+ * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
37
+ * @param {string} params.fileId - File unique ID.
38
+ * @param {string} params.expire - Token expiry date
24
39
  * @throws {AppwriteException}
25
40
  * @returns {Promise<Models.ResourceToken>}
26
41
  */
42
+ createFileToken(params: {
43
+ bucketId: string;
44
+ fileId: string;
45
+ expire?: string;
46
+ }): Promise<Models.ResourceToken>;
47
+ /**
48
+ * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
49
+ *
50
+ * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
51
+ * @param {string} fileId - File unique ID.
52
+ * @param {string} expire - Token expiry date
53
+ * @throws {AppwriteException}
54
+ * @returns {Promise<Models.ResourceToken>}
55
+ * @deprecated Use the object parameter style method for a better developer experience.
56
+ */
27
57
  createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken>;
28
58
  /**
29
59
  * Get a token by its unique ID.
30
60
  *
31
- * @param {string} tokenId
61
+ * @param {string} params.tokenId - Token ID.
32
62
  * @throws {AppwriteException}
33
63
  * @returns {Promise<Models.ResourceToken>}
34
64
  */
65
+ get(params: {
66
+ tokenId: string;
67
+ }): Promise<Models.ResourceToken>;
68
+ /**
69
+ * Get a token by its unique ID.
70
+ *
71
+ * @param {string} tokenId - Token ID.
72
+ * @throws {AppwriteException}
73
+ * @returns {Promise<Models.ResourceToken>}
74
+ * @deprecated Use the object parameter style method for a better developer experience.
75
+ */
35
76
  get(tokenId: string): Promise<Models.ResourceToken>;
36
77
  /**
37
- * Update a token by its unique ID. Use this endpoint to update a token&#039;s expiry date.
78
+ * Update a token by its unique ID. Use this endpoint to update a token's expiry date.
79
+ *
80
+ * @param {string} params.tokenId - Token unique ID.
81
+ * @param {string} params.expire - File token expiry date
82
+ * @throws {AppwriteException}
83
+ * @returns {Promise<Models.ResourceToken>}
84
+ */
85
+ update(params: {
86
+ tokenId: string;
87
+ expire?: string;
88
+ }): Promise<Models.ResourceToken>;
89
+ /**
90
+ * Update a token by its unique ID. Use this endpoint to update a token's expiry date.
38
91
  *
39
- * @param {string} tokenId
40
- * @param {string} expire
92
+ * @param {string} tokenId - Token unique ID.
93
+ * @param {string} expire - File token expiry date
41
94
  * @throws {AppwriteException}
42
95
  * @returns {Promise<Models.ResourceToken>}
96
+ * @deprecated Use the object parameter style method for a better developer experience.
43
97
  */
44
98
  update(tokenId: string, expire?: string): Promise<Models.ResourceToken>;
45
99
  /**
46
100
  * Delete a token by its unique ID.
47
101
  *
48
- * @param {string} tokenId
102
+ * @param {string} params.tokenId - Token ID.
103
+ * @throws {AppwriteException}
104
+ * @returns {Promise<{}>}
105
+ */
106
+ delete(params: {
107
+ tokenId: string;
108
+ }): Promise<{}>;
109
+ /**
110
+ * Delete a token by its unique ID.
111
+ *
112
+ * @param {string} tokenId - Token ID.
49
113
  * @throws {AppwriteException}
50
114
  * @returns {Promise<{}>}
115
+ * @deprecated Use the object parameter style method for a better developer experience.
51
116
  */
52
117
  delete(tokenId: string): Promise<{}>;
53
118
  }
@@ -8,46 +8,111 @@ declare class Tokens {
8
8
  /**
9
9
  * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.
10
10
  *
11
- * @param {string} bucketId
12
- * @param {string} fileId
13
- * @param {string[]} queries
11
+ * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
12
+ * @param {string} params.fileId - File unique ID.
13
+ * @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: expire
14
14
  * @throws {AppwriteException}
15
15
  * @returns {Promise<Models.ResourceTokenList>}
16
16
  */
17
+ list(params: {
18
+ bucketId: string;
19
+ fileId: string;
20
+ queries?: string[];
21
+ }): Promise<Models.ResourceTokenList>;
22
+ /**
23
+ * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.
24
+ *
25
+ * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
26
+ * @param {string} fileId - File unique 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: expire
28
+ * @throws {AppwriteException}
29
+ * @returns {Promise<Models.ResourceTokenList>}
30
+ * @deprecated Use the object parameter style method for a better developer experience.
31
+ */
17
32
  list(bucketId: string, fileId: string, queries?: string[]): Promise<Models.ResourceTokenList>;
18
33
  /**
19
34
  * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
20
35
  *
21
- * @param {string} bucketId
22
- * @param {string} fileId
23
- * @param {string} expire
36
+ * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
37
+ * @param {string} params.fileId - File unique ID.
38
+ * @param {string} params.expire - Token expiry date
24
39
  * @throws {AppwriteException}
25
40
  * @returns {Promise<Models.ResourceToken>}
26
41
  */
42
+ createFileToken(params: {
43
+ bucketId: string;
44
+ fileId: string;
45
+ expire?: string;
46
+ }): Promise<Models.ResourceToken>;
47
+ /**
48
+ * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
49
+ *
50
+ * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
51
+ * @param {string} fileId - File unique ID.
52
+ * @param {string} expire - Token expiry date
53
+ * @throws {AppwriteException}
54
+ * @returns {Promise<Models.ResourceToken>}
55
+ * @deprecated Use the object parameter style method for a better developer experience.
56
+ */
27
57
  createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken>;
28
58
  /**
29
59
  * Get a token by its unique ID.
30
60
  *
31
- * @param {string} tokenId
61
+ * @param {string} params.tokenId - Token ID.
32
62
  * @throws {AppwriteException}
33
63
  * @returns {Promise<Models.ResourceToken>}
34
64
  */
65
+ get(params: {
66
+ tokenId: string;
67
+ }): Promise<Models.ResourceToken>;
68
+ /**
69
+ * Get a token by its unique ID.
70
+ *
71
+ * @param {string} tokenId - Token ID.
72
+ * @throws {AppwriteException}
73
+ * @returns {Promise<Models.ResourceToken>}
74
+ * @deprecated Use the object parameter style method for a better developer experience.
75
+ */
35
76
  get(tokenId: string): Promise<Models.ResourceToken>;
36
77
  /**
37
- * Update a token by its unique ID. Use this endpoint to update a token&#039;s expiry date.
78
+ * Update a token by its unique ID. Use this endpoint to update a token's expiry date.
79
+ *
80
+ * @param {string} params.tokenId - Token unique ID.
81
+ * @param {string} params.expire - File token expiry date
82
+ * @throws {AppwriteException}
83
+ * @returns {Promise<Models.ResourceToken>}
84
+ */
85
+ update(params: {
86
+ tokenId: string;
87
+ expire?: string;
88
+ }): Promise<Models.ResourceToken>;
89
+ /**
90
+ * Update a token by its unique ID. Use this endpoint to update a token's expiry date.
38
91
  *
39
- * @param {string} tokenId
40
- * @param {string} expire
92
+ * @param {string} tokenId - Token unique ID.
93
+ * @param {string} expire - File token expiry date
41
94
  * @throws {AppwriteException}
42
95
  * @returns {Promise<Models.ResourceToken>}
96
+ * @deprecated Use the object parameter style method for a better developer experience.
43
97
  */
44
98
  update(tokenId: string, expire?: string): Promise<Models.ResourceToken>;
45
99
  /**
46
100
  * Delete a token by its unique ID.
47
101
  *
48
- * @param {string} tokenId
102
+ * @param {string} params.tokenId - Token ID.
103
+ * @throws {AppwriteException}
104
+ * @returns {Promise<{}>}
105
+ */
106
+ delete(params: {
107
+ tokenId: string;
108
+ }): Promise<{}>;
109
+ /**
110
+ * Delete a token by its unique ID.
111
+ *
112
+ * @param {string} tokenId - Token ID.
49
113
  * @throws {AppwriteException}
50
114
  * @returns {Promise<{}>}
115
+ * @deprecated Use the object parameter style method for a better developer experience.
51
116
  */
52
117
  delete(tokenId: string): Promise<{}>;
53
118
  }
@@ -6,16 +6,20 @@ class Tokens {
6
6
  constructor(client) {
7
7
  this.client = client;
8
8
  }
9
- /**
10
- * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.
11
- *
12
- * @param {string} bucketId
13
- * @param {string} fileId
14
- * @param {string[]} queries
15
- * @throws {AppwriteException}
16
- * @returns {Promise<Models.ResourceTokenList>}
17
- */
18
- list(bucketId, fileId, queries) {
9
+ list(paramsOrFirst, ...rest) {
10
+ let params;
11
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
12
+ params = paramsOrFirst || {};
13
+ } else {
14
+ params = {
15
+ bucketId: paramsOrFirst,
16
+ fileId: rest[0],
17
+ queries: rest[1]
18
+ };
19
+ }
20
+ const bucketId = params.bucketId;
21
+ const fileId = params.fileId;
22
+ const queries = params.queries;
19
23
  if (typeof bucketId === "undefined") {
20
24
  throw new client.AppwriteException('Missing required parameter: "bucketId"');
21
25
  }
@@ -36,16 +40,20 @@ class Tokens {
36
40
  payload
37
41
  );
38
42
  }
39
- /**
40
- * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
41
- *
42
- * @param {string} bucketId
43
- * @param {string} fileId
44
- * @param {string} expire
45
- * @throws {AppwriteException}
46
- * @returns {Promise<Models.ResourceToken>}
47
- */
48
- createFileToken(bucketId, fileId, expire) {
43
+ createFileToken(paramsOrFirst, ...rest) {
44
+ let params;
45
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
46
+ params = paramsOrFirst || {};
47
+ } else {
48
+ params = {
49
+ bucketId: paramsOrFirst,
50
+ fileId: rest[0],
51
+ expire: rest[1]
52
+ };
53
+ }
54
+ const bucketId = params.bucketId;
55
+ const fileId = params.fileId;
56
+ const expire = params.expire;
49
57
  if (typeof bucketId === "undefined") {
50
58
  throw new client.AppwriteException('Missing required parameter: "bucketId"');
51
59
  }
@@ -68,14 +76,16 @@ class Tokens {
68
76
  payload
69
77
  );
70
78
  }
71
- /**
72
- * Get a token by its unique ID.
73
- *
74
- * @param {string} tokenId
75
- * @throws {AppwriteException}
76
- * @returns {Promise<Models.ResourceToken>}
77
- */
78
- get(tokenId) {
79
+ get(paramsOrFirst) {
80
+ let params;
81
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
82
+ params = paramsOrFirst || {};
83
+ } else {
84
+ params = {
85
+ tokenId: paramsOrFirst
86
+ };
87
+ }
88
+ const tokenId = params.tokenId;
79
89
  if (typeof tokenId === "undefined") {
80
90
  throw new client.AppwriteException('Missing required parameter: "tokenId"');
81
91
  }
@@ -90,15 +100,18 @@ class Tokens {
90
100
  payload
91
101
  );
92
102
  }
93
- /**
94
- * Update a token by its unique ID. Use this endpoint to update a token&#039;s expiry date.
95
- *
96
- * @param {string} tokenId
97
- * @param {string} expire
98
- * @throws {AppwriteException}
99
- * @returns {Promise<Models.ResourceToken>}
100
- */
101
- update(tokenId, expire) {
103
+ update(paramsOrFirst, ...rest) {
104
+ let params;
105
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
106
+ params = paramsOrFirst || {};
107
+ } else {
108
+ params = {
109
+ tokenId: paramsOrFirst,
110
+ expire: rest[0]
111
+ };
112
+ }
113
+ const tokenId = params.tokenId;
114
+ const expire = params.expire;
102
115
  if (typeof tokenId === "undefined") {
103
116
  throw new client.AppwriteException('Missing required parameter: "tokenId"');
104
117
  }
@@ -118,14 +131,16 @@ class Tokens {
118
131
  payload
119
132
  );
120
133
  }
121
- /**
122
- * Delete a token by its unique ID.
123
- *
124
- * @param {string} tokenId
125
- * @throws {AppwriteException}
126
- * @returns {Promise<{}>}
127
- */
128
- delete(tokenId) {
134
+ delete(paramsOrFirst) {
135
+ let params;
136
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
137
+ params = paramsOrFirst || {};
138
+ } else {
139
+ params = {
140
+ tokenId: paramsOrFirst
141
+ };
142
+ }
143
+ const tokenId = params.tokenId;
129
144
  if (typeof tokenId === "undefined") {
130
145
  throw new client.AppwriteException('Missing required parameter: "tokenId"');
131
146
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/services/tokens.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I,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AACJ","sourcesContent":["import { AppwriteException, Client, type Payload, UploadProgress } from '../client';\nimport type { Models } from '../models';\n\nexport class Tokens {\n client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.\n *\n * @param {string} bucketId\n * @param {string} fileId\n * @param {string[]} queries\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceTokenList>}\n */\n list(bucketId: string, fileId: string, queries?: string[]): Promise<Models.ResourceTokenList> {\n if (typeof bucketId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"bucketId\"');\n }\n if (typeof fileId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"fileId\"');\n }\n const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);\n const payload: Payload = {};\n if (typeof queries !== 'undefined') {\n payload['queries'] = queries;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.\n *\n * @param {string} bucketId\n * @param {string} fileId\n * @param {string} expire\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken> {\n if (typeof bucketId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"bucketId\"');\n }\n if (typeof fileId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"fileId\"');\n }\n const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);\n const payload: Payload = {};\n if (typeof expire !== 'undefined') {\n payload['expire'] = expire;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'post',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Get a token by its unique ID.\n *\n * @param {string} tokenId\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n get(tokenId: string): Promise<Models.ResourceToken> {\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Update a token by its unique ID. Use this endpoint to update a token&#039;s expiry date.\n *\n * @param {string} tokenId\n * @param {string} expire\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n update(tokenId: string, expire?: string): Promise<Models.ResourceToken> {\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n if (typeof expire !== 'undefined') {\n payload['expire'] = expire;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'patch',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Delete a token by its unique ID.\n *\n * @param {string} tokenId\n * @throws {AppwriteException}\n * @returns {Promise<{}>}\n */\n delete(tokenId: string): Promise<{}> {\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'delete',\n uri,\n apiHeaders,\n payload,\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/services/tokens.ts"],"names":[],"mappings":"AAAA,SAAS,yBAA+D;AAIjE,MAAM,OAAO;AAAA,EAGhB,YAAY,QAAgB;AACxB,SAAK,SAAS;AAAA,EAClB;AAAA,EAuBA,KACI,kBACG,MAC8B;AACjC,QAAI;AAEJ,QAAK,iBAAiB,OAAO,kBAAkB,YAAY,CAAC,MAAM,QAAQ,aAAa,GAAI;AACvF,eAAU,iBAAiB,CAAC;AAAA,IAChC,OAAO;AACH,eAAS;AAAA,QACL,UAAU;AAAA,QACV,QAAQ,KAAK,CAAC;AAAA,QACd,SAAS,KAAK,CAAC;AAAA,MACnB;AAAA,IACJ;AAEA,UAAM,WAAW,OAAO;AACxB,UAAM,SAAS,OAAO;AACtB,UAAM,UAAU,OAAO;AAEvB,QAAI,OAAO,aAAa,aAAa;AACjC,YAAM,IAAI,kBAAkB,wCAAwC;AAAA,IACxE;AACA,QAAI,OAAO,WAAW,aAAa;AAC/B,YAAM,IAAI,kBAAkB,sCAAsC;AAAA,IACtE;AAEA,UAAM,UAAU,4CAA4C,QAAQ,cAAc,QAAQ,EAAE,QAAQ,YAAY,MAAM;AACtH,UAAM,UAAmB,CAAC;AAC1B,QAAI,OAAO,YAAY,aAAa;AAChC,cAAQ,SAAS,IAAI;AAAA,IACzB;AACA,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C,CACjD;AAEA,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EAuBA,gBACI,kBACG,MAC0B;AAC7B,QAAI;AAEJ,QAAK,iBAAiB,OAAO,kBAAkB,YAAY,CAAC,MAAM,QAAQ,a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AAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AACJ","sourcesContent":["import { AppwriteException, Client, type Payload, UploadProgress } from '../client';\nimport type { Models } from '../models';\n\n\nexport class Tokens {\n client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.\n *\n * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).\n * @param {string} params.fileId - File unique ID.\n * @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: expire\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceTokenList>}\n */\n list(params: { bucketId: string, fileId: string, queries?: string[] }): Promise<Models.ResourceTokenList>;\n /**\n * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.\n *\n * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).\n * @param {string} fileId - File unique ID.\n * @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: expire\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceTokenList>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n list(bucketId: string, fileId: string, queries?: string[]): Promise<Models.ResourceTokenList>;\n list(\n paramsOrFirst: { bucketId: string, fileId: string, queries?: string[] } | string,\n ...rest: [(string)?, (string[])?] \n ): Promise<Models.ResourceTokenList> {\n let params: { bucketId: string, fileId: string, queries?: string[] };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, queries?: string[] };\n } else {\n params = {\n bucketId: paramsOrFirst as string,\n fileId: rest[0] as string,\n queries: rest[1] as string[] \n };\n }\n \n const bucketId = params.bucketId;\n const fileId = params.fileId;\n const queries = params.queries;\n\n if (typeof bucketId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"bucketId\"');\n }\n if (typeof fileId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"fileId\"');\n }\n\n const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);\n const payload: Payload = {};\n if (typeof queries !== 'undefined') {\n payload['queries'] = queries;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.\n *\n * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).\n * @param {string} params.fileId - File unique ID.\n * @param {string} params.expire - Token expiry date\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n createFileToken(params: { bucketId: string, fileId: string, expire?: string }): Promise<Models.ResourceToken>;\n /**\n * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.\n *\n * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).\n * @param {string} fileId - File unique ID.\n * @param {string} expire - Token expiry date\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken>;\n createFileToken(\n paramsOrFirst: { bucketId: string, fileId: string, expire?: string } | string,\n ...rest: [(string)?, (string)?] \n ): Promise<Models.ResourceToken> {\n let params: { bucketId: string, fileId: string, expire?: string };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, expire?: string };\n } else {\n params = {\n bucketId: paramsOrFirst as string,\n fileId: rest[0] as string,\n expire: rest[1] as string \n };\n }\n \n const bucketId = params.bucketId;\n const fileId = params.fileId;\n const expire = params.expire;\n\n if (typeof bucketId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"bucketId\"');\n }\n if (typeof fileId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"fileId\"');\n }\n\n const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);\n const payload: Payload = {};\n if (typeof expire !== 'undefined') {\n payload['expire'] = expire;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'post',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Get a token by its unique ID.\n *\n * @param {string} params.tokenId - Token ID.\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n get(params: { tokenId: string }): Promise<Models.ResourceToken>;\n /**\n * Get a token by its unique ID.\n *\n * @param {string} tokenId - Token ID.\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n get(tokenId: string): Promise<Models.ResourceToken>;\n get(\n paramsOrFirst: { tokenId: string } | string \n ): Promise<Models.ResourceToken> {\n let params: { tokenId: string };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { tokenId: string };\n } else {\n params = {\n tokenId: paramsOrFirst as string \n };\n }\n \n const tokenId = params.tokenId;\n\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Update a token by its unique ID. Use this endpoint to update a token's expiry date.\n *\n * @param {string} params.tokenId - Token unique ID.\n * @param {string} params.expire - File token expiry date\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n update(params: { tokenId: string, expire?: string }): Promise<Models.ResourceToken>;\n /**\n * Update a token by its unique ID. Use this endpoint to update a token's expiry date.\n *\n * @param {string} tokenId - Token unique ID.\n * @param {string} expire - File token expiry date\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n update(tokenId: string, expire?: string): Promise<Models.ResourceToken>;\n update(\n paramsOrFirst: { tokenId: string, expire?: string } | string,\n ...rest: [(string)?] \n ): Promise<Models.ResourceToken> {\n let params: { tokenId: string, expire?: string };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { tokenId: string, expire?: string };\n } else {\n params = {\n tokenId: paramsOrFirst as string,\n expire: rest[0] as string \n };\n }\n \n const tokenId = params.tokenId;\n const expire = params.expire;\n\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n if (typeof expire !== 'undefined') {\n payload['expire'] = expire;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'patch',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Delete a token by its unique ID.\n *\n * @param {string} params.tokenId - Token ID.\n * @throws {AppwriteException}\n * @returns {Promise<{}>}\n */\n delete(params: { tokenId: string }): Promise<{}>;\n /**\n * Delete a token by its unique ID.\n *\n * @param {string} tokenId - Token ID.\n * @throws {AppwriteException}\n * @returns {Promise<{}>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n delete(tokenId: string): Promise<{}>;\n delete(\n paramsOrFirst: { tokenId: string } | string \n ): Promise<{}> {\n let params: { tokenId: string };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { tokenId: string };\n } else {\n params = {\n tokenId: paramsOrFirst as string \n };\n }\n \n const tokenId = params.tokenId;\n\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'delete',\n uri,\n apiHeaders,\n payload,\n );\n }\n}\n"]}
@@ -5,16 +5,20 @@ var Tokens = class {
5
5
  constructor(client) {
6
6
  this.client = client;
7
7
  }
8
- /**
9
- * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.
10
- *
11
- * @param {string} bucketId
12
- * @param {string} fileId
13
- * @param {string[]} queries
14
- * @throws {AppwriteException}
15
- * @returns {Promise<Models.ResourceTokenList>}
16
- */
17
- list(bucketId, fileId, queries) {
8
+ list(paramsOrFirst, ...rest) {
9
+ let params;
10
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
11
+ params = paramsOrFirst || {};
12
+ } else {
13
+ params = {
14
+ bucketId: paramsOrFirst,
15
+ fileId: rest[0],
16
+ queries: rest[1]
17
+ };
18
+ }
19
+ const bucketId = params.bucketId;
20
+ const fileId = params.fileId;
21
+ const queries = params.queries;
18
22
  if (typeof bucketId === "undefined") {
19
23
  throw new AppwriteException('Missing required parameter: "bucketId"');
20
24
  }
@@ -35,16 +39,20 @@ var Tokens = class {
35
39
  payload
36
40
  );
37
41
  }
38
- /**
39
- * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
40
- *
41
- * @param {string} bucketId
42
- * @param {string} fileId
43
- * @param {string} expire
44
- * @throws {AppwriteException}
45
- * @returns {Promise<Models.ResourceToken>}
46
- */
47
- createFileToken(bucketId, fileId, expire) {
42
+ createFileToken(paramsOrFirst, ...rest) {
43
+ let params;
44
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
45
+ params = paramsOrFirst || {};
46
+ } else {
47
+ params = {
48
+ bucketId: paramsOrFirst,
49
+ fileId: rest[0],
50
+ expire: rest[1]
51
+ };
52
+ }
53
+ const bucketId = params.bucketId;
54
+ const fileId = params.fileId;
55
+ const expire = params.expire;
48
56
  if (typeof bucketId === "undefined") {
49
57
  throw new AppwriteException('Missing required parameter: "bucketId"');
50
58
  }
@@ -67,14 +75,16 @@ var Tokens = class {
67
75
  payload
68
76
  );
69
77
  }
70
- /**
71
- * Get a token by its unique ID.
72
- *
73
- * @param {string} tokenId
74
- * @throws {AppwriteException}
75
- * @returns {Promise<Models.ResourceToken>}
76
- */
77
- get(tokenId) {
78
+ get(paramsOrFirst) {
79
+ let params;
80
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
81
+ params = paramsOrFirst || {};
82
+ } else {
83
+ params = {
84
+ tokenId: paramsOrFirst
85
+ };
86
+ }
87
+ const tokenId = params.tokenId;
78
88
  if (typeof tokenId === "undefined") {
79
89
  throw new AppwriteException('Missing required parameter: "tokenId"');
80
90
  }
@@ -89,15 +99,18 @@ var Tokens = class {
89
99
  payload
90
100
  );
91
101
  }
92
- /**
93
- * Update a token by its unique ID. Use this endpoint to update a token&#039;s expiry date.
94
- *
95
- * @param {string} tokenId
96
- * @param {string} expire
97
- * @throws {AppwriteException}
98
- * @returns {Promise<Models.ResourceToken>}
99
- */
100
- update(tokenId, expire) {
102
+ update(paramsOrFirst, ...rest) {
103
+ let params;
104
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
105
+ params = paramsOrFirst || {};
106
+ } else {
107
+ params = {
108
+ tokenId: paramsOrFirst,
109
+ expire: rest[0]
110
+ };
111
+ }
112
+ const tokenId = params.tokenId;
113
+ const expire = params.expire;
101
114
  if (typeof tokenId === "undefined") {
102
115
  throw new AppwriteException('Missing required parameter: "tokenId"');
103
116
  }
@@ -117,14 +130,16 @@ var Tokens = class {
117
130
  payload
118
131
  );
119
132
  }
120
- /**
121
- * Delete a token by its unique ID.
122
- *
123
- * @param {string} tokenId
124
- * @throws {AppwriteException}
125
- * @returns {Promise<{}>}
126
- */
127
- delete(tokenId) {
133
+ delete(paramsOrFirst) {
134
+ let params;
135
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
136
+ params = paramsOrFirst || {};
137
+ } else {
138
+ params = {
139
+ tokenId: paramsOrFirst
140
+ };
141
+ }
142
+ const tokenId = params.tokenId;
128
143
  if (typeof tokenId === "undefined") {
129
144
  throw new AppwriteException('Missing required parameter: "tokenId"');
130
145
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/services/tokens.ts"],"names":[],"mappings":";AAAA,SAAS,yBAA+D;AAGjE,IAAM,SAAN,MAAa;AAAA,EAGhB,YAAY,QAAgB;AACxB,SAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,KAAK,UAAkB,QAAgB,SAAuD;AAC1F,QAAI,OAAO,aAAa,aAAa;AACjC,YAAM,IAAI,kBAAkB,wCAAwC;AAAA,IACxE;AACA,QAAI,OAAO,WAAW,aAAa;AAC/B,YAAM,IAAI,kBAAkB,sCAAsC;AAAA,IACtE;AACA,UAAM,UAAU,4CAA4C,QAAQ,cAAc,QAAQ,EAAE,QAAQ,YAA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,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,SAAiB,QAAgD;AACpE,QAAI,OAAO,YAAY,aAAa;AAChC,YAAM,IAAI,kBAAkB,uCAAuC;AAAA,IACvE;AACA,UAAM,UAAU,oBAAoB,QAAQ,aAAa,OAAO;AAChE,UAAM,UAAmB,CAAC;AAC1B,QAAI,OAAO,WAAW,aAAa;AAC/B,cAAQ,QAAQ,IAAI;AAAA,IACxB;AACA,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,OAAO,SAA8B;AACjC,QAAI,OAAO,YAAY,aAAa;AAChC,YAAM,IAAI,kBAAkB,uCAAuC;AAAA,IACvE;AACA,UAAM,UAAU,oBAAoB,QAAQ,aAAa,OAAO;AAChE,UAAM,UAAmB,CAAC;AAC1B,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AACJ","sourcesContent":["import { AppwriteException, Client, type Payload, UploadProgress } from '../client';\nimport type { Models } from '../models';\n\nexport class Tokens {\n client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.\n *\n * @param {string} bucketId\n * @param {string} fileId\n * @param {string[]} queries\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceTokenList>}\n */\n list(bucketId: string, fileId: string, queries?: string[]): Promise<Models.ResourceTokenList> {\n if (typeof bucketId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"bucketId\"');\n }\n if (typeof fileId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"fileId\"');\n }\n const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);\n const payload: Payload = {};\n if (typeof queries !== 'undefined') {\n payload['queries'] = queries;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.\n *\n * @param {string} bucketId\n * @param {string} fileId\n * @param {string} expire\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken> {\n if (typeof bucketId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"bucketId\"');\n }\n if (typeof fileId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"fileId\"');\n }\n const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);\n const payload: Payload = {};\n if (typeof expire !== 'undefined') {\n payload['expire'] = expire;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'post',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Get a token by its unique ID.\n *\n * @param {string} tokenId\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n get(tokenId: string): Promise<Models.ResourceToken> {\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Update a token by its unique ID. Use this endpoint to update a token&#039;s expiry date.\n *\n * @param {string} tokenId\n * @param {string} expire\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n update(tokenId: string, expire?: string): Promise<Models.ResourceToken> {\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n if (typeof expire !== 'undefined') {\n payload['expire'] = expire;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'patch',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Delete a token by its unique ID.\n *\n * @param {string} tokenId\n * @throws {AppwriteException}\n * @returns {Promise<{}>}\n */\n delete(tokenId: string): Promise<{}> {\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'delete',\n uri,\n apiHeaders,\n payload,\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/services/tokens.ts"],"names":[],"mappings":";AAAA,SAAS,yBAA+D;AAIjE,IAAM,SAAN,MAAa;AAAA,EAGhB,YAAY,QAAgB;AACxB,SAAK,SAAS;AAAA,EAClB;AAAA,EAuBA,KACI,kBACG,MAC8B;AACjC,QAAI;AAEJ,QAAK,iBAAiB,OAAO,kBAAkB,YAAY,CAAC,MAAM,QAAQ,aAAa,GAAI;AACvF,eAAU,iBAAiB,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AAChC,YAAM,IAAI,kBAAkB,uCAAuC;AAAA,IACvE;AAEA,UAAM,UAAU,oBAAoB,QAAQ,aAAa,OAAO;AAChE,UAAM,UAAmB,CAAC;AAC1B,QAAI,OAAO,WAAW,aAAa;AAC/B,cAAQ,QAAQ,IAAI;AAAA,IACxB;AACA,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EAmBA,OACI,eACW;AACX,QAAI;AAEJ,QAAK,iBAAiB,OAAO,kBAAkB,YAAY,CAAC,MAAM,QAAQ,aAAa,GAAI;AACvF,eAAU,iBAAiB,CAAC;AAAA,IAChC,OAAO;AACH,eAAS;AAAA,QACL,SAAS;AAAA,MACb;AAAA,IACJ;AAEA,UAAM,UAAU,OAAO;AAEvB,QAAI,OAAO,YAAY,aAAa;AAChC,YAAM,IAAI,kBAAkB,uCAAuC;AAAA,IACvE;AAEA,UAAM,UAAU,oBAAoB,QAAQ,aAAa,OAAO;AAChE,UAAM,UAAmB,CAAC;AAC1B,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,OAAO;AAEzD,UAAM,aAA2C;AAAA,MAC7C,gBAAgB;AAAA,IACpB;AAEA,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AACJ","sourcesContent":["import { AppwriteException, Client, type Payload, UploadProgress } from '../client';\nimport type { Models } from '../models';\n\n\nexport class Tokens {\n client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.\n *\n * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).\n * @param {string} params.fileId - File unique ID.\n * @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: expire\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceTokenList>}\n */\n list(params: { bucketId: string, fileId: string, queries?: string[] }): Promise<Models.ResourceTokenList>;\n /**\n * List all the tokens created for a specific file or bucket. You can use the query params to filter your results.\n *\n * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).\n * @param {string} fileId - File unique ID.\n * @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: expire\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceTokenList>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n list(bucketId: string, fileId: string, queries?: string[]): Promise<Models.ResourceTokenList>;\n list(\n paramsOrFirst: { bucketId: string, fileId: string, queries?: string[] } | string,\n ...rest: [(string)?, (string[])?] \n ): Promise<Models.ResourceTokenList> {\n let params: { bucketId: string, fileId: string, queries?: string[] };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, queries?: string[] };\n } else {\n params = {\n bucketId: paramsOrFirst as string,\n fileId: rest[0] as string,\n queries: rest[1] as string[] \n };\n }\n \n const bucketId = params.bucketId;\n const fileId = params.fileId;\n const queries = params.queries;\n\n if (typeof bucketId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"bucketId\"');\n }\n if (typeof fileId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"fileId\"');\n }\n\n const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);\n const payload: Payload = {};\n if (typeof queries !== 'undefined') {\n payload['queries'] = queries;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.\n *\n * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).\n * @param {string} params.fileId - File unique ID.\n * @param {string} params.expire - Token expiry date\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n createFileToken(params: { bucketId: string, fileId: string, expire?: string }): Promise<Models.ResourceToken>;\n /**\n * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.\n *\n * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).\n * @param {string} fileId - File unique ID.\n * @param {string} expire - Token expiry date\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken>;\n createFileToken(\n paramsOrFirst: { bucketId: string, fileId: string, expire?: string } | string,\n ...rest: [(string)?, (string)?] \n ): Promise<Models.ResourceToken> {\n let params: { bucketId: string, fileId: string, expire?: string };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, expire?: string };\n } else {\n params = {\n bucketId: paramsOrFirst as string,\n fileId: rest[0] as string,\n expire: rest[1] as string \n };\n }\n \n const bucketId = params.bucketId;\n const fileId = params.fileId;\n const expire = params.expire;\n\n if (typeof bucketId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"bucketId\"');\n }\n if (typeof fileId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"fileId\"');\n }\n\n const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);\n const payload: Payload = {};\n if (typeof expire !== 'undefined') {\n payload['expire'] = expire;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'post',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Get a token by its unique ID.\n *\n * @param {string} params.tokenId - Token ID.\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n get(params: { tokenId: string }): Promise<Models.ResourceToken>;\n /**\n * Get a token by its unique ID.\n *\n * @param {string} tokenId - Token ID.\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n get(tokenId: string): Promise<Models.ResourceToken>;\n get(\n paramsOrFirst: { tokenId: string } | string \n ): Promise<Models.ResourceToken> {\n let params: { tokenId: string };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { tokenId: string };\n } else {\n params = {\n tokenId: paramsOrFirst as string \n };\n }\n \n const tokenId = params.tokenId;\n\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n }\n\n return this.client.call(\n 'get',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Update a token by its unique ID. Use this endpoint to update a token's expiry date.\n *\n * @param {string} params.tokenId - Token unique ID.\n * @param {string} params.expire - File token expiry date\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n */\n update(params: { tokenId: string, expire?: string }): Promise<Models.ResourceToken>;\n /**\n * Update a token by its unique ID. Use this endpoint to update a token's expiry date.\n *\n * @param {string} tokenId - Token unique ID.\n * @param {string} expire - File token expiry date\n * @throws {AppwriteException}\n * @returns {Promise<Models.ResourceToken>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n update(tokenId: string, expire?: string): Promise<Models.ResourceToken>;\n update(\n paramsOrFirst: { tokenId: string, expire?: string } | string,\n ...rest: [(string)?] \n ): Promise<Models.ResourceToken> {\n let params: { tokenId: string, expire?: string };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { tokenId: string, expire?: string };\n } else {\n params = {\n tokenId: paramsOrFirst as string,\n expire: rest[0] as string \n };\n }\n \n const tokenId = params.tokenId;\n const expire = params.expire;\n\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n if (typeof expire !== 'undefined') {\n payload['expire'] = expire;\n }\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'patch',\n uri,\n apiHeaders,\n payload,\n );\n }\n\n /**\n * Delete a token by its unique ID.\n *\n * @param {string} params.tokenId - Token ID.\n * @throws {AppwriteException}\n * @returns {Promise<{}>}\n */\n delete(params: { tokenId: string }): Promise<{}>;\n /**\n * Delete a token by its unique ID.\n *\n * @param {string} tokenId - Token ID.\n * @throws {AppwriteException}\n * @returns {Promise<{}>}\n * @deprecated Use the object parameter style method for a better developer experience.\n */\n delete(tokenId: string): Promise<{}>;\n delete(\n paramsOrFirst: { tokenId: string } | string \n ): Promise<{}> {\n let params: { tokenId: string };\n \n if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {\n params = (paramsOrFirst || {}) as { tokenId: string };\n } else {\n params = {\n tokenId: paramsOrFirst as string \n };\n }\n \n const tokenId = params.tokenId;\n\n if (typeof tokenId === 'undefined') {\n throw new AppwriteException('Missing required parameter: \"tokenId\"');\n }\n\n const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId);\n const payload: Payload = {};\n const uri = new URL(this.client.config.endpoint + apiPath);\n\n const apiHeaders: { [header: string]: string } = {\n 'content-type': 'application/json',\n }\n\n return this.client.call(\n 'delete',\n uri,\n apiHeaders,\n payload,\n );\n }\n}\n"]}