Skip to content

Latest commit

 

History

History
287 lines (218 loc) · 15.7 KB

File metadata and controls

287 lines (218 loc) · 15.7 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

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.ListReportsRequest;
import com.gr4vy.sdk.models.operations.ListReportsResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Gr4vy sdk = Gr4vy.builder()
                .merchantAccountId("<id>")
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        ListReportsRequest req = ListReportsRequest.builder()
                .build();


        sdk.reports().list()
                .callAsStream()
                .forEach((ListReportsResponse item) -> {
                   // handle page
                });

    }
}

Parameters

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

Response

ListReportsResponse

Errors

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

create

Create a new report.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.components.*;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.AddReportResponse;
import java.lang.Exception;
import java.util.Map;

public class Application {

    public static void main(String[] args) throws Exception {

        Gr4vy sdk = Gr4vy.builder()
                .merchantAccountId("<id>")
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        AddReportResponse res = sdk.reports().create()
                .reportCreate(ReportCreate.builder()
                    .name("Monthly Transaction Report")
                    .schedule(ReportSchedule.DAILY)
                    .scheduleEnabled(true)
                    .spec(DetailedSettlementReportSpec.builder()
                        .params(Map.ofEntries(
                            Map.entry("filters", Map.ofEntries(
                                Map.entry("ingested_at", Map.ofEntries(
                                    Map.entry("end", "day_end"),
                                    Map.entry("start", "day_start")))))))
                        .build())
                    .scheduleTimezone("UTC")
                    .build())
                .call();

        if (res.report().isPresent()) {
            System.out.println(res.report().get());
        }
    }
}

Parameters

Parameter Type Required Description
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.
reportCreate ReportCreate ✔️ N/A

Response

AddReportResponse

Errors

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

get

Fetches a report by its ID.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.GetReportResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Gr4vy sdk = Gr4vy.builder()
                .merchantAccountId("<id>")
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        GetReportResponse res = sdk.reports().get()
                .reportId("4d4c7123-b794-4fad-b1b9-5ab2606e6bbe")
                .call();

        if (res.report().isPresent()) {
            System.out.println(res.report().get());
        }
    }
}

Parameters

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

Response

GetReportResponse

Errors

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

put

Updates the configuration of a report.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.components.ReportUpdate;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.UpdateReportResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Gr4vy sdk = Gr4vy.builder()
                .merchantAccountId("<id>")
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        UpdateReportResponse res = sdk.reports().put()
                .reportId("4d4c7123-b794-4fad-b1b9-5ab2606e6bbe")
                .reportUpdate(ReportUpdate.builder()
                    .build())
                .call();

        if (res.report().isPresent()) {
            System.out.println(res.report().get());
        }
    }
}

Parameters

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

Response

UpdateReportResponse

Errors

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