From dd00b0413798806aac069373fee1508399c460fc Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:39:36 +0000 Subject: [PATCH] Release 0.0.1-beta14 --- pyproject.toml | 2 +- reference.md | 163 +-------- src/gooey/__init__.py | 5 +- src/gooey/client.py | 33 +- src/gooey/core/client_wrapper.py | 2 +- src/gooey/misc/__init__.py | 2 - src/gooey/misc/client.py | 321 ------------------ src/gooey/types/__init__.py | 2 + .../types/bot_broadcast_request_model.py | 49 +++ 9 files changed, 71 insertions(+), 508 deletions(-) delete mode 100644 src/gooey/misc/__init__.py delete mode 100644 src/gooey/misc/client.py create mode 100644 src/gooey/types/bot_broadcast_request_model.py diff --git a/pyproject.toml b/pyproject.toml index 52a220c..889c0e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "gooeyai" -version = "0.0.1-beta13" +version = "0.0.1-beta14" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index 6f7dda4..c45a177 100644 --- a/reference.md +++ b/reference.md @@ -5637,7 +5637,7 @@ Generally speaking, dense embeddings excel at understanding the context of the q -
client.health_status_get() +
client.get_balance()
@@ -5655,7 +5655,7 @@ from gooey import Gooey client = Gooey( api_key="YOUR_API_KEY", ) -client.health_status_get() +client.get_balance() ```
@@ -6243,162 +6243,3 @@ typing.Optional[core.File]` — See core.File for more documentation
-## Misc -
client.misc.get_balance() -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from gooey import Gooey - -client = Gooey( - api_key="YOUR_API_KEY", -) -client.misc.get_balance() - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- - -
-
-
- -
client.misc.video_bots_broadcast(...) -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from gooey import Gooey - -client = Gooey( - api_key="YOUR_API_KEY", -) -client.misc.video_bots_broadcast( - text="text", -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**text:** `str` — Message to broadcast to all users - -
-
- -
-
- -**example_id:** `typing.Optional[str]` - -
-
- -
-
- -**run_id:** `typing.Optional[str]` - -
-
- -
-
- -**audio:** `typing.Optional[str]` — Audio URL to send to all users - -
-
- -
-
- -**video:** `typing.Optional[str]` — Video URL to send to all users - -
-
- -
-
- -**documents:** `typing.Optional[typing.Sequence[str]]` — Video URL to send to all users - -
-
- -
-
- -**buttons:** `typing.Optional[typing.Sequence[ReplyButton]]` — Buttons to send to all users - -
-
- -
-
- -**filters:** `typing.Optional[BotBroadcastFilters]` — Filters to select users to broadcast to. If not provided, will broadcast to all users of this bot. - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- - -
-
-
- diff --git a/src/gooey/__init__.py b/src/gooey/__init__.py index 33cebf3..c720956 100644 --- a/src/gooey/__init__.py +++ b/src/gooey/__init__.py @@ -20,6 +20,7 @@ AsyncApiResponseModelV3, BalanceResponse, BotBroadcastFilters, + BotBroadcastRequestModel, BulkEvalPageOutput, BulkEvalPageRequestAggFunctionsItem, BulkEvalPageRequestAggFunctionsItemFunction, @@ -365,7 +366,7 @@ VideoBotsPageStatusResponse, ) from .errors import PaymentRequiredError, TooManyRequestsError, UnprocessableEntityError -from . import copilot, misc +from . import copilot from .client import AsyncGooey, Gooey from .copilot import ( CopilotCompletionRequestAsrModel, @@ -413,6 +414,7 @@ "AsyncGooey", "BalanceResponse", "BotBroadcastFilters", + "BotBroadcastRequestModel", "BulkEvalPageOutput", "BulkEvalPageRequestAggFunctionsItem", "BulkEvalPageRequestAggFunctionsItemFunction", @@ -783,5 +785,4 @@ "VideoBotsPageStatusResponse", "__version__", "copilot", - "misc", ] diff --git a/src/gooey/client.py b/src/gooey/client.py index 580b1c2..46fe851 100644 --- a/src/gooey/client.py +++ b/src/gooey/client.py @@ -7,7 +7,6 @@ from .core.api_error import ApiError from .core.client_wrapper import SyncClientWrapper from .copilot.client import CopilotClient -from .misc.client import MiscClient from .types.deforum_sd_page_request_animation_prompts_item import DeforumSdPageRequestAnimationPromptsItem from .types.deforum_sd_page_request_functions_item import DeforumSdPageRequestFunctionsItem from .types.deforum_sd_page_request_selected_model import DeforumSdPageRequestSelectedModel @@ -144,9 +143,9 @@ from .types.related_qn_a_doc_page_request_citation_style import RelatedQnADocPageRequestCitationStyle from .types.related_qn_a_doc_page_request_response_format_type import RelatedQnADocPageRequestResponseFormatType from .types.related_qn_a_doc_page_output import RelatedQnADocPageOutput +from .types.balance_response import BalanceResponse from .core.client_wrapper import AsyncClientWrapper from .copilot.client import AsyncCopilotClient -from .misc.client import AsyncMiscClient # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -213,7 +212,6 @@ def __init__( timeout=_defaulted_timeout, ) self.copilot = CopilotClient(client_wrapper=self._client_wrapper) - self.misc = MiscClient(client_wrapper=self._client_wrapper) def animate( self, @@ -4828,9 +4826,7 @@ def seo_people_also_ask_doc( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def health_status_get( - self, *, request_options: typing.Optional[RequestOptions] = None - ) -> typing.Optional[typing.Any]: + def get_balance(self, *, request_options: typing.Optional[RequestOptions] = None) -> BalanceResponse: """ Parameters ---------- @@ -4839,7 +4835,7 @@ def health_status_get( Returns ------- - typing.Optional[typing.Any] + BalanceResponse Successful Response Examples @@ -4849,19 +4845,19 @@ def health_status_get( client = Gooey( api_key="YOUR_API_KEY", ) - client.health_status_get() + client.get_balance() """ _response = self._client_wrapper.httpx_client.request( - "status", + "v1/balance/", method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: return typing.cast( - typing.Optional[typing.Any], + BalanceResponse, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=BalanceResponse, # type: ignore object_=_response.json(), ), ) @@ -4932,7 +4928,6 @@ def __init__( timeout=_defaulted_timeout, ) self.copilot = AsyncCopilotClient(client_wrapper=self._client_wrapper) - self.misc = AsyncMiscClient(client_wrapper=self._client_wrapper) async def animate( self, @@ -9787,9 +9782,7 @@ async def main() -> None: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def health_status_get( - self, *, request_options: typing.Optional[RequestOptions] = None - ) -> typing.Optional[typing.Any]: + async def get_balance(self, *, request_options: typing.Optional[RequestOptions] = None) -> BalanceResponse: """ Parameters ---------- @@ -9798,7 +9791,7 @@ async def health_status_get( Returns ------- - typing.Optional[typing.Any] + BalanceResponse Successful Response Examples @@ -9813,22 +9806,22 @@ async def health_status_get( async def main() -> None: - await client.health_status_get() + await client.get_balance() asyncio.run(main()) """ _response = await self._client_wrapper.httpx_client.request( - "status", + "v1/balance/", method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: return typing.cast( - typing.Optional[typing.Any], + BalanceResponse, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=BalanceResponse, # type: ignore object_=_response.json(), ), ) diff --git a/src/gooey/core/client_wrapper.py b/src/gooey/core/client_wrapper.py index 65c8508..ab26b2a 100644 --- a/src/gooey/core/client_wrapper.py +++ b/src/gooey/core/client_wrapper.py @@ -22,7 +22,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "gooeyai", - "X-Fern-SDK-Version": "0.0.1-beta13", + "X-Fern-SDK-Version": "0.0.1-beta14", } headers["Authorization"] = f"Bearer {self._get_api_key()}" return headers diff --git a/src/gooey/misc/__init__.py b/src/gooey/misc/__init__.py deleted file mode 100644 index f3ea265..0000000 --- a/src/gooey/misc/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - diff --git a/src/gooey/misc/client.py b/src/gooey/misc/client.py deleted file mode 100644 index 8d6d2c2..0000000 --- a/src/gooey/misc/client.py +++ /dev/null @@ -1,321 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -from ..core.client_wrapper import SyncClientWrapper -from ..core.request_options import RequestOptions -from ..types.balance_response import BalanceResponse -from ..core.pydantic_utilities import parse_obj_as -from json.decoder import JSONDecodeError -from ..core.api_error import ApiError -from ..types.reply_button import ReplyButton -from ..types.bot_broadcast_filters import BotBroadcastFilters -from ..errors.unprocessable_entity_error import UnprocessableEntityError -from ..types.http_validation_error import HttpValidationError -from ..core.client_wrapper import AsyncClientWrapper - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class MiscClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_balance(self, *, request_options: typing.Optional[RequestOptions] = None) -> BalanceResponse: - """ - Parameters - ---------- - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - BalanceResponse - Successful Response - - Examples - -------- - from gooey import Gooey - - client = Gooey( - api_key="YOUR_API_KEY", - ) - client.misc.get_balance() - """ - _response = self._client_wrapper.httpx_client.request( - "v1/balance/", - method="GET", - request_options=request_options, - ) - try: - if 200 <= _response.status_code < 300: - return typing.cast( - BalanceResponse, - parse_obj_as( - type_=BalanceResponse, # type: ignore - object_=_response.json(), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def video_bots_broadcast( - self, - *, - text: str, - example_id: typing.Optional[str] = None, - run_id: typing.Optional[str] = None, - audio: typing.Optional[str] = OMIT, - video: typing.Optional[str] = OMIT, - documents: typing.Optional[typing.Sequence[str]] = OMIT, - buttons: typing.Optional[typing.Sequence[ReplyButton]] = OMIT, - filters: typing.Optional[BotBroadcastFilters] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.Optional[typing.Any]: - """ - Parameters - ---------- - text : str - Message to broadcast to all users - - example_id : typing.Optional[str] - - run_id : typing.Optional[str] - - audio : typing.Optional[str] - Audio URL to send to all users - - video : typing.Optional[str] - Video URL to send to all users - - documents : typing.Optional[typing.Sequence[str]] - Video URL to send to all users - - buttons : typing.Optional[typing.Sequence[ReplyButton]] - Buttons to send to all users - - filters : typing.Optional[BotBroadcastFilters] - Filters to select users to broadcast to. If not provided, will broadcast to all users of this bot. - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - typing.Optional[typing.Any] - Successful Response - - Examples - -------- - from gooey import Gooey - - client = Gooey( - api_key="YOUR_API_KEY", - ) - client.misc.video_bots_broadcast( - text="text", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "v2/video-bots/broadcast/send/", - method="POST", - params={ - "example_id": example_id, - "run_id": run_id, - }, - json={ - "text": text, - "audio": audio, - "video": video, - "documents": documents, - "buttons": buttons, - "filters": filters, - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - return typing.cast( - typing.Optional[typing.Any], - parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore - object_=_response.json(), - ), - ) - if _response.status_code == 422: - raise UnprocessableEntityError( - typing.cast( - HttpValidationError, - parse_obj_as( - type_=HttpValidationError, # type: ignore - object_=_response.json(), - ), - ) - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncMiscClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_balance(self, *, request_options: typing.Optional[RequestOptions] = None) -> BalanceResponse: - """ - Parameters - ---------- - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - BalanceResponse - Successful Response - - Examples - -------- - import asyncio - - from gooey import AsyncGooey - - client = AsyncGooey( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.misc.get_balance() - - - asyncio.run(main()) - """ - _response = await self._client_wrapper.httpx_client.request( - "v1/balance/", - method="GET", - request_options=request_options, - ) - try: - if 200 <= _response.status_code < 300: - return typing.cast( - BalanceResponse, - parse_obj_as( - type_=BalanceResponse, # type: ignore - object_=_response.json(), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def video_bots_broadcast( - self, - *, - text: str, - example_id: typing.Optional[str] = None, - run_id: typing.Optional[str] = None, - audio: typing.Optional[str] = OMIT, - video: typing.Optional[str] = OMIT, - documents: typing.Optional[typing.Sequence[str]] = OMIT, - buttons: typing.Optional[typing.Sequence[ReplyButton]] = OMIT, - filters: typing.Optional[BotBroadcastFilters] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.Optional[typing.Any]: - """ - Parameters - ---------- - text : str - Message to broadcast to all users - - example_id : typing.Optional[str] - - run_id : typing.Optional[str] - - audio : typing.Optional[str] - Audio URL to send to all users - - video : typing.Optional[str] - Video URL to send to all users - - documents : typing.Optional[typing.Sequence[str]] - Video URL to send to all users - - buttons : typing.Optional[typing.Sequence[ReplyButton]] - Buttons to send to all users - - filters : typing.Optional[BotBroadcastFilters] - Filters to select users to broadcast to. If not provided, will broadcast to all users of this bot. - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - typing.Optional[typing.Any] - Successful Response - - Examples - -------- - import asyncio - - from gooey import AsyncGooey - - client = AsyncGooey( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.misc.video_bots_broadcast( - text="text", - ) - - - asyncio.run(main()) - """ - _response = await self._client_wrapper.httpx_client.request( - "v2/video-bots/broadcast/send/", - method="POST", - params={ - "example_id": example_id, - "run_id": run_id, - }, - json={ - "text": text, - "audio": audio, - "video": video, - "documents": documents, - "buttons": buttons, - "filters": filters, - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - return typing.cast( - typing.Optional[typing.Any], - parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore - object_=_response.json(), - ), - ) - if _response.status_code == 422: - raise UnprocessableEntityError( - typing.cast( - HttpValidationError, - parse_obj_as( - type_=HttpValidationError, # type: ignore - object_=_response.json(), - ), - ) - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/gooey/types/__init__.py b/src/gooey/types/__init__.py index 02ed7e1..9d53b3f 100644 --- a/src/gooey/types/__init__.py +++ b/src/gooey/types/__init__.py @@ -19,6 +19,7 @@ from .async_api_response_model_v3 import AsyncApiResponseModelV3 from .balance_response import BalanceResponse from .bot_broadcast_filters import BotBroadcastFilters +from .bot_broadcast_request_model import BotBroadcastRequestModel from .bulk_eval_page_output import BulkEvalPageOutput from .bulk_eval_page_request_agg_functions_item import BulkEvalPageRequestAggFunctionsItem from .bulk_eval_page_request_agg_functions_item_function import BulkEvalPageRequestAggFunctionsItemFunction @@ -393,6 +394,7 @@ "AsyncApiResponseModelV3", "BalanceResponse", "BotBroadcastFilters", + "BotBroadcastRequestModel", "BulkEvalPageOutput", "BulkEvalPageRequestAggFunctionsItem", "BulkEvalPageRequestAggFunctionsItemFunction", diff --git a/src/gooey/types/bot_broadcast_request_model.py b/src/gooey/types/bot_broadcast_request_model.py new file mode 100644 index 0000000..e1a2b6a --- /dev/null +++ b/src/gooey/types/bot_broadcast_request_model.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import pydantic +import typing +from .reply_button import ReplyButton +from .bot_broadcast_filters import BotBroadcastFilters +from ..core.pydantic_utilities import IS_PYDANTIC_V2 + + +class BotBroadcastRequestModel(UniversalBaseModel): + text: str = pydantic.Field() + """ + Message to broadcast to all users + """ + + audio: typing.Optional[str] = pydantic.Field(default=None) + """ + Audio URL to send to all users + """ + + video: typing.Optional[str] = pydantic.Field(default=None) + """ + Video URL to send to all users + """ + + documents: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Video URL to send to all users + """ + + buttons: typing.Optional[typing.List[ReplyButton]] = pydantic.Field(default=None) + """ + Buttons to send to all users + """ + + filters: typing.Optional[BotBroadcastFilters] = pydantic.Field(default=None) + """ + Filters to select users to broadcast to. If not provided, will broadcast to all users of this bot. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow