# coding: utf-8

"""
    Canva Connect API

    API for building integrations with Canva via a REST api

    The version of the OpenAPI document: latest
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field, StrictStr, field_validator
from typing import Optional
from typing_extensions import Annotated
from canva_alpha_ti.models.create_design_request import CreateDesignRequest
from canva_alpha_ti.models.create_design_response import CreateDesignResponse
from canva_alpha_ti.models.get_design_export_formats_response import GetDesignExportFormatsResponse
from canva_alpha_ti.models.get_design_pages_response import GetDesignPagesResponse
from canva_alpha_ti.models.get_design_response import GetDesignResponse
from canva_alpha_ti.models.get_list_design_response import GetListDesignResponse
from canva_alpha_ti.models.ownership_type import OwnershipType
from canva_alpha_ti.models.sort_by_type import SortByType

from canva_alpha_ti.api_client import ApiClient, RequestSerialized
from canva_alpha_ti.api_response import ApiResponse
from canva_alpha_ti.rest import RESTResponseType


class DesignApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    def create_design(
        self,
        create_design_request: Optional[CreateDesignRequest] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> CreateDesignResponse:
        """create_design

        Creates a new Canva design. To create a new design, you can either:  - Use a preset design type. - Set height and width dimensions for a custom design.  Additionally, you can also provide the `asset_id` of an asset in the user's [projects](https://www.canva.com/help/find-designs-and-folders/) to add to the new design. Currently, this only supports image assets. To list the assets in a folder in the user's projects, use the [List folder items API](https://www.canva.dev/docs/connect/api-reference/folders/list-folder-items/).

        :param create_design_request:
        :type create_design_request: CreateDesignRequest
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_design_serialize(
            create_design_request=create_design_request,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CreateDesignResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def create_design_with_http_info(
        self,
        create_design_request: Optional[CreateDesignRequest] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> ApiResponse[CreateDesignResponse]:
        """create_design

        Creates a new Canva design. To create a new design, you can either:  - Use a preset design type. - Set height and width dimensions for a custom design.  Additionally, you can also provide the `asset_id` of an asset in the user's [projects](https://www.canva.com/help/find-designs-and-folders/) to add to the new design. Currently, this only supports image assets. To list the assets in a folder in the user's projects, use the [List folder items API](https://www.canva.dev/docs/connect/api-reference/folders/list-folder-items/).

        :param create_design_request:
        :type create_design_request: CreateDesignRequest
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_design_serialize(
            create_design_request=create_design_request,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CreateDesignResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def create_design_without_preload_content(
        self,
        create_design_request: Optional[CreateDesignRequest] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> RESTResponseType:
        """create_design

        Creates a new Canva design. To create a new design, you can either:  - Use a preset design type. - Set height and width dimensions for a custom design.  Additionally, you can also provide the `asset_id` of an asset in the user's [projects](https://www.canva.com/help/find-designs-and-folders/) to add to the new design. Currently, this only supports image assets. To list the assets in a folder in the user's projects, use the [List folder items API](https://www.canva.dev/docs/connect/api-reference/folders/list-folder-items/).

        :param create_design_request:
        :type create_design_request: CreateDesignRequest
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_design_serialize(
            create_design_request=create_design_request,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CreateDesignResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        return response_data.response


    def _create_design_serialize(
        self,
        create_design_request,
        request_auth__,
        content_type__,
        headers__,
        host__,
    ) -> RequestSerialized:


        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = headers__ or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if create_design_request is not None:
            _body_params = create_design_request


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if content_type__:
            _header_params['Content-Type'] = content_type__
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'oauthAuthCode'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/v1/designs',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            host__=host__,
            request_auth__=request_auth__
        )




    @validate_call
    def get_design(
        self,
        design_id: Annotated[str, Field(strict=True, description="The design ID.")],
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> GetDesignResponse:
        """get_design

        Gets the metadata for a design. This includes owner information, URLs for editing and viewing, and thumbnail information.

        :param design_id: The design ID. (required)
        :type design_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_design_serialize(
            design_id=design_id,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetDesignResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_design_with_http_info(
        self,
        design_id: Annotated[str, Field(strict=True, description="The design ID.")],
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> ApiResponse[GetDesignResponse]:
        """get_design

        Gets the metadata for a design. This includes owner information, URLs for editing and viewing, and thumbnail information.

        :param design_id: The design ID. (required)
        :type design_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_design_serialize(
            design_id=design_id,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetDesignResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_design_without_preload_content(
        self,
        design_id: Annotated[str, Field(strict=True, description="The design ID.")],
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> RESTResponseType:
        """get_design

        Gets the metadata for a design. This includes owner information, URLs for editing and viewing, and thumbnail information.

        :param design_id: The design ID. (required)
        :type design_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_design_serialize(
            design_id=design_id,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetDesignResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        return response_data.response


    def _get_design_serialize(
        self,
        design_id,
        request_auth__,
        content_type__,
        headers__,
        host__,
    ) -> RequestSerialized:


        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = headers__ or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if design_id is not None:
            _path_params['designId'] = design_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'oauthAuthCode'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/designs/{designId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            host__=host__,
            request_auth__=request_auth__
        )




    @validate_call
    def get_design_export_formats(
        self,
        design_id: Annotated[str, Field(strict=True, description="The design ID.")],
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> GetDesignExportFormatsResponse:
        """get_design_export_formats

        <Warning>  This API is currently provided as a preview. Be aware of the following:  - There might be unannounced breaking changes. - Any breaking changes to preview APIs won't produce a new [API version](https://www.canva.dev/docs/connect/versions/). - Public integrations that use preview APIs will not pass the review process, and can't be made available to all Canva users.  </Warning>  Lists the available file formats for [exporting a design](https://www.canva.dev/docs/connect/api-reference/exports/create-design-export-job/).

        :param design_id: The design ID. (required)
        :type design_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_design_export_formats_serialize(
            design_id=design_id,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetDesignExportFormatsResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_design_export_formats_with_http_info(
        self,
        design_id: Annotated[str, Field(strict=True, description="The design ID.")],
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> ApiResponse[GetDesignExportFormatsResponse]:
        """get_design_export_formats

        <Warning>  This API is currently provided as a preview. Be aware of the following:  - There might be unannounced breaking changes. - Any breaking changes to preview APIs won't produce a new [API version](https://www.canva.dev/docs/connect/versions/). - Public integrations that use preview APIs will not pass the review process, and can't be made available to all Canva users.  </Warning>  Lists the available file formats for [exporting a design](https://www.canva.dev/docs/connect/api-reference/exports/create-design-export-job/).

        :param design_id: The design ID. (required)
        :type design_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_design_export_formats_serialize(
            design_id=design_id,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetDesignExportFormatsResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_design_export_formats_without_preload_content(
        self,
        design_id: Annotated[str, Field(strict=True, description="The design ID.")],
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> RESTResponseType:
        """get_design_export_formats

        <Warning>  This API is currently provided as a preview. Be aware of the following:  - There might be unannounced breaking changes. - Any breaking changes to preview APIs won't produce a new [API version](https://www.canva.dev/docs/connect/versions/). - Public integrations that use preview APIs will not pass the review process, and can't be made available to all Canva users.  </Warning>  Lists the available file formats for [exporting a design](https://www.canva.dev/docs/connect/api-reference/exports/create-design-export-job/).

        :param design_id: The design ID. (required)
        :type design_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_design_export_formats_serialize(
            design_id=design_id,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetDesignExportFormatsResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        return response_data.response


    def _get_design_export_formats_serialize(
        self,
        design_id,
        request_auth__,
        content_type__,
        headers__,
        host__,
    ) -> RequestSerialized:


        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = headers__ or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if design_id is not None:
            _path_params['designId'] = design_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'oauthAuthCode'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/designs/{designId}/export-formats',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            host__=host__,
            request_auth__=request_auth__
        )




    @validate_call
    def get_design_pages(
        self,
        design_id: Annotated[str, Field(strict=True, description="The design ID.")],
        offset: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="The page index to start the range of pages to return. Default is `1`.  Pages are indexed using one-based numbering, so the first page in a design has the index value `1`. ")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=1)]], Field(description="The number of pages to return, starting at the page index specified using the `offset` parameter. Default is `50` pages.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> GetDesignPagesResponse:
        """get_design_pages

        <Warning>  This API is currently provided as a preview. Be aware of the following:  - There might be unannounced breaking changes. - Any breaking changes to preview APIs won't produce a new [API version](https://www.canva.dev/docs/connect/versions/). - Public integrations that use preview APIs will not pass the review process, and can't be made available to all Canva users.  </Warning>  Lists metadata for pages in a design, such as page-specific thumbnails.  For the specified design, you can provide `offset` and `limit` values to specify the range of pages to return.  NOTE: Some design types don't have pages (for example, Canva docs).

        :param design_id: The design ID. (required)
        :type design_id: str
        :param offset: The page index to start the range of pages to return. Default is `1`.  Pages are indexed using one-based numbering, so the first page in a design has the index value `1`. 
        :type offset: int
        :param limit: The number of pages to return, starting at the page index specified using the `offset` parameter. Default is `50` pages.
        :type limit: int
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_design_pages_serialize(
            design_id=design_id,
            offset=offset,
            limit=limit,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetDesignPagesResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_design_pages_with_http_info(
        self,
        design_id: Annotated[str, Field(strict=True, description="The design ID.")],
        offset: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="The page index to start the range of pages to return. Default is `1`.  Pages are indexed using one-based numbering, so the first page in a design has the index value `1`. ")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=1)]], Field(description="The number of pages to return, starting at the page index specified using the `offset` parameter. Default is `50` pages.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> ApiResponse[GetDesignPagesResponse]:
        """get_design_pages

        <Warning>  This API is currently provided as a preview. Be aware of the following:  - There might be unannounced breaking changes. - Any breaking changes to preview APIs won't produce a new [API version](https://www.canva.dev/docs/connect/versions/). - Public integrations that use preview APIs will not pass the review process, and can't be made available to all Canva users.  </Warning>  Lists metadata for pages in a design, such as page-specific thumbnails.  For the specified design, you can provide `offset` and `limit` values to specify the range of pages to return.  NOTE: Some design types don't have pages (for example, Canva docs).

        :param design_id: The design ID. (required)
        :type design_id: str
        :param offset: The page index to start the range of pages to return. Default is `1`.  Pages are indexed using one-based numbering, so the first page in a design has the index value `1`. 
        :type offset: int
        :param limit: The number of pages to return, starting at the page index specified using the `offset` parameter. Default is `50` pages.
        :type limit: int
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_design_pages_serialize(
            design_id=design_id,
            offset=offset,
            limit=limit,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetDesignPagesResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_design_pages_without_preload_content(
        self,
        design_id: Annotated[str, Field(strict=True, description="The design ID.")],
        offset: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="The page index to start the range of pages to return. Default is `1`.  Pages are indexed using one-based numbering, so the first page in a design has the index value `1`. ")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=1)]], Field(description="The number of pages to return, starting at the page index specified using the `offset` parameter. Default is `50` pages.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> RESTResponseType:
        """get_design_pages

        <Warning>  This API is currently provided as a preview. Be aware of the following:  - There might be unannounced breaking changes. - Any breaking changes to preview APIs won't produce a new [API version](https://www.canva.dev/docs/connect/versions/). - Public integrations that use preview APIs will not pass the review process, and can't be made available to all Canva users.  </Warning>  Lists metadata for pages in a design, such as page-specific thumbnails.  For the specified design, you can provide `offset` and `limit` values to specify the range of pages to return.  NOTE: Some design types don't have pages (for example, Canva docs).

        :param design_id: The design ID. (required)
        :type design_id: str
        :param offset: The page index to start the range of pages to return. Default is `1`.  Pages are indexed using one-based numbering, so the first page in a design has the index value `1`. 
        :type offset: int
        :param limit: The number of pages to return, starting at the page index specified using the `offset` parameter. Default is `50` pages.
        :type limit: int
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_design_pages_serialize(
            design_id=design_id,
            offset=offset,
            limit=limit,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetDesignPagesResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        return response_data.response


    def _get_design_pages_serialize(
        self,
        design_id,
        offset,
        limit,
        request_auth__,
        content_type__,
        headers__,
        host__,
    ) -> RequestSerialized:


        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = headers__ or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if design_id is not None:
            _path_params['designId'] = design_id
        # process the query parameters
        if offset is not None:
            
            _query_params.append(('offset', offset))
            
        if limit is not None:
            
            _query_params.append(('limit', limit))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'oauthAuthCode'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/designs/{designId}/pages',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            host__=host__,
            request_auth__=request_auth__
        )




    @validate_call
    def list_designs(
        self,
        query: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Lets you search the user's designs, and designs shared with the user, using a search term or terms.")] = None,
        continuation: Annotated[Optional[StrictStr], Field(description="If the success response contains a continuation token, the list contains more designs you can list. You can use this token as a query parameter and retrieve more designs from the list, for example `/v1/designs?continuation={continuation}`.  To retrieve all of a user's designs, you might need to make multiple requests.")] = None,
        ownership: Annotated[Optional[OwnershipType], Field(description="Filter the list of designs based on the user's ownership of the designs. This can be one of the following:  - `owned`: Designs owned by the user. - `shared`: Designs shared with the user. - `any`: Designs owned by and shared with the user.")] = None,
        sort_by: Annotated[Optional[SortByType], Field(description="Sort the list of designs. This can be one of the following:  - `relevance`: (Default) Sort results using a relevance algorithm. - `modified_descending`: Sort results by the date last modified in descending order. - `modified_ascending`: Sort results by the date last modified in ascending order. - `title_descending`: Sort results by title in descending order. - `title_ascending`: Sort results by title in ascending order.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> GetListDesignResponse:
        """list_designs

        Lists metadata for all the designs in a Canva user's [projects](https://www.canva.com/help/find-designs-and-folders/). You can also:  - Use search terms to filter the listed designs. - Show designs either created by, or shared with the user. - Sort the results.

        :param query: Lets you search the user's designs, and designs shared with the user, using a search term or terms.
        :type query: str
        :param continuation: If the success response contains a continuation token, the list contains more designs you can list. You can use this token as a query parameter and retrieve more designs from the list, for example `/v1/designs?continuation={continuation}`.  To retrieve all of a user's designs, you might need to make multiple requests.
        :type continuation: str
        :param ownership: Filter the list of designs based on the user's ownership of the designs. This can be one of the following:  - `owned`: Designs owned by the user. - `shared`: Designs shared with the user. - `any`: Designs owned by and shared with the user.
        :type ownership: OwnershipType
        :param sort_by: Sort the list of designs. This can be one of the following:  - `relevance`: (Default) Sort results using a relevance algorithm. - `modified_descending`: Sort results by the date last modified in descending order. - `modified_ascending`: Sort results by the date last modified in ascending order. - `title_descending`: Sort results by title in descending order. - `title_ascending`: Sort results by title in ascending order.
        :type sort_by: SortByType
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_designs_serialize(
            query=query,
            continuation=continuation,
            ownership=ownership,
            sort_by=sort_by,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetListDesignResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def list_designs_with_http_info(
        self,
        query: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Lets you search the user's designs, and designs shared with the user, using a search term or terms.")] = None,
        continuation: Annotated[Optional[StrictStr], Field(description="If the success response contains a continuation token, the list contains more designs you can list. You can use this token as a query parameter and retrieve more designs from the list, for example `/v1/designs?continuation={continuation}`.  To retrieve all of a user's designs, you might need to make multiple requests.")] = None,
        ownership: Annotated[Optional[OwnershipType], Field(description="Filter the list of designs based on the user's ownership of the designs. This can be one of the following:  - `owned`: Designs owned by the user. - `shared`: Designs shared with the user. - `any`: Designs owned by and shared with the user.")] = None,
        sort_by: Annotated[Optional[SortByType], Field(description="Sort the list of designs. This can be one of the following:  - `relevance`: (Default) Sort results using a relevance algorithm. - `modified_descending`: Sort results by the date last modified in descending order. - `modified_ascending`: Sort results by the date last modified in ascending order. - `title_descending`: Sort results by title in descending order. - `title_ascending`: Sort results by title in ascending order.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> ApiResponse[GetListDesignResponse]:
        """list_designs

        Lists metadata for all the designs in a Canva user's [projects](https://www.canva.com/help/find-designs-and-folders/). You can also:  - Use search terms to filter the listed designs. - Show designs either created by, or shared with the user. - Sort the results.

        :param query: Lets you search the user's designs, and designs shared with the user, using a search term or terms.
        :type query: str
        :param continuation: If the success response contains a continuation token, the list contains more designs you can list. You can use this token as a query parameter and retrieve more designs from the list, for example `/v1/designs?continuation={continuation}`.  To retrieve all of a user's designs, you might need to make multiple requests.
        :type continuation: str
        :param ownership: Filter the list of designs based on the user's ownership of the designs. This can be one of the following:  - `owned`: Designs owned by the user. - `shared`: Designs shared with the user. - `any`: Designs owned by and shared with the user.
        :type ownership: OwnershipType
        :param sort_by: Sort the list of designs. This can be one of the following:  - `relevance`: (Default) Sort results using a relevance algorithm. - `modified_descending`: Sort results by the date last modified in descending order. - `modified_ascending`: Sort results by the date last modified in ascending order. - `title_descending`: Sort results by title in descending order. - `title_ascending`: Sort results by title in ascending order.
        :type sort_by: SortByType
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_designs_serialize(
            query=query,
            continuation=continuation,
            ownership=ownership,
            sort_by=sort_by,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetListDesignResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def list_designs_without_preload_content(
        self,
        query: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Lets you search the user's designs, and designs shared with the user, using a search term or terms.")] = None,
        continuation: Annotated[Optional[StrictStr], Field(description="If the success response contains a continuation token, the list contains more designs you can list. You can use this token as a query parameter and retrieve more designs from the list, for example `/v1/designs?continuation={continuation}`.  To retrieve all of a user's designs, you might need to make multiple requests.")] = None,
        ownership: Annotated[Optional[OwnershipType], Field(description="Filter the list of designs based on the user's ownership of the designs. This can be one of the following:  - `owned`: Designs owned by the user. - `shared`: Designs shared with the user. - `any`: Designs owned by and shared with the user.")] = None,
        sort_by: Annotated[Optional[SortByType], Field(description="Sort the list of designs. This can be one of the following:  - `relevance`: (Default) Sort results using a relevance algorithm. - `modified_descending`: Sort results by the date last modified in descending order. - `modified_ascending`: Sort results by the date last modified in ascending order. - `title_descending`: Sort results by title in descending order. - `title_ascending`: Sort results by title in ascending order.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> RESTResponseType:
        """list_designs

        Lists metadata for all the designs in a Canva user's [projects](https://www.canva.com/help/find-designs-and-folders/). You can also:  - Use search terms to filter the listed designs. - Show designs either created by, or shared with the user. - Sort the results.

        :param query: Lets you search the user's designs, and designs shared with the user, using a search term or terms.
        :type query: str
        :param continuation: If the success response contains a continuation token, the list contains more designs you can list. You can use this token as a query parameter and retrieve more designs from the list, for example `/v1/designs?continuation={continuation}`.  To retrieve all of a user's designs, you might need to make multiple requests.
        :type continuation: str
        :param ownership: Filter the list of designs based on the user's ownership of the designs. This can be one of the following:  - `owned`: Designs owned by the user. - `shared`: Designs shared with the user. - `any`: Designs owned by and shared with the user.
        :type ownership: OwnershipType
        :param sort_by: Sort the list of designs. This can be one of the following:  - `relevance`: (Default) Sort results using a relevance algorithm. - `modified_descending`: Sort results by the date last modified in descending order. - `modified_ascending`: Sort results by the date last modified in ascending order. - `title_descending`: Sort results by title in descending order. - `title_ascending`: Sort results by title in ascending order.
        :type sort_by: SortByType
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_designs_serialize(
            query=query,
            continuation=continuation,
            ownership=ownership,
            sort_by=sort_by,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetListDesignResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        return response_data.response


    def _list_designs_serialize(
        self,
        query,
        continuation,
        ownership,
        sort_by,
        request_auth__,
        content_type__,
        headers__,
        host__,
    ) -> RequestSerialized:


        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = headers__ or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if query is not None:
            
            _query_params.append(('query', query))
            
        if continuation is not None:
            
            _query_params.append(('continuation', continuation))
            
        if ownership is not None:
            
            _query_params.append(('ownership', ownership.value))
            
        if sort_by is not None:
            
            _query_params.append(('sort_by', sort_by.value))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'oauthAuthCode'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/designs',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            host__=host__,
            request_auth__=request_auth__
        )


