|
504 | 504 | } |
505 | 505 | ], |
506 | 506 | "operations": { |
507 | | - "newsletter": { |
| 507 | + "newsletters": { |
508 | 508 | "type": "namespace", |
509 | 509 | "operations": { |
510 | 510 | "list": { |
511 | 511 | "type": "operation", |
512 | 512 | "description": "List newsletters", |
513 | 513 | "method": "GET", |
514 | | - "path": "/newsletter", |
| 514 | + "path": "/newsletters", |
515 | 515 | "parameters": { |
516 | 516 | "query": { |
517 | 517 | "limit": { |
|
539 | 539 | "type": "operation", |
540 | 540 | "description": "Get newsletter", |
541 | 541 | "method": "GET", |
542 | | - "path": "/newsletter/:id", |
| 542 | + "path": "/newsletters/:id", |
543 | 543 | "parameters": { |
544 | 544 | "path": { |
545 | 545 | "id": { |
|
559 | 559 | "type": "Error & {code: \"RESOURCE_NOT_FOUND\"}" |
560 | 560 | } |
561 | 561 | ] |
| 562 | + } |
| 563 | + } |
| 564 | + }, |
| 565 | + "subscriptions": { |
| 566 | + "type": "namespace", |
| 567 | + "operations": { |
| 568 | + "list": { |
| 569 | + "type": "operation", |
| 570 | + "description": "List newsletter subscriptions", |
| 571 | + "token": "newsletter.subscriptions.list.own", |
| 572 | + "method": "GET", |
| 573 | + "path": "/subscriptions", |
| 574 | + "parameters": { |
| 575 | + "query": { |
| 576 | + "limit": { |
| 577 | + "description": "The number of subscriptions to return per page. No more than 50.", |
| 578 | + "default": "10", |
| 579 | + "type": "number", |
| 580 | + "required": false |
| 581 | + }, |
| 582 | + "page": { |
| 583 | + "description": "The page number. No more than 2³² (4294967296).", |
| 584 | + "default": "1", |
| 585 | + "type": "number", |
| 586 | + "required": false |
| 587 | + } |
| 588 | + } |
| 589 | + }, |
| 590 | + "returns": [ |
| 591 | + { |
| 592 | + "status": 200, |
| 593 | + "type": "DatedNewsletterSubscription[]" |
| 594 | + } |
| 595 | + ] |
562 | 596 | }, |
563 | | - "subscribe": { |
| 597 | + "get": { |
564 | 598 | "type": "operation", |
565 | | - "description": "Subscribe to newsletter", |
566 | | - "method": "POST", |
567 | | - "path": "/newsletter/:id/subscribe", |
| 599 | + "description": "Get newsletter subscription", |
| 600 | + "method": "GET", |
| 601 | + "path": "/subscriptions/:id", |
568 | 602 | "parameters": { |
569 | 603 | "path": { |
570 | 604 | "id": { |
571 | | - "description": "A newsletter ID", |
| 605 | + "description": "The ID of the subscription to get", |
572 | 606 | "type": "string", |
573 | 607 | "required": true |
574 | 608 | } |
| 609 | + } |
| 610 | + }, |
| 611 | + "returns": [ |
| 612 | + { |
| 613 | + "status": 200, |
| 614 | + "type": "DatedNewsletterSubscription" |
575 | 615 | }, |
| 616 | + { |
| 617 | + "status": 404, |
| 618 | + "type": "Error & {code: \"RESOURCE_NOT_FOUND\"}" |
| 619 | + } |
| 620 | + ] |
| 621 | + }, |
| 622 | + "create": { |
| 623 | + "type": "operation", |
| 624 | + "description": "Subscribe to newsletter", |
| 625 | + "method": "POST", |
| 626 | + "path": "/subscriptions", |
| 627 | + "parameters": { |
576 | 628 | "body": { |
| 629 | + "newsletter": { |
| 630 | + "description": "The ID of the newsletter to subscribe to", |
| 631 | + "type": "string", |
| 632 | + "required": true |
| 633 | + }, |
577 | 634 | "email": { |
578 | 635 | "description": "Subscriber's email address", |
579 | 636 | "type": "string", |
|
591 | 648 | "status": 201, |
592 | 649 | "type": "NewsletterSubscription" |
593 | 650 | }, |
594 | | - { |
595 | | - "status": 404, |
596 | | - "type": "Error & {code: \"RESOURCE_NOT_FOUND\"}" |
597 | | - }, |
598 | 651 | { |
599 | 652 | "status": 422, |
600 | 653 | "type": "Error & {code: \"INVALID_DATA\"}" |
|
604 | 657 | "type": "Error & {code: \"CONFLICT\"}" |
605 | 658 | } |
606 | 659 | ] |
607 | | - } |
608 | | - } |
609 | | - }, |
610 | | - "newsletters": { |
611 | | - "type": "namespace", |
612 | | - "operations": { |
613 | | - "unsubscribe": { |
| 660 | + }, |
| 661 | + "delete": { |
614 | 662 | "type": "operation", |
615 | | - "description": "Revoke a subscription (unsubscribe)", |
616 | | - "method": "POST", |
617 | | - "path": "/newsletters/unsubscribe", |
| 663 | + "description": "Unsubscribe from newsletter", |
| 664 | + "method": "DELETE", |
| 665 | + "path": "/subscriptions/:id", |
618 | 666 | "parameters": { |
619 | | - "body": { |
620 | | - "subscription": { |
| 667 | + "path": { |
| 668 | + "id": { |
621 | 669 | "description": "The ID of the subscription to revoke", |
622 | 670 | "type": "string", |
623 | 671 | "required": true |
|
638 | 686 | "type": "Error & {code: \"INVALID_DATA\"}" |
639 | 687 | } |
640 | 688 | ] |
641 | | - }, |
642 | | - "listSubscriptions": { |
643 | | - "type": "operation", |
644 | | - "description": "List subscriptions of the authenticated user", |
645 | | - "token": "newsletter.subscriptions.list.own", |
646 | | - "method": "GET", |
647 | | - "path": "/newsletters/subscriptions", |
648 | | - "parameters": { |
649 | | - "query": { |
650 | | - "limit": { |
651 | | - "description": "The number of subscriptions to return per page. No more than 50.", |
652 | | - "default": "10", |
653 | | - "type": "number", |
654 | | - "required": false |
655 | | - }, |
656 | | - "page": { |
657 | | - "description": "The page number. No more than 2³² (4294967296).", |
658 | | - "default": "1", |
659 | | - "type": "number", |
660 | | - "required": false |
661 | | - } |
662 | | - } |
663 | | - }, |
664 | | - "returns": [ |
665 | | - { |
666 | | - "status": 200, |
667 | | - "type": "DatedNewsletterSubscription[]" |
668 | | - } |
669 | | - ] |
670 | 689 | } |
671 | 690 | } |
672 | 691 | }, |
673 | | - "token": { |
| 692 | + "tokens": { |
674 | 693 | "type": "namespace", |
675 | 694 | "operations": { |
676 | 695 | "list": { |
677 | 696 | "type": "operation", |
678 | 697 | "description": "List tokens of user", |
679 | 698 | "token": "tokens.list.own", |
680 | 699 | "method": "GET", |
681 | | - "path": "/token", |
| 700 | + "path": "/tokens", |
682 | 701 | "parameters": { |
683 | 702 | "query": { |
684 | 703 | "limit": { |
|
712 | 731 | "description": "Create token", |
713 | 732 | "token": "tokens.create.own", |
714 | 733 | "method": "POST", |
715 | | - "path": "/token", |
| 734 | + "path": "/tokens", |
716 | 735 | "parameters": { |
717 | 736 | "body": { |
718 | 737 | "permissions": { |
|
748 | 767 | "description": "Get token details", |
749 | 768 | "token": "tokens.get.own", |
750 | 769 | "method": "GET", |
751 | | - "path": "/token/:id", |
| 770 | + "path": "/tokens/:id", |
752 | 771 | "parameters": { |
753 | 772 | "path": { |
754 | 773 | "id": { |
|
778 | 797 | "description": "Revoke token", |
779 | 798 | "token": "tokens.revoke.own", |
780 | 799 | "method": "DELETE", |
781 | | - "path": "/token/:id", |
| 800 | + "path": "/tokens/:id", |
782 | 801 | "parameters": { |
783 | 802 | "path": { |
784 | 803 | "id": { |
|
802 | 821 | "type": "Error & {code: \"INVALID_DATA\"}" |
803 | 822 | }, |
804 | 823 | { |
805 | | - "status": 400, |
| 824 | + "status": 423, |
806 | 825 | "type": "Error & {code: \"MODIFICATION_NOT_ALLOWED\"}" |
807 | 826 | } |
808 | 827 | ] |
|
812 | 831 | "description": "Get list of recent requests made with the token", |
813 | 832 | "token": "tokens.get.own.requests", |
814 | 833 | "method": "GET", |
815 | | - "path": "/token/:id/requests", |
| 834 | + "path": "/tokens/:id/requests", |
816 | 835 | "parameters": { |
817 | 836 | "path": { |
818 | 837 | "id": { |
|
856 | 875 | "description": "Get a recent request by ID", |
857 | 876 | "token": "tokens.get.own.requests", |
858 | 877 | "method": "GET", |
859 | | - "path": "/token/:id/requests/:request", |
| 878 | + "path": "/tokens/:id/requests/:request", |
860 | 879 | "parameters": { |
861 | 880 | "path": { |
862 | 881 | "id": { |
|
883 | 902 | { |
884 | 903 | "status": 422, |
885 | 904 | "type": "Error & {code: \"INVALID_DATA\"}" |
| 905 | + }, |
| 906 | + { |
| 907 | + "status": 423, |
| 908 | + "type": "Error & {code: \"MODIFICATION_NOT_ALLOWED\"}" |
886 | 909 | } |
887 | 910 | ] |
888 | | - } |
889 | | - } |
890 | | - }, |
891 | | - "tokens": { |
892 | | - "type": "namespace", |
893 | | - "operations": { |
| 911 | + }, |
894 | 912 | "refresh": { |
895 | 913 | "type": "operation", |
896 | 914 | "description": "Refresh current token. The token that was used to authenticate the request will be deleted. A new token with a new ID but the same permissions will be created and returned. The lifespan of the new token will be the same as the old one, starting from the time of the request. This operation effectively allows a token to be used indefinitely.", |
897 | 915 | "token": "token.refresh", |
898 | 916 | "method": "POST", |
899 | | - "path": "/token/refresh", |
900 | | - "parameters": {}, |
| 917 | + "path": "/tokens/:id", |
| 918 | + "parameters": { |
| 919 | + "path": { |
| 920 | + "id": { |
| 921 | + "description": "The ID of the token to refresh. Specify `current` to refresh the token that was used to authenticate the request.", |
| 922 | + "type": "string | \"current\"", |
| 923 | + "required": true |
| 924 | + } |
| 925 | + } |
| 926 | + }, |
901 | 927 | "returns": [ |
902 | 928 | { |
903 | | - "status": 201, |
| 929 | + "status": 200, |
904 | 930 | "type": "Token" |
905 | 931 | }, |
906 | 932 | { |
|
923 | 949 | "parameters": { |
924 | 950 | "body": { |
925 | 951 | "username": { |
926 | | - "description": "The username to use for the account. Must be between 3 and 32 characters long. Cannot start with `user_`. May contain only letters, numbers, dashes and underscores. Must be unique.", |
| 952 | + "description": "The username to use for the account. Must be between 3 and 20 characters long. Cannot start with `user_`. May contain only letters, numbers, dashes and underscores. Must be unique.", |
927 | 953 | "type": "string", |
928 | 954 | "required": true |
929 | 955 | }, |
|
1037 | 1063 | "parameters": { |
1038 | 1064 | "body": { |
1039 | 1065 | "username": { |
1040 | | - "description": "Your unique username. Between 3 and 64 characters. Only letters, numbers, dashes and underscores. May not start with `user_`.", |
| 1066 | + "description": "Your unique username. Between 3 and 20 characters. Only letters, numbers, dashes and underscores. May not start with `user_`.", |
1041 | 1067 | "type": "string", |
1042 | 1068 | "required": true |
1043 | 1069 | }, |
1044 | 1070 | "name": { |
1045 | | - "description": "Your full name. Set to `null` to remove.", |
| 1071 | + "description": "Your full name. Set to `null` to remove. Min 2 characters, max 32. Allowed characters (lowercase as well): A–Z `',-.,` and `ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞSŸ`", |
1046 | 1072 | "type": "string | null", |
1047 | 1073 | "required": false |
1048 | 1074 | } |
|
1081 | 1107 | "parameters": { |
1082 | 1108 | "body": { |
1083 | 1109 | "username": { |
1084 | | - "description": "Your unique username. Between 3 and 64 characters. Only letters, numbers, dashes and underscores. May not start with `user_`.", |
| 1110 | + "description": "Your unique username. Between 3 and 20 characters. Only letters, numbers, dashes and underscores. May not start with `user_`.", |
1085 | 1111 | "type": "string", |
1086 | 1112 | "required": true |
1087 | 1113 | }, |
1088 | 1114 | "name": { |
1089 | | - "description": "Your full name. Set to `null` to remove.", |
| 1115 | + "description": "Your full name. Set to `null` to remove. Min 2 characters, max 32. Allowed characters (lowercase as well): A–Z `',-.,` and `ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞSŸ`", |
1090 | 1116 | "type": "string | null", |
1091 | 1117 | "required": true |
1092 | 1118 | } |
|
0 commit comments