bloombox / bloombox.client.services.shop / ShopClient

ShopClient

class ShopClient : RPCClient, ServiceClient (source)

Shop API client. Provides access to digital storefront and vendor services. With this API, you can communicate with the Bloombox Shop service to retrieve shop info and hours, verify and enroll members, and submit and retrieve commercial orders, among other things.

Types

ShopContext

data class ShopContext

Specifies contextual information for a shop operation. Required info, aside from the standard API key required for all transactions with the Bloombox API, includes the desired partner and location code. They can be specified here to override context for a specific client instance or request. If left unspecified, defaults are used.

Constructors

<init>

ShopClient(host: String, port: Int, apiKey: String, timeout: Duration, transportMode: TransportMode = TransportMode.SECURE, clientAuth: ClientAuth = ClientAuth.NONE, clientCredentials: ClientCredentials? = null, clientAuthorityRoots: InputStream? = null, executor: Executor = Executors.newSingleThreadExecutor(), defaultPartner: String? = null, defaultLocation: String? = null)

Shop API client. Provides access to digital storefront and vendor services. With this API, you can communicate with the Bloombox Shop service to retrieve shop info and hours, verify and enroll members, and submit and retrieve commercial orders, among other things.

Properties

apiKey

val apiKey: String

API key in use by this client. Identifies the implementing/integrating project that is operating this client. Can be obtained via the Bloombox Dashboard or a properly integrated Google Cloud Platform project.

channel

val channel: ManagedChannel

Channel for client->server traffic. Construction of this object is handled by the base RPC client class, which adds necessary items like base interceptors and crypto assets.

clientAuth

val clientAuth: ClientAuth

Client TLS auth mode. This specifies whether client auth is enabled or not for a given API client object. The default value is no client auth. Client authentication (mTLS) is required in some circumstances.

clientAuthorityRoots

val clientAuthorityRoots: InputStream?

Authority roots to accept from the client-side. Defaults to the embedded 'authority-roots.pem', which includes issuing authority certificates for all Bloombox endpoints.

clientCredentials

val clientCredentials: ClientCredentials?

Client credential information. This specifies the client-side portion of mTLS (Mutual Transport-Layer Security) credential data. In particular, this includes a private key and identity certificate chain. First position is the private client key, second is the certificate.

executor

val executor: Executor

Executor for followup and RPC client activities. Defaults to a single-threaded executor that conducts API requests and any related followup in a background thread.

host

val host: String

Host to send RPCs to. This is a regular hostname string, and can be a raw IP address (in the case of "127.0.0.1") or a DNS name.

port

val port: Int

Port to send RPCs to. In some circumstances this may be a service-specific value, and so it is specified here, but by and large RPC traffic occurs over ports 443 and 465.

timeout

val timeout: Duration

RPC request timeout to apply. After this duration, an in-flight RPC request with no server response data will be considered failed due to a "time-out."

transportMode

val transportMode: TransportMode

Transport mode setting. Available options are "INTERNAL" and "SECURE." In nearly all circumstances, including network-internal traffic, "SECURE" should be used, which enforces end-to-end SSL. "INTERNAL" mode is only useful during development and for machine-internal traffic.

Functions

checkZipcode

fun checkZipcode(zipcode: String, callback: ZipcheckCallback?, err: ShopErrorCallback?, context: ShopContext = ShopContext.defaultContext()): ListenableFuture<Response>

Fetch information about a given U.S. zipcode, with regard to storefront sales, asynchronously. The resulting info contains support status for delivery to the subject zipcode, and any delivery minimum subtotal value, if specified. "NOT_FOUND", or 404 when operating over HTTP, is interpreted to mean the zipcode is not supported.

fun checkZipcode(zipcode: String, context: ShopContext = ShopContext.defaultContext()): Response

Fetch information about a given U.S. zipcode, with regard to storefront sales. The resulting info contains support status for delivery to the subject zipcode, and any delivery minimum subtotal value, if specified. "NOT_FOUND", or 404 when operating over HTTP, is interpreted to mean the zipcode is not supported.

getOrder

fun getOrder(id: String, callback: GetOrderCallback?, err: ShopErrorCallback?, context: ShopContext = ShopContext.defaultContext()): ListenableFuture<Response>

Fetch a commercial order, asynchronously, with all associated data, including its status, action history, ordering customer info, and constituent order items. If the order could not be found, or the invoking client does not have access to the order, a "NOT_FOUND" status is returned (code 404 if operating over HTTP).

fun getOrder(id: String, context: ShopContext = ShopContext.defaultContext()): Response

Fetch a commercial order, synchronously, with all associated data, including its status, action history, ordering customer info, and constituent order items. If the order could not be found, or the invoking client does not have access to the order, a "NOT_FOUND" status is returned (code 404 if operating over HTTP).

info

fun info(callback: InfoCallback?, err: ShopErrorCallback?, context: ShopContext = ShopContext.defaultContext()): ListenableFuture<Response>

Fetch "top-of-the-fold" (i.e. the most critical) information about a particular digital storefront, asynchronously. This includes its current status (OPEN/CLOSED/{PICKUP|DELIVERY}_ONLY) and any other requisite information to render a page. This may change in the future.

fun info(context: ShopContext = ShopContext.defaultContext()): Response

Fetch "top-of-the-fold" (i.e. the most critical) information about a particular digital storefront. This includes its current status (OPEN/CLOSED/{PICKUP|DELIVERY}_ONLY) and any other requisite information to render a page. This may change in the future.

submitOrder

fun submitOrder(order: Order, callback: SubmitOrderCallback?, err: ShopErrorCallback?, context: ShopContext = ShopContext.defaultContext()): ListenableFuture<Response>

Submit a commercial order, asynchronously, to a particular digital storefront via the shop service (identified by a partner and location code pair). The ordering customer must be a valid member of the storefront at the specified partner and location code pair, in addition to being a valid and active user account at all (i.e. active and valid identification, medical recommendation if applicable, and good account standing). Items in the order are specified as product keys with an associated desired count.

fun submitOrder(order: Order, context: ShopContext = ShopContext.defaultContext()): Response

Submit a commercial order, synchronously, to a particular digital storefront via the shop service (identified by a partner and location code pair). The ordering customer must be a valid member of the storefront at the specified partner and location code pair, in addition to being a valid and active user account at all (i.e. active and valid identification, medical recommendation if applicable, and good account standing). Items in the order are specified as product keys with an associated desired count.

verifyMember

fun verifyMember(email: String, callback: VerifyMemberCallback?, err: ShopErrorCallback?, context: ShopContext = ShopContext.defaultContext()): ListenableFuture<Response>

Verify that an end user account is a valid and active member of the subject partner and location, asynchronously. This involves re-verifying the subject account's identification and medical recommendation (if applicable), and checking to make sure they are an active member of the specified digital storefront (addressed by its partner and location code pair).

fun verifyMember(email: String, context: ShopContext = ShopContext.defaultContext()): Response

Verify that an end user account is a valid and active member of the subject partner and location, synchronously. This involves re-verifying the subject account's identification and medical recommendation (if applicable), and checking to make sure they are an active member of the specified digital storefront (addressed by its partner and location code pair).