Skip to content

Latest commit

 

History

History
274 lines (204 loc) · 12.8 KB

File metadata and controls

274 lines (204 loc) · 12.8 KB

Reports

Overview

Available Operations

  • list - List configured reports
  • create - Add a report
  • get - Get a report
  • put - Update a report

list

List all configured reports that can be generated.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$request = new Gr4vy\ListReportsRequest();

$responses = $sdk->reports->list(
    request: $request
);


foreach ($responses as $response) {
    if ($response->statusCode === 200) {
        // handle response
    }
}

Parameters

Parameter Type Required Description
$request Gr4vy\ListReportsRequest ✔️ The request object to use for the request.

Response

?ListReportsResponse

Errors

Error Type Status Code Content Type
Errors\Error400 400 application/json
Errors\Error401 401 application/json
Errors\Error403 403 application/json
Errors\Error404 404 application/json
Errors\Error405 405 application/json
Errors\Error409 409 application/json
Errors\HTTPValidationError 422 application/json
Errors\Error425 425 application/json
Errors\Error429 429 application/json
Errors\Error500 500 application/json
Errors\Error502 502 application/json
Errors\Error504 504 application/json
errors\APIException 4XX, 5XX */*

create

Create a new report.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$reportCreate = new Gr4vy\ReportCreate(
    name: 'Monthly Transaction Report',
    schedule: '<value>',
    scheduleEnabled: true,
    scheduleTimezone: 'UTC',
    spec: new Gr4vy\DetailedSettlementReportSpec(
        params: [
            'filters' => [
                'ingested_at' => [
                    'end' => 'day_end',
                    'start' => 'day_start',
                ],
            ],
        ],
    ),
);

$response = $sdk->reports->create(
    reportCreate: $reportCreate
);

if ($response->report !== null) {
    // handle response
}

Parameters

Parameter Type Required Description Example
reportCreate ReportCreate ✔️ N/A
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?AddReportResponse

Errors

Error Type Status Code Content Type
Errors\Error400 400 application/json
Errors\Error401 401 application/json
Errors\Error403 403 application/json
Errors\Error404 404 application/json
Errors\Error405 405 application/json
Errors\Error409 409 application/json
Errors\HTTPValidationError 422 application/json
Errors\Error425 425 application/json
Errors\Error429 429 application/json
Errors\Error500 500 application/json
Errors\Error502 502 application/json
Errors\Error504 504 application/json
errors\APIException 4XX, 5XX */*

get

Fetches a report by its ID.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();



$response = $sdk->reports->get(
    reportId: '4d4c7123-b794-4fad-b1b9-5ab2606e6bbe'
);

if ($response->report !== null) {
    // handle response
}

Parameters

Parameter Type Required Description Example
reportId string ✔️ The ID of the report to retrieve details for. 4d4c7123-b794-4fad-b1b9-5ab2606e6bbe
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?GetReportResponse

Errors

Error Type Status Code Content Type
Errors\Error400 400 application/json
Errors\Error401 401 application/json
Errors\Error403 403 application/json
Errors\Error404 404 application/json
Errors\Error405 405 application/json
Errors\Error409 409 application/json
Errors\HTTPValidationError 422 application/json
Errors\Error425 425 application/json
Errors\Error429 429 application/json
Errors\Error500 500 application/json
Errors\Error502 502 application/json
Errors\Error504 504 application/json
errors\APIException 4XX, 5XX */*

put

Updates the configuration of a report.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$reportUpdate = new Gr4vy\ReportUpdate();

$response = $sdk->reports->put(
    reportId: '4d4c7123-b794-4fad-b1b9-5ab2606e6bbe',
    reportUpdate: $reportUpdate

);

if ($response->report !== null) {
    // handle response
}

Parameters

Parameter Type Required Description Example
reportId string ✔️ The ID of the report to edit. 4d4c7123-b794-4fad-b1b9-5ab2606e6bbe
reportUpdate ReportUpdate ✔️ N/A
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?UpdateReportResponse

Errors

Error Type Status Code Content Type
Errors\Error400 400 application/json
Errors\Error401 401 application/json
Errors\Error403 403 application/json
Errors\Error404 404 application/json
Errors\Error405 405 application/json
Errors\Error409 409 application/json
Errors\HTTPValidationError 422 application/json
Errors\Error425 425 application/json
Errors\Error429 429 application/json
Errors\Error500 500 application/json
Errors\Error502 502 application/json
Errors\Error504 504 application/json
errors\APIException 4XX, 5XX */*