All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.checkout.reports.ReportsClientImpl Maven / Gradle / Ivy

There is a newer version: 6.4.2
Show newest version
package com.checkout.reports;

import com.checkout.AbstractClient;
import com.checkout.ApiClient;
import com.checkout.CheckoutConfiguration;
import com.checkout.ContentResponse;
import com.checkout.SdkAuthorizationType;

import java.util.concurrent.CompletableFuture;

public class ReportsClientImpl extends AbstractClient implements ReportsClient {

    private static final String REPORTS_PATH = "reports";
    private static final String FILES_PATH = "files";

    public ReportsClientImpl(final ApiClient apiClient, final CheckoutConfiguration configuration) {
        super(apiClient, configuration, SdkAuthorizationType.SECRET_KEY_OR_OAUTH);
    }

    @Override
    public CompletableFuture getAllReports(final ReportsQuery query) {
        return apiClient.queryAsync(REPORTS_PATH, sdkAuthorization(), query, ReportsResponse.class);
    }

    @Override
    public CompletableFuture getReportDetails(final String reportId) {
        return apiClient.getAsync(buildPath(REPORTS_PATH, reportId), sdkAuthorization(), ReportDetailsResponse.class);
    }

    @Override
    public CompletableFuture getReportFile(final String reportId, final String fileId) {
        return apiClient.queryCsvContentAsync(
                buildPath(REPORTS_PATH, reportId, FILES_PATH, fileId),
                sdkAuthorization(),
                null,
                null);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy