@appwrite.io/console 5.0.0 → 6.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 (41) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -2
  3. package/dist/cjs/sdk.js +516 -285
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +516 -286
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +517 -286
  8. package/docs/examples/domains/{confirm-purchase.md → update-purchase.md} +1 -1
  9. package/docs/examples/domains/{confirm-transfer-in.md → update-transfer-in.md} +1 -1
  10. package/docs/examples/{projects/update-webhook.md → webhooks/create.md} +5 -6
  11. package/docs/examples/{projects/get-webhook.md → webhooks/delete.md} +3 -4
  12. package/docs/examples/{projects/delete-webhook.md → webhooks/get.md} +3 -4
  13. package/docs/examples/{projects/list-webhooks.md → webhooks/list.md} +4 -4
  14. package/docs/examples/{projects/update-webhook-signature.md → webhooks/update-signature.md} +3 -4
  15. package/docs/examples/{projects/create-webhook.md → webhooks/update.md} +6 -6
  16. package/package.json +1 -1
  17. package/src/client.ts +1 -1
  18. package/src/enums/build-runtime.ts +86 -3
  19. package/src/enums/domain-purchase-status.ts +6 -0
  20. package/src/enums/{domain-transfer-status-status.ts → domain-transfer-status-enum.ts} +1 -1
  21. package/src/enums/runtime.ts +86 -3
  22. package/src/enums/runtimes.ts +86 -3
  23. package/src/enums/scopes.ts +2 -0
  24. package/src/index.ts +3 -2
  25. package/src/models.ts +58 -16
  26. package/src/services/domains.ts +30 -30
  27. package/src/services/projects.ts +0 -473
  28. package/src/services/webhooks.ts +451 -0
  29. package/types/enums/build-runtime.d.ts +87 -4
  30. package/types/enums/domain-purchase-status.d.ts +6 -0
  31. package/types/enums/{domain-transfer-status-status.d.ts → domain-transfer-status-enum.d.ts} +1 -1
  32. package/types/enums/runtime.d.ts +87 -4
  33. package/types/enums/runtimes.d.ts +87 -4
  34. package/types/enums/scopes.d.ts +2 -0
  35. package/types/index.d.ts +3 -2
  36. package/types/models.d.ts +57 -16
  37. package/types/services/domains.d.ts +22 -22
  38. package/types/services/projects.d.ts +0 -171
  39. package/types/services/webhooks.d.ts +165 -0
  40. package/src/enums/domain-purchase-payment-status.ts +0 -10
  41. package/types/enums/domain-purchase-payment-status.d.ts +0 -10
@@ -221,9 +221,9 @@ export class Domains {
221
221
  * @param {string} params.companyName - Company or organization name for the registrant.
222
222
  * @param {number} params.periodYears - Registration term in years (1-10).
223
223
  * @throws {AppwriteException}
224
- * @returns {Promise<Models.Domain>}
224
+ * @returns {Promise<Models.DomainPurchase>}
225
225
  */
226
- createPurchase(params: { domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number }): Promise<Models.Domain>;
226
+ createPurchase(params: { domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number }): Promise<Models.DomainPurchase>;
227
227
  /**
228
228
  * Create a domain purchase with registrant information.
229
229
  *
@@ -239,14 +239,14 @@ export class Domains {
239
239
  * @param {string} companyName - Company or organization name for the registrant.
240
240
  * @param {number} periodYears - Registration term in years (1-10).
241
241
  * @throws {AppwriteException}
242
- * @returns {Promise<Models.Domain>}
242
+ * @returns {Promise<Models.DomainPurchase>}
243
243
  * @deprecated Use the object parameter style method for a better developer experience.
244
244
  */
245
- createPurchase(domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number): Promise<Models.Domain>;
245
+ createPurchase(domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number): Promise<Models.DomainPurchase>;
246
246
  createPurchase(
247
247
  paramsOrFirst: { domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number } | string,
248
248
  ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?]
249
- ): Promise<Models.Domain> {
249
+ ): Promise<Models.DomainPurchase> {
250
250
  let params: { domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number };
251
251
 
252
252
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -354,28 +354,28 @@ export class Domains {
354
354
  }
355
355
 
356
356
  /**
357
- * Confirm a domain purchase after payment authentication. Call this after the client has confirmed the payment via Stripe.js.
357
+ * Confirm and complete a domain purchase after payment authentication.
358
358
  *
359
359
  * @param {string} params.domainId - Domain ID to confirm purchase for.
360
360
  * @param {string} params.organizationId - Team ID that owns the domain.
361
361
  * @throws {AppwriteException}
362
- * @returns {Promise<Models.Domain>}
362
+ * @returns {Promise<Models.DomainPurchase>}
363
363
  */
364
- confirmPurchase(params: { domainId: string, organizationId: string }): Promise<Models.Domain>;
364
+ updatePurchase(params: { domainId: string, organizationId: string }): Promise<Models.DomainPurchase>;
365
365
  /**
366
- * Confirm a domain purchase after payment authentication. Call this after the client has confirmed the payment via Stripe.js.
366
+ * Confirm and complete a domain purchase after payment authentication.
367
367
  *
368
368
  * @param {string} domainId - Domain ID to confirm purchase for.
369
369
  * @param {string} organizationId - Team ID that owns the domain.
370
370
  * @throws {AppwriteException}
371
- * @returns {Promise<Models.Domain>}
371
+ * @returns {Promise<Models.DomainPurchase>}
372
372
  * @deprecated Use the object parameter style method for a better developer experience.
373
373
  */
374
- confirmPurchase(domainId: string, organizationId: string): Promise<Models.Domain>;
375
- confirmPurchase(
374
+ updatePurchase(domainId: string, organizationId: string): Promise<Models.DomainPurchase>;
375
+ updatePurchase(
376
376
  paramsOrFirst: { domainId: string, organizationId: string } | string,
377
377
  ...rest: [(string)?]
378
- ): Promise<Models.Domain> {
378
+ ): Promise<Models.DomainPurchase> {
379
379
  let params: { domainId: string, organizationId: string };
380
380
 
381
381
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -397,7 +397,7 @@ export class Domains {
397
397
  throw new AppwriteException('Missing required parameter: "organizationId"');
398
398
  }
399
399
 
400
- const apiPath = '/domains/purchases/{domainId}/confirm'.replace('{domainId}', domainId);
400
+ const apiPath = '/domains/purchases/{domainId}'.replace('{domainId}', domainId);
401
401
  const payload: Payload = {};
402
402
  if (typeof organizationId !== 'undefined') {
403
403
  payload['organizationId'] = organizationId;
@@ -409,7 +409,7 @@ export class Domains {
409
409
  }
410
410
 
411
411
  return this.client.call(
412
- 'post',
412
+ 'patch',
413
413
  uri,
414
414
  apiHeaders,
415
415
  payload
@@ -514,9 +514,9 @@ export class Domains {
514
514
  * @param {string} params.authCode - Authorization code for the domain transfer.
515
515
  * @param {string} params.paymentMethodId - Payment method ID to authorize and capture the transfer.
516
516
  * @throws {AppwriteException}
517
- * @returns {Promise<Models.Domain>}
517
+ * @returns {Promise<Models.DomainPurchase>}
518
518
  */
519
- createTransferIn(params: { domain: string, organizationId: string, authCode: string, paymentMethodId: string }): Promise<Models.Domain>;
519
+ createTransferIn(params: { domain: string, organizationId: string, authCode: string, paymentMethodId: string }): Promise<Models.DomainPurchase>;
520
520
  /**
521
521
  * Create a domain transfer in with authorization code and registrant information.
522
522
  *
@@ -525,14 +525,14 @@ export class Domains {
525
525
  * @param {string} authCode - Authorization code for the domain transfer.
526
526
  * @param {string} paymentMethodId - Payment method ID to authorize and capture the transfer.
527
527
  * @throws {AppwriteException}
528
- * @returns {Promise<Models.Domain>}
528
+ * @returns {Promise<Models.DomainPurchase>}
529
529
  * @deprecated Use the object parameter style method for a better developer experience.
530
530
  */
531
- createTransferIn(domain: string, organizationId: string, authCode: string, paymentMethodId: string): Promise<Models.Domain>;
531
+ createTransferIn(domain: string, organizationId: string, authCode: string, paymentMethodId: string): Promise<Models.DomainPurchase>;
532
532
  createTransferIn(
533
533
  paramsOrFirst: { domain: string, organizationId: string, authCode: string, paymentMethodId: string } | string,
534
534
  ...rest: [(string)?, (string)?, (string)?]
535
- ): Promise<Models.Domain> {
535
+ ): Promise<Models.DomainPurchase> {
536
536
  let params: { domain: string, organizationId: string, authCode: string, paymentMethodId: string };
537
537
 
538
538
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -593,28 +593,28 @@ export class Domains {
593
593
  }
594
594
 
595
595
  /**
596
- * Confirm a domain transfer in after payment authentication. Call this after the client has confirmed the payment via Stripe.js.
596
+ * Confirm and complete a domain transfer in after payment authentication.
597
597
  *
598
598
  * @param {string} params.domainId - Domain ID to confirm transfer for.
599
599
  * @param {string} params.organizationId - Team ID that owns the domain.
600
600
  * @throws {AppwriteException}
601
- * @returns {Promise<Models.Domain>}
601
+ * @returns {Promise<Models.DomainPurchase>}
602
602
  */
603
- confirmTransferIn(params: { domainId: string, organizationId: string }): Promise<Models.Domain>;
603
+ updateTransferIn(params: { domainId: string, organizationId: string }): Promise<Models.DomainPurchase>;
604
604
  /**
605
- * Confirm a domain transfer in after payment authentication. Call this after the client has confirmed the payment via Stripe.js.
605
+ * Confirm and complete a domain transfer in after payment authentication.
606
606
  *
607
607
  * @param {string} domainId - Domain ID to confirm transfer for.
608
608
  * @param {string} organizationId - Team ID that owns the domain.
609
609
  * @throws {AppwriteException}
610
- * @returns {Promise<Models.Domain>}
610
+ * @returns {Promise<Models.DomainPurchase>}
611
611
  * @deprecated Use the object parameter style method for a better developer experience.
612
612
  */
613
- confirmTransferIn(domainId: string, organizationId: string): Promise<Models.Domain>;
614
- confirmTransferIn(
613
+ updateTransferIn(domainId: string, organizationId: string): Promise<Models.DomainPurchase>;
614
+ updateTransferIn(
615
615
  paramsOrFirst: { domainId: string, organizationId: string } | string,
616
616
  ...rest: [(string)?]
617
- ): Promise<Models.Domain> {
617
+ ): Promise<Models.DomainPurchase> {
618
618
  let params: { domainId: string, organizationId: string };
619
619
 
620
620
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -636,7 +636,7 @@ export class Domains {
636
636
  throw new AppwriteException('Missing required parameter: "organizationId"');
637
637
  }
638
638
 
639
- const apiPath = '/domains/transfers/in/{domainId}/confirm'.replace('{domainId}', domainId);
639
+ const apiPath = '/domains/transfers/in/{domainId}'.replace('{domainId}', domainId);
640
640
  const payload: Payload = {};
641
641
  if (typeof organizationId !== 'undefined') {
642
642
  payload['organizationId'] = organizationId;
@@ -648,7 +648,7 @@ export class Domains {
648
648
  }
649
649
 
650
650
  return this.client.call(
651
- 'post',
651
+ 'patch',
652
652
  uri,
653
653
  apiHeaders,
654
654
  payload
@@ -4428,477 +4428,4 @@ export class Projects {
4428
4428
  payload
4429
4429
  );
4430
4430
  }
4431
-
4432
- /**
4433
- * Get a list of all webhooks belonging to the project. You can use the query params to filter your results.
4434
- *
4435
- * @param {string} params.projectId - Project unique ID.
4436
- * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
4437
- * @throws {AppwriteException}
4438
- * @returns {Promise<Models.WebhookList>}
4439
- */
4440
- listWebhooks(params: { projectId: string, total?: boolean }): Promise<Models.WebhookList>;
4441
- /**
4442
- * Get a list of all webhooks belonging to the project. You can use the query params to filter your results.
4443
- *
4444
- * @param {string} projectId - Project unique ID.
4445
- * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
4446
- * @throws {AppwriteException}
4447
- * @returns {Promise<Models.WebhookList>}
4448
- * @deprecated Use the object parameter style method for a better developer experience.
4449
- */
4450
- listWebhooks(projectId: string, total?: boolean): Promise<Models.WebhookList>;
4451
- listWebhooks(
4452
- paramsOrFirst: { projectId: string, total?: boolean } | string,
4453
- ...rest: [(boolean)?]
4454
- ): Promise<Models.WebhookList> {
4455
- let params: { projectId: string, total?: boolean };
4456
-
4457
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4458
- params = (paramsOrFirst || {}) as { projectId: string, total?: boolean };
4459
- } else {
4460
- params = {
4461
- projectId: paramsOrFirst as string,
4462
- total: rest[0] as boolean
4463
- };
4464
- }
4465
-
4466
- const projectId = params.projectId;
4467
- const total = params.total;
4468
-
4469
- if (typeof projectId === 'undefined') {
4470
- throw new AppwriteException('Missing required parameter: "projectId"');
4471
- }
4472
-
4473
- const apiPath = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId);
4474
- const payload: Payload = {};
4475
- if (typeof total !== 'undefined') {
4476
- payload['total'] = total;
4477
- }
4478
- const uri = new URL(this.client.config.endpoint + apiPath);
4479
-
4480
- const apiHeaders: { [header: string]: string } = {
4481
- }
4482
-
4483
- return this.client.call(
4484
- 'get',
4485
- uri,
4486
- apiHeaders,
4487
- payload
4488
- );
4489
- }
4490
-
4491
- /**
4492
- * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur.
4493
- *
4494
- * @param {string} params.projectId - Project unique ID.
4495
- * @param {string} params.name - Webhook name. Max length: 128 chars.
4496
- * @param {string[]} params.events - Events list. Maximum of 100 events are allowed.
4497
- * @param {string} params.url - Webhook URL.
4498
- * @param {boolean} params.security - Certificate verification, false for disabled or true for enabled.
4499
- * @param {boolean} params.enabled - Enable or disable a webhook.
4500
- * @param {string} params.httpUser - Webhook HTTP user. Max length: 256 chars.
4501
- * @param {string} params.httpPass - Webhook HTTP password. Max length: 256 chars.
4502
- * @throws {AppwriteException}
4503
- * @returns {Promise<Models.Webhook>}
4504
- */
4505
- createWebhook(params: { projectId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string }): Promise<Models.Webhook>;
4506
- /**
4507
- * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur.
4508
- *
4509
- * @param {string} projectId - Project unique ID.
4510
- * @param {string} name - Webhook name. Max length: 128 chars.
4511
- * @param {string[]} events - Events list. Maximum of 100 events are allowed.
4512
- * @param {string} url - Webhook URL.
4513
- * @param {boolean} security - Certificate verification, false for disabled or true for enabled.
4514
- * @param {boolean} enabled - Enable or disable a webhook.
4515
- * @param {string} httpUser - Webhook HTTP user. Max length: 256 chars.
4516
- * @param {string} httpPass - Webhook HTTP password. Max length: 256 chars.
4517
- * @throws {AppwriteException}
4518
- * @returns {Promise<Models.Webhook>}
4519
- * @deprecated Use the object parameter style method for a better developer experience.
4520
- */
4521
- createWebhook(projectId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string): Promise<Models.Webhook>;
4522
- createWebhook(
4523
- paramsOrFirst: { projectId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string } | string,
4524
- ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (boolean)?, (string)?, (string)?]
4525
- ): Promise<Models.Webhook> {
4526
- let params: { projectId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string };
4527
-
4528
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4529
- params = (paramsOrFirst || {}) as { projectId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string };
4530
- } else {
4531
- params = {
4532
- projectId: paramsOrFirst as string,
4533
- name: rest[0] as string,
4534
- events: rest[1] as string[],
4535
- url: rest[2] as string,
4536
- security: rest[3] as boolean,
4537
- enabled: rest[4] as boolean,
4538
- httpUser: rest[5] as string,
4539
- httpPass: rest[6] as string
4540
- };
4541
- }
4542
-
4543
- const projectId = params.projectId;
4544
- const name = params.name;
4545
- const events = params.events;
4546
- const url = params.url;
4547
- const security = params.security;
4548
- const enabled = params.enabled;
4549
- const httpUser = params.httpUser;
4550
- const httpPass = params.httpPass;
4551
-
4552
- if (typeof projectId === 'undefined') {
4553
- throw new AppwriteException('Missing required parameter: "projectId"');
4554
- }
4555
- if (typeof name === 'undefined') {
4556
- throw new AppwriteException('Missing required parameter: "name"');
4557
- }
4558
- if (typeof events === 'undefined') {
4559
- throw new AppwriteException('Missing required parameter: "events"');
4560
- }
4561
- if (typeof url === 'undefined') {
4562
- throw new AppwriteException('Missing required parameter: "url"');
4563
- }
4564
- if (typeof security === 'undefined') {
4565
- throw new AppwriteException('Missing required parameter: "security"');
4566
- }
4567
-
4568
- const apiPath = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId);
4569
- const payload: Payload = {};
4570
- if (typeof name !== 'undefined') {
4571
- payload['name'] = name;
4572
- }
4573
- if (typeof enabled !== 'undefined') {
4574
- payload['enabled'] = enabled;
4575
- }
4576
- if (typeof events !== 'undefined') {
4577
- payload['events'] = events;
4578
- }
4579
- if (typeof url !== 'undefined') {
4580
- payload['url'] = url;
4581
- }
4582
- if (typeof security !== 'undefined') {
4583
- payload['security'] = security;
4584
- }
4585
- if (typeof httpUser !== 'undefined') {
4586
- payload['httpUser'] = httpUser;
4587
- }
4588
- if (typeof httpPass !== 'undefined') {
4589
- payload['httpPass'] = httpPass;
4590
- }
4591
- const uri = new URL(this.client.config.endpoint + apiPath);
4592
-
4593
- const apiHeaders: { [header: string]: string } = {
4594
- 'content-type': 'application/json',
4595
- }
4596
-
4597
- return this.client.call(
4598
- 'post',
4599
- uri,
4600
- apiHeaders,
4601
- payload
4602
- );
4603
- }
4604
-
4605
- /**
4606
- * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project.
4607
- *
4608
- * @param {string} params.projectId - Project unique ID.
4609
- * @param {string} params.webhookId - Webhook unique ID.
4610
- * @throws {AppwriteException}
4611
- * @returns {Promise<Models.Webhook>}
4612
- */
4613
- getWebhook(params: { projectId: string, webhookId: string }): Promise<Models.Webhook>;
4614
- /**
4615
- * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project.
4616
- *
4617
- * @param {string} projectId - Project unique ID.
4618
- * @param {string} webhookId - Webhook unique ID.
4619
- * @throws {AppwriteException}
4620
- * @returns {Promise<Models.Webhook>}
4621
- * @deprecated Use the object parameter style method for a better developer experience.
4622
- */
4623
- getWebhook(projectId: string, webhookId: string): Promise<Models.Webhook>;
4624
- getWebhook(
4625
- paramsOrFirst: { projectId: string, webhookId: string } | string,
4626
- ...rest: [(string)?]
4627
- ): Promise<Models.Webhook> {
4628
- let params: { projectId: string, webhookId: string };
4629
-
4630
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4631
- params = (paramsOrFirst || {}) as { projectId: string, webhookId: string };
4632
- } else {
4633
- params = {
4634
- projectId: paramsOrFirst as string,
4635
- webhookId: rest[0] as string
4636
- };
4637
- }
4638
-
4639
- const projectId = params.projectId;
4640
- const webhookId = params.webhookId;
4641
-
4642
- if (typeof projectId === 'undefined') {
4643
- throw new AppwriteException('Missing required parameter: "projectId"');
4644
- }
4645
- if (typeof webhookId === 'undefined') {
4646
- throw new AppwriteException('Missing required parameter: "webhookId"');
4647
- }
4648
-
4649
- const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
4650
- const payload: Payload = {};
4651
- const uri = new URL(this.client.config.endpoint + apiPath);
4652
-
4653
- const apiHeaders: { [header: string]: string } = {
4654
- }
4655
-
4656
- return this.client.call(
4657
- 'get',
4658
- uri,
4659
- apiHeaders,
4660
- payload
4661
- );
4662
- }
4663
-
4664
- /**
4665
- * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook.
4666
- *
4667
- * @param {string} params.projectId - Project unique ID.
4668
- * @param {string} params.webhookId - Webhook unique ID.
4669
- * @param {string} params.name - Webhook name. Max length: 128 chars.
4670
- * @param {string[]} params.events - Events list. Maximum of 100 events are allowed.
4671
- * @param {string} params.url - Webhook URL.
4672
- * @param {boolean} params.security - Certificate verification, false for disabled or true for enabled.
4673
- * @param {boolean} params.enabled - Enable or disable a webhook.
4674
- * @param {string} params.httpUser - Webhook HTTP user. Max length: 256 chars.
4675
- * @param {string} params.httpPass - Webhook HTTP password. Max length: 256 chars.
4676
- * @throws {AppwriteException}
4677
- * @returns {Promise<Models.Webhook>}
4678
- */
4679
- updateWebhook(params: { projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string }): Promise<Models.Webhook>;
4680
- /**
4681
- * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook.
4682
- *
4683
- * @param {string} projectId - Project unique ID.
4684
- * @param {string} webhookId - Webhook unique ID.
4685
- * @param {string} name - Webhook name. Max length: 128 chars.
4686
- * @param {string[]} events - Events list. Maximum of 100 events are allowed.
4687
- * @param {string} url - Webhook URL.
4688
- * @param {boolean} security - Certificate verification, false for disabled or true for enabled.
4689
- * @param {boolean} enabled - Enable or disable a webhook.
4690
- * @param {string} httpUser - Webhook HTTP user. Max length: 256 chars.
4691
- * @param {string} httpPass - Webhook HTTP password. Max length: 256 chars.
4692
- * @throws {AppwriteException}
4693
- * @returns {Promise<Models.Webhook>}
4694
- * @deprecated Use the object parameter style method for a better developer experience.
4695
- */
4696
- updateWebhook(projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string): Promise<Models.Webhook>;
4697
- updateWebhook(
4698
- paramsOrFirst: { projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string } | string,
4699
- ...rest: [(string)?, (string)?, (string[])?, (string)?, (boolean)?, (boolean)?, (string)?, (string)?]
4700
- ): Promise<Models.Webhook> {
4701
- let params: { projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string };
4702
-
4703
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4704
- params = (paramsOrFirst || {}) as { projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string };
4705
- } else {
4706
- params = {
4707
- projectId: paramsOrFirst as string,
4708
- webhookId: rest[0] as string,
4709
- name: rest[1] as string,
4710
- events: rest[2] as string[],
4711
- url: rest[3] as string,
4712
- security: rest[4] as boolean,
4713
- enabled: rest[5] as boolean,
4714
- httpUser: rest[6] as string,
4715
- httpPass: rest[7] as string
4716
- };
4717
- }
4718
-
4719
- const projectId = params.projectId;
4720
- const webhookId = params.webhookId;
4721
- const name = params.name;
4722
- const events = params.events;
4723
- const url = params.url;
4724
- const security = params.security;
4725
- const enabled = params.enabled;
4726
- const httpUser = params.httpUser;
4727
- const httpPass = params.httpPass;
4728
-
4729
- if (typeof projectId === 'undefined') {
4730
- throw new AppwriteException('Missing required parameter: "projectId"');
4731
- }
4732
- if (typeof webhookId === 'undefined') {
4733
- throw new AppwriteException('Missing required parameter: "webhookId"');
4734
- }
4735
- if (typeof name === 'undefined') {
4736
- throw new AppwriteException('Missing required parameter: "name"');
4737
- }
4738
- if (typeof events === 'undefined') {
4739
- throw new AppwriteException('Missing required parameter: "events"');
4740
- }
4741
- if (typeof url === 'undefined') {
4742
- throw new AppwriteException('Missing required parameter: "url"');
4743
- }
4744
- if (typeof security === 'undefined') {
4745
- throw new AppwriteException('Missing required parameter: "security"');
4746
- }
4747
-
4748
- const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
4749
- const payload: Payload = {};
4750
- if (typeof name !== 'undefined') {
4751
- payload['name'] = name;
4752
- }
4753
- if (typeof enabled !== 'undefined') {
4754
- payload['enabled'] = enabled;
4755
- }
4756
- if (typeof events !== 'undefined') {
4757
- payload['events'] = events;
4758
- }
4759
- if (typeof url !== 'undefined') {
4760
- payload['url'] = url;
4761
- }
4762
- if (typeof security !== 'undefined') {
4763
- payload['security'] = security;
4764
- }
4765
- if (typeof httpUser !== 'undefined') {
4766
- payload['httpUser'] = httpUser;
4767
- }
4768
- if (typeof httpPass !== 'undefined') {
4769
- payload['httpPass'] = httpPass;
4770
- }
4771
- const uri = new URL(this.client.config.endpoint + apiPath);
4772
-
4773
- const apiHeaders: { [header: string]: string } = {
4774
- 'content-type': 'application/json',
4775
- }
4776
-
4777
- return this.client.call(
4778
- 'put',
4779
- uri,
4780
- apiHeaders,
4781
- payload
4782
- );
4783
- }
4784
-
4785
- /**
4786
- * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events.
4787
- *
4788
- * @param {string} params.projectId - Project unique ID.
4789
- * @param {string} params.webhookId - Webhook unique ID.
4790
- * @throws {AppwriteException}
4791
- * @returns {Promise<{}>}
4792
- */
4793
- deleteWebhook(params: { projectId: string, webhookId: string }): Promise<{}>;
4794
- /**
4795
- * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events.
4796
- *
4797
- * @param {string} projectId - Project unique ID.
4798
- * @param {string} webhookId - Webhook unique ID.
4799
- * @throws {AppwriteException}
4800
- * @returns {Promise<{}>}
4801
- * @deprecated Use the object parameter style method for a better developer experience.
4802
- */
4803
- deleteWebhook(projectId: string, webhookId: string): Promise<{}>;
4804
- deleteWebhook(
4805
- paramsOrFirst: { projectId: string, webhookId: string } | string,
4806
- ...rest: [(string)?]
4807
- ): Promise<{}> {
4808
- let params: { projectId: string, webhookId: string };
4809
-
4810
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4811
- params = (paramsOrFirst || {}) as { projectId: string, webhookId: string };
4812
- } else {
4813
- params = {
4814
- projectId: paramsOrFirst as string,
4815
- webhookId: rest[0] as string
4816
- };
4817
- }
4818
-
4819
- const projectId = params.projectId;
4820
- const webhookId = params.webhookId;
4821
-
4822
- if (typeof projectId === 'undefined') {
4823
- throw new AppwriteException('Missing required parameter: "projectId"');
4824
- }
4825
- if (typeof webhookId === 'undefined') {
4826
- throw new AppwriteException('Missing required parameter: "webhookId"');
4827
- }
4828
-
4829
- const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
4830
- const payload: Payload = {};
4831
- const uri = new URL(this.client.config.endpoint + apiPath);
4832
-
4833
- const apiHeaders: { [header: string]: string } = {
4834
- 'content-type': 'application/json',
4835
- }
4836
-
4837
- return this.client.call(
4838
- 'delete',
4839
- uri,
4840
- apiHeaders,
4841
- payload
4842
- );
4843
- }
4844
-
4845
- /**
4846
- * Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook.
4847
- *
4848
- * @param {string} params.projectId - Project unique ID.
4849
- * @param {string} params.webhookId - Webhook unique ID.
4850
- * @throws {AppwriteException}
4851
- * @returns {Promise<Models.Webhook>}
4852
- */
4853
- updateWebhookSignature(params: { projectId: string, webhookId: string }): Promise<Models.Webhook>;
4854
- /**
4855
- * Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook.
4856
- *
4857
- * @param {string} projectId - Project unique ID.
4858
- * @param {string} webhookId - Webhook unique ID.
4859
- * @throws {AppwriteException}
4860
- * @returns {Promise<Models.Webhook>}
4861
- * @deprecated Use the object parameter style method for a better developer experience.
4862
- */
4863
- updateWebhookSignature(projectId: string, webhookId: string): Promise<Models.Webhook>;
4864
- updateWebhookSignature(
4865
- paramsOrFirst: { projectId: string, webhookId: string } | string,
4866
- ...rest: [(string)?]
4867
- ): Promise<Models.Webhook> {
4868
- let params: { projectId: string, webhookId: string };
4869
-
4870
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4871
- params = (paramsOrFirst || {}) as { projectId: string, webhookId: string };
4872
- } else {
4873
- params = {
4874
- projectId: paramsOrFirst as string,
4875
- webhookId: rest[0] as string
4876
- };
4877
- }
4878
-
4879
- const projectId = params.projectId;
4880
- const webhookId = params.webhookId;
4881
-
4882
- if (typeof projectId === 'undefined') {
4883
- throw new AppwriteException('Missing required parameter: "projectId"');
4884
- }
4885
- if (typeof webhookId === 'undefined') {
4886
- throw new AppwriteException('Missing required parameter: "webhookId"');
4887
- }
4888
-
4889
- const apiPath = '/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
4890
- const payload: Payload = {};
4891
- const uri = new URL(this.client.config.endpoint + apiPath);
4892
-
4893
- const apiHeaders: { [header: string]: string } = {
4894
- 'content-type': 'application/json',
4895
- }
4896
-
4897
- return this.client.call(
4898
- 'patch',
4899
- uri,
4900
- apiHeaders,
4901
- payload
4902
- );
4903
- }
4904
4431
  }