|
1 | | -from typing import Iterable, Optional, Union |
| 1 | +from typing import Dict, Iterable, Optional, Union |
2 | 2 |
|
3 | 3 | from crowdin_api.api_resources.abstract.resources import BaseResource |
4 | 4 | from crowdin_api.api_resources.ai.enums import ( |
@@ -804,6 +804,96 @@ def translate_ai_strings( |
804 | 804 | request_data=request_data, |
805 | 805 | ) |
806 | 806 |
|
| 807 | + def get_ai_provider_gateway_path( |
| 808 | + self, user_id: int, ai_provider_id: int, path: str |
| 809 | + ) -> str: |
| 810 | + return f"users/{user_id}/ai/providers/{ai_provider_id}/gateway/{path}" |
| 811 | + |
| 812 | + def get_ai_provider_gateway( |
| 813 | + self, user_id: int, ai_provider_id: int, path: str |
| 814 | + ): |
| 815 | + """ |
| 816 | + AI Provider Gateway GET Request |
| 817 | +
|
| 818 | + Link to documentation: |
| 819 | + https://support.crowdin.com/developer/api/v2/#tag/AI-Gateway/operation/api.ai.providers.gateway.crowdin.get |
| 820 | + """ |
| 821 | + return self.requester.request( |
| 822 | + method="get", |
| 823 | + path=self.get_ai_provider_gateway_path(user_id, ai_provider_id, path), |
| 824 | + ) |
| 825 | + |
| 826 | + def create_ai_provider_gateway( |
| 827 | + self, |
| 828 | + user_id: int, |
| 829 | + ai_provider_id: int, |
| 830 | + path: str, |
| 831 | + request_data: Optional[Dict] = None, |
| 832 | + ): |
| 833 | + """ |
| 834 | + AI Provider Gateway POST Request |
| 835 | +
|
| 836 | + Link to documentation: |
| 837 | + https://support.crowdin.com/developer/api/v2/#tag/AI-Gateway/operation/api.ai.providers.gateway.crowdin.post |
| 838 | + """ |
| 839 | + return self.requester.request( |
| 840 | + method="post", |
| 841 | + path=self.get_ai_provider_gateway_path(user_id, ai_provider_id, path), |
| 842 | + request_data=request_data, |
| 843 | + ) |
| 844 | + |
| 845 | + def replace_ai_provider_gateway( |
| 846 | + self, |
| 847 | + user_id: int, |
| 848 | + ai_provider_id: int, |
| 849 | + path: str, |
| 850 | + request_data: Optional[Dict] = None, |
| 851 | + ): |
| 852 | + """ |
| 853 | + AI Provider Gateway PUT Request |
| 854 | +
|
| 855 | + Link to documentation: |
| 856 | + https://support.crowdin.com/developer/api/v2/#tag/AI-Gateway/operation/api.ai.providers.gateway.crowdin.put |
| 857 | + """ |
| 858 | + return self.requester.request( |
| 859 | + method="put", |
| 860 | + path=self.get_ai_provider_gateway_path(user_id, ai_provider_id, path), |
| 861 | + request_data=request_data, |
| 862 | + ) |
| 863 | + |
| 864 | + def edit_ai_provider_gateway( |
| 865 | + self, |
| 866 | + user_id: int, |
| 867 | + ai_provider_id: int, |
| 868 | + path: str, |
| 869 | + request_data: Optional[Dict] = None, |
| 870 | + ): |
| 871 | + """ |
| 872 | + AI Provider Gateway PATCH Request |
| 873 | +
|
| 874 | + Link to documentation: |
| 875 | + https://support.crowdin.com/developer/api/v2/#tag/AI-Gateway/operation/api.ai.providers.gateway.crowdin.patch |
| 876 | + """ |
| 877 | + return self.requester.request( |
| 878 | + method="patch", |
| 879 | + path=self.get_ai_provider_gateway_path(user_id, ai_provider_id, path), |
| 880 | + request_data=request_data, |
| 881 | + ) |
| 882 | + |
| 883 | + def delete_ai_provider_gateway( |
| 884 | + self, user_id: int, ai_provider_id: int, path: str |
| 885 | + ): |
| 886 | + """ |
| 887 | + AI Provider Gateway DELETE Request |
| 888 | +
|
| 889 | + Link to documentation: |
| 890 | + https://support.crowdin.com/developer/api/v2/#tag/AI-Gateway/operation/api.ai.providers.gateway.crowdin.delete |
| 891 | + """ |
| 892 | + return self.requester.request( |
| 893 | + method="delete", |
| 894 | + path=self.get_ai_provider_gateway_path(user_id, ai_provider_id, path), |
| 895 | + ) |
| 896 | + |
807 | 897 |
|
808 | 898 | class EnterpriseAIResource(BaseResource): |
809 | 899 | """ |
@@ -1540,3 +1630,84 @@ def translate_ai_strings( |
1540 | 1630 | path="ai/translate", |
1541 | 1631 | request_data=request_data, |
1542 | 1632 | ) |
| 1633 | + |
| 1634 | + def get_ai_provider_gateway_path(self, ai_provider_id: int, path: str) -> str: |
| 1635 | + return f"ai/providers/{ai_provider_id}/gateway/{path}" |
| 1636 | + |
| 1637 | + def get_ai_provider_gateway(self, ai_provider_id: int, path: str): |
| 1638 | + """ |
| 1639 | + AI Provider Gateway GET Request |
| 1640 | +
|
| 1641 | + Link to documentation: |
| 1642 | + https://support.crowdin.com/developer/enterprise/api/v2/#tag/AI-Gateway/operation/api.ai.providers.gateway.enterprise.get |
| 1643 | + """ |
| 1644 | + return self.requester.request( |
| 1645 | + method="get", |
| 1646 | + path=self.get_ai_provider_gateway_path(ai_provider_id, path), |
| 1647 | + ) |
| 1648 | + |
| 1649 | + def create_ai_provider_gateway( |
| 1650 | + self, |
| 1651 | + ai_provider_id: int, |
| 1652 | + path: str, |
| 1653 | + request_data: Optional[Dict] = None, |
| 1654 | + ): |
| 1655 | + """ |
| 1656 | + AI Provider Gateway POST Request |
| 1657 | +
|
| 1658 | + Link to documentation: |
| 1659 | + https://support.crowdin.com/developer/enterprise/api/v2/#tag/AI-Gateway/operation/api.ai.providers.gateway.enterprise.post |
| 1660 | + """ |
| 1661 | + return self.requester.request( |
| 1662 | + method="post", |
| 1663 | + path=self.get_ai_provider_gateway_path(ai_provider_id, path), |
| 1664 | + request_data=request_data, |
| 1665 | + ) |
| 1666 | + |
| 1667 | + def replace_ai_provider_gateway( |
| 1668 | + self, |
| 1669 | + ai_provider_id: int, |
| 1670 | + path: str, |
| 1671 | + request_data: Optional[Dict] = None, |
| 1672 | + ): |
| 1673 | + """ |
| 1674 | + AI Provider Gateway PUT Request |
| 1675 | +
|
| 1676 | + Link to documentation: |
| 1677 | + https://support.crowdin.com/developer/enterprise/api/v2/#tag/AI-Gateway/operation/api.ai.providers.gateway.enterprise.put |
| 1678 | + """ |
| 1679 | + return self.requester.request( |
| 1680 | + method="put", |
| 1681 | + path=self.get_ai_provider_gateway_path(ai_provider_id, path), |
| 1682 | + request_data=request_data, |
| 1683 | + ) |
| 1684 | + |
| 1685 | + def edit_ai_provider_gateway( |
| 1686 | + self, |
| 1687 | + ai_provider_id: int, |
| 1688 | + path: str, |
| 1689 | + request_data: Optional[Dict] = None, |
| 1690 | + ): |
| 1691 | + """ |
| 1692 | + AI Provider Gateway PATCH Request |
| 1693 | +
|
| 1694 | + Link to documentation: |
| 1695 | + https://support.crowdin.com/developer/enterprise/api/v2/#tag/AI-Gateway/operation/api.ai.providers.gateway.enterprise.patch |
| 1696 | + """ |
| 1697 | + return self.requester.request( |
| 1698 | + method="patch", |
| 1699 | + path=self.get_ai_provider_gateway_path(ai_provider_id, path), |
| 1700 | + request_data=request_data, |
| 1701 | + ) |
| 1702 | + |
| 1703 | + def delete_ai_provider_gateway(self, ai_provider_id: int, path: str): |
| 1704 | + """ |
| 1705 | + AI Provider Gateway DELETE Request |
| 1706 | +
|
| 1707 | + Link to documentation: |
| 1708 | + https://support.crowdin.com/developer/enterprise/api/v2/#tag/AI-Gateway/operation/api.ai.providers.gateway.enterprise.delete |
| 1709 | + """ |
| 1710 | + return self.requester.request( |
| 1711 | + method="delete", |
| 1712 | + path=self.get_ai_provider_gateway_path(ai_provider_id, path), |
| 1713 | + ) |
0 commit comments