<filename>discogspy/core/rq_inventory_export.py
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/04_core.rq_inventory_export.ipynb (unless otherwise specified).

__all__ = ['request_inventory_export', 'get_recent_inventory_exports', 'get_inventory_export_details',
           'download_inventory_export']

# Cell
import requests
from typing import Union
from . import *

# Cell


def request_inventory_export(user: UserWithUserTokenBasedAuthentication
                             ) -> requests.models.Response:
    """
    Request an csv export for the given inventory.

    User Authentication needed.

    Parameters:

    user: user object (required)
    """
    url = f"{INVENTORY_EXPORT_URL}"
    headers = user.headers
    params = user.params

    return requests.post(url, headers=headers, params=params)

# Cell


def get_recent_inventory_exports(user: UserWithUserTokenBasedAuthentication,
                                 page: Union[int, None] = None,
                                 per_page: Union[int, None] = None
                                 ) -> requests.models.Response:
    """
    Get a list of all recent exports for the given inventory.

    User Authentication needed.

    Parameters:

    user: user object (required)

    page: number (optional)
        -> The page you want to request.

    per_page: number (optional)
        -> The number of items per page.
    """
    url = f"{INVENTORY_EXPORT_URL}"
    headers = user.headers
    params = user.params

    if page:
        params["page"] = max(1, page)
    if per_page:
        params["per_page"] = max(1, per_page)

    return requests.get(url, headers=headers, params=params)

# Cell


def get_inventory_export_details(user: UserWithUserTokenBasedAuthentication,
                                 export_id: int
                                 ) -> requests.models.Response:
    """
    Get details about the status of the given inventory export.

    User Authentication needed.

    Parameters:

    user: user object (required)

    export_id: number (required)
        -> Id of the export.
    """
    url = f"{INVENTORY_EXPORT_URL}/{export_id}"
    headers = user.headers
    params = user.params

    return requests.get(url, headers=headers, params=params)

# Cell


def download_inventory_export(user: UserWithUserTokenBasedAuthentication,
                              export_id: int
                              ) -> requests.models.Response:
    """
    Download an existing inventory export.
    The response will be a zipped csv file.

    User Authentication needed.

    Parameters:

    user: user object (required)

    export_id: number (required)
        -> Id of the export.
    """
    url = f"{INVENTORY_EXPORT_URL}/{export_id}/download"
    headers = user.headers
    params = user.params

    return requests.get(url, headers=headers, params=params)
<filename>discogspy/core/rq_inventory_export.py
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/04_core.rq_inventory_export.ipynb (unless otherwise specified).

__all__ = ['request_inventory_export', 'get_recent_inventory_exports', 'get_inventory_export_details',
           'download_inventory_export']

# Cell
import requests
from typing import Union
from . import *

# Cell


def request_inventory_export(user: UserWithUserTokenBasedAuthentication
                             ) -> requests.models.Response:
    """
    Request an csv export for the given inventory.

    User Authentication needed.

    Parameters:

    user: user object (required)
    """
    url = f"{INVENTORY_EXPORT_URL}"
    headers = user.headers
    params = user.params

    return requests.post(url, headers=headers, params=params)

# Cell


def get_recent_inventory_exports(user: UserWithUserTokenBasedAuthentication,
                                 page: Union[int, None] = None,
                                 per_page: Union[int, None] = None
                                 ) -> requests.models.Response:
    """
    Get a list of all recent exports for the given inventory.

    User Authentication needed.

    Parameters:

    user: user object (required)

    page: number (optional)
        -> The page you want to request.

    per_page: number (optional)
        -> The number of items per page.
    """
    url = f"{INVENTORY_EXPORT_URL}"
    headers = user.headers
    params = user.params

    if page:
        params["page"] = max(1, page)
    if per_page:
        params["per_page"] = max(1, per_page)

    return requests.get(url, headers=headers, params=params)

# Cell


def get_inventory_export_details(user: UserWithUserTokenBasedAuthentication,
                                 export_id: int
                                 ) -> requests.models.Response:
    """
    Get details about the status of the given inventory export.

    User Authentication needed.

    Parameters:

    user: user object (required)

    export_id: number (required)
        -> Id of the export.
    """
    url = f"{INVENTORY_EXPORT_URL}/{export_id}"
    headers = user.headers
    params = user.params

    return requests.get(url, headers=headers, params=params)

# Cell


def download_inventory_export(user: UserWithUserTokenBasedAuthentication,
                              export_id: int
                              ) -> requests.models.Response:
    """
    Download an existing inventory export.
    The response will be a zipped csv file.

    User Authentication needed.

    Parameters:

    user: user object (required)

    export_id: number (required)
        -> Id of the export.
    """
    url = f"{INVENTORY_EXPORT_URL}/{export_id}/download"
    headers = user.headers
    params = user.params

    return requests.get(url, headers=headers, params=params)
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/04_core.rq_inventory_export.ipynb (unless otherwise specified). # Cell # Cell Request an csv export for the given inventory.      User Authentication needed.      Parameters:      user: user object (required) # Cell Get a list of all recent exports for the given inventory.      User Authentication needed.      Parameters:      user: user object (required)      page: number (optional)         -> The page you want to request.      per_page: number (optional)         -> The number of items per page. # Cell Get details about the status of the given inventory export.      User Authentication needed.      Parameters:      user: user object (required)      export_id: number (required)         -> Id of the export. # Cell Download an existing inventory export.     The response will be a zipped csv file.      User Authentication needed.      Parameters:      user: user object (required)      export_id: number (required)         -> Id of the export.