/** * JSON:API Response Types */ /** * Generic JSON:API response structure */ export interface JsonApiResponse { /** The primary data of the response */ data: T; /** Included related resources */ included?: JsonApiResource[]; /** Response metadata */ meta?: JsonApiMeta; /** Links related to the response */ links?: JsonApiLinks; } /** * JSON:API metadata object */ export interface JsonApiMeta { /** Pagination details, if applicable */ pagination?: PaginationInfo; [key: string]: unknown; } /** * JSON:API links object */ export interface JsonApiLinks { /** Link to the current resource/page */ self?: string; /** Link to the first page of a collection */ first?: string; /** Link to the last page of a collection */ last?: string; /** Link to the previous page of a collection */ prev?: string; /** Link to the next page of a collection */ next?: string; } /** * Base JSON:API resource object */ export interface JsonApiResource { /** The unique identifier for the resource */ id: string; /** The type of the resource */ type: string; /** Attributes of the resource */ attributes: { [key: string]: unknown; }; /** Relationships to other resources */ relationships?: { [key: string]: JsonApiRelationship; }; /** Links related to the resource */ links?: JsonApiLinks; } /** * JSON:API relationship object */ export interface JsonApiRelationship { /** The resource identifier for the related resource */ data: JsonApiResourceIdentifier | JsonApiResourceIdentifier[]; /** Links related to the relationship */ links?: JsonApiLinks; /** Metadata about the relationship */ meta?: JsonApiMeta; } /** * JSON:API resource identifier object */ export interface JsonApiResourceIdentifier { /** The unique identifier for the resource */ id: string; /** The type of the resource */ type: string; } /** * Request/Response Data Types */ /** * The `data` object for a JSON:API request body */ export interface RequestData { /** The type of the resource */ type: string; /** Attributes of the resource */ attributes: Record; /** Relationships to other resources */ relationships?: Record; } /** * JSON:API request body structure */ export interface RequestBody { /** The primary data for the request */ data: RequestData; } /** * Query parameters for API requests */ export interface QueryParams { /** Pagination parameters */ page?: { size?: number; number?: number; }; /** Sort order for the results */ sort?: string | string[]; /** Filtering options */ filter?: Record; /** Which related resources to include */ include?: string; [key: string]: unknown; } /** * Options for the QueryUtil helper */ export interface QueryUtilOptions { /** Key-value pairs for filtering results */ filters?: Record; /** Field to sort by (prepend with '-' for descending) */ sort?: string | string[]; /** Page number to retrieve */ page?: number; /** Number of results per page */ pageSize?: number; /** Comma-separated list of related resources to include */ include?: string | string[]; [key: string]: unknown; } /** * HTTP headers for API requests */ export interface HttpHeaders { 'Content-Type': 'application/vnd.api+json'; Accept: 'application/vnd.api+json'; 'User-Agent': string; 'x-api-key': string; } /** * Error Types */ /** * Structure for API error responses */ export interface ApiErrorResponse { /** Array of error objects */ errors: ApiError[]; /** Error metadata */ meta?: { [key: string]: unknown; }; } /** * Detailed API error object */ export interface ApiError { /** Unique identifier for this occurrence of the problem */ id?: string; /** The HTTP status code applicable to this problem */ status: string; /** An application-specific error code */ code?: string; /** A short, human-readable summary of the problem */ title?: string; /** A human-readable explanation specific to this occurrence of the problem */ detail?: string; /** An object containing references to the source of the error */ source?: { pointer?: string; parameter?: string; }; /** A meta object containing non-standard meta-information about the error */ meta?: { [key: string]: unknown; }; } /** * Resource-specific types that can be extended by individual resources */ /** * Base resource structure with required fields */ export interface BaseResource { id: string; type: string; attributes: { [key: string]: unknown; }; relationships?: { [key: string]: unknown; }; } /** * Base response for a list of resources */ export interface BaseListResponse { data: T[]; meta?: { pagination?: PaginationInfo; }; included?: BaseResource[]; links?: JsonApiLinks; } /** * Base response for a single resource item */ export interface BaseItemResponse { data: T; meta?: { [key: string]: unknown; }; included?: BaseResource[]; links?: JsonApiLinks; } /** * Flexible Asset types */ export interface FlexibleAssetResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } export interface FlexibleAssetTraits extends JsonApiResource { type: 'traits'; attributes: Record; } /** * Organization types */ export interface OrganizationResource extends JsonApiResource { attributes: { name: string; description?: string; [key: string]: unknown; }; } /** * Organization Type types */ export interface OrganizationTypeResource extends JsonApiResource { attributes: { name: string; }; } /** * Password types */ export interface PasswordResource extends JsonApiResource { attributes: { title: string; username?: string; password?: string; notes?: string; [key: string]: unknown; }; } /** * Contact types */ export interface ContactResource extends JsonApiResource { attributes: { 'first-name'?: string; 'last-name'?: string; email?: string; [key: string]: unknown; }; } /** * Location types */ export interface LocationResource extends JsonApiResource { attributes: { name: string; address?: string; city?: string; state?: string; 'zip-code'?: string; [key: string]: unknown; }; } /** * Configuration types */ export interface ConfigurationResource extends JsonApiResource { attributes: { name: string; notes?: string; [key: string]: unknown; }; } /** * Configuration Type types */ export interface ConfigurationTypeResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * Configuration Status types */ export interface ConfigurationStatusResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * Configuration Interface types */ export interface ConfigurationInterfaceResource extends JsonApiResource { attributes: { name?: string; 'ip-address'?: string; hostname?: string; [key: string]: unknown; }; } /** * Manufacturer types */ export interface ManufacturerResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * Model types */ export interface ModelResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * Operating System types */ export interface OperatingSystemResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * Flexible Asset Type types */ export interface FlexibleAssetTypeResource extends JsonApiResource { attributes: { name: string; description?: string; icon?: string; [key: string]: unknown; }; } /** * Flexible Asset Field types */ export interface FlexibleAssetFieldResource extends JsonApiResource { attributes: { name: string; kind: string; required?: boolean; order: number; [key: string]: unknown; }; } /** * Organization Status types */ export interface OrganizationStatusResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * Domain types */ export interface DomainResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * Password Category types */ export interface PasswordCategoryResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * Platform types */ export interface PlatformResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * Region types */ export interface RegionResource extends JsonApiResource { attributes: { name: string; iso: string; [key: string]: unknown; }; } /** * Related Item types */ export interface RelatedItemResource extends JsonApiResource { attributes: { notes: string | null; [key: string]: unknown; }; } /** * User types */ export interface UserResource extends JsonApiResource { attributes: { 'first-name': string; 'last-name': string; email: string; role: string; [key: string]: unknown; }; } /** * Log types */ export interface LogResource extends JsonApiResource { attributes: { name: string; description: string; 'created-at': string; [key: string]: unknown; }; } /** * Contact Type types */ export interface ContactTypeResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * Country types */ export interface CountryResource extends JsonApiResource { attributes: { name: string; 'iso-code': string; [key: string]: unknown; }; } /** * Expiration types */ export interface ExpirationResource extends JsonApiResource { attributes: { name: string; 'expiration-date': string; notes?: string; [key: string]: unknown; }; } /** * Export types */ export interface ExportResource extends JsonApiResource { attributes: { status: string; 'export-type': string; url?: string; 'created-at': string; 'updated-at': string; 'expires-at'?: string; [key: string]: unknown; }; } /** * Attachment types */ export interface AttachmentResource extends JsonApiResource { attributes: { filename: string; 'file-size': number; 'content-type': string; description: string | null; url: string | null; 'created-at': string; [key: string]: unknown; }; } /** * Tag types */ export interface TagResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * User Metric types */ export interface UserMetricResource extends JsonApiResource { attributes: { 'passwords-viewed-count': number; 'passwords-added-count': number; 'passwords-edited-count': number; 'passwords-deleted-count': number; 'passwords-failed-count': number; 'passwords-copied-count': number; 'passwords-unsuccessfully-copied-count': number; [key: string]: unknown; }; } /** * Document types */ export interface DocumentResource extends JsonApiResource { attributes: { name: string; 'document-folder-id'?: number; 'document-template-id'?: number; content?: string; [key: string]: unknown; }; } /** * Group types */ export interface GroupResource extends JsonApiResource { attributes: { name: string; [key: string]: unknown; }; } /** * Checklist types */ export interface ChecklistResource extends JsonApiResource { attributes: { name: string; description?: string; 'checklist-template-id'?: number; 'organization-id'?: number; [key: string]: unknown; }; } /** * Password Folder types */ export interface PasswordFolderResource extends JsonApiResource { attributes: { name: string; 'parent-id'?: number; 'organization-id'?: number; [key: string]: unknown; }; } /** * Utility types */ /** A resource identifier (ID) */ export type ResourceId = string | number; /** Pagination metadata */ export interface PaginationInfo { /** The current page number */ current_page: number; /** The total number of pages */ total_pages: number; /** The total number of items across all pages */ total_count: number; /** The number of items per page */ per_page: number; } /** Supported HTTP methods */ export type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';