|
13 | 13 |
|
14 | 14 | class ConfigurationApiV37(HttpClient): |
15 | 15 | ''' Configuration API client class in version 3.7. ''' |
| 16 | + |
16 | 17 | def __init__(self, |
17 | 18 | token: Union[AccessToken, str], |
18 | 19 | base_url: str, |
@@ -1865,7 +1866,6 @@ def batch_update_bots(self, |
1865 | 1866 | json=payload, |
1866 | 1867 | headers=headers) |
1867 | 1868 |
|
1868 | | - |
1869 | 1869 | # Greetings |
1870 | 1870 |
|
1871 | 1871 | def create_greeting(self, |
@@ -2029,3 +2029,124 @@ def update_greeting(self, |
2029 | 2029 | return self.session.post(f'{self.api_url}/update_greeting', |
2030 | 2030 | json=payload, |
2031 | 2031 | headers=headers) |
| 2032 | + |
| 2033 | + |
| 2034 | +# Canned responses |
| 2035 | + |
| 2036 | + def create_canned_response(self, |
| 2037 | + text: str = None, |
| 2038 | + tags: list[str] = None, |
| 2039 | + group_id: int = None, |
| 2040 | + is_private: bool = None, |
| 2041 | + payload: dict = None, |
| 2042 | + headers: dict = None) -> httpx.Response: |
| 2043 | + ''' Creates a new canned response. |
| 2044 | +
|
| 2045 | + Args: |
| 2046 | + text (str): Canned response text content (max 2000 characters). |
| 2047 | + tags (list[str]): Array of tags (max 20 tags, each max 50 characters). |
| 2048 | + group_id (int): ID of the group the canned response belongs to. |
| 2049 | + is_private (bool): Whether the canned response is private (default: `false`). |
| 2050 | + payload (dict): Custom payload to be used as request's data. |
| 2051 | + It overrides all other parameters provided for the method. |
| 2052 | + headers (dict): Custom headers to be used with session headers. |
| 2053 | + They will be merged with session-level values that are set, |
| 2054 | + however, these method-level parameters will not be persisted across requests. |
| 2055 | +
|
| 2056 | + Returns: |
| 2057 | + httpx.Response: The Response object from `httpx` library, |
| 2058 | + which contains a server's response to an HTTP request. |
| 2059 | + ''' |
| 2060 | + if payload is None: |
| 2061 | + payload = prepare_payload(locals()) |
| 2062 | + return self.session.post(f'{self.api_url}/create_canned_response', |
| 2063 | + json=payload, |
| 2064 | + headers=headers) |
| 2065 | + |
| 2066 | + def update_canned_response(self, |
| 2067 | + id: int = None, |
| 2068 | + text: str = None, |
| 2069 | + tags: list[str] = None, |
| 2070 | + group_id: int = None, |
| 2071 | + is_private: bool = None, |
| 2072 | + payload: dict = None, |
| 2073 | + headers: dict = None) -> httpx.Response: |
| 2074 | + ''' Updates an existing canned response. All parameters are optional - |
| 2075 | + only provided parameters will be updated. |
| 2076 | +
|
| 2077 | + Args: |
| 2078 | + id (int): ID of the canned response to update. |
| 2079 | + text (str): New canned response text (max 2000 characters). |
| 2080 | + tags (list[str]): Array of tags (max 20 tags, each max 50 characters). |
| 2081 | + group_id (int): New group ID for the canned response. |
| 2082 | + is_private (bool): Whether the canned response is private. |
| 2083 | + payload (dict): Custom payload to be used as request's data. |
| 2084 | + It overrides all other parameters provided for the method. |
| 2085 | + headers (dict): Custom headers to be used with session headers. |
| 2086 | + They will be merged with session-level values that are set, |
| 2087 | + however, these method-level parameters will not be persisted across requests. |
| 2088 | +
|
| 2089 | + Returns: |
| 2090 | + httpx.Response: The Response object from `httpx` library, |
| 2091 | + which contains a server's response to an HTTP request. |
| 2092 | + ''' |
| 2093 | + if payload is None: |
| 2094 | + payload = prepare_payload(locals()) |
| 2095 | + return self.session.post(f'{self.api_url}/update_canned_response', |
| 2096 | + json=payload, |
| 2097 | + headers=headers) |
| 2098 | + |
| 2099 | + def list_canned_responses(self, |
| 2100 | + group_ids: list[int] = None, |
| 2101 | + include_private: bool = None, |
| 2102 | + limit: int = None, |
| 2103 | + page_id: str = None, |
| 2104 | + payload: dict = None, |
| 2105 | + headers: dict = None) -> httpx.Response: |
| 2106 | + ''' Returns a paginated list of canned responses. |
| 2107 | +
|
| 2108 | + Args: |
| 2109 | + group_ids (list[int]): Filter by specific group IDs |
| 2110 | + (if not provided, uses user's accessible groups). |
| 2111 | + include_private (bool): Include private canned responses (default: `false`). |
| 2112 | + limit (int): Number of results per page (1-100, default: 100). |
| 2113 | + page_id (str): Page ID for pagination. |
| 2114 | + payload (dict): Custom payload to be used as request's data. |
| 2115 | + It overrides all other parameters provided for the method. |
| 2116 | + headers (dict): Custom headers to be used with session headers. |
| 2117 | + They will be merged with session-level values that are set, |
| 2118 | + however, these method-level parameters will not be persisted across requests. |
| 2119 | +
|
| 2120 | + Returns: |
| 2121 | + httpx.Response: The Response object from `httpx` library, |
| 2122 | + which contains a server's response to an HTTP request. |
| 2123 | + ''' |
| 2124 | + if payload is None: |
| 2125 | + payload = prepare_payload(locals()) |
| 2126 | + return self.session.post(f'{self.api_url}/list_canned_responses', |
| 2127 | + json=payload, |
| 2128 | + headers=headers) |
| 2129 | + |
| 2130 | + def delete_canned_response(self, |
| 2131 | + id: int = None, |
| 2132 | + payload: dict = None, |
| 2133 | + headers: dict = None) -> httpx.Response: |
| 2134 | + ''' Deletes an existing canned response. |
| 2135 | +
|
| 2136 | + Args: |
| 2137 | + id (int): ID of the canned response to delete. |
| 2138 | + payload (dict): Custom payload to be used as request's data. |
| 2139 | + It overrides all other parameters provided for the method. |
| 2140 | + headers (dict): Custom headers to be used with session headers. |
| 2141 | + They will be merged with session-level values that are set, |
| 2142 | + however, these method-level parameters will not be persisted across requests. |
| 2143 | +
|
| 2144 | + Returns: |
| 2145 | + httpx.Response: The Response object from `httpx` library, |
| 2146 | + which contains a server's response to an HTTP request. |
| 2147 | + ''' |
| 2148 | + if payload is None: |
| 2149 | + payload = prepare_payload(locals()) |
| 2150 | + return self.session.post(f'{self.api_url}/delete_canned_response', |
| 2151 | + json=payload, |
| 2152 | + headers=headers) |
0 commit comments