{
    "openapi": "3.0.3",
    "info": {
        "title": "Get Donations for Charity Group",
        "description": "Get list of charity group donations.",
        "version": "1.0.0",
        "contact": {
            "name": "RunSignup API Support",
            "url": "https://runsignup.com/API",
            "email": "info@runsignup.com"
        }
    },
    "servers": [
        {
            "url": "https://api.runsignup.com/rest",
            "description": "Production API Server"
        }
    ],
    "tags": [
        {
            "name": "Charity Group",
            "description": "APIs related to Charity Group"
        }
    ],
    "components": {
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "string",
                        "description": "Error message"
                    },
                    "details": {
                        "type": "object",
                        "description": "Additional error details",
                        "additionalProperties": true
                    }
                },
                "required": [
                    "error"
                ]
            },
            "BadRequestError": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Error"
                    },
                    {
                        "description": "Error indicating invalid request parameters or structure"
                    }
                ]
            },
            "UnauthorizedError": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Error"
                    },
                    {
                        "description": "Error indicating authentication failure"
                    }
                ]
            },
            "ForbiddenError": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Error"
                    },
                    {
                        "description": "Error indicating the authenticated user lacks required permissions"
                    }
                ]
            },
            "NotFoundError": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Error"
                    },
                    {
                        "description": "Error indicating the requested resource does not exist"
                    }
                ]
            },
            "ServerError": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Error"
                    },
                    {
                        "description": "Error indicating an unexpected server-side issue"
                    }
                ]
            },
            "V2CharityGroupGetCharityGroupRaceDonationsGetResponse": {
                "type": "object",
                "title": "Charity Group Donations",
                "description": "List of donations associated with a charity group.",
                "properties": {
                    "race_donations": {
                        "type": "array",
                        "description": "List of race donations",
                        "items": {
                            "type": "object",
                            "description": "Individual donation information",
                            "nullable": true,
                            "properties": {
                                "donation_id": {
                                    "type": "integer",
                                    "description": "Unique identifier for the donation"
                                },
                                "race_fundraiser_id": {
                                    "type": "integer",
                                    "description": "Race fundraiser ID"
                                },
                                "race_id": {
                                    "type": "integer",
                                    "description": "Race ID"
                                },
                                "transaction_id": {
                                    "type": "integer",
                                    "description": "Transaction ID"
                                },
                                "rsu_transaction_id": {
                                    "type": "integer",
                                    "description": "RunSignUp transaction ID"
                                },
                                "invoice_num": {
                                    "type": "integer",
                                    "description": "Invoice number"
                                },
                                "donor": {
                                    "type": "object",
                                    "description": "Information about the donor",
                                    "nullable": true,
                                    "properties": {
                                        "user_id": {
                                            "type": "integer",
                                            "description": "User ID of the donor"
                                        },
                                        "first_name": {
                                            "type": "string",
                                            "description": "First name of the donor"
                                        },
                                        "last_name": {
                                            "type": "string",
                                            "description": "Last name of the donor"
                                        },
                                        "email": {
                                            "type": "string",
                                            "description": "Email of the donor"
                                        },
                                        "phone_number": {
                                            "type": "string",
                                            "description": "Phone number of the donor"
                                        }
                                    },
                                    "required": [
                                        "user_id",
                                        "first_name",
                                        "last_name",
                                        "email",
                                        "phone_number"
                                    ]
                                },
                                "donation_amount": {
                                    "type": "string",
                                    "description": "Amount of the donation"
                                },
                                "amount_paid": {
                                    "type": "string",
                                    "description": "Amount actually paid"
                                },
                                "processing_fee": {
                                    "type": "string",
                                    "description": "Processing fee for the donation"
                                },
                                "status": {
                                    "type": "string",
                                    "description": "Status of the donation"
                                },
                                "on_behalf_of": {
                                    "type": "string",
                                    "description": "Donation made on behalf of"
                                },
                                "anonymous": {
                                    "type": "string",
                                    "description": "Whether the donation is anonymous",
                                    "enum": [
                                        "T",
                                        "F"
                                    ]
                                },
                                "donation_date_ts": {
                                    "type": "integer",
                                    "description": "Timestamp when the donation was made"
                                },
                                "charity_id": {
                                    "type": "integer",
                                    "description": "ID of the associated charity"
                                },
                                "charity_name": {
                                    "type": "string",
                                    "description": "Name of the associated charity"
                                }
                            },
                            "required": [
                                "donation_id",
                                "race_fundraiser_id",
                                "race_id",
                                "transaction_id",
                                "rsu_transaction_id",
                                "invoice_num",
                                "donor",
                                "donation_amount",
                                "amount_paid",
                                "processing_fee",
                                "status",
                                "on_behalf_of",
                                "anonymous",
                                "donation_date_ts",
                                "charity_id",
                                "charity_name"
                            ]
                        }
                    }
                },
                "required": [
                    "race_donations"
                ],
                "example": {
                    "race_donations": [
                        {
                            "donation_id": 12345,
                            "race_fundraiser_id": 1,
                            "race_id": 555,
                            "transaction_id": 1234567,
                            "rsu_transaction_id": 7654321,
                            "invoice_num": 1234,
                            "donor": {
                                "user_id": 123,
                                "first_name": "John",
                                "last_name": "Doe",
                                "email": "john.doe@example.com",
                                "phone_number": "555-555-5555"
                            },
                            "donation_amount": "$90.00",
                            "amount_paid": "$88.00",
                            "processing_fee": "$2.00",
                            "status": "Normal",
                            "on_behalf_of": "The Doe Family",
                            "anonymous": "F",
                            "donation_date_ts": 111111111,
                            "charity_id": 33,
                            "charity_name": "Save the Whales"
                        }
                    ]
                }
            }
        },
        "securitySchemes": {
            "apiKey": {
                "type": "apiKey",
                "in": "query",
                "name": "api_key",
                "description": "RunSignup API Key"
            },
            "apiSecret": {
                "type": "apiKey",
                "in": "query",
                "name": "api_secret",
                "description": "RunSignup API Secret"
            }
        }
    },
    "paths": {
        "/v2/charity-group/get-charity-group-race-donations.json": {
            "get": {
                "tags": [
                    "Charity Group"
                ],
                "summary": "Get Donations for Charity Group",
                "description": "Get list of charity group donations.",
                "operationId": "v2_charity_group_get_charity_group_race_donations_json",
                "parameters": [
                    {
                        "name": "charity_group_id",
                        "in": "query",
                        "description": "ID of charity group.",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "rsu_api_key",
                        "in": "query",
                        "description": "API key.",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-RSU-API-SECRET",
                        "in": "header",
                        "description": "API secret.",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Page number to get.",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": "1"
                        }
                    },
                    {
                        "name": "results_per_page",
                        "in": "query",
                        "description": "Number of results per page.",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": "50"
                        }
                    },
                    {
                        "name": "donations_after_ts",
                        "in": "query",
                        "description": "Get donations donated on or after the provided timestamp.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "donations_before_ts",
                        "in": "query",
                        "description": "Get donations donated on or before the provided timestamp.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "security": [
                    {
                        "apiKey": [],
                        "apiSecret": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Charity Group Donations - List of donations associated with a charity group.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/V2CharityGroupGetCharityGroupRaceDonationsGetResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BadRequestError"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/UnauthorizedError"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ForbiddenError"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/NotFoundError"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ServerError"
                                }
                            }
                        }
                    }
                },
                "x-permissions": []
            }
        }
    }
}