@maxio-com/advanced-billing-sdk
Version:
Ultimate billing and pricing flexibility for B2B SaaS. Maxio integrates directly into your product, so you can seamlessly manage your product catalog, bill customers, and collect payments.
39 lines (33 loc) • 1.21 kB
text/typescript
/**
* AdvancedBilling
*
* This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
import { array, oneOf, Schema, string, validateAndMap } from '../../schema';
import { CustomerError, customerErrorSchema } from '../customerError';
/** This is a container type for one-of types. */
export type CustomerErrorResponseErrors = CustomerError | string[];
export const customerErrorResponseErrorsSchema: Schema<CustomerErrorResponseErrors> = oneOf(
[customerErrorSchema, array(string())]
);
export namespace CustomerErrorResponseErrors {
/**
* Validation method to narrow down union type to CustomerError type case.
*
* This is Customer Error case.
*/
export function isCustomerError(value: unknown): value is CustomerError {
const validationResult = validateAndMap(value, customerErrorSchema);
return validationResult.errors === false;
}
/**
* Validation method to narrow down union type to string[] type case.
*
* This is Array of String case.
*/
export function isArrayOfString(value: unknown): value is string[] {
return (
Array.isArray(value) && value.every((item) => typeof item === 'string')
);
}
}