bloombox / bloombox.client.services.menu / MenuClient

MenuClient

class MenuClient : RPCClient, ServiceClient (source)

Menu API client. Provides access to menu/product catalog data for a particular partner and location pair. Menus can' be requested in full or section by section. By default, items marked as "invisible" are not returned - these are items considered out-of-stock or no longer carried by the partner. To retrieve all items, pass full as true.

Types

MenuContext

data class MenuContext

Specifies contextual information for a menu operation. Required context items (aside from the standard API key required for all operations) are the partner code and location code to consider when downloading menu data.

Constructors

<init>

MenuClient(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)

Menu API client. Provides access to menu/product catalog data for a particular partner and location pair. Menus can' be requested in full or section by section. By default, items marked as "invisible" are not returned - these are items considered out-of-stock or no longer carried by the partner. To retrieve all items, pass full as true.

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

retrieve

fun retrieve(context: MenuContext = MenuContext.defaultContext(), full: Boolean = false, callback: MenuCallback?, err: MenuErrorCallback?): ListenableFuture<Response>

Fetch an entire menu, asynchronously, for a given partner/location code pair. Every menu section is fetched. By default, items marked as "invisible" (i.e. out of stock, or not carried any longer) are not returned. To fetch all product catalog entries including these items, pass true for full.

fun retrieve(context: MenuContext = MenuContext.defaultContext(), full: Boolean = false): Response

Fetch an entire menu, synchronously, for a given partner/location code pair. Every menu section is fetched. By default, items marked as "invisible" (i.e. out of stock, or not carried any longer) are not returned. To fetch all product catalog entries including these items, pass true for full.