UNPKG

ade-planning-api

Version:

An unofficial API wrapper for ADE Planning from Adesoft

50 lines (49 loc) 2.1 kB
import type { Credentials } from "./models/auth"; import type { Project, Event, EventParams, EventByDetail, Memberships, AllMembers, Counters, Constraints, Cost, Activity, ActivityByDetail, Rights, Resource, ResourceParams, ResourceByDetail } from "./models/timetable"; export declare class ADEPlanningAPI { private fetcher; /** * Initializes a new instance of the ADEPlanningAPI class. * @param baseUrl The base URL of the ADE instance. * @returns A new instance of the ADEPlanningAPI class. */ constructor(baseUrl: string); /** * Initializes a new session with the API. * @param credentials The credentials to use for authentication. * @returns A promise that resolves when the session is initialized. */ initializeSession(credentials: Credentials): Promise<void>; /** * Terminates the current session with the API. * @returns A promise that resolves when the session is terminated. */ terminateSession(): Promise<void>; /** * Gets the list of projects. * @returns A promise that resolves with the list of projects. */ getProjects(): Promise<Project[]>; /** * Sets the current project. * @param project The project to set as current. * @returns A promise that resolves when the project is set. */ setProject(project: Project): Promise<void>; /** * Gets the list of events. * @param params The parameters to pass to the API. * @returns A promise that resolves with the list of events. */ getEvents<T extends number>(params: EventParams & { detail: T; }): Promise<EventByDetail<T>[]>; /** * @param params The parameters to pass to the API. * @returns A promise that resolves with the list of resources. */ getResources<T extends number>(params: ResourceParams & { detail: T; }): Promise<ResourceByDetail<T>[]>; } export type { Project, EventByDetail, ResourceByDetail, ActivityByDetail, Event, Activity, Resource, Memberships, AllMembers, Counters, Constraints, Cost, Rights, Credentials };