/* tslint:disable */ /* eslint-disable */ /** * Boat Public API v1 * Public JSON API for creating, operating, prompting, observing, and exposing Boat sandboxes from backend services, CI jobs, hosted workers, and Boat automation products. The v1 reference intentionally documents the developer integration surface only. Dashboard billing actions are not part of v1. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { mapValues } from '../runtime'; import type { ApiKeyScope } from './ApiKeyScope'; import { ApiKeyScopeFromJSON, ApiKeyScopeFromJSONTyped, ApiKeyScopeToJSON, ApiKeyScopeToJSONTyped, } from './ApiKeyScope'; import type { ApiKeyRequestUsage } from './ApiKeyRequestUsage'; import { ApiKeyRequestUsageFromJSON, ApiKeyRequestUsageFromJSONTyped, ApiKeyRequestUsageToJSON, ApiKeyRequestUsageToJSONTyped, } from './ApiKeyRequestUsage'; import type { ApiKeyResourceTotals } from './ApiKeyResourceTotals'; import { ApiKeyResourceTotalsFromJSON, ApiKeyResourceTotalsFromJSONTyped, ApiKeyResourceTotalsToJSON, ApiKeyResourceTotalsToJSONTyped, } from './ApiKeyResourceTotals'; /** * * @export * @interface ApiKey */ export interface ApiKey { /** * * @type {string} * @memberof ApiKey */ id: string; /** * * @type {string} * @memberof ApiKey */ name: string; /** * Credential storage lane. Scoped secrets are never stored in the legacy hash column. * @type {ApiKeyCredentialLaneEnum} * @memberof ApiKey */ credentialLane: ApiKeyCredentialLaneEnum; /** * * @type {string} * @memberof ApiKey */ keyPrefix: string; /** * * @type {string} * @memberof ApiKey */ keyLastFour: string; /** * Box ID for a platform-managed machine key, or null for a user-created key. * @type {string} * @memberof ApiKey */ sandboxId: string | null; /** * * @type {Date} * @memberof ApiKey */ createdAt: Date; /** * * @type {Date} * @memberof ApiKey */ lastUsedAt: Date | null; /** * * @type {ApiKeyRequestUsage} * @memberof ApiKey */ usage: ApiKeyRequestUsage; /** * * @type {ApiKeyResourceTotals} * @memberof ApiKey */ resources: ApiKeyResourceTotals; /** * * @type {Date} * @memberof ApiKey */ expiresAt?: Date | null; /** * * @type {boolean} * @memberof ApiKey */ expired?: boolean; /** * * @type {boolean} * @memberof ApiKey */ expiringSoon?: boolean; /** * * @type {ApiKeyScope} * @memberof ApiKey */ scope?: ApiKeyScope; } /** * @export */ export const ApiKeyCredentialLaneEnum = { Legacy: 'legacy', ScopedV1: 'scoped-v1' } as const; export type ApiKeyCredentialLaneEnum = typeof ApiKeyCredentialLaneEnum[keyof typeof ApiKeyCredentialLaneEnum]; /** * Check if a given object implements the ApiKey interface. */ export function instanceOfApiKey(value: object): value is ApiKey { if (!('id' in value) || value['id'] === undefined) return false; if (!('name' in value) || value['name'] === undefined) return false; if (!('credentialLane' in value) || value['credentialLane'] === undefined) return false; if (!('keyPrefix' in value) || value['keyPrefix'] === undefined) return false; if (!('keyLastFour' in value) || value['keyLastFour'] === undefined) return false; if (!('sandboxId' in value) || value['sandboxId'] === undefined) return false; if (!('createdAt' in value) || value['createdAt'] === undefined) return false; if (!('lastUsedAt' in value) || value['lastUsedAt'] === undefined) return false; if (!('usage' in value) || value['usage'] === undefined) return false; if (!('resources' in value) || value['resources'] === undefined) return false; return true; } export function ApiKeyFromJSON(json: any): ApiKey { return ApiKeyFromJSONTyped(json, false); } export function ApiKeyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiKey { if (json == null) { return json; } return { 'id': json['id'], 'name': json['name'], 'credentialLane': json['credentialLane'], 'keyPrefix': json['keyPrefix'], 'keyLastFour': json['keyLastFour'], 'sandboxId': json['sandboxId'], 'createdAt': (new Date(json['createdAt'])), 'lastUsedAt': (json['lastUsedAt'] == null ? null : new Date(json['lastUsedAt'])), 'usage': ApiKeyRequestUsageFromJSON(json['usage']), 'resources': ApiKeyResourceTotalsFromJSON(json['resources']), 'expiresAt': json['expiresAt'] == null ? undefined : (new Date(json['expiresAt'])), 'expired': json['expired'] == null ? undefined : json['expired'], 'expiringSoon': json['expiringSoon'] == null ? undefined : json['expiringSoon'], 'scope': json['scope'] == null ? undefined : ApiKeyScopeFromJSON(json['scope']), }; } export function ApiKeyToJSON(json: any): ApiKey { return ApiKeyToJSONTyped(json, false); } export function ApiKeyToJSONTyped(value?: ApiKey | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { 'id': value['id'], 'name': value['name'], 'credentialLane': value['credentialLane'], 'keyPrefix': value['keyPrefix'], 'keyLastFour': value['keyLastFour'], 'sandboxId': value['sandboxId'], 'createdAt': value['createdAt'].toISOString(), 'lastUsedAt': value['lastUsedAt'] == null ? value['lastUsedAt'] : value['lastUsedAt'].toISOString(), 'usage': ApiKeyRequestUsageToJSON(value['usage']), 'resources': ApiKeyResourceTotalsToJSON(value['resources']), 'expiresAt': value['expiresAt'] == null ? value['expiresAt'] : value['expiresAt'].toISOString(), 'expired': value['expired'], 'expiringSoon': value['expiringSoon'], 'scope': ApiKeyScopeToJSON(value['scope']), }; }