import { ResourceObject } from "jsonapi-typescript"; import type { IArcGISContext } from "../types/IArcGISContext"; import { JobRecordType, TJobRecordType } from "./enums/jobRecordType"; import { TJobRecordStatus } from "./enums/jobRecordStatus"; import { IHubRequestOptions } from "../hub-types"; import { ItemOrServerEnrichment } from "../items/_enrichments"; /** * JSONAPI dataset resource returned by the Hub API */ export type DatasetResource = ResourceObject<"dataset", { [k: string]: any; }>; /** * Options object for `fetchContent()` */ export interface IFetchContentOptions extends IHubRequestOptions { layerId?: number; siteOrgKey?: string; enrichments?: ItemOrServerEnrichment[]; context?: IArcGISContext; } /** * Represents a job record from the Hub API */ export interface IHubJobRecord { /** Unique entry id */ id: string; /** Type of job record */ type: TJobRecordType; /** Status of the job record */ status: TJobRecordStatus; /** wellknown message id */ messageId: string; /** untranslated plaintext message */ message: string; /** Timestamp of when the job record was created */ created: number; /** Timestamp of when the job record was last modified */ modified: number; } /** * Represents a download job record from the Hub API */ export interface IHubDownloadJobRecord extends IHubJobRecord { type: typeof JobRecordType.DOWNLOAD; /** The layer associated with the download */ layerId?: string; } /** * Request options for fetching job records */ export interface IHubJobRecordRequestOptions { /** Context object from consuming application */ context: IArcGISContext; /** Job types to be included in the results */ types?: TJobRecordType[]; /** Job statuses to be included in the results */ statuses?: TJobRecordStatus[]; /** ISO Date string indicating the start date for the search */ from?: string; /** ISO Date string indicating the end date of the search */ to?: string; /** Total number of records to return */ limit?: number; } export type IHubContentStatus = IHubServiceBackedContentStatus | IHubOtherContentStatus; export interface IHubBaseContentStatus { kind: "service" | "other"; } export interface IHubServiceBackedContentStatus extends IHubBaseContentStatus { kind: "service"; service: { availability: "available" | "slow" | "unavailable" | "auth-required"; }; } export interface IHubOtherContentStatus extends IHubBaseContentStatus { kind: "other"; }