/**
* IT Glue API Type Definitions
* Based on JSON API Spec (jsonapi.org)
*/
// Base types for JSON API responses
export interface JsonApiResource<T extends string, A = Record<string, unknown>> {
id: string;
type: T;
attributes: A;
relationships?: Record<string, JsonApiRelationship>;
links?: {
self?: string;
};
}
export interface JsonApiRelationship {
data: JsonApiResourceIdentifier | JsonApiResourceIdentifier[] | null;
links?: {
self?: string;
related?: string;
};
}
export interface JsonApiResourceIdentifier {
id: string;
type: string;
}
export interface JsonApiResponse<T> {
data: T;
included?: JsonApiResource<string, unknown>[];
meta?: {
'current-page'?: number;
'next-page'?: number;
'prev-page'?: number;
'total-pages'?: number;
'total-count'?: number;
};
links?: {
self?: string;
first?: string;
prev?: string;
next?: string;
last?: string;
};
}
// Organization types
export interface OrganizationAttributes {
name: string;
'organization-type-id'?: number;
'organization-type-name'?: string;
'organization-status-id'?: number;
'organization-status-name'?: string;
primary?: boolean;
logo?: string;
'quick-notes'?: string;
'short-name'?: string;
description?: string;
'created-at'?: string;
'updated-at'?: string;
'my-glue-account-id'?: number;
'psa-id'?: string;
'psa-integration-type'?: string;
'parent-id'?: number;
alert?: string;
}
export type Organization = JsonApiResource<'organizations', OrganizationAttributes>;
// Configuration types
export interface ConfigurationAttributes {
'organization-id'?: number;
'organization-name'?: string;
'resource-url'?: string;
name: string;
hostname?: string;
'primary-ip'?: string;
'mac-address'?: string;
'default-gateway'?: string;
'serial-number'?: string;
'asset-tag'?: string;
'configuration-type-id'?: number;
'configuration-type-name'?: string;
'configuration-type-kind'?: string;
'configuration-status-id'?: number;
'configuration-status-name'?: string;
'manufacturer-id'?: number;
'manufacturer-name'?: string;
'model-id'?: number;
'model-name'?: string;
'operating-system-id'?: number;
'operating-system-name'?: string;
'operating-system-notes'?: string;
'location-id'?: number;
'location-name'?: string;
'contact-id'?: number;
'contact-name'?: string;
notes?: string;
'warranty-expires-at'?: string;
'installed-by'?: string;
'purchased-by'?: string;
'purchased-at'?: string;
archived?: boolean;
'created-at'?: string;
'updated-at'?: string;
'psa-id'?: string;
'psa-integration-type'?: string;
'rmm-id'?: string;
'rmm-integration-type'?: string;
}
export type Configuration = JsonApiResource<'configurations', ConfigurationAttributes>;
// Password types
export interface PasswordAttributes {
'organization-id'?: number;
'organization-name'?: string;
'resource-url'?: string;
name: string;
username?: string;
password?: string;
url?: string;
notes?: string;
'password-category-id'?: number;
'password-category-name'?: string;
archived?: boolean;
'password-updated-at'?: string;
otp_enabled?: boolean;
'created-at'?: string;
'updated-at'?: string;
'autofill-selectors'?: string;
'restricted-to-auto-access'?: boolean;
'password-folder-id'?: number;
}
export type Password = JsonApiResource<'passwords', PasswordAttributes>;
// Contact types
export interface ContactAttributes {
'organization-id'?: number;
'organization-name'?: string;
'resource-url'?: string;
name?: string;
'first-name': string;
'last-name': string;
title?: string;
'contact-type-id'?: number;
'contact-type-name'?: string;
'location-id'?: number;
'location-name'?: string;
important?: boolean;
notes?: string;
'psa-id'?: string;
'created-at'?: string;
'updated-at'?: string;
}
export interface ContactEmail {
primary: boolean;
value: string;
'label-name': string;
'label-type': string;
}
export interface ContactPhone {
primary: boolean;
value: string;
extension?: string;
'label-name': string;
'label-type': string;
}
export type Contact = JsonApiResource<'contacts', ContactAttributes & {
'contact-emails'?: ContactEmail[];
'contact-phones'?: ContactPhone[];
}>;
// Flexible Asset types
export interface FlexibleAssetAttributes {
'organization-id'?: number;
'organization-name'?: string;
'resource-url'?: string;
name?: string;
traits: Record<string, unknown>;
archived?: boolean;
'created-at'?: string;
'updated-at'?: string;
'flexible-asset-type-id'?: number;
'flexible-asset-type-name'?: string;
}
export type FlexibleAsset = JsonApiResource<'flexible-assets', FlexibleAssetAttributes>;
// Flexible Asset Type
export interface FlexibleAssetTypeAttributes {
name: string;
description?: string;
icon?: string;
'show-in-menu'?: boolean;
enabled?: boolean;
'created-at'?: string;
'updated-at'?: string;
}
export type FlexibleAssetType = JsonApiResource<'flexible-asset-types', FlexibleAssetTypeAttributes>;
// Flexible Asset Field
export interface FlexibleAssetFieldAttributes {
'flexible-asset-type-id'?: number;
order?: number;
name: string;
kind: string;
hint?: string;
'default-value'?: string;
required?: boolean;
'show-in-list'?: boolean;
'use-for-title'?: boolean;
expiration?: boolean;
'tag-type'?: string;
'created-at'?: string;
'updated-at'?: string;
}
export type FlexibleAssetField = JsonApiResource<'flexible-asset-fields', FlexibleAssetFieldAttributes>;
// Location types
export interface LocationAttributes {
'organization-id'?: number;
'organization-name'?: string;
name: string;
primary?: boolean;
'address-1'?: string;
'address-2'?: string;
city?: string;
'postal-code'?: string;
'region-id'?: number;
'region-name'?: string;
'country-id'?: number;
'country-name'?: string;
phone?: string;
fax?: string;
notes?: string;
'created-at'?: string;
'updated-at'?: string;
'formatted-address'?: string;
'psa-id'?: string;
}
export type Location = JsonApiResource<'locations', LocationAttributes>;
// Domain types
export interface DomainAttributes {
'organization-id'?: number;
'organization-name'?: string;
'resource-url'?: string;
name: string;
'registrar-name'?: string;
'expires-on'?: string;
notes?: string;
'created-at'?: string;
'updated-at'?: string;
}
export type Domain = JsonApiResource<'domains', DomainAttributes>;
// Document types
export interface DocumentAttributes {
'organization-id'?: number;
'organization-name'?: string;
'resource-url'?: string;
name: string;
content?: string;
'document-folder-id'?: number;
archived?: boolean;
'created-at'?: string;
'updated-at'?: string;
}
export type Document = JsonApiResource<'documents', DocumentAttributes>;
// Configuration Interface types
export interface ConfigurationInterfaceAttributes {
'configuration-id'?: number;
name: string;
'ip-address'?: string;
'mac-address'?: string;
notes?: string;
primary?: boolean;
'created-at'?: string;
'updated-at'?: string;
}
export type ConfigurationInterface = JsonApiResource<'configuration-interfaces', ConfigurationInterfaceAttributes>;
// User types
export interface UserAttributes {
name?: string;
'first-name'?: string;
'last-name'?: string;
'role-name'?: string;
email?: string;
'invitation-sent-at'?: string;
'current-sign-in-at'?: string;
'current-sign-in-ip'?: string;
avatar?: string;
'my-glue'?: boolean;
'my-glue-account-id'?: number;
'created-at'?: string;
'updated-at'?: string;
}
export type User = JsonApiResource<'users', UserAttributes>;
// Expiration types
export interface ExpirationAttributes {
'organization-id'?: number;
'organization-name'?: string;
'resource-url'?: string;
'resource-type-name'?: string;
'resource-name'?: string;
description?: string;
'expiration-date'?: string;
notes?: string;
'created-at'?: string;
'updated-at'?: string;
}
export type Expiration = JsonApiResource<'expirations', ExpirationAttributes>;
// Reference types (read-only)
export interface ManufacturerAttributes {
name: string;
'created-at'?: string;
'updated-at'?: string;
}
export type Manufacturer = JsonApiResource<'manufacturers', ManufacturerAttributes>;
export interface ModelAttributes {
'manufacturer-id'?: number;
name: string;
'created-at'?: string;
'updated-at'?: string;
}
export type Model = JsonApiResource<'models', ModelAttributes>;
export interface OperatingSystemAttributes {
name: string;
'platform-id'?: number;
'platform-name'?: string;
'created-at'?: string;
'updated-at'?: string;
}
export type OperatingSystem = JsonApiResource<'operating-systems', OperatingSystemAttributes>;
// Category types
export interface PasswordCategoryAttributes {
name: string;
'created-at'?: string;
'updated-at'?: string;
}
export type PasswordCategory = JsonApiResource<'password-categories', PasswordCategoryAttributes>;
export interface ConfigurationTypeAttributes {
name: string;
'configuration-type-kind'?: string;
'created-at'?: string;
'updated-at'?: string;
}
export type ConfigurationType = JsonApiResource<'configuration-types', ConfigurationTypeAttributes>;
export interface ConfigurationStatusAttributes {
name: string;
'created-at'?: string;
'updated-at'?: string;
}
export type ConfigurationStatus = JsonApiResource<'configuration-statuses', ConfigurationStatusAttributes>;
export interface ContactTypeAttributes {
name: string;
'created-at'?: string;
'updated-at'?: string;
}
export type ContactType = JsonApiResource<'contact-types', ContactTypeAttributes>;
export interface OrganizationTypeAttributes {
name: string;
'created-at'?: string;
'updated-at'?: string;
}
export type OrganizationType = JsonApiResource<'organization-types', OrganizationTypeAttributes>;
export interface OrganizationStatusAttributes {
name: string;
'created-at'?: string;
'updated-at'?: string;
}
export type OrganizationStatus = JsonApiResource<'organization-statuses', OrganizationStatusAttributes>;
// Response format enum
export enum ResponseFormat {
MARKDOWN = 'markdown',
JSON = 'json'
}
// API error response
export interface ITGlueApiError {
errors?: Array<{
status?: string;
title?: string;
detail?: string;
source?: {
pointer?: string;
};
}>;
}