### Get All User Lots Source: https://funpayapi.readthedocs.io/ru/latest/types Retrieves a list of all lots associated with a user's profile. This method returns a list of LotShortcut objects, where each object represents a lot. It is a method of the UserProfile class. ```python user_profile = FunPayAPI.types.UserProfile(...) # Assuming user_profile is initialized all_lots = user_profile.get_lots() ``` -------------------------------- ### Get Currency Lots - FunPayAPI Source: https://funpayapi.readthedocs.io/ru/latest/types Retrieves a list of currency lots from the user's page. These lots are specifically related to currency exchange or trading. The function returns a list of LotShortcut objects, detailing each currency lot. ```python get_currency_lots() → list[FunPayAPI.types.LotShortcut]# ``` -------------------------------- ### Create a bot to deliver goods upon new order with 'аккаунт' in description Source: https://funpayapi.readthedocs.io/ru/latest/quickstart This example demonstrates how to build a bot that automatically delivers digital goods when a new order is placed. If the order description contains the word 'аккаунт', the bot finds the buyer's chat and sends a message containing account credentials. This requires the FunPayAPI library and a valid account token. ```python from FunPayAPI import Account, Runner, types, enums TOKEN = "" # Создаем класс аккаунта и сразу же получаем данные аккаунта. acc = Account(TOKEN).get() # Создаем класс "прослушивателя" событий. runner = Runner(acc) # "Слушаем" события for event in runner.listen(requests_delay=4): # Если событие - новый заказ if event.type is enums.EventTypes.NEW_ORDER: # Если "аккаунт" есть в названии заказа if "аккаунт" in event.order.description: chat = acc.get_chat_by_name(event.order.buyer_username, True) # получаем ID чата по никнейму acc.send_message(chat.id, f"Привет, {event.order.buyer_username}!\n" f"Вот твой аккаунт:\n" f"Почта: mail@somemail.ru\n" f"Пароль: somepassword!123") # отправляем ответное сообщение ``` -------------------------------- ### Get Lot by ID Source: https://funpayapi.readthedocs.io/ru/latest/types Retrieves a specific lot from a user's profile by its ID. It returns a LotShortcut object if the lot is found, otherwise returns None. This is a method of the UserProfile class. ```python user_profile = FunPayAPI.types.UserProfile(...) # Assuming user_profile is initialized lot_id = 456 lot_shortcut = user_profile.get_lot(lot_id) ``` -------------------------------- ### Get Sorted Lots - FunPayAPI Source: https://funpayapi.readthedocs.io/ru/latest/types Retrieves a sorted list of user lots. The output format depends on the 'mode' parameter: mode 1 returns a dictionary of {ID: lot}, mode 2 returns a dictionary of {subcategory: {ID: lot}}, and mode 3 returns a dictionary of {lot type: {ID: lot}}. This function is useful for organizing and accessing user listings efficiently. ```python get_sorted_lots(_mode : Literal[1]_) → dict[int | str, FunPayAPI.types.LotShortcut]# get_sorted_lots(_mode : Literal[2]_) → dict[FunPayAPI.types.SubCategory, dict[int | str, FunPayAPI.types.LotShortcut]] get_sorted_lots(_mode : Literal[3]_) → dict[FunPayAPI.common.enums.SubCategoryTypes, dict[int | str, FunPayAPI.types.LotShortcut]] ``` -------------------------------- ### Get Common Lots - FunPayAPI Source: https://funpayapi.readthedocs.io/ru/latest/types Retrieves a list of standard lots from the user's page. These are typical listings that users offer. The function returns a list of LotShortcut objects, providing details about each standard lot. ```python get_common_lots() → list[FunPayAPI.types.LotShortcut]# ``` -------------------------------- ### Get Lot Fields Source: https://funpayapi.readthedocs.io/ru/latest/types Retrieves all fields of a lot as a dictionary. This method is part of the LotFields class and returns a dictionary where keys are field names (strings) and values are field values (strings). ```python lot_fields = FunPayAPI.types.LotFields(lot_id=123, fields={'title_ru': 'Example Lot'}) all_fields = lot_fields.fields ``` -------------------------------- ### User Lots API Source: https://funpayapi.readthedocs.io/ru/latest/types Retrieve and manage lots associated with a user account. This includes fetching all lots, sorted lots with different modes, adding new lots, and getting common or currency lots. ```APIDOC ## GET /get_sorted_lots ### Description Retrieves a list of all user lots, optionally sorted and returned in different dictionary formats. ### Method GET ### Endpoint /get_sorted_lots ### Parameters #### Query Parameters - **mode** (integer) - Required - Specifies the sorting mode for the lots. - `1`: Returns a dictionary of {Lot ID: Lot Object}. - `2`: Returns a dictionary of {SubCategory: {Lot ID: Lot Object}}. - `3`: Returns a dictionary of {Lot Type: {Lot ID: Lot Object}}. ### Response #### Success Response (200) - **lots** (list or dict) - A list or dictionary of LotShortcut objects, depending on the 'mode' parameter. #### Response Example (mode=1) { "lots": { "123": { "id": 123, "name": "Example Lot", "price": 100.00, "amount": 10, "description": "A sample lot." } } } #### Response Example (mode=2) { "lots": { "Electronics": { "456": { "id": 456, "name": "Another Lot", "price": 250.00, "amount": 5, "description": "Another sample lot." } } } } ``` ```APIDOC ## POST /add_lot ### Description Adds a new lot to the user's list of lots. ### Method POST ### Endpoint /add_lot ### Parameters #### Request Body - **lot** (object) - Required - An object representing the lot to be added. This should be a `FunPayAPI.types.LotShortcut` object. ### Request Example ```json { "lot": { "id": 789, "name": "New Product", "price": 50.00, "amount": 20, "description": "A newly added product." } } ``` ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the lot was added successfully. #### Response Example { "message": "Lot added successfully." } ``` ```APIDOC ## GET /get_common_lots ### Description Retrieves a list of standard lots from the user's page. ### Method GET ### Endpoint /get_common_lots ### Response #### Success Response (200) - **lots** (list) - A list of `FunPayAPI.types.LotShortcut` objects representing common lots. #### Response Example ```json [ { "id": 101, "name": "Standard Item 1", "price": 75.00, "amount": 15, "description": "A common item." }, { "id": 102, "name": "Standard Item 2", "price": 120.00, "amount": 8, "description": "Another common item." } ] ``` ``` ```APIDOC ## GET /get_currency_lots ### Description Retrieves a list of currency lots from the user's page. ### Method GET ### Endpoint /get_currency_lots ### Response #### Success Response (200) - **lots** (list) - A list of `FunPayAPI.types.LotShortcut` objects representing currency lots. #### Response Example ```json [ { "id": 201, "name": "USD Currency", "price": 90.00, "amount": 100, "description": "US Dollars." }, { "id": 202, "name": "EUR Currency", "price": 105.00, "amount": 50, "description": "Euros." } ] ``` ``` -------------------------------- ### Get Raise Modal Source: https://funpayapi.readthedocs.io/ru/latest/account Requests a modal form to raise lots for a category (game). Handles cases where only one subcategory exists. ```APIDOC ## POST /get_raise_modal ### Description Requests a modal form to raise lots for a category (game). Handles cases where only one subcategory exists. ### Method POST ### Endpoint /get_raise_modal ### Parameters #### Request Body - **category_id** (int) - Required - The ID of the category (game). ### Request Example ```json { "category_id": 101 } ``` ### Response #### Success Response (200) - **funpay_response** (dict) - The response from FunPay, containing data for the modal form. #### Response Example ```json { "funpay_response": { "modal_data": "..." } } ``` ``` -------------------------------- ### Get User Profile Source: https://funpayapi.readthedocs.io/ru/latest/account Retrieves the profile information for a given user ID by parsing their page. ```APIDOC ## GET /get_user ### Description Retrieves the profile information for a given user ID by parsing their page. ### Method GET ### Endpoint /get_user ### Parameters #### Query Parameters - **user_id** (int) - Required - The ID of the user. ### Request Example ``` GET /get_user?user_id=987654321 ``` ### Response #### Success Response (200) - **user_profile** (UserProfile) - An object containing the user's profile information. #### Response Example ```json { "user_profile": { "id": 987654321, "username": "example_user", "avatar_url": "http://example.com/avatar.jpg" } } ``` ``` -------------------------------- ### Get Public Lots by Subcategory (Python) Source: https://funpayapi.readthedocs.io/ru/latest/account Fetches a list of all published lots within a specified subcategory. Requires the `subcategory_type` (an enum from `FunPayAPI.enums.SubCategoryTypes`) and the `subcategory_id` as integer. ```python from FunPayAPI.enums import SubCategoryTypes lots = account.get_subcategory_public_lots( subcategory_type=SubCategoryTypes.GAME, subcategory_id=12345 ) ``` -------------------------------- ### Get User Balance (Python) Source: https://funpayapi.readthedocs.io/ru/latest/account Retrieves the user's balance information. An optional `lot_id` can be provided to check the balance associated with a specific lot. If no `lot_id` is given, it defaults to a pre-defined lot ID. ```python balance = account.get_balance(lot_id=18853876) ``` -------------------------------- ### Get Histories for Multiple Chats (Python) Source: https://funpayapi.readthedocs.io/ru/latest/account Fetches message histories for multiple chats simultaneously. It accepts a dictionary where keys are chat IDs (integer or string) and values are interlocutor usernames (string or None). It retrieves up to 50 messages per private chat and 25 per public chat. ```python chats_data = { 48392847: 'SLLMK', 58392098: 'Amongus', 38948728: None } multiple_histories = account.get_chats_histories(chats_data=chats_data) ``` -------------------------------- ### Get and Update Account Data (Python) Source: https://funpayapi.readthedocs.io/ru/latest/account Retrieves or updates the account data. It's recommended to call this method periodically (every 40-60 minutes) to refresh the `Account.phpsessid`. The `update_phpsessid` parameter controls whether to use the existing session ID or fetch a new one. ```python updated_account = account.get(update_phpsessid=True) ``` -------------------------------- ### Get User Profile with FunPayAPI Source: https://funpayapi.readthedocs.io/ru/latest/account This function retrieves and parses a user's profile information from FunPay. It takes the user's ID as input and returns a UserProfile object containing the parsed information. The returned object contains profile details. ```python get_user(_user_id : int_) -> UserProfile ``` -------------------------------- ### Send Request to FunPay API (Python) Source: https://funpayapi.readthedocs.io/ru/latest/account A core method for sending requests to the FunPay API. It supports both 'get' and 'post' methods, takes an API method or URL, custom headers, and a payload. It automatically includes `user_agent` and cookies, with options to exclude `phpsessid` and raise exceptions for non-200 status codes. ```python response = account.method( request_method='post', api_method='api/v1/some_method', headers={'X-Custom-Header': 'value'}, payload={'param1': 'value1'}, exclude_phpsessid=False, raise_not_200=True ) ``` -------------------------------- ### Get Raise Modal with FunPayAPI Source: https://funpayapi.readthedocs.io/ru/latest/account This function retrieves a modal form for raising lots within a specific category (game) on FunPay. It is designed to handle cases where there are multiple subcategories within a category and the user needs to select which subcategories to raise. If only one subcategory exists, the system bypasses the modal form. ```python get_raise_modal(_category_id : int_) -> dict ``` -------------------------------- ### Get Chat Info Source: https://funpayapi.readthedocs.io/ru/latest/account Retrieves information about a private chat based on its ID. ```APIDOC ## GET /get_chat ### Description Retrieves information about a private chat based on its ID. ### Method GET ### Endpoint /get_chat ### Parameters #### Query Parameters - **chat_id** (int) - Required - The ID of the chat. ### Request Example ``` GET /get_chat?chat_id=123456789 ``` ### Response #### Success Response (200) - **chat** (Chat) - An object containing information about the chat. #### Response Example ```json { "chat": { "id": 123456789, "type": "private", "participant_id": 987654321 } } ``` ``` -------------------------------- ### Initialize FunPay Account Manager (Python) Source: https://funpayapi.readthedocs.io/ru/latest/account Initializes the `Account` class for managing FunPay account operations. Requires a `golden_key` and optionally accepts `user_agent`, `requests_timeout`, and `proxy` for customized requests. The `user_agent` should match the browser used for login, and `proxy` can be a dictionary of proxy settings. ```python from FunPayAPI.account import Account account = Account( golden_key="YOUR_GOLDEN_KEY", user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", requests_timeout=15, proxy={"http": "http://user:password@host:port", "https": "http://user:password@host:port"} ) ``` -------------------------------- ### Initialize FunPayAPI Runner Source: https://funpayapi.readthedocs.io/ru/latest/runner Initializes the Runner class for fetching FunPay events. It allows disabling requests for message history or order lists. The account parameter is mandatory and must be an initialized Account instance. ```python runner = FunPayAPI.updater.runner.Runner(_account=account, _disable_message_requests=False, _disabled_order_requests=False) ``` -------------------------------- ### Add Lot - FunPayAPI Source: https://funpayapi.readthedocs.io/ru/latest/types Adds a lot to the user's list of lots. This function requires a LotShortcut object as input, which contains all the necessary details for the lot being added. It is a straightforward method for programmatically managing user listings. ```python add_lot(_lot : LotShortcut_)# ``` -------------------------------- ### Balance Object Source: https://funpayapi.readthedocs.io/ru/latest/types Represents the financial balance of a user's account, including total and available amounts in different currencies. ```APIDOC ## Object: FunPayAPI.types.Balance ### Description This class represents the balance information for an account. ### Fields - **total_rub** (float) - The total balance in Russian Rubles. - **available_rub** (float) - The available balance for withdrawal in Russian Rubles. - **total_usd** (float) - The total balance in US Dollars. - **available_usd** (float) - The available balance for withdrawal in US Dollars. - **total_eur** (float) - The total balance in Euros. - **available_eur** (float) - The available balance for withdrawal in Euros. ### Example ```json { "total_rub": 1500.50, "available_rub": 1200.00, "total_usd": 25.75, "available_usd": 20.50, "total_eur": 10.00, "available_eur": 8.00 } ``` ``` -------------------------------- ### Account.is_initiated Source: https://funpayapi.readthedocs.io/ru/latest/account Checks if the FunPayAPI.account.Account class has been initialized. ```APIDOC ## GET /account/is_initiated ### Description Checks whether the `FunPayAPI.account.Account` class has been successfully initialized using the `FunPayAPI.account.Account.get()` method. ### Method GET ### Endpoint `/account/is_initiated` ### Parameters None ### Response #### Success Response (200) - **is_initiated** (bool) - Returns `True` if the account is initialized, `False` otherwise. #### Response Example ```json { "is_initiated": true } ``` ``` -------------------------------- ### Create a simple bot to respond to messages with 'привет' Source: https://funpayapi.readthedocs.io/ru/latest/quickstart This snippet shows how to create a basic bot using FunPayAPI that listens for new messages. When a message with the text 'привет' is received from another user, the bot automatically replies with 'Ну привет...'. It requires the FunPayAPI library and an account token. ```python from FunPayAPI import Account, Runner, types, enums TOKEN = "" # Создаем класс аккаунта и сразу же получаем данные аккаунта. acc = Account(TOKEN).get() # Создаем класс "прослушивателя" событий. runner = Runner(acc) # "Слушаем" события for event in runner.listen(requests_delay=4): # Если событие - новое сообщение if event.type is enums.EventTypes.NEW_MESSAGE: # Если текст сообщения == "привет" и оно отправлено не нами if event.message.text.lower() == "привет" and event.message.author_id != acc.id: acc.send_message(event.message.chat_id, "Ну привет...") # отправляем ответное сообщение ``` -------------------------------- ### FunPay Event Handling API Source: https://funpayapi.readthedocs.io/ru/latest/index This section covers the mechanisms for receiving and processing real-time events from FunPay, including message and order updates. ```APIDOC ## FunPay Event Handling API This API allows you to handle real-time events from FunPay, such as new messages and order status changes. ### Runner Methods - **Runner.make_msg_requests**: Make requests related to messages. - **Runner.make_order_requests**: Make requests related to orders. - **Runner.saved_orders**: A list of saved orders. - **Runner.last_messages**: A list of the last received messages. - **Runner.init_messages**: Initialize message tracking. - **Runner.by_bot_ids**: Filter events by bot IDs. - **Runner.last_messages_ids**: Get the IDs of the last messages. - **Runner.account**: The account object associated with the runner. - **Runner.get_updates()**: Fetch updates from FunPay. - **Runner.parse_updates()**: Parse general updates. - **Runner.parse_chat_updates()**: Parse updates specifically related to chats. - **Runner.generate_new_message_events()**: Generate new message events from parsed updates. - **Runner.parse_order_updates()**: Parse updates related to orders. - **Runner.update_last_message()**: Update the last message information. - **Runner.update_order()**: Update the status or details of an order. - **Runner.mark_as_by_bot()**: Mark messages or orders as processed by a bot. - **Runner.listen()**: Start listening for real-time events. ``` -------------------------------- ### Get Chat History (Python) Source: https://funpayapi.readthedocs.io/ru/latest/account Retrieves the message history for a specific chat, fetching up to 100 recent messages. Parameters include `chat_id`, an optional `last_message_id` for filtering, `interlocutor_username` (recommended for private chats), and `from_id` for further filtering. ```python chat_history = account.get_chat_history( chat_id=48392847, last_message_id=10000000000000000000000, interlocutor_username='SLLMK', from_id=0 ) ``` -------------------------------- ### Review Object Source: https://funpayapi.readthedocs.io/ru/latest/types Represents a review for an order, including details like stars, text, reply, and author information. ```APIDOC ## Object: FunPayAPI.types.Review ### Description This class represents a review for an order. ### Fields - **stars** (integer or None) - The number of stars given in the review. - **text** (string or None) - The text content of the review. - **reply** (string or None) - The reply to the review. - **anonymous** (boolean) - Indicates if the review is anonymous. - **html** (string) - The HTML representation of the review. - **order_id** (string or None, optional) - The ID of the order the review is associated with. - **author** (string or None, optional) - The username of the author of the review. - **author_id** (integer or None, optional) - The ID of the author of the review. ### Example ```json { "stars": 5, "text": "Great service!", "reply": "Thank you!", "anonymous": false, "html": "

Great service!

", "order_id": "ORD12345", "author": "User123", "author_id": 987 } ``` ``` -------------------------------- ### OrderShortcut Attributes Source: https://funpayapi.readthedocs.io/ru/latest/types Lists the attributes for the OrderShortcut class, detailing each piece of information available for a condensed order widget. This includes identifiers, descriptions, pricing, buyer details, status, timestamps, and HTML content. ```python id _: str_ # ID заказа. description _: str_ # Описание заказа. price _: float_ # Цена заказа. amount _: int | None_ # Кол-во товаров. buyer_username _: str_ # Никнейм покупателя. buyer_id _: int_ # ID покупателя. status _: OrderStatuses_ # Статус заказа. date _: datetime_ # Дата создания заказа. subcategory_name _: str_ # Название подкатегории, к которой относится заказ. html _: str_ # HTML код виджета заказа. ``` -------------------------------- ### Get Chat Information with FunPayAPI Source: https://funpayapi.readthedocs.io/ru/latest/account This function fetches information about a personal chat on the FunPay platform. It takes the chat ID as a parameter and returns a Chat object containing details about the chat. The returned object contains chat details. ```python get_chat(_chat_id : int_) -> Chat ``` -------------------------------- ### OrderShortcut Class Definition Source: https://funpayapi.readthedocs.io/ru/latest/types Defines the OrderShortcut class, representing a condensed order widget from the FunPay orders page. It includes attributes like ID, description, price, buyer information, status, date, subcategory name, and HTML content. An optional parameter `dont_search_amount` controls the search for the item quantity. ```python class _FunPayAPI.types.OrderShortcut(_id_ : str_, _description : str_, _price : float_, _buyer_username : str_, _buyer_id : int_, _status : OrderStatuses_, _date : datetime_, _subcategory_name : str_, _html : str_, _dont_search_amount : bool = False_): """ Данный класс представляет виджет заказа со страницы https://funpay.com/orders/trade Параметры: * **id** (`str`) – ID заказа. * **description** (`str`) – описание заказа. * **price** (`float`) – цена заказа. * **buyer_username** (`str`) – никнейм покупателя. * **buyer_id** (`int`) – ID покупателя. * **status** (`FunPayAPI.common.enums.OrderStatuses`) – статус заказа. * **date** (`datetime.datetime`) – дата создания заказа. * **subcategory_name** (`str`) – название подкатегории, к которой относится заказ. * **html** (`str`) – HTML код виджета заказа. * **dont_search_amount** (`bool`, опционально) – не искать кол-во товара. """ pass ``` -------------------------------- ### Upload Image to FunPay Server (Python) Source: https://funpayapi.readthedocs.io/ru/latest/account Uploads an image to the FunPay server, preparing it for sending as a message. The `image` parameter can be a file path (string) or a file-like object opened in binary mode (`IO[bytes]`). For sending the image in a chat, `send_image()` should be used subsequently. ```python with open('path/to/your/image.png', 'rb') as image_file: image_id = account.upload_image(image=image_file) ``` -------------------------------- ### Order Class Definition Source: https://funpayapi.readthedocs.io/ru/latest/types Defines the Order class, representing a detailed order from a specific order page on FunPay. It includes comprehensive attributes such as ID, status, subcategory details, descriptions, sum, buyer and seller information, HTML content, and review data. ```python class _FunPayAPI.types.Order(_id_ : str_, _status : OrderStatuses_, _subcategory : SubCategory_, _short_description : str | None_, _full_description : str | None_, _sum_ : float_, _buyer_id : int_, _buyer_username : str_, _seller_id : int_, _seller_username : str_, _html : str_, _review : Review | None_): """ Данный класс представляет заказ со страницы https://funpay.com/orders// Параметры: * **id** (`str`) – ID заказа. * **status** (`FunPayAPI.common.enums.OrderStatuses`) – статус заказа. * **subcategory** (`FunPayAPI.types.SubCategory`) – подкатегория, к которой относится заказ. * **short_description** (`str` or `None`) – краткое описание (название) заказа. * **full_description** (`str` or `None`) – полное описание заказа. * **sum** (`float`) – сумма заказа. * **buyer_id** (`int`) – ID покупателя. * **buyer_username** (`str`) – никнейм покупателя. * **seller_id** (`int`) – ID продавца. * **seller_username** (`str`) – никнейм продавца. * **html** (`str`) – HTML код заказа. * **review** (`FunPayAPI.types.Review` or `None`) – объект отзыва на заказ. """ pass ``` -------------------------------- ### Fetch FunPay Updates Source: https://funpayapi.readthedocs.io/ru/latest/runner Retrieves a list of events from FunPay. This method returns raw data from the FunPay API. ```python updates = runner.get_updates() ``` -------------------------------- ### OrderShortcut Method: parse_amount Source: https://funpayapi.readthedocs.io/ru/latest/types Implements the `parse_amount` method for the OrderShortcut class. This method is designed to extract the quantity of purchased items by searching for a specific substring using a regular expression. It returns the parsed quantity as an integer. ```python parse_amount() -> int: """ Парсит кол-во купленного товара (ищет подстроку по регулярному выражению). Результат: кол-во купленного товара. Тип результата: `int` """ pass ``` -------------------------------- ### Order Attributes Source: https://funpayapi.readthedocs.io/ru/latest/types Details the attributes of the Order class, providing a comprehensive view of a specific order's data. This includes order identifiers, status, subcategory information, descriptive fields, financial sum, buyer and seller credentials, and associated HTML and review data. ```python id _: str_ # ID заказа. status _: OrderStatuses_ # Статус заказа. subcategory _: SubCategory_ # Подкатегория, к которой относится заказ. short_description _: str | None_ # Краткое описание (название) заказа. То же самое, что и Order.title. title _: str | None_ # Краткое описание (название) заказа. То же самое, что и Order.short_description. full_description _: str | None_ # Полное описание заказа. sum _: float_ # Сумма заказа. buyer_id _: int_ # ID покупателя. buyer_username _: str_ # Никнейм покупателя. seller_id _: int_ # ID продавца. seller_username _: str_ # Никнейм продавца. html _: str_ # HTML код заказа. review _: Review | None_ # Объект отзыва заказа. ``` -------------------------------- ### Balance Class - FunPayAPI.types Source: https://funpayapi.readthedocs.io/ru/latest/types Represents the account balance information. This class provides details on total and available balances in RUB, USD, and EUR. It is crucial for tracking financial status within the FunPay account. ```python _class _FunPayAPI.types.Balance(_total_rub : float_, _available_rub : float_, _total_usd : float_, _available_usd : float_, _total_eur : float_, _available_eur : float_)# ``` -------------------------------- ### Review Class - FunPayAPI.types Source: https://funpayapi.readthedocs.io/ru/latest/types Represents a review for an order. This class holds information such as the number of stars, review text, reply, anonymity status, and HTML content. It also includes optional fields for order ID, author name, and author ID. ```python _class _FunPayAPI.types.Review(_stars : int | None_, _text : str | None_, _reply : str | None_, _anonymous : bool_, _html : str_, _order_id : str | None = None_, _author : str | None = None_, _author_id : int | None = None_)# ``` -------------------------------- ### Category Method: get_sorted_subcategories Source: https://funpayapi.readthedocs.io/ru/latest/types Implements the `get_sorted_subcategories` method for the Category class. This method returns a dictionary that organizes all subcategories by their type and ID. This facilitates efficient retrieval and management of subcategories within a category. ```python get_sorted_subcategories() -> dict[FunPayAPI.common.enums.SubCategoryTypes, dict[int, FunPayAPI.types.SubCategory]]: """ ``` -------------------------------- ### Account Management API Source: https://funpayapi.readthedocs.io/ru/latest/index This section details the methods available for managing your FunPay account, including retrieving account information, managing sales, and handling financial transactions. ```APIDOC ## Account Management API This API provides methods to interact with and manage your FunPay account. ### Methods - **Account.golden_key**: Get the golden key for account authentication. - **Account.user_agent**: Get the user agent string associated with the account. - **Account.requests_timeout**: Get or set the request timeout for the account. - **Account.html**: Get the raw HTML of the FunPay page for the account. - **Account.app_data**: Get application-specific data for the account. - **Account.id**: Get the unique identifier of the account. - **Account.username**: Get the username of the account. - **Account.active_sales**: Get a list of active sales for the account. - **Account.active_purchases**: Get a list of active purchases for the account. - **Account.csrf_token**: Get the CSRF token for the account. - **Account.phpsessid**: Get the PHPSESSID cookie for the account. - **Account.last_update**: Get the timestamp of the last account update. - **Account.runner**: Get the runner object associated with the account. - **Account.method()**: A general method placeholder (details not provided). - **Account.get()**: A general GET method for the account (details not provided). - **Account.get_subcategory_public_lots()**: Get public lots for a given subcategory. - **Account.get_balance()**: Get the account balance. - **Account.get_chat_history()**: Get the chat history for a specific chat. - **Account.get_chats_histories()**: Get chat histories for multiple chats. - **Account.upload_image()**: Upload an image to be used in messages or other FunPay features. - **Account.send_message()**: Send a text message to a chat. - **Account.send_image()**: Send an image message to a chat. - **Account.send_review()**: Send a review for a completed transaction. - **Account.delete_review()**: Delete a previously sent review. - **Account.refund()**: Initiate a refund for an order. - **Account.withdraw()**: Initiate a withdrawal of funds from the account. - **Account.get_raise_modal()**: Get data required to raise lots. - **Account.raise_lots()**: Raise the visibility of specified lots. - **Account.get_user()**: Get information about a specific user. - **Account.get_chat()**: Get details of a specific chat. - **Account.get_order()**: Get details of a specific order. - **Account.get_sells()**: Get a list of recent sales. - **Account.add_chats()**: Add new chats to be monitored. - **Account.request_chats()**: Request information about chats. - **Account.get_chats()**: Get a list of chats associated with the account. - **Account.get_chat_by_name()**: Retrieve a chat by its name. - **Account.get_chat_by_id()**: Retrieve a chat by its ID. - **Account.get_lot_fields()**: Get the fields of a specific lot. - **Account.save_lot()**: Save or update a lot. - **Account.get_category()**: Get information about a specific category. - **Account.categories**: Get a list of all categories. - **Account.get_sorted_categories()**: Get a list of categories sorted in a specific order. - **Account.get_subcategory()**: Get information about a specific subcategory. - **Account.subcategories**: Get a list of all subcategories. - **Account.get_sorted_subcategories()**: Get a list of subcategories sorted in a specific order. - **Account.is_initiated**: Check if the account object has been successfully initialized. ``` -------------------------------- ### Parse All FunPay Updates Source: https://funpayapi.readthedocs.io/ru/latest/runner Parses the raw updates obtained from FunPay into a list of structured event objects. This includes events related to chats and orders. ```python events = runner.parse_updates(updates) ``` -------------------------------- ### Raise Lots Source: https://funpayapi.readthedocs.io/ru/latest/account Raises all lots for all subcategories within a given category (game). Allows specifying subcategories or excluding some. ```APIDOC ## POST /raise_lots ### Description Raises all lots for all subcategories within a given category (game). Allows specifying subcategories or excluding some. ### Method POST ### Endpoint /raise_lots ### Parameters #### Request Body - **category_id** (int) - Required - The ID of the category (game). - **subcategories** (list[int | SubCategory], optional) - A list of subcategory IDs or objects to raise. If not provided, all subcategories within the category will be raised. - **exclude** (list[int], optional) - A list of subcategory IDs to exclude from the raise operation. ### Request Example ```json { "category_id": 101, "subcategories": [10101, 10102] } ``` ### Response #### Success Response (200) - **success** (bool) - True if the lots were successfully raised, False otherwise. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Wallet Enum Source: https://funpayapi.readthedocs.io/ru/latest/enums Lists the available wallet types for withdrawing funds from the FunPay balance. ```APIDOC ## Wallet Enum ### Description This enum lists all wallet types for withdrawing funds from the FunPay balance. ### Values - **QIWI (0)**: Qiwi wallet. - **BINANCE (1)**: Binance Pay. - **TRC (2)**: USDT TRC20. - **CARD_RUB (3)**: Ruble bank card. - **CARD_USD (4)**: Dollar bank card. - **CARD_EUR (5)**: Euro bank card. - **WEBMONEY (6)**: WebMoney WMZ. - **YOUMONEY (7)**: YooMoney. ``` -------------------------------- ### Category Method: get_subcategories Source: https://funpayapi.readthedocs.io/ru/latest/types Defines the `get_subcategories` method for the Category class. This method returns a list of all `SubCategory` objects associated with the current category. This provides a way to access all available subcategories for a given game or product category. ```python get_subcategories() -> list[FunPayAPI.types.SubCategory]: """ Возвращает все подкатегории данной категории (игры). Результат: все подкатегории данной категории (игры). Тип результата: `list` of `FunPayAPI.types.SubCategory` """ pass ``` -------------------------------- ### Initial Chat Scan and Data Storage in FunPayAPI Source: https://funpayapi.readthedocs.io/ru/latest/HOW_chats This snippet illustrates how the FunPayAPI listener initializes by scanning existing chats and storing the last message details. It populates two dictionaries: `last_messages` with the message text and timestamp, and `init_messages` with just the message text. The maximum message length stored is 250 characters. ```python class Runner: last_messages = {} init_messages = {} def listen(self): # ... initial chat scan logic ... for chat_id, last_message_data in scanned_chats.items(): self.last_messages[chat_id] = [last_message_data['text'][:250], last_message_data['timestamp']] self.init_messages[chat_id] = last_message_data['text'][:250] # ... rest of the listener logic ... ``` -------------------------------- ### Refund Order Source: https://funpayapi.readthedocs.io/ru/latest/account Initiates a refund for a given order. ```APIDOC ## POST /refund ### Description Initiates a refund for a given order. ### Method POST ### Endpoint /refund ### Parameters #### Request Body - **order_id** (str) - Required - The ID of the order for which to process a refund. ### Request Example ```json { "order_id": "ORD123456789" } ``` ### Response #### Success Response (200) - (No specific response body details provided, typically indicates success or returns status information) #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Listen for FunPay Events - Python Source: https://funpayapi.readthedocs.io/ru/latest/runner Continuously sends requests to retrieve new events from FunPay. This function returns a generator yielding various event types such as chat updates, message updates, and order status changes. It allows customization of the delay between requests and whether to ignore exceptions during the process. ```python def listen(_requests_delay : int | float = 6.0_, _ignore_exceptions : bool = True_) -> Generator[InitialChatEvent | ChatsListChangedEvent | LastChatMessageChangedEvent | NewMessageEvent | InitialOrderEvent | OrdersListChangedEvent | NewOrderEvent | OrderStatusChangedEvent]: ``` -------------------------------- ### Currency Enum Source: https://funpayapi.readthedocs.io/ru/latest/enums Enumerates the supported currency types for balances on FunPay. ```APIDOC ## Currency Enum ### Description This enum lists all currency types for the FunPay balance. ### Values - **USD (0)**: Dollar - **RUB (1)**: Ruble - **EUR (2)**: Euro ``` -------------------------------- ### Generate New Message Events Source: https://funpayapi.readthedocs.io/ru/latest/runner Generates new message events based on provided chat data. It takes a dictionary of chat IDs and corresponding interlocutor nicknames (or None) and returns a dictionary mapping chat IDs to lists of new message events. ```python chats_data = {48392847: 'SLLMK', 58392098: 'Amongus', 38948728: None} new_message_events = runner.generate_new_message_events(chats_data) ``` -------------------------------- ### Set Lot Fields Source: https://funpayapi.readthedocs.io/ru/latest/types Resets all current lot fields and sets them to the provided values. This method does not edit the properties of the LotFields instance itself but rather prepares the fields for potential renewal. It is a method of the LotFields class. ```python lot_fields = FunPayAPI.types.LotFields(lot_id=123, fields={'title_ru': 'Old Title'}) fields_to_set = {'title_ru': 'New Title', 'price': '100.50'} lot_fields.set_fields(fields_to_set) ``` -------------------------------- ### Account.get_sorted_subcategories Source: https://funpayapi.readthedocs.io/ru/latest/account Retrieves all FunPay subcategories organized into a dictionary structure. ```APIDOC ## GET /account/sorted_subcategories ### Description Returns all FunPay subcategories, organized in a dictionary where keys are subcategory types and values are dictionaries mapping subcategory IDs to subcategory objects. This data is parsed upon the first execution of the Account.get() method. ### Method GET ### Endpoint `/account/sorted_subcategories` ### Parameters None ### Response #### Success Response (200) - **sorted_subcategories** (dict[FunPayAPI.common.enums.SubCategoryTypes, dict[int, FunPayAPI.types.SubCategory]]) - A dictionary containing sorted subcategories. #### Response Example ```json { "sorted_subcategories": { "TYPE_A": { "1": {"id": 1, "name": "Subcategory A1"}, "2": {"id": 2, "name": "Subcategory A2"} }, "TYPE_B": { "3": {"id": 3, "name": "Subcategory B1"} } } } ``` ``` -------------------------------- ### Category Attributes Source: https://funpayapi.readthedocs.io/ru/latest/types Outlines the attributes of the Category class, which represents a game or product category. It includes the unique ID, the display name, and an optional list of subcategories associated with this category. ```python id _: int_ # ID категории (game_id / data-id). name _: str_ # Название категории (игры). subcategories _: list[FunPayAPI.types.SubCategory] | None # Подкатегории. ``` -------------------------------- ### Raise Lots with FunPayAPI Source: https://funpayapi.readthedocs.io/ru/latest/account This function raises all the lots for a given category (game) or a specified list of subcategories within FunPay. It allows the user to raise all subcategories or specify a subset, and also provides an option to exclude certain subcategories. The function returns a boolean to indicate success. ```python raise_lots(_category_id : int_, _subcategories : list[int | FunPayAPI.types.SubCategory] | None = None_, _exclude : list[int] | None = None_) -> bool ``` -------------------------------- ### Category Method: get_subcategory Source: https://funpayapi.readthedocs.io/ru/latest/types Implements the `get_subcategory` method for the Category class. This method is used to retrieve a specific subcategory based on its type and ID. It returns the `SubCategory` object if found, otherwise, it returns `None`. ```python get_subcategory(_subcategory_type : SubCategoryTypes_, _subcategory_id : int_) -> SubCategory | None: """ Возвращает объект подкатегории. Параметры: * **subcategory_type** (`FunPayAPI.common.enums.SubCategoryTypes`) – тип подкатегории. * **subcategory_id** (`int`) – ID подкатегории. Результат: объект подкатегории или None, если подкатегория не найдена. Тип результата: `FunPayAPI.types.SubCategory` or `None` """ pass ```