"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from .basesdk import BaseSDK
from leonardo_ai_sdk import utils
from leonardo_ai_sdk._hooks import HookContext
from leonardo_ai_sdk.models import errors, operations
from leonardo_ai_sdk.types import BaseModel, OptionalNullable, UNSET
from typing import Optional, Union, cast


class Texture(BaseSDK):
    def create_texture_generation(
        self,
        *,
        request: Optional[
            Union[
                operations.CreateTextureGenerationRequestBody,
                operations.CreateTextureGenerationRequestBodyTypedDict,
            ]
        ] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.CreateTextureGenerationResponse:
        r"""Create Texture Generation

        This endpoint will generate a texture generation.

        :param request: The request object to send.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        if not isinstance(request, BaseModel):
            request = utils.unmarshal(
                request, Optional[operations.CreateTextureGenerationRequestBody]
            )
        request = cast(Optional[operations.CreateTextureGenerationRequestBody], request)

        req = self.build_request(
            method="POST",
            path="/generations-texture",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=False,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request,
                False,
                True,
                "json",
                Optional[operations.CreateTextureGenerationRequestBody],
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="createTextureGeneration",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["4XX", "5XX"],
            retry_config=retry_config,
        )

        if utils.match_response(http_res, "200", "application/json"):
            return operations.CreateTextureGenerationResponse(
                object=utils.unmarshal_json(
                    http_res.text,
                    Optional[operations.CreateTextureGenerationResponseBody],
                ),
                status_code=http_res.status_code,
                content_type=http_res.headers.get("Content-Type") or "",
                raw_response=http_res,
            )
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def create_texture_generation_async(
        self,
        *,
        request: Optional[
            Union[
                operations.CreateTextureGenerationRequestBody,
                operations.CreateTextureGenerationRequestBodyTypedDict,
            ]
        ] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.CreateTextureGenerationResponse:
        r"""Create Texture Generation

        This endpoint will generate a texture generation.

        :param request: The request object to send.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        if not isinstance(request, BaseModel):
            request = utils.unmarshal(
                request, Optional[operations.CreateTextureGenerationRequestBody]
            )
        request = cast(Optional[operations.CreateTextureGenerationRequestBody], request)

        req = self.build_request_async(
            method="POST",
            path="/generations-texture",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=False,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request,
                False,
                True,
                "json",
                Optional[operations.CreateTextureGenerationRequestBody],
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="createTextureGeneration",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["4XX", "5XX"],
            retry_config=retry_config,
        )

        if utils.match_response(http_res, "200", "application/json"):
            return operations.CreateTextureGenerationResponse(
                object=utils.unmarshal_json(
                    http_res.text,
                    Optional[operations.CreateTextureGenerationResponseBody],
                ),
                status_code=http_res.status_code,
                content_type=http_res.headers.get("Content-Type") or "",
                raw_response=http_res,
            )
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def delete_texture_generation_by_id(
        self,
        *,
        id: str,
        request_body: Optional[
            Union[
                operations.DeleteTextureGenerationByIDRequestBody,
                operations.DeleteTextureGenerationByIDRequestBodyTypedDict,
            ]
        ] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.DeleteTextureGenerationByIDResponse:
        r"""Delete Texture Generation by ID

        This endpoint deletes the specific texture generation.

        :param id: _\"id\" is required (enter it either in parameters or request body)_
        :param request_body: Query parameters can also be provided in the request body as a JSON object
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.DeleteTextureGenerationByIDRequest(
            id=id,
            request_body=utils.get_pydantic_model(
                request_body,
                Optional[operations.DeleteTextureGenerationByIDRequestBody],
            ),
        )

        req = self.build_request(
            method="DELETE",
            path="/generations-texture/{id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.request_body,
                False,
                True,
                "json",
                Optional[operations.DeleteTextureGenerationByIDRequestBody],
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="deleteTextureGenerationById",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["4XX", "5XX"],
            retry_config=retry_config,
        )

        if utils.match_response(http_res, "200", "application/json"):
            return operations.DeleteTextureGenerationByIDResponse(
                object=utils.unmarshal_json(
                    http_res.text,
                    Optional[operations.DeleteTextureGenerationByIDResponseBody],
                ),
                status_code=http_res.status_code,
                content_type=http_res.headers.get("Content-Type") or "",
                raw_response=http_res,
            )
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def delete_texture_generation_by_id_async(
        self,
        *,
        id: str,
        request_body: Optional[
            Union[
                operations.DeleteTextureGenerationByIDRequestBody,
                operations.DeleteTextureGenerationByIDRequestBodyTypedDict,
            ]
        ] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.DeleteTextureGenerationByIDResponse:
        r"""Delete Texture Generation by ID

        This endpoint deletes the specific texture generation.

        :param id: _\"id\" is required (enter it either in parameters or request body)_
        :param request_body: Query parameters can also be provided in the request body as a JSON object
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.DeleteTextureGenerationByIDRequest(
            id=id,
            request_body=utils.get_pydantic_model(
                request_body,
                Optional[operations.DeleteTextureGenerationByIDRequestBody],
            ),
        )

        req = self.build_request_async(
            method="DELETE",
            path="/generations-texture/{id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.request_body,
                False,
                True,
                "json",
                Optional[operations.DeleteTextureGenerationByIDRequestBody],
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="deleteTextureGenerationById",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["4XX", "5XX"],
            retry_config=retry_config,
        )

        if utils.match_response(http_res, "200", "application/json"):
            return operations.DeleteTextureGenerationByIDResponse(
                object=utils.unmarshal_json(
                    http_res.text,
                    Optional[operations.DeleteTextureGenerationByIDResponseBody],
                ),
                status_code=http_res.status_code,
                content_type=http_res.headers.get("Content-Type") or "",
                raw_response=http_res,
            )
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def get_texture_generation_by_id(
        self,
        *,
        id: str,
        limit: Optional[int] = 10,
        offset: Optional[int] = 0,
        request_body: Optional[
            Union[
                operations.GetTextureGenerationByIDRequestBody,
                operations.GetTextureGenerationByIDRequestBodyTypedDict,
            ]
        ] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.GetTextureGenerationByIDResponse:
        r"""Get Texture Generation by ID

        This endpoint gets the specific texture generation.

        :param id: _\"id\" is required (enter it either in parameters or request body)_
        :param limit:
        :param offset:
        :param request_body: Query parameters can also be provided in the request body as a JSON object
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.GetTextureGenerationByIDRequest(
            id=id,
            limit=limit,
            offset=offset,
            request_body=utils.get_pydantic_model(
                request_body, Optional[operations.GetTextureGenerationByIDRequestBody]
            ),
        )

        req = self.build_request(
            method="GET",
            path="/generations-texture/{id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.request_body,
                False,
                True,
                "json",
                Optional[operations.GetTextureGenerationByIDRequestBody],
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="getTextureGenerationById",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["4XX", "5XX"],
            retry_config=retry_config,
        )

        if utils.match_response(http_res, "200", "application/json"):
            return operations.GetTextureGenerationByIDResponse(
                object=utils.unmarshal_json(
                    http_res.text,
                    Optional[operations.GetTextureGenerationByIDResponseBody],
                ),
                status_code=http_res.status_code,
                content_type=http_res.headers.get("Content-Type") or "",
                raw_response=http_res,
            )
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def get_texture_generation_by_id_async(
        self,
        *,
        id: str,
        limit: Optional[int] = 10,
        offset: Optional[int] = 0,
        request_body: Optional[
            Union[
                operations.GetTextureGenerationByIDRequestBody,
                operations.GetTextureGenerationByIDRequestBodyTypedDict,
            ]
        ] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.GetTextureGenerationByIDResponse:
        r"""Get Texture Generation by ID

        This endpoint gets the specific texture generation.

        :param id: _\"id\" is required (enter it either in parameters or request body)_
        :param limit:
        :param offset:
        :param request_body: Query parameters can also be provided in the request body as a JSON object
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.GetTextureGenerationByIDRequest(
            id=id,
            limit=limit,
            offset=offset,
            request_body=utils.get_pydantic_model(
                request_body, Optional[operations.GetTextureGenerationByIDRequestBody]
            ),
        )

        req = self.build_request_async(
            method="GET",
            path="/generations-texture/{id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.request_body,
                False,
                True,
                "json",
                Optional[operations.GetTextureGenerationByIDRequestBody],
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="getTextureGenerationById",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["4XX", "5XX"],
            retry_config=retry_config,
        )

        if utils.match_response(http_res, "200", "application/json"):
            return operations.GetTextureGenerationByIDResponse(
                object=utils.unmarshal_json(
                    http_res.text,
                    Optional[operations.GetTextureGenerationByIDResponseBody],
                ),
                status_code=http_res.status_code,
                content_type=http_res.headers.get("Content-Type") or "",
                raw_response=http_res,
            )
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def get_texture_generations_by_model_id(
        self,
        *,
        model_id: str,
        limit: Optional[int] = 10,
        offset: Optional[int] = 0,
        request_body: Optional[
            Union[
                operations.GetTextureGenerationsByModelIDRequestBody,
                operations.GetTextureGenerationsByModelIDRequestBodyTypedDict,
            ]
        ] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.GetTextureGenerationsByModelIDResponse:
        r"""Get texture generations by 3D Model ID

        This endpoint gets the specific texture generations by the 3d model id.

        :param model_id: _\"modelId\" is required (enter it either in parameters or request body)_
        :param limit:
        :param offset:
        :param request_body: Query parameters can also be provided in the request body as a JSON object
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.GetTextureGenerationsByModelIDRequest(
            limit=limit,
            model_id=model_id,
            offset=offset,
            request_body=utils.get_pydantic_model(
                request_body,
                Optional[operations.GetTextureGenerationsByModelIDRequestBody],
            ),
        )

        req = self.build_request(
            method="GET",
            path="/generations-texture/model/{modelId}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.request_body,
                False,
                True,
                "json",
                Optional[operations.GetTextureGenerationsByModelIDRequestBody],
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="getTextureGenerationsByModelId",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["4XX", "5XX"],
            retry_config=retry_config,
        )

        if utils.match_response(http_res, "200", "application/json"):
            return operations.GetTextureGenerationsByModelIDResponse(
                object=utils.unmarshal_json(
                    http_res.text,
                    Optional[operations.GetTextureGenerationsByModelIDResponseBody],
                ),
                status_code=http_res.status_code,
                content_type=http_res.headers.get("Content-Type") or "",
                raw_response=http_res,
            )
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def get_texture_generations_by_model_id_async(
        self,
        *,
        model_id: str,
        limit: Optional[int] = 10,
        offset: Optional[int] = 0,
        request_body: Optional[
            Union[
                operations.GetTextureGenerationsByModelIDRequestBody,
                operations.GetTextureGenerationsByModelIDRequestBodyTypedDict,
            ]
        ] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.GetTextureGenerationsByModelIDResponse:
        r"""Get texture generations by 3D Model ID

        This endpoint gets the specific texture generations by the 3d model id.

        :param model_id: _\"modelId\" is required (enter it either in parameters or request body)_
        :param limit:
        :param offset:
        :param request_body: Query parameters can also be provided in the request body as a JSON object
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.GetTextureGenerationsByModelIDRequest(
            limit=limit,
            model_id=model_id,
            offset=offset,
            request_body=utils.get_pydantic_model(
                request_body,
                Optional[operations.GetTextureGenerationsByModelIDRequestBody],
            ),
        )

        req = self.build_request_async(
            method="GET",
            path="/generations-texture/model/{modelId}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.request_body,
                False,
                True,
                "json",
                Optional[operations.GetTextureGenerationsByModelIDRequestBody],
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="getTextureGenerationsByModelId",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["4XX", "5XX"],
            retry_config=retry_config,
        )

        if utils.match_response(http_res, "200", "application/json"):
            return operations.GetTextureGenerationsByModelIDResponse(
                object=utils.unmarshal_json(
                    http_res.text,
                    Optional[operations.GetTextureGenerationsByModelIDResponseBody],
                ),
                status_code=http_res.status_code,
                content_type=http_res.headers.get("Content-Type") or "",
                raw_response=http_res,
            )
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )
