### SDK API Usage Examples Source: https://github.com/1clickimpact/makeimpact-py/blob/main/TESTING.md Demonstrates the direct keyword argument approach for interacting with the 1ClickImpact SDK. These examples show how to plant trees, retrieve records, and get customer records. ```python # Simple API with direct keyword arguments sdk.plant_tree(amount=1, category="reforestation") sdk.get_records(filter_by="tree_planted", limit=10) sdk.get_customer_records(customer_email="example@email.com") ``` -------------------------------- ### Install MakeImpact Python SDK Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Install the makeimpact package using pip or poetry. ```bash pip install makeimpact # or poetry add makeimpact ``` -------------------------------- ### Install Test Dependencies Source: https://github.com/1clickimpact/makeimpact-py/blob/main/TESTING.md Installs necessary testing libraries like pytest and python-dotenv. Ensure pip is up-to-date before installation. ```bash # First make sure pip is up to date pip install --upgrade pip # Then install pytest and python-dotenv pip install pytest python-dotenv requests # Verify pytest was installed correctly python3 -c "import pytest; print(f'pytest version: {pytest.__version__}')" ``` -------------------------------- ### Get All Projects Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieves a list of all available environmental impact projects. The SDK must be initialized first. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get all projects projects = sdk.get_projects() ``` -------------------------------- ### Get All Customers Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieves a list of all customers. The default limit for results is 10. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get all customers (default limit is 10) customers = sdk.get_customers() ``` -------------------------------- ### Get Projects Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieve available environmental impact projects, with options to filter by type and locale. ```APIDOC ## GET /projects ### Description Retrieves a list of available environmental impact projects. Supports filtering by impact type and locale. ### Method GET ### Endpoint /projects ### Parameters #### Query Parameters - **type** (string) - Optional - Filters projects by impact type (e.g., "trees", "ocean", "carbon"). - **locale** (string) - Optional - Filters projects by language locale (e.g., "de" for German). ### Request Example ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get all projects projects = sdk.get_projects() # Filter by impact type tree_projects = sdk.get_projects(type="trees") ocean_projects = sdk.get_projects(type="ocean") carbon_projects = sdk.get_projects(type="carbon") # Get projects in a specific language german_projects = sdk.get_projects(locale="de") for project in projects.projects: print(f"{project.project_id}: {project.name} ({project.location})") ``` ### Response #### Success Response (200) - **projects** (array) - List of project objects. - **project_id** (string) - Unique identifier for the project. - **name** (string) - Name of the project. - **location** (string) - Location of the project. ``` -------------------------------- ### Get Customers Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieve a list of customer information, with options for filtering by email and pagination. ```APIDOC ## GET /customers ### Description Retrieves a list of customer information. Supports filtering by email and pagination. ### Method GET ### Endpoint /customers ### Parameters #### Query Parameters - **customer_email** (string) - Optional - Filters customers by email address. - **limit** (integer) - Optional - Maximum number of customers to return (1-1000, default 10). - **cursor** (string) - Optional - Cursor for paginating through results. ### Request Example ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get all customers (default limit is 10) customers = sdk.get_customers() # Get customers with filtering and pagination filtered_customers = sdk.get_customers( customer_email="example@email.com", # Optional: Filter by email limit=50, # Optional: Limit results (1-1000) cursor="cursor_from_previous_response" # Optional: For pagination ) ``` ### Response #### Success Response (200) - **customers** (array) - List of customer objects. - **next_cursor** (string) - Cursor for the next page of results. ``` -------------------------------- ### Verify API Key and Get Account Info with Python Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Use this snippet to verify your API key and retrieve your account information. This is useful for confirming authentication. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Verify API key and get account information account_info = sdk.who_am_i() ``` -------------------------------- ### Get Project by ID with Python Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieve full details for a specific project using its ID. You can also specify a locale for localized project information. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") project = sdk.get_project_by_id("PROJECT_ID") print(f"Name: {project.name}") print(f"Type: {project.type}") print(f"Location: {project.location}") print(f"Organization: {project.organization}") print(f"Available: {project.available}") # SDG alignments for sdg in project.sdgs: print(f"SDG {sdg.number}: {sdg.title}") # Get project in a specific language project_es = sdk.get_project_by_id("PROJECT_ID", locale="es") ``` -------------------------------- ### Get Impact Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Get aggregated lifetime impact statistics, including a breakdown between direct impact and customer impact. ```APIDOC ## Get Impact ### Description Get aggregated lifetime impact statistics with breakdown between direct impact and customer impact. ### Method `sdk.get_impact()` ### Parameters This method does not take any parameters. ### Request Example ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") impact = sdk.get_impact() ``` ### Response #### Success Response (200) - **tree_planted** (int) - Total trees planted - **waste_removed** (int) - Total ocean waste removed in lbs - **carbon_captured** (int) - Total carbon captured in lbs - **money_donated** (int) - Total money donated (in cents) - **user_impact** (object) - Direct impact by your organization - **tree_planted** (int) - Direct trees planted - **waste_removed** (int) - Direct waste removed in lbs - **customer_impact** (object) - Impact on behalf of customers - **tree_planted** (int) - Customer trees planted - **waste_removed** (int) - Customer waste removed in lbs ### Response Example ```json { "tree_planted": 10000, "waste_removed": 5000, "carbon_captured": 2000, "money_donated": 100000, "user_impact": { "tree_planted": 5000, "waste_removed": 2500 }, "customer_impact": { "tree_planted": 5000, "waste_removed": 2500 } } ``` ``` -------------------------------- ### Get Daily Impact Data with Python Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieve time-series daily impact data, with options to filter by a specific date range. This includes trees planted, waste removed, carbon captured, and money donated. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get all daily impact data daily_impact = sdk.get_daily_impact() for day in daily_impact.daily_impact: print(f"Date: {day.date}") print(f" Trees: {day.tree_planted}") print(f" Waste removed: {day.waste_removed} lbs") print(f" Carbon captured: {day.carbon_captured} lbs") print(f" Donated: ${day.money_donated / 100}") # Get daily impact for specific date range filtered_impact = sdk.get_daily_impact( start_date="2025-01-01", end_date="2025-12-31" ) ``` -------------------------------- ### Get Projects in Specific Language Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieves projects available in a specific language, using locale codes (e.g., 'de' for German). ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get projects in a specific language german_projects = sdk.get_projects(locale="de") ``` -------------------------------- ### Get All Records Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieves all impact records. Ensure you have initialized the OneClickImpact SDK with your API key. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get all records records = sdk.get_records() ``` -------------------------------- ### Get Records Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieve impact records with optional filtering by type, date range, and pagination support. ```APIDOC ## GET /records ### Description Retrieves impact records. Supports filtering by type and date range, and includes pagination. ### Method GET ### Endpoint /records ### Parameters #### Query Parameters - **filter_by** (string) - Optional - Filters records by type (e.g., "tree_planted"). - **start_date** (string) - Optional - Filters records starting from this date (YYYY-MM-DD). - **end_date** (string) - Optional - Filters records up to this date (YYYY-MM-DD). - **cursor** (string) - Optional - Cursor for paginating through results. - **limit** (integer) - Optional - Number of records to return per page (default 10). ### Request Example ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get all records records = sdk.get_records() # Filter records by type tree_records = sdk.get_records(filter_by="tree_planted") # Filter records by date range recent_records = sdk.get_records( start_date="2023-01-01", end_date="2023-12-31" ) # Pagination paginated_records = sdk.get_records( cursor="cursor_from_previous_response", limit=10 ) ``` ### Response #### Success Response (200) - **user_records** (array) - List of record objects. - **next_cursor** (string) - Cursor for the next page of results. ``` -------------------------------- ### Get Project by ID Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieve full details for a specific project using its unique identifier. You can also specify a locale for localized project information. ```APIDOC ## Get Project by ID ### Description Retrieve full details for a specific project. ### Method `sdk.get_project_by_id(project_id: str, locale: Optional[str] = None)` ### Parameters #### Path Parameters - **project_id** (str) - Required - Unique project identifier - **locale** (str) - Optional - Language code for localized information (e.g., "es") ### Request Example ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") project = sdk.get_project_by_id("PROJECT_ID") ``` ### Response #### Success Response (200) - **project_id** (str) - Unique project identifier - **name** (str) - Project name - **type** (str) - Impact type (`"trees"`, `"ocean"`, or `"carbon"`) - **location** (str) - Project location name - **description** (str) - Short project description - **about** (str) - Detailed project information - **country_code** (str) - ISO country code - **organization** (str) - Executing organization name - **sdgs** (list) - List of UN Sustainable Development Goals this project aligns with - **image_urls** (list) - List of project image URLs - **latitude** (float) - Project coordinates - **longitude** (float) - Project coordinates - **available** (bool) - Whether the project is currently active ### Response Example ```json { "project_id": "PROJECT_ID", "name": "Reforestation in the Amazon", "type": "trees", "location": "Amazon Rainforest", "description": "Planting trees to combat deforestation.", "about": "Detailed information about the reforestation project.", "country_code": "BR", "organization": "Amazon Conservation Team", "sdgs": [ {"number": 13, "title": "Climate Action"} ], "image_urls": ["url1", "url2"], "latitude": -3.4653, "longitude": -58.3800, "available": true } ``` ``` -------------------------------- ### Get Customer Records by Email Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieves impact records for a specific customer identified by their email address. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get records for a specific customer customer_records = sdk.get_customer_records( customer_email="customer@example.com" ) ``` -------------------------------- ### Get Aggregated Impact Statistics with Python Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Fetch aggregated lifetime impact statistics for your organization, including breakdowns for direct impact and impact on behalf of customers. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get overall impact statistics for your organization impact = sdk.get_impact() # Total impact (user + customer) print(f"Total trees planted: {impact.tree_planted}") print(f"Total ocean waste removed: {impact.waste_removed} lbs") print(f"Total carbon captured: {impact.carbon_captured} lbs") print(f"Total money donated: ${impact.money_donated / 100}") # Direct impact by your organization print(f"\nDirect impact trees: {impact.user_impact.tree_planted}") print(f"Direct impact waste removed: {impact.user_impact.waste_removed} lbs") # Impact on behalf of customers print(f"\nCustomer impact trees: {impact.customer_impact.tree_planted}") print(f"Customer impact waste removed: {impact.customer_impact.waste_removed} lbs") ``` -------------------------------- ### Get Customer Records Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieve records associated with a specific customer, identified by email, with optional filtering. ```APIDOC ## GET /customer_records ### Description Retrieves impact records for a specific customer identified by their email address. Supports filtering by record type. ### Method GET ### Endpoint /customer_records ### Parameters #### Query Parameters - **customer_email** (string) - Required - The email address of the customer. - **filter_by** (string) - Optional - Filters records by type (e.g., "tree_planted"). ### Request Example ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get records for a specific customer customer_records = sdk.get_customer_records( customer_email="customer@example.com" ) # Filter customer records by type customer_tree_records = sdk.get_customer_records( customer_email="customer@example.com", filter_by="tree_planted" ) ``` ### Response #### Success Response (200) - **user_records** (array) - List of record objects for the specified customer. ``` -------------------------------- ### Get Daily Impact Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieve time-series daily impact data, with optional filtering by date range. ```APIDOC ## Get Daily Impact ### Description Get time-series daily impact data with optional date range filtering. ### Method `sdk.get_daily_impact(start_date: Optional[str] = None, end_date: Optional[str] = None)` ### Parameters #### Query Parameters - **start_date** (str) - Optional - Start date for filtering (YYYY-MM-DD format) - **end_date** (str) - Optional - End date for filtering (YYYY-MM-DD format) ### Request Example ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") daily_impact = sdk.get_daily_impact(start_date="2025-01-01", end_date="2025-12-31") ``` ### Response #### Success Response (200) - **daily_impact** (list) - A list of daily impact records - **date** (str) - The date of the impact record (YYYY-MM-DD) - **tree_planted** (int) - Trees planted on this day - **waste_removed** (int) - Ocean waste removed on this day (lbs) - **carbon_captured** (int) - Carbon captured on this day (lbs) - **money_donated** (int) - Money donated on this day (in cents) ### Response Example ```json { "daily_impact": [ { "date": "2025-01-01", "tree_planted": 100, "waste_removed": 50, "carbon_captured": 20, "money_donated": 1000 }, { "date": "2025-01-02", "tree_planted": 120, "waste_removed": 60, "carbon_captured": 25, "money_donated": 1200 } ] } ``` ``` -------------------------------- ### Initialize SDK and Perform Basic Actions Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Initialize the SDK with an API key and perform basic environmental actions. ```python from makeimpact import OneClickImpact, Environment # Initialize the SDK with your API key (production environment by default) sdk = OneClickImpact("your_api_key") # Create environmental impact with just a few lines of code sdk.plant_tree(amount=1) sdk.clean_ocean(amount=5) sdk.capture_carbon(amount=2) ``` -------------------------------- ### Plant Trees with MakeImpact SDK Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Plant trees using the SDK, with options for quantity, category, and customer tracking. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Plant a single tree sdk.plant_tree(amount=1) # Plant trees with a specific category sdk.plant_tree(amount=10, category="food") # Plant trees with customer tracking sdk.plant_tree( amount=5, customer_email="customer@example.com", customer_name="John Doe" ) ``` -------------------------------- ### Initialize SDK with Sandbox Environment Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Use this snippet to initialize the SDK for testing purposes with the sandbox environment. Ensure you replace 'your_test_api_key' with your actual test API key. ```python from makeimpact import OneClickImpact, Environment # Initialize with sandbox environment sdk = OneClickImpact("your_test_api_key", Environment.SANDBOX) ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/1clickimpact/makeimpact-py/blob/main/TESTING.md Sets up a Python virtual environment for isolating project dependencies. Activate it using the appropriate command for your operating system. ```bash # Create a virtual environment python3 -m venv venv # Activate it on macOS/Linux source venv/bin/activate # Activate it on Windows virtualenv\Scripts\activate ``` -------------------------------- ### Run All Tests Source: https://github.com/1clickimpact/makeimpact-py/blob/main/TESTING.md Executes all tests in the project from the root directory. Use the -v flag for more verbose output. ```bash # From the project root directory python3 -m pytest tests/ # For more verbose output python3 -m pytest -v tests/ ``` -------------------------------- ### Capture Carbon with MakeImpact SDK Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Capture carbon using the SDK, with options for amount and customer tracking. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Capture 2 pounds of carbon sdk.capture_carbon(amount=2) # Capture carbon with customer tracking sdk.capture_carbon( amount=5, customer_email="customer@example.com", customer_name="John Doe" ) ``` -------------------------------- ### Iterate and Print Project Details Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Iterates through a list of projects and prints their ID, name, and location. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") projects = sdk.get_projects() for project in projects.projects: print(f"{project.project_id}: {project.name} ({project.location})") ``` -------------------------------- ### Create .env File for API Key Source: https://github.com/1clickimpact/makeimpact-py/blob/main/TESTING.md Alternatively, store your API key in a .env file in the project root for the SDK to load. Ensure the variable name is exactly TEST_API_KEY. ```dotenv TEST_API_KEY=your_sandbox_api_key_here ``` -------------------------------- ### Set API Key Environment Variable Source: https://github.com/1clickimpact/makeimpact-py/blob/main/TESTING.md Configures the API key for testing by setting the TEST_API_KEY environment variable. Replace 'your_sandbox_api_key_here' with your actual key. ```bash export TEST_API_KEY=your_sandbox_api_key_here ``` -------------------------------- ### Clean Ocean Plastic with MakeImpact SDK Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Remove ocean plastic using the SDK, with options for amount and customer tracking. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Clean 5 pounds of ocean plastic sdk.clean_ocean(amount=5) # Clean ocean plastic with customer tracking sdk.clean_ocean( amount=10, customer_email="customer@example.com", customer_name="John Doe" ) ``` -------------------------------- ### Create and Track Impact Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Demonstrates creating an impact (e.g., planting a tree) and then tracking its progress using the response identifiers. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # First create an impact response = sdk.plant_tree(amount=1) # Then track its progress tracking_info = sdk.track( user_id=response.user_id, time_utc=response.time_utc ) print(f"Tracking ID: {tracking_info.tracking_id}") print(f"Impact Initiated: {tracking_info.impact_initiated}") if tracking_info.project_location: print(f"Project Location: {tracking_info.project_location}") if tracking_info.assigned_agent: print(f"Assigned Agent: {tracking_info.assigned_agent}") if tracking_info.impact_completed: print(f"Impact Completed: {tracking_info.impact_completed}") ``` -------------------------------- ### Who Am I Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Verify your API key and retrieve account information. ```APIDOC ## Who Am I ### Description Verify your API key and get account information. ### Method `sdk.who_am_i()` ### Parameters This method does not take any parameters. ### Request Example ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") account_info = sdk.who_am_i() ``` ### Response #### Success Response (200) - **user_id** (str) - The unique identifier for the user. - **email** (str) - The email address associated with the account. - **organization_name** (str) - The name of the organization. - **plan_name** (str) - The name of the current subscription plan. ### Response Example ```json { "user_id": "USER_ID", "email": "user@example.com", "organization_name": "Example Corp", "plan_name": "Pro" } ``` ``` -------------------------------- ### Donate Money with MakeImpact SDK Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Donate money using the SDK, with options for amount and customer tracking. Note that custom causes require direct contact with 1ClickImpact. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Donate $1.00 (amount in cents) sdk.donate_money(amount=100) # Donate with customer tracking sdk.donate_money( amount=500, # $5.00 customer_email="customer@example.com", customer_name="John Doe" ) ``` -------------------------------- ### Filter and Paginate Customers Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieves customers with optional filtering by email and pagination. The limit can be set between 1 and 1000. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Get customers with filtering and pagination filtered_customers = sdk.get_customers( customer_email="example@email.com", # Optional: Filter by email limit=50, # Optional: Limit results (1-1000) cursor="cursor_from_previous_response" # Optional: For pagination ) ``` -------------------------------- ### Run Specific Test Method Source: https://github.com/1clickimpact/makeimpact-py/blob/main/TESTING.md Executes a single, specific test method, such as 'test_plant_trees_with_category'. This is useful for debugging a particular test case. ```bash # Run only the test for planting trees with a category python3 -m pytest tests/test_client.py::TestOneClickImpact::TestPlantTrees::test_plant_trees_with_category ``` -------------------------------- ### Run Specific Test Classes Source: https://github.com/1clickimpact/makeimpact-py/blob/main/TESTING.md Targets specific test classes for execution. Use this to isolate testing for 'Plant Trees' or 'Clean Ocean' functionalities. ```bash # Run only the Plant Trees tests python3 -m pytest tests/test_client.py::TestOneClickImpact::TestPlantTrees # Run only the Clean Ocean tests python3 -m pytest tests/test_client.py::TestOneClickImpact::TestCleanOcean ``` -------------------------------- ### Track Impact from Historical Records Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Shows how to retrieve historical records and then track a specific impact using its user ID and time. ```python # Get records and track a specific impact records = sdk.get_records(limit=1) if records.user_records: record = records.user_records[0] tracking_info = sdk.track( user_id=record.user_id, time_utc=record.time_utc ) print("Tracking Info:", tracking_info) ``` -------------------------------- ### Paginate Records Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieves impact records with pagination support using a cursor and limit. Use the cursor from a previous response to fetch the next set of records. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Pagination paginated_records = sdk.get_records( cursor="cursor_from_previous_response", limit=10 ) ``` -------------------------------- ### Additional Pytest Options Source: https://github.com/1clickimpact/makeimpact-py/blob/main/TESTING.md Utilizes advanced pytest options for enhanced testing control and reporting. Options include showing print statements, stopping on failure, and generating coverage reports. ```bash # Show print statements during tests python3 -m pytest -v tests/ -s # Stop after first failure python3 -m pytest tests/ -x # Show detailed test summary python3 -m pytest tests/ -v # Generate test coverage report # (requires pytest-cov package: pip install pytest-cov) python3 -m pytest --cov=makeimpact tests/ ``` -------------------------------- ### Filter Projects by Impact Type Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieves projects filtered by their impact type, such as 'trees', 'ocean', or 'carbon'. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Filter by impact type tree_projects = sdk.get_projects(type="trees") ocean_projects = sdk.get_projects(type="ocean") carbon_projects = sdk.get_projects(type="carbon") ``` -------------------------------- ### Filter Records by Date Range Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieves impact records within a specified date range. Dates should be in 'YYYY-MM-DD' format. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Filter records by date range recent_records = sdk.get_records( start_date="2023-01-01", end_date="2023-12-31" ) ``` -------------------------------- ### Filter Customer Records by Type Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieves impact records for a specific customer, filtered by impact type. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Filter customer records by type customer_tree_records = sdk.get_customer_records( customer_email="customer@example.com", filter_by="tree_planted" ) ``` -------------------------------- ### Filter Records by Type Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Retrieves impact records filtered by a specific type, such as 'tree_planted'. ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # Filter records by type tree_records = sdk.get_records(filter_by="tree_planted") ``` -------------------------------- ### Track Impact Source: https://github.com/1clickimpact/makeimpact-py/blob/main/README.md Track the lifecycle and status of a specific impact event using its user ID and timestamp. ```APIDOC ## GET /track ### Description Tracks the complete lifecycle and current status of a specific impact event. ### Method GET ### Endpoint /track ### Parameters #### Query Parameters - **user_id** (string) - Required - The unique identifier for the impact event. - **time_utc** (string) - Required - The UTC timestamp when the impact was created. ### Request Example ```python from makeimpact import OneClickImpact sdk = OneClickImpact("your_api_key") # First create an impact response = sdk.plant_tree(amount=1) # Then track its progress tracking_info = sdk.track( user_id=response.user_id, time_utc=response.time_utc ) print(f"Tracking ID: {tracking_info.tracking_id}") print(f"Impact Initiated: {tracking_info.impact_initiated}") if tracking_info.project_location: print(f"Project Location: {tracking_info.project_location}") if tracking_info.assigned_agent: print(f"Assigned Agent: {tracking_info.assigned_agent}") if tracking_info.impact_completed: print(f"Impact Completed: {tracking_info.impact_completed}") ``` ### Response #### Success Response (200) - **tracking_id** (string) - Unique identifier for this impact (format: `user_id-time_utc`). - **impact_initiated** (string) - UTC timestamp when the impact was created. - **tree_planted** (integer) - Optional - Impact metric for trees planted. - **waste_removed** (integer) - Optional - Impact metric for waste removed. - **carbon_captured** (integer) - Optional - Impact metric for carbon captured. - **money_donated** (integer) - Optional - Impact metric for money donated. - **category** (string) - Optional - Impact category (e.g., "food"). - **donation_available** (string) - Optional - UTC timestamp when the donation became available. - **donation_sent** (string) - Optional - UTC timestamp when the donation was sent. - **assigned_agent** (string) - Optional - Name of the agent or organization executing the impact. - **project_location** (string) - Optional - Detailed description of project location and partners. - **location_map** (string) - Optional - Google Maps embed URL for the project location. - **impact_completed** (string) - Optional - UTC timestamp when the impact was completed. - **donation_category** (string) - Optional - Type of impact funded (for donations). - **certificate** (string) - Optional - Certificate URL for the impact (only present in production). - **impact_video** (string) - Optional - URL to video recording or live session. - **live_session_date** (string) - Optional - Scheduled live session timestamp. - **project_id** (string) - Optional - ID of the project assigned to this impact. - **is_test_transaction** (boolean) - Whether this was a test transaction. - **is_bonus_impact** (boolean) - Whether this was a bonus impact from subscription plans. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.