Skip to content

Latest commit

 

History

History
341 lines (256 loc) · 18.9 KB

File metadata and controls

341 lines (256 loc) · 18.9 KB

Buyers

Overview

Available Operations

list

List all buyers or search for a specific buyer.

Example Usage

package hello.world;

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

public class Application {

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

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

        ListBuyersRequest req = ListBuyersRequest.builder()
                .cursor("ZXhhbXBsZTE")
                .search("John")
                .externalIdentifier("buyer-12345")
                .build();


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

    }
}

Parameters

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

Response

ListBuyersResponse

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 buyer record.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.components.BuyerCreate;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.AddBuyerResponse;
import java.lang.Exception;

public class Application {

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

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

        AddBuyerResponse res = sdk.buyers().create()
                .buyerCreate(BuyerCreate.builder()
                    .build())
                .call();

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

Parameters

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

Response

AddBuyerResponse

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 buyer 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.GetBuyerResponse;
import java.lang.Exception;

public class Application {

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

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

        GetBuyerResponse res = sdk.buyers().get()
                .buyerId("fe26475d-ec3e-4884-9553-f7356683f7f9")
                .call();

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

Parameters

Parameter Type Required Description Example
buyerId String ✔️ The ID of the buyer to retrieve. fe26475d-ec3e-4884-9553-f7356683f7f9
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.

Response

GetBuyerResponse

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 */*

update

Updates a buyer record.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.components.BuyerUpdate;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.UpdateBuyerResponse;
import java.lang.Exception;

public class Application {

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

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

        UpdateBuyerResponse res = sdk.buyers().update()
                .buyerId("fe26475d-ec3e-4884-9553-f7356683f7f9")
                .buyerUpdate(BuyerUpdate.builder()
                    .build())
                .call();

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

Parameters

Parameter Type Required Description Example
buyerId String ✔️ The ID of the buyer to edit. fe26475d-ec3e-4884-9553-f7356683f7f9
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.
buyerUpdate BuyerUpdate ✔️ N/A

Response

UpdateBuyerResponse

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 */*

delete

Permanently removes a buyer record.

Example Usage

package hello.world;

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

public class Application {

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

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

        DeleteBuyerResponse res = sdk.buyers().delete()
                .buyerId("fe26475d-ec3e-4884-9553-f7356683f7f9")
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description Example
buyerId String ✔️ The ID of the buyer to delete. fe26475d-ec3e-4884-9553-f7356683f7f9
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.

Response

DeleteBuyerResponse

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 */*