@shipengine/connect-carrier-api
Version:
This is the typescript/javascript definitions for carrier api
20 lines (17 loc) • 1.13 kB
text/typescript
import Joi from 'joi';
import { ConnectionNames, ConnectionNamesSchema } from './connection-names-configuration';
export class AccountConnectionSpecification {
/** @description A Connection Name is an optional feature that an integration may provide. A
* common use of connections is to provide the ability to connect to a sandbox or production
* endpoint. This collection must be a unique set of strings representing a list of connections
* that a user may choose to use. When present {@link DefaultConnectionName} must also be
* populated.*/
ConnectionNames?: ConnectionNames[];
/** @description The default connection name to use if a connection name is not selected. This
* value must match a value in {@link ConnectionNames}*/
DefaultConnectionName?: ConnectionNames;
}
export const AccountConnectionSpecificationSchema = Joi.object({
ConnectionNames: Joi.array().items(ConnectionNamesSchema).optional().unique(),
DefaultConnectionName: ConnectionNamesSchema.required().optional(),
}).and('ConnectionNames', 'DefaultConnectionName'); // and is "all or nothing"; if one is present the other must be.