### Add and Make Example Executable Source: https://github.com/whopio/whopsdk-python/blob/main/CONTRIBUTING.md Demonstrates how to add a new Python example file to the `examples/` directory and make it executable. This allows for easy testing and running of example scripts. ```python # add an example to examples/.py #!/usr/bin/env -S rye run python … ``` -------------------------------- ### Run Example Scripts Source: https://github.com/whopio/whopsdk-python/blob/main/CONTRIBUTING.md Command to execute a Python example script after it has been added and made executable. This is useful for testing SDK functionality against your API. ```shell $ chmod +x examples/.py # run the example against your api $ ./examples/.py ``` -------------------------------- ### Install from Git Repository Source: https://github.com/whopio/whopsdk-python/blob/main/CONTRIBUTING.md Instructions for installing the Whop SDK Python package directly from its Git repository using pip. This is useful for development or using the latest unreleased code. ```shell $ pip install git+ssh://git@github.com/whopio/whopsdk-python.git ``` -------------------------------- ### Set Up Mock Server for Tests Source: https://github.com/whopio/whopsdk-python/blob/main/CONTRIBUTING.md Command to start a mock server using Prism, a tool that mocks API servers based on an OpenAPI specification. This is a prerequisite for running most of the project's tests. ```shell # you will need npm installed $ npx prism mock path/to/your/openapi.yml ``` -------------------------------- ### Install Dependencies with Rye Source: https://github.com/whopio/whopsdk-python/blob/main/CONTRIBUTING.md Commands to set up the project environment using Rye. Rye automatically provisions the correct Python version and manages dependencies. It can be run directly via a bootstrap script or manually after installing Rye. ```shell #!/bin/bash $ ./scripts/bootstrap ``` ```shell #!/bin/bash $ rye sync --all-features ``` -------------------------------- ### Build and Install Wheel File Source: https://github.com/whopio/whopsdk-python/blob/main/CONTRIBUTING.md Commands to build a distributable wheel file for the Python package using Rye or the standard Python build module. The generated wheel file in the `dist/` directory can then be installed efficiently. ```shell $ rye build # or $ python -m build $ pip install ./path-to-wheel-file.whl ``` -------------------------------- ### Publish PyPI Package Manually Source: https://github.com/whopio/whopsdk-python/blob/main/CONTRIBUTING.md Instructions for manually publishing the package to PyPI. This involves running a specific script (`bin/publish-pypi`) and ensuring the `PYPI_TOKEN` environment variable is set. ```shell # Ensure PYPI_TOKEN is set in your environment $ bin/publish-pypi ``` -------------------------------- ### Install Dependencies with Pip Source: https://github.com/whopio/whopsdk-python/blob/main/CONTRIBUTING.md Alternative method for installing project dependencies using pip without Rye. This involves ensuring the correct Python version is present, creating a virtual environment, and then installing from the requirements lock file. ```shell $ pip install -r requirements-dev.lock ``` -------------------------------- ### Install Whop Python SDK Source: https://github.com/whopio/whopsdk-python/blob/main/README.md Installs the Whop Python SDK from PyPI. This is the first step to using the library in your Python application. ```sh pip install whop-sdk ``` -------------------------------- ### Run Project Tests Source: https://github.com/whopio/whopsdk-python/blob/main/CONTRIBUTING.md Command to execute the project's test suite. This assumes the mock server is running if required by the tests. ```shell $ ./scripts/test ``` -------------------------------- ### Activate and Run Python Environment with Rye Source: https://github.com/whopio/whopsdk-python/blob/main/CONTRIBUTING.md Instructions for activating the virtual environment created by Rye and running Python scripts directly. This allows omitting the `rye run` prefix for convenience. ```shell # Activate the virtual environment $ source .venv/bin/activate # now you can omit the `rye run` prefix $ python script.py ``` -------------------------------- ### Lint and Format Code Source: https://github.com/whopio/whopsdk-python/blob/main/CONTRIBUTING.md Commands to run linting and code formatting checks using Ruff and Black. The `lint` script checks for issues, while the `format` script automatically fixes them. ```shell $ ./scripts/lint $ ./scripts/format ``` -------------------------------- ### Install Whop Python SDK with aiohttp support Source: https://github.com/whopio/whopsdk-python/blob/main/README.md Installs the Whop Python SDK with optional aiohttp support. This is for users who prefer aiohttp for asynchronous HTTP requests, potentially offering better concurrency. ```sh pip install whop-sdk[aiohttp] ``` -------------------------------- ### Promo Code Management with Whop Python SDK Source: https://context7.com/whopio/whopsdk-python/llms.txt This example demonstrates creating and managing promotional discount codes using the Whop Python SDK. It covers creating percentage-based and fixed-amount discount codes, specifying parameters like access pass ID, code, discount type, amount, duration, stock, and user restrictions. It also includes listing and deleting promo codes. ```python client = Whop(api_key="key", app_id="app_id") # Create percentage discount code promo = client.promo_codes.create( access_pass_id="pass_xxxxxxxxxxxxxx", code="SUMMER2024", discount_type="percentage", discount_amount=20, # 20% off duration_in_months=3, stock=100, new_users_only=True ) # Create fixed amount discount promo = client.promo_codes.create( access_pass_id="pass_xxxxxxxxxxxxxx", code="SAVE50", discount_type="flat_amount", discount_amount=5000, # $50 off in cents duration_in_months=1 ) # List promo codes promos = client.promo_codes.list( access_pass_id="pass_xxxxxxxxxxxxxx", status="active" ) # Delete promo code client.promo_codes.delete("promo_xxxxxxxxxxxxxx") ``` -------------------------------- ### Retrieve and Refund Payment (Python) Source: https://context7.com/whopio/whopsdk-python/llms.txt Provides code examples for retrieving specific payment details using its ID and processing full or partial refunds for a given payment. ```python client = Whop(api_key="key", app_id="app_id") # Retrieve a specific payment payment = client.payments.retrieve("pay_xxxxxxxxxxxxxx") print(f"Payment status: {payment.status}") print(f"Amount: {payment.final_amount} {payment.currency}") print(f"Customer: {payment.user_id}") # Refund a payment (full refund) refunded_payment = client.payments.refund("pay_xxxxxxxxxxxxxx") print(f"Refund status: {refunded_payment.status}") # Partial refund (amount in cents) refunded_payment = client.payments.refund( "pay_xxxxxxxxxxxxxx", amount=1000 # $10.00 refund ) ``` -------------------------------- ### Create Plans with Pricing using Whop Python SDK Source: https://context7.com/whopio/whopsdk-python/llms.txt This example illustrates how to create different types of plans, including recurring subscription plans and one-time purchase plans, using the Whop Python SDK. It allows setting parameters such as access pass ID, plan type, billing period, prices, stock, and accepted payment methods. The SDK functions return plan objects upon successful creation. ```python client = Whop(api_key="key", app_id="app_id") # Create monthly subscription plan plan = client.plans.create( access_pass_id="pass_xxxxxxxxxxxxxx", plan_type="recurring", billing_period=30, # days internal_notes="Standard monthly plan", direct_link_enabled=True, renewal_price=2999, # $29.99 in cents initial_price=1999, # $19.99 first month accepted_payment_methods=["card", "paypal"] ) print(f"Plan created: {plan.id}") # Create one-time purchase plan lifetime_plan = client.plans.create( access_pass_id="pass_xxxxxxxxxxxxxx", plan_type="one_time", initial_price=9999, # $99.99 stock=50 ) # List and filter plans plans = client.plans.list( access_pass_id="pass_xxxxxxxxxxxxxx", plan_type="recurring" ) ``` -------------------------------- ### Manage User Access with Whop SDK Source: https://context7.com/whopio/whopsdk-python/llms.txt Provides examples of retrieving user information, checking user access to a specific resource, and listing authorized users with specific roles using the Whop SDK. It requires an initialized Whop client. The output includes user details and access status. ```python client = Whop(api_key="key", app_id="app_id") # Retrieve user user = client.users.retrieve("user_xxxxxxxxxxxxxx") print(f"User: {user.email}") # Check user access to resource access = client.users.check_access( id="user_xxxxxxxxxxxxxx", resource_id="exp_xxxxxxxxxxxxxx" ) print(f"Has access: {access.valid}") print(f"Access type: {access.access_pass_type}") # List authorized users authorized = client.authorized_users.list( company_id="biz_xxxxxxxxxxxxxx", role="admin" ) for user in authorized.data: print(f"{user.email}: {user.role}") ``` -------------------------------- ### List Checkout Configurations using Whop SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Lists Checkout Configurations with optional filtering parameters using the Whop SDK. It returns a paginated list of Configurations. This method corresponds to the GET /checkout_configurations API endpoint. ```python from whop_sdk.types import CheckoutConfigurationListResponse # Assuming 'client' is an initialized Whop client instance # params would be a dictionary of CheckoutConfiguration list parameters # configs_page = client.checkout_configurations.list(**params) ``` -------------------------------- ### Create Invoice with Nested Parameters Source: https://github.com/whopio/whopsdk-python/blob/main/README.md Shows how to create an invoice using the Whop SDK, utilizing nested parameters for plan and product details. The example initializes the Whop client and calls the invoices.create method with specific parameters including a datetime object for the due date. ```python from whop_sdk import Whop from datetime import datetime client = Whop( app_id="app_xxxxxxxxxxxxxx", ) invoice = client.invoices.create( collection_method="send_invoice", company_id="biz_xxxxxxxxxxxxxx", due_date=datetime.fromisoformat("2023-12-01T05:00:00.401"), member_id="mber_xxxxxxxxxxxxx", plan={}, product={"title": "title"}, ) print(invoice.plan) ``` -------------------------------- ### List Memberships with Filters using Whop Python SDK Source: https://context7.com/whopio/whopsdk-python/llms.txt This example shows how to query and filter user memberships using the Whop Python SDK. It allows filtering by plan IDs, statuses, validity, creation and expiration dates, user IDs, and supports sorting and pagination. The function returns a list of membership data, including their IDs, statuses, and user IDs. ```python from datetime import datetime memberships = client.memberships.list( plan_ids=["plan_xxx"], statuses=["active", "trialing"], valid=True, created_after=datetime(2024, 1, 1), expires_after=datetime(2024, 12, 31), user_ids=["user_xxx", "user_yyy"], direction="asc", order="created_at", first=100 ) for membership in memberships.data: print(f"{membership.id}: {membership.status} - {membership.user_id}") ``` -------------------------------- ### Create Course, Chapter, and Lesson using Whop SDK Source: https://context7.com/whopio/whopsdk-python/llms.txt Demonstrates how to create a new course, add chapters, and lessons within that course using the Whop SDK. It requires an initialized Whop client with appropriate credentials. The outputs are structured objects representing the created course, chapter, and lesson. ```python client = Whop(api_key="key", app_id="app_id") # Create course course = client.courses.create( experience_id="exp_xxxxxxxxxxxxxx", title="Python Programming Masterclass", description="Learn Python from beginner to advanced", visibility="visible", language="en" ) # Create chapter chapter = client.course_chapters.create( course_id=course.id, title="Introduction to Python", description="Getting started with Python basics", position=1 ) # Create lesson lesson = client.course_lessons.create( chapter_id=chapter.id, title="Variables and Data Types", description="Understanding Python data types", content_type="video", position=1, video_url="https://example.com/video.mp4", duration_seconds=600 ) # List course students students = client.course_students.list(course_id=course.id) for student in students.data: print(f"Student: {student.user_id}, Progress: {student.progress_percentage}%") ``` -------------------------------- ### Initialize Whop Client (Python) Source: https://context7.com/whopio/whopsdk-python/llms.txt Demonstrates how to initialize the synchronous Whop client, including configuring custom timeouts, retries, and using a context manager for automatic resource cleanup. ```python import os from whop_sdk import Whop # Synchronous client client = Whop( api_key=os.environ.get("WHOP_API_KEY"), app_id="app_xxxxxxxxxxxxxx" ) # Configure custom timeout and retries client = Whop( api_key=os.environ.get("WHOP_API_KEY"), app_id="app_xxxxxxxxxxxxxx", timeout=30.0, max_retries=5 ) # Context manager for automatic cleanup with Whop(api_key="key", app_id="app_id") as client: payments = client.payments.list(company_id="biz_xxx") print(payments.data) ``` -------------------------------- ### Check Whop SDK Python Version Source: https://github.com/whopio/whopsdk-python/blob/main/README.md This code snippet allows you to programmatically determine the installed version of the Whop SDK within your Python environment. It requires the 'whop_sdk' library to be installed. The output is the version string. ```python import whop_sdk print(whop_sdk.__version__) ``` -------------------------------- ### Create and Manage Products with Whop Python SDK Source: https://context7.com/whopio/whopsdk-python/llms.txt This code demonstrates how to create, update, list, and delete products using the Whop Python SDK. It involves specifying product details like company ID, title, description, visibility, and initial stock. The SDK functions return product objects or status indicators for success. ```python client = Whop(api_key="key", app_id="app_id") # Create a product product = client.products.create( company_id="biz_xxxxxxxxxxxxxx", title="Premium Course Access", description="Access to all premium courses", visibility="visible", initial_stock=100 ) print(f"Created product: {product.id}") # Update product updated_product = client.products.update( product.id, title="Ultimate Course Bundle", description="Complete access to all courses and materials", visibility="hidden" ) # List products products = client.products.list(company_id="biz_xxxxxxxxxxxxxx") for prod in products.data: print(f"{prod.id}: {prod.title}") # Delete product deleted = client.products.delete("prod_xxxxxxxxxxxxxx") print(f"Deleted: {deleted.success}") ``` -------------------------------- ### List Courses - Python Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Lists courses with optional filtering parameters using the Whop SDK. It returns a paginated list of CourseListResponse objects. This method is associated with the GET /courses endpoint. ```python from whop_sdk.types import Course, Languages, CourseListResponse, CourseDeleteResponse # ... client initialization ... # Example usage: # courses_page = client.courses.list(**params) ``` -------------------------------- ### Create a Product using Whop Python SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md This method allows for the creation of a new product. It requires product creation parameters and returns the created product details. It depends on the whop_sdk.types.product_create_params and whop_sdk.types.shared.product modules. ```python from whop_sdk.types import Product from whop_sdk.types.product_create_params import ProductCreateParams # Assuming 'client' is an initialized Whop client instance # product_data: ProductCreateParams = {...} # Define your product data # created_product: Product = client.products.create(**product_data) ``` -------------------------------- ### List Forums - Python Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Lists forums with optional filtering parameters using the Whop SDK. It returns a paginated list of ForumListResponse objects. This method is associated with the GET /forums endpoint. ```python from whop_sdk.types import ForumListResponse # ... client initialization ... # Example usage: # forums_page = client.forums.list(**params) ``` -------------------------------- ### App Management in Python SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Demonstrates methods for managing apps using the whop_sdk. The `create` method takes parameters to create a new app, `retrieve` fetches an app by its ID, `update` modifies an existing app with new parameters, and `list` retrieves a paginated list of apps with optional parameters. These methods interact with the client's apps resource. ```python from whop_sdk.types import AppListResponse # Example usage (assuming 'client' is an initialized Whop client instance) # Create an app # new_app_params = {...} # Define creation parameters # created_app = client.apps.create(**new_app_params) # Retrieve an app by ID # app_id_to_retrieve = "some_app_id" # retrieved_app = client.apps.retrieve(app_id_to_retrieve) # Update an app by ID # app_id_to_update = "some_app_id" # update_params = {...} # Define update parameters # updated_app = client.apps.update(app_id_to_update, **update_params) # List apps # list_params = {...} # Define list parameters (optional) # app_list_response = client.apps.list(**list_params) ``` -------------------------------- ### List Members - Python Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Lists members with optional filtering parameters using the Whop SDK. It returns a paginated list of MemberListResponse objects. This method is associated with the GET /members endpoint. ```python from whop_sdk.types import MemberRetrieveResponse, MemberListResponse # ... client initialization ... # Example usage: # members_page = client.members.list(**params) ``` -------------------------------- ### List Reactions - Python Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Lists reactions with optional filtering parameters using the Whop SDK. It returns a paginated list of ReactionListResponse objects. This method is associated with the GET /reactions endpoint. ```python from whop_sdk.types import ReactionListResponse # ... client initialization ... # Example usage: # reactions_page = client.reactions.list(**params) ``` -------------------------------- ### List Promo Codes - Python Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Lists promo codes with optional filtering parameters using the Whop SDK. It returns a paginated list of PromoCodeListResponse objects. This method is associated with the GET /promo_codes endpoint. ```python from whop_sdk.types import ( PromoCode, PromoCodeStatus, PromoDuration, PromoCodeListResponse, PromoCodeDeleteResponse, ) # ... client initialization ... # Example usage: # promo_codes_page = client.promo_codes.list(**params) ``` -------------------------------- ### List Messages using Whop SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Lists Messages with optional filtering parameters using the Whop SDK. It returns a paginated list of Messages. This method corresponds to the GET /messages API endpoint. ```python from whop_sdk.types import MessageListResponse # Assuming 'client' is an initialized Whop client instance # params would be a dictionary of Message list parameters # messages_page = client.messages.list(**params) ``` -------------------------------- ### Create a Plan using Whop Python SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md This method creates a new plan. It requires plan creation parameters and returns the created plan details. It depends on the whop_sdk.types.plan_create_params and whop_sdk.types.shared.plan modules. ```python from whop_sdk.types import Plan from whop_sdk.types.plan_create_params import PlanCreateParams # Assuming 'client' is an initialized Whop client instance # plan_data: PlanCreateParams = {...} # Define your plan data # created_plan: Plan = client.plans.create(**plan_data) ``` -------------------------------- ### List Shipments using Whop SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Lists Shipments with optional filtering parameters using the Whop SDK. It returns a paginated list of Shipments. This method corresponds to the GET /shipments API endpoint. ```python from whop_sdk.types import ShipmentListResponse # Assuming 'client' is an initialized Whop client instance # params would be a dictionary of Shipment list parameters # shipments_page = client.shipments.list(**params) ``` -------------------------------- ### Initialize and use Whop Python SDK (Synchronous) Source: https://github.com/whopio/whopsdk-python/blob/main/README.md Demonstrates initializing the synchronous Whop client with an application ID and API key, then listing payments for a company. It shows how to access the data from the response. ```python import os from whop_sdk import Whop client = Whop( app_id="app_xxxxxxxxxxxxxx", api_key=os.environ.get("WHOP_API_KEY"), # This is the default and can be omitted ) page = client.payments.list( company_id="biz_xxxxxxxxxxxxxx", ) print(page.data) ``` -------------------------------- ### List AppBuilds using Whop SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Lists AppBuilds with optional filtering parameters using the Whop SDK. It returns a paginated list of AppBuilds. This method corresponds to the GET /app_builds API endpoint. ```python from whop_sdk.types import AppBuildListResponse # Assuming 'client' is an initialized Whop client instance # params would be a dictionary of AppBuild list parameters # app_builds_page = client.app_builds.list(**params) ``` -------------------------------- ### Initialize and Use Async Whop Client (Python) Source: https://context7.com/whopio/whopsdk-python/llms.txt Shows how to initialize and use the asynchronous Whop client for non-blocking operations, including fetching payments and integrating with libraries like aiohttp for enhanced concurrency. ```python import asyncio from whop_sdk import AsyncWhop async def main(): client = AsyncWhop( api_key="your_api_key", app_id="app_xxxxxxxxxxxxxx" ) # Fetch payments asynchronously payments = await client.payments.list(company_id="biz_xxx") for payment in payments.data: print(f"Payment {payment.id}: ${payment.final_amount}") # Use with aiohttp for better concurrency from whop_sdk import DefaultAioHttpClient async with AsyncWhop( api_key="key", app_id="app_id", http_client=DefaultAioHttpClient() ) as client: result = await client.payments.retrieve("pay_xxx") asyncio.run(main()) ``` -------------------------------- ### AppBuilds API Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Endpoints for managing App Builds, including creation, retrieval, listing, and promotion. ```APIDOC ## POST /app_builds ### Description Creates a new app build. ### Method POST ### Endpoint /app_builds ### Parameters #### Request Body - **params** (object) - Required - Parameters for creating an app build. ### Response #### Success Response (200) - **AppBuild** (object) - The created app build. ## GET /app_builds/{id} ### Description Retrieves a specific app build by its ID. ### Method GET ### Endpoint /app_builds/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the app build to retrieve. ### Response #### Success Response (200) - **AppBuild** (object) - The requested app build. ## GET /app_builds ### Description Lists all app builds with optional filtering and pagination. ### Method GET ### Endpoint /app_builds ### Parameters #### Query Parameters - **params** (object) - Optional - Parameters for filtering and paginating the list of app builds. ### Response #### Success Response (200) - **SyncCursorPage[AppBuildListResponse]** (object) - A paginated list of app builds. ## POST /app_builds/{id}/promote ### Description Promotes a specific app build. ### Method POST ### Endpoint /app_builds/{id}/promote ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the app build to promote. ### Response #### Success Response (200) - **AppBuild** (object) - The promoted app build. ``` -------------------------------- ### Retrieve Course by ID - Python Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Retrieves a specific course by its ID using the Whop SDK. It takes the course ID as input and returns a Course object. This method corresponds to the GET /courses/{id} endpoint. ```python from whop_sdk.types import Course, Languages, CourseListResponse, CourseDeleteResponse # ... client initialization ... # Example usage: # course = client.courses.retrieve(id) ``` -------------------------------- ### Manage Whop Community Experiences (Forums, Chat) Source: https://context7.com/whopio/whopsdk-python/llms.txt Shows how to create and manage community features such as experiences, forums, forum posts, and chat channels using the Whop SDK. This requires an authenticated Whop client. The code creates these resources and demonstrates sending a message. ```python client = Whop(api_key="key", app_id="app_id") # Create experience experience = client.experiences.create( product_id="prod_xxxxxxxxxxxxxx", title="VIP Community", experience_type="chat", visibility="visible" ) # Create forum forum = client.forums.create( experience_id="exp_xxxxxxxxxxxxxx", title="General Discussion", description="Talk about anything here", who_can_post="all_members" ) # Create forum post post = client.forum_posts.create( forum_id="forum_xxxxxxxxxxxxxx", user_id="user_xxxxxxxxxxxxxx", content="Welcome to the community!", title="Welcome Post" ) # Create chat channel channel = client.chat_channels.create( experience_id="exp_xxxxxxxxxxxxxx", name="announcements", description="Important updates" ) # Send message message = client.messages.create( chat_channel_id="chan_xxxxxxxxxxxxxx", user_id="user_xxxxxxxxxxxxxx", content="Hello everyone!" ) ``` -------------------------------- ### Retrieve Reaction by ID - Python Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Retrieves a specific reaction by its ID using the Whop SDK. It takes the reaction ID as input and returns a Reaction object. This method corresponds to the GET /reactions/{id} endpoint. ```python from whop_sdk.types import ReactionListResponse # ... client initialization ... # Example usage: # reaction = client.reactions.retrieve(id) ``` -------------------------------- ### Products API Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Endpoints for creating, retrieving, updating, listing, and deleting products. ```APIDOC ## POST /products ### Description Creates a new product. ### Method POST ### Endpoint /products ### Parameters #### Request Body - **params** (object) - Required - Parameters for creating a product. ### Request Example ```json { "example": "{\"name\": \"Example Product\", \"price\": 1000}" } ``` ### Response #### Success Response (200) - **product** (object) - The created product details. #### Response Example ```json { "example": "{\"id\": \"prod_12345\", \"name\": \"Example Product\", \"price\": 1000}" } ``` ``` ```APIDOC ## GET /products/{id} ### Description Retrieves a specific product by its ID. ### Method GET ### Endpoint /products/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the product to retrieve. ### Response #### Success Response (200) - **product** (object) - The details of the requested product. #### Response Example ```json { "example": "{\"id\": \"prod_12345\", \"name\": \"Example Product\", \"price\": 1000}" } ``` ``` ```APIDOC ## PATCH /products/{id} ### Description Updates an existing product. ### Method PATCH ### Endpoint /products/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the product to update. #### Request Body - **params** (object) - Required - Parameters for updating the product. ### Response #### Success Response (200) - **product** (object) - The updated product details. #### Response Example ```json { "example": "{\"id\": \"prod_12345\", \"name\": \"Updated Product Name\", \"price\": 1200}" } ``` ``` ```APIDOC ## GET /products ### Description Retrieves a list of products, supporting pagination. ### Method GET ### Endpoint /products ### Parameters #### Query Parameters - **params** (object) - Optional - Parameters for filtering and paginating the product list. ### Response #### Success Response (200) - **products** (object) - A paginated list of products. #### Response Example ```json { "example": "{\"items\": [{\"id\": \"prod_12345\", \"name\": \"Example Product\"}], \"next_cursor\": \"cursor_abcde\"}" } ``` ``` ```APIDOC ## DELETE /products/{id} ### Description Deletes a product by its ID. ### Method DELETE ### Endpoint /products/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the product to delete. ### Response #### Success Response (200) - **response** (object) - The response indicating the success of the deletion. #### Response Example ```json { "example": "{\"success\": true}" } ``` ``` -------------------------------- ### Retrieve Forum by ID - Python Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Retrieves a specific forum's details by its ID using the Whop SDK. It takes the forum ID as input and returns a Forum object. This method corresponds to the GET /forums/{id} endpoint. ```python from whop_sdk.types import ForumListResponse # ... client initialization ... # Example usage: # forum = client.forums.retrieve(id) ``` -------------------------------- ### Initialize and use Whop Async SDK with aiohttp Source: https://github.com/whopio/whopsdk-python/blob/main/README.md Demonstrates initializing the asynchronous Whop client using `aiohttp` as the HTTP backend. The client is managed with an `async with` statement, and API calls are awaited. ```python import asyncio from whop_sdk import DefaultAioHttpClient from whop_sdk import AsyncWhop async def main() -> None: async with AsyncWhop( app_id="app_xxxxxxxxxxxxxx", api_key="My API Key", http_client=DefaultAioHttpClient(), ) as client: page = await client.payments.list( company_id="biz_xxxxxxxxxxxxxx", ) print(page.data) asyncio.run(main()) ``` -------------------------------- ### Retrieve Member by ID - Python Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Retrieves a specific member's details by their ID using the Whop SDK. It takes the member ID as input and returns a MemberRetrieveResponse object. This method corresponds to the GET /members/{id} endpoint. ```python from whop_sdk.types import MemberRetrieveResponse, MemberListResponse # ... client initialization ... # Example usage: # member = client.members.retrieve(id) ``` -------------------------------- ### Whop SDK: Manage Experiences (Python) Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Provides comprehensive methods for creating, retrieving, updating, deleting, attaching, detaching, and duplicating experiences via the Whop API. Supports detailed parameter configurations for each action. ```python from whop_sdk.types import ExperienceListResponse, ExperienceDeleteResponse from whop_sdk.types.shared.experience import Experience # Create a new experience new_experience: Experience = client.experiences.create(**create_params) # Retrieve an experience by ID experience: Experience = client.experiences.retrieve(experience_id) # Update an experience updated_experience: Experience = client.experiences.update(experience_id, **update_params) # List experiences with optional parameters experience_list: SyncCursorPage[ExperienceListResponse] = client.experiences.list(**list_params) # Delete an experience delete_response: ExperienceDeleteResponse = client.experiences.delete(experience_id) # Attach a user to an experience attached_experience: Experience = client.experiences.attach(experience_id, **attach_params) # Detach a user from an experience detached_experience: Experience = client.experiences.detach(experience_id, **detach_params) # Duplicate an experience duplicated_experience: Experience = client.experiences.duplicate(experience_id, **duplicate_params) ``` -------------------------------- ### List Chat Channels using Whop SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Lists Chat Channels with optional filtering parameters using the Whop SDK. It returns a paginated list of Chat Channels. This method corresponds to the GET /chat_channels API endpoint. ```python from whop_sdk.types import ChatChannelListResponse # Assuming 'client' is an initialized Whop client instance # params would be a dictionary of ChatChannel list parameters # channels_page = client.chat_channels.list(**params) ``` -------------------------------- ### Create, Retrieve, Update, List, Delete Course Lessons (Python) Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Enables management of course lessons. Supports creating new lessons, retrieving existing ones by ID, updating lesson details, listing all lessons with pagination, and deleting lessons. Specific parameter objects are used for creation and update. ```python from whop_sdk.types import ( AssessmentQuestionTypes, Lesson, LessonTypes, LessonVisibilities, CourseLessonListResponse, CourseLessonDeleteResponse, ) # Create a course lesson # client.course_lessons.create(**params) -> Lesson # Retrieve a course lesson by ID # client.course_lessons.retrieve(id) -> Lesson # Update a course lesson by ID # client.course_lessons.update(id, **params) -> Lesson # List all course lessons with pagination # client.course_lessons.list(**params) -> SyncCursorPage[CourseLessonListResponse] # Delete a course lesson by ID # client.course_lessons.delete(id) -> CourseLessonDeleteResponse ``` -------------------------------- ### Retrieve Promo Code by ID - Python Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Retrieves a specific promo code by its ID using the Whop SDK. It takes the promo code ID as input and returns a PromoCode object. This method corresponds to the GET /promo_codes/{id} endpoint. ```python from whop_sdk.types import ( PromoCode, PromoCodeStatus, PromoDuration, PromoCodeListResponse, PromoCodeDeleteResponse, ) # ... client initialization ... # Example usage: # promo_code = client.promo_codes.retrieve(id) ``` -------------------------------- ### Create, Retrieve, Update, List, Delete Course Chapters (Python) Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Provides functionality to manage course chapters. Includes methods for creation, retrieval by ID, updating, listing all chapters with pagination, and deletion. Requires specific parameters for create and update operations. ```python from whop_sdk.types import CourseChapter, CourseChapterListResponse, CourseChapterDeleteResponse # Create a course chapter # client.course_chapters.create(**params) -> CourseChapter # Retrieve a course chapter by ID # client.course_chapters.retrieve(id) -> CourseChapter # Update a course chapter by ID # client.course_chapters.update(id, **params) -> CourseChapter # List all course chapters with pagination # client.course_chapters.list(**params) -> SyncCursorPage[CourseChapterListResponse] # Delete a course chapter by ID # client.course_chapters.delete(id) -> CourseChapterDeleteResponse ``` -------------------------------- ### Create Course - Python Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Creates a new course using the Whop SDK. Requires course creation parameters and returns a Course object. This method interacts with the POST /courses endpoint. ```python from whop_sdk.types import Course, Languages, CourseListResponse, CourseDeleteResponse # ... client initialization ... # Example usage: # new_course = client.courses.create(**params) ``` -------------------------------- ### Retrieve Message by ID using Whop SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Retrieves a specific Message by its ID using the Whop SDK. It takes the Message ID as input and returns a Message object. This method corresponds to the GET /messages/{id} API endpoint. ```python from whop_sdk.types import MessageListResponse # Assuming 'client' is an initialized Whop client instance # message = client.messages.retrieve(id) ``` -------------------------------- ### Retrieve Shipment by ID using Whop SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Retrieves a specific Shipment by its ID using the Whop SDK. It takes the Shipment ID as input and returns a Shipment object. This method corresponds to the GET /shipments/{id} API endpoint. ```python from whop_sdk.types import ShipmentListResponse # Assuming 'client' is an initialized Whop client instance # shipment = client.shipments.retrieve(id) ``` -------------------------------- ### Create a Company using Whop Python SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md This method creates a new company. It requires company creation parameters and returns the created company details. It depends on the whop_sdk.types.company_create_params and whop_sdk.types.shared.company modules. ```python from whop_sdk.types import Company from whop_sdk.types.company_create_params import CompanyCreateParams # Assuming 'client' is an initialized Whop client instance # company_data: CompanyCreateParams = {...} # Define your company data # created_company: Company = client.companies.create(**company_data) ``` -------------------------------- ### Create AppBuild using Whop SDK Source: https://github.com/whopio/whopsdk-python/blob/main/api.md Creates a new AppBuild using the Whop SDK. It requires optional parameters and returns an AppBuild object. This method corresponds to the POST /app_builds API endpoint. ```python from whop_sdk.types import AppBuildListResponse # Assuming 'client' is an initialized Whop client instance # params would be a dictionary of AppBuild creation parameters # app_build = client.app_builds.create(**params) ```