/** * Copyright 2022 Agendize All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at. * * Http://www.apache.org/licenses/LICENSE-2.0. * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { EventEntity } from "./data/Event"; import { AdditionalFieldsEntity, ContactAdvancedSearchEntity, ContactEntity, ContactTagEntity, PromoteFieldEntity } from "./data/Contact"; import TokenDto from "./service/authenticationService"; import { QUERY_PAGINATED_RESULT, QUERY_RESULT, QUERY_RESULTS, QUERY_TYPE } from "./repository"; import { ServiceEntity } from "./data/Service"; import { StaffEntity } from "./data/Staff"; import { UserEntity } from "./data/User"; import { CompanyEntity } from "./data/Company"; import { CalendarEntity, CalendarTeamEntity } from "./data/Calendar"; import { FreeSlotEntity } from "./data/FreeSlot"; import { PrivacyPolicyEntity } from "./data/PrivacyPolicy"; import { ServiceGroupEntity } from "./data/ServiceGroup"; import { AccountEntity } from "./data/Account"; import { StaffGroupEntity } from "./data/StaffGroup"; import { StaffFormsEntity } from "./data/StaffForms"; import { SettingsWorkingDayEntity } from "./data/WorkingHours"; import { RightsEntity } from "./data/Rights"; import { ActivityEntity } from "./data/Activity"; import { NoteEntity } from "./data/Note"; import { ShortPollingNotificationEntity } from "./data/ShortPollingNotification"; import { FormBuilderEntity, WidgetFormEntity } from "./data/Form"; import { QueueEntity } from "./data/Queue"; import { FormResultEntity } from "./data/FormResult"; import { FormResultStatusEntity } from "./data/FormResultStatus"; import { QueueRegistrationEntity, QueueRegistrationStatus } from "./data/QueueRegistration"; import { NotificationStatusEntity } from "./data/NotificationStatus"; import { Logger } from "./utils/logger"; import { ServiceResourceEntity } from "./data/ServiceResource"; import { WidgetUrlCipherEntity, WidgetUrlCipherInputEntity } from "./data/WidgetUrlCipher"; import { EventFields } from "./service/items/EventFields"; import { ReportDashboardFilter, ReportsEntity } from "./data/Reporting"; import { CompanyPerformanceEntity } from "./data/CompanyPerformance"; import { PlanningEntity } from "./data/planning/Planning"; import { UserSchedulesEntity } from "./data/scheduling/schedule/UserSchedules"; import { ApiErrors } from "./data/Error"; import { SchedulingRightsEntity } from "./data/scheduling/SchedulingRights"; import { LogEntity } from "./data/Log"; import { NotificationEntity } from "./data/Notification"; import { WorkingPlanningEntity } from "./data/scheduling/WorkingPlanning"; import { ChangelogEntity } from "./data/Changelog"; import { ReportingExportResponseEntity } from "./data/ReportingExportResponse"; import { ReportingExportBodyEntity } from "./data/ReportingExportBody"; import { ShortenerEntity } from "./data/Shortener"; import { CustomStatusEntity } from "./data/CustomStatus"; import { ConferenceEntity, ConferenceInviteeEntity, ConferenceRegistrationCancelEntity, ConferenceRegistrationEntity, ConferenceSessionEntity, ConferenceSessionsSearchBodyEntity, ConferenceSessionsSearchEntity, ConferenceSpeakerEntity, ConferenceTagEntity } from "./data/conference/Conference"; import { EventSearchBodyEntity, EventSearchEntity, EventSearchOption, EventSearchPageEntity } from "./data/EventSearch"; import { ShortPollingNotificationScope } from "./service/shortPollingNotificationService"; import { IntegrationEntity } from "./data/Integration"; import { ConnectorEntity } from "./data/Connector"; import { CRMSettingsEntity } from "./data/CRMSettings"; import { KeyFigureType } from "./data/dashboard/KeyFigures"; import { LoginProviderEntity } from "./data/LoginProvider"; import { WidgetFormFieldsAPIProperties } from "./service/widgetFormService"; import { LoginRealmEntity } from "./data/LoginRealm"; export interface ApiOptions { baseURL: string; clientId: string; logger?: Logger; } export declare class CalendarApi { private authenticationService; private accountService; private batchService; private accountRepository; private calendarRepository; private companyRepository; private staffRepository; private serviceRepository; private contactRepository; private externalContactRepository; private externalEventRepository; private icsEventRepository; private eventRepository; private userRepository; private userDefaultRepository; private widgetFormRepository; private formBuilderRepository; private freeSlotRepository; private freeStaffService; private planningRepository; private privacyPolicyRepository; private promoteFieldRepository; private serviceGroupRepository; private serviceResourceRepository; private staffGroupRepository; private staffFormsRepository; private rightsRepository; private schedulingRightsRepository; private activityRepository; private noteRepository; private notificationStatusRepository; private queueRepository; private queueRegistrationRepository; private formResultRepository; private formResultStatusRepository; private tagRepository; private additionalFieldsRepository; private widgetUrlCipherRepository; private reportingRepository; private companyPerformanceRepository; private scheduleRepository; private exportCalendarRepository; private exportAppointmentsRepository; private notificationRepository; private workingPlanningRepository; private logRepository; private changelogRepository; private shortenerRepository; private conferenceRepository; private conferenceSpeakerRepository; private conferenceInviteeRepository; private customStatusRepository; private conferenceSessionRepository; private conferenceRegistrationRepository; private conferenceTagRepository; private userDirectoryRepository; private shortPollingNotificationRepository; private settingsRepository; private integrationsRepository; private connectorsRepository; private dashboardStructureRepository; private dashboardRepository; private crmSettingsRepository; private indexedDb; private companyIdsAccount; private formIdsAccount; private queueIdsAccount; private logger?; private baseURL; private clientId; private bearer; constructor({ baseURL, clientId, logger }: ApiOptions); getBaseURL(): string; loginNHWithRedirect(authorizationCallbackUrl: string, locale?: string, error?: ApiErrors, autoRedirect?: boolean): string; loginWithRedirect(authorizationCallbackUrl: string, locale?: string, error?: ApiErrors, autoRedirect?: boolean): string; resetPassword(login: string): Promise; getLoginRealm(realm?: string): Promise; getLoginProviders(): Promise; getAccessToken(authorizationCode: string): Promise; getAccessTokenFromBasic(authorizationCode: string, login: string, password: string): Promise; refreshToken(): Promise; useBearerToken(bearer: string): void; refreshOrganisationStorage(selectedOrganisation: AccountEntity): Promise; refreshUserStorage(allUsers: UserEntity[] | undefined, meInOrganisation: UserEntity): Promise; clearAfterAccountSwitch(): Promise; logout(): Promise; getSchedulingRights(organisation: string): Promise; getSchedulingRightsById(organisation: string, userId: string): Promise; updateSchedulingRights(organisation: string, userId: string, rights: SchedulingRightsEntity): Promise; getRights(organisation: string, rightsId: string[]): Promise; /** * @deprecated The method should not be used, used cipher */ cipherUrl(companyId: string, urlToCipher: string, domaine?: string, shortener?: boolean): Promise; cipher(organisation: string, companyId: string, params: WidgetUrlCipherInputEntity): Promise; getAccount(account?: string, crossAccount?: boolean): Promise<{ result: AccountEntity | undefined; local: boolean; }>; updateAccount(account: AccountEntity, v2_3?: boolean): Promise; updatePassword(currentPassword: string, newPassword: string): Promise; getAllCompanies(account?: string, mode?: QUERY_TYPE): Promise<{ results: CompanyEntity[] | undefined; local: boolean; }>; getCompanyById(companyId: string, account?: string, mode?: QUERY_TYPE): Promise<{ result: CompanyEntity | undefined; local: boolean; }>; createCompany(account: string, company: CompanyEntity): Promise; cloneCompany(clonedCompanyId: string, company: CompanyEntity): Promise; updateCompany(companyId: string, company: CompanyEntity): Promise; deleteCompany(companyId: string): Promise; getUserById(organisation: string, userId: string, mode?: QUERY_TYPE): Promise<{ result: UserEntity | undefined; local: boolean; }>; getDefaultAgendaUsers(organisation: string): Promise<{ results: UserEntity[] | undefined; local: boolean; }>; getAllUsers(organisation: string, mode?: QUERY_TYPE): Promise<{ results: UserEntity[] | undefined; local: boolean; }>; getAllUsersWithTeam(organisation: string): Promise<{ users: UserEntity[] | undefined; teams: CalendarTeamEntity[] | undefined; local: boolean; }>; getDefaultTeams(organisation: string): Promise>; getAllTeams(organisation: string): Promise>; getAllStaffs(companyId: string, account?: string, mode?: QUERY_TYPE): Promise<{ results: StaffEntity[] | undefined; local: boolean; }>; getStaffById(companyId: string, staffId: string, account?: string, mode?: QUERY_TYPE): Promise<{ result: StaffEntity | undefined; local: boolean; }>; createStaff(companyId: string, staff: StaffEntity): Promise; updateStaff(companyId: string, staffId: string, staff: StaffEntity): Promise; patchAllStaff(companyId: string, workingHours?: SettingsWorkingDayEntity[], vacations?: { startDate?: Date; endDate?: Date; }[], staffIds?: string[]): Promise<{ results: StaffEntity[] | undefined; local: boolean; }>; deleteStaff(companyId: string, staffId: string): Promise; getAllServices(companyId: string, account?: string, mode?: QUERY_TYPE): Promise<{ results: ServiceEntity[] | undefined; local: boolean; }>; getServiceById(companyId: string, serviceId: string, account?: string, mode?: QUERY_TYPE): Promise<{ result: ServiceEntity | undefined; local: boolean; }>; createService(companyId: string, service: ServiceEntity): Promise; updateService(companyId: string, serviceId: string, service: ServiceEntity): Promise; deleteService(companyId: string, serviceId: string): Promise; getServiceResourceById(companyId: string, serviceResourceId: string, account?: string, mode?: QUERY_TYPE): Promise<{ result: ServiceResourceEntity | undefined; local: boolean; }>; getAllServiceResources(companyId: string, account?: string): Promise<{ results: ServiceResourceEntity[] | undefined; local: boolean; }>; createServiceResource(companyId: string, serviceResource: ServiceResourceEntity): Promise; updateServiceResource(companyId: string, serviceResourceId: string, serviceResource: ServiceResourceEntity): Promise; deleteServiceResource(companyId: string, serviceResourceId: string): Promise; getServiceGroupById(companyId: string, serviceGroupId: string, account?: string, mode?: QUERY_TYPE): Promise<{ result: ServiceGroupEntity | undefined; local: boolean; }>; getAllServiceGroups(companyId: string, account?: string, mode?: QUERY_TYPE): Promise<{ results: ServiceGroupEntity[] | undefined; local: boolean; }>; createServiceGroup(account: string, companyId: string, serviceGroup: ServiceGroupEntity): Promise; updateServiceGroup(account: string, companyId: string, serviceGroupId: string, serviceGroup: ServiceGroupEntity): Promise; deleteServiceGroup(account: string, companyId: string, serviceGroupId: string): Promise; getEventById(organisationEmail: string, eventId: string, showPersonal?: boolean, mode?: QUERY_TYPE): Promise<{ result: EventEntity | undefined; local: boolean; }>; getCompanyEventById(organisationEmail: string, companyId: string, eventId: string, showPersonal?: boolean): Promise; getAllEvents(organisationEmail: string, start: Date, end: Date, userIds: string[], showPersonal?: boolean, showDeleted?: boolean, timeZone?: string, fields?: EventFields[], syncToken?: string, mode?: QUERY_TYPE): Promise<{ results: EventEntity[] | undefined; nextSyncToken?: string; local: boolean; }>; getExternalEventById(organisationEmail: string, eventId: string, timeZone?: string): Promise<{ result: EventEntity | undefined; local: boolean; }>; getExternalEvents(organisationEmail: string, start: Date, end: Date, userIds: string[], timeZone?: string, mode?: QUERY_TYPE): Promise<{ results: EventEntity[] | undefined; local: boolean; }>; getIcs(icsUrl: string): Promise; createEvent(companyId: string, event: EventEntity, timeZone: string, force: boolean): Promise; updateEvent(companyId: string, event: EventEntity, timeZone?: string, force?: boolean): Promise; updateEventStatus(companyId: string, eventId: string, status: string): Promise; updateEventsToStatus(organisation: string, events: EventSearchEntity[], status: string | CustomStatusEntity): Promise; updateEventCustomStatus(companyId: string, eventId: string, customStatus: CustomStatusEntity): Promise; searchEvents(organisation: string, searchBody: EventSearchBodyEntity, options?: EventSearchOption): Promise; countAppointmentConflict(organisation: string, searchBody: EventSearchBodyEntity): Promise; deleteAppointmentConflict(organisation: string, eventId: string): Promise; getContactById(account: string, contactId: string, mode?: QUERY_TYPE): Promise<{ result: ContactEntity | undefined; local: boolean; }>; getExternalContactById(account: string, contactId: string): Promise<{ result: ContactEntity | undefined; local: boolean; }>; searchContacts(account: string | undefined, query: string, showAnonymized?: boolean, sort?: string, maxResult?: number): Promise<{ results: ContactEntity[] | undefined; local: boolean; }>; searchExternalContacts(account: string | undefined, query: string, sort?: string): Promise<{ results: ContactEntity[] | undefined; local: boolean; }>; searchContactWithPages(account: string | undefined, query: string | ContactAdvancedSearchEntity, showAnonymized?: boolean, sort?: string, pageToken?: string): Promise>; createContact(account: string, contact: ContactEntity): Promise; updateContact(account: string, contactId: string, contact: ContactEntity): Promise; deleteContact(account: string, contactId: string): Promise; getWidgetForm(account: string, companyId: string, serviceId?: string, properties?: WidgetFormFieldsAPIProperties): Promise; getFormBuilders(account?: string): Promise>; getFormBuilder(formId: string, account?: string): Promise>; deleteFormBuilder(formId: string): Promise; createFormBuilder(account: string, form: FormBuilderEntity): Promise; updateFormBuilder(formId: string, form: FormBuilderEntity): Promise; getCalendars(account: string, start: Date, end: Date, timeZone?: string, userIdList?: string[], anonymousUserIdList?: string[], mode?: QUERY_TYPE): Promise<{ results: CalendarEntity[] | undefined; local: boolean; }>; getFreeSlots(companyId: string, startDate: string, endDate: string, serviceId: string, staffId?: string, timeZone?: string, iterationCount?: string): Promise<{ result: FreeSlotEntity | undefined; local: boolean; }>; getFreeStaffs(companyId: string, eventId: string, serviceId: string, staffIds?: string[], timeZone?: string): Promise; getPrivacyPolicy(ownerId: string, ownerLogin: string, mode?: QUERY_TYPE): Promise<{ result: PrivacyPolicyEntity | undefined; local: boolean; }>; getStaffGroupById(companyId: string, staffGroupId: string, account?: string, mode?: QUERY_TYPE): Promise<{ result: StaffGroupEntity | undefined; local: boolean; }>; getAllStaffGroups(companyId: string, account?: string, mode?: QUERY_TYPE): Promise<{ results: StaffGroupEntity[] | undefined; local: boolean; }>; deleteStaffGroup(companyId: string, staffGroupId: string): Promise; createStaffGroup(account: string, companyId: string, staffGroup: StaffGroupEntity): Promise; updateStaffGroup(account: string, companyId: string, staffGroupId: string, staffGroup: StaffGroupEntity): Promise; getStaffFormsByAccount(account: string, mode?: QUERY_TYPE): Promise<{ result: StaffFormsEntity | undefined; local: boolean; }>; getAllClientActivities(account: string, clientId: string): Promise<{ results: ActivityEntity[] | undefined; local: boolean; }>; getAllEventActivities(account: string, clientId: string, eventId: string): Promise<{ results: ActivityEntity[] | undefined; local: boolean; }>; getAllClientNotes(account: string, clientId: string): Promise<{ results: NoteEntity[] | undefined; local: boolean; }>; createClientNote(account: string, clientId: string, note: NoteEntity): Promise; createQueue(account: string, queue: QueueEntity): Promise; updateQueue(queueId: string, queue: QueueEntity): Promise; getAllQueues(account: string, mode?: QUERY_TYPE): Promise<{ results: QueueEntity[] | undefined; local: boolean; }>; getQueue(queueId: string, account?: string, mode?: QUERY_TYPE): Promise<{ result: QueueEntity | undefined; local: boolean; }>; deleteQueue(queueId: string): Promise; getAllQueueRegistrations(queueId: string, account?: string, status?: QueueRegistrationStatus): Promise; updateQueueRegistration(queueId: string, queueRegistrationId: string, queueRegistration: QueueRegistrationEntity): Promise; nextQueueRegistration(queueId: string): Promise; getIcsEvents(start: string, end: string, userIds: string[], timeZone?: string): Promise>; getIcsEventById(eventId: string, timeZone?: string): Promise>; saveIcsEvents(events: EventEntity[]): void; getAllFormResultByForm(formId: string, timeZone: string, account: string): Promise<{ results: FormResultEntity[] | undefined; local: boolean; }>; getFormResultById(formId: string, resultId: string, timeZone: string, account: string): Promise<{ result: FormResultEntity | undefined; local: boolean; }>; updateFormResultById(formId: string, resultId: string, result: FormResultEntity, timeZone: string, account: string): Promise; deleteFormResultById(formId: string, resultId: string, account: string): Promise; getStatusByFormResultId(formId: string, resultId: string, timeZone: string, account: string): Promise<{ results: FormResultStatusEntity[] | undefined; local: boolean; }>; createNewStatus(formId: string, resultId: string, status: FormResultStatusEntity, timeZone: string, account: string): Promise; getAllTags(account: string): Promise<{ results: ContactTagEntity[] | undefined; local: boolean; }>; getAdditionalFields(account: string): Promise; getNotificationStatus(userId: string): Promise>; refreshesNotificationStatus(userId: string, readDate: Date): Promise; getAllPromoteFields(account: string): Promise>; private initIndexedDb; private getCompanyAccount; private getFormAccount; private getQueueAccount; searchLogWithPages(account: string | undefined, query: string, sort?: string, pageToken?: string): Promise>; getChangeLog(account: string, changeLogId: string): Promise<{ result: ChangelogEntity | undefined; }>; getReports(account: string, locale?: string, filters?: ReportDashboardFilter): Promise>; getPerformance(account: string, companyId: string): Promise; getPlannings(account: string): Promise>; getPlanning(planningId: string, account: string): Promise>; createPlanning(planning: PlanningEntity, account: string): Promise; updatePlanning(planningId: string, planning: PlanningEntity, account: string): Promise; deletePlanning(planningId: string, account: string): Promise; getSchedules(organisation: string, start: string, end: string): Promise>; getExportCalendarToXlsx(organisation: string, start: Date, end: Date, timezone: string, showDeleted: boolean, userIds?: string[], companyIds?: string[]): Promise; generateAppointmentsExport(organisation: string, dataToExport: ReportingExportBodyEntity): Promise; getExport(organisation: string, exportId: string, filename: string): Promise; getNotification(organisation: string, companyId: string, notificationId: string, mode?: QUERY_TYPE): Promise<{ result: NotificationEntity | undefined; local: boolean; }>; getAllCompanyWorkingPlannings(organisationEmail: string, companyId: string, start: Date, end: Date, withOccupancy: boolean): Promise; createWorkingPlanning(organisationEmail: string, workingPlanning: WorkingPlanningEntity): Promise; shorten(url: string): Promise; getAllConferences(organisationEmail: string, timeZone?: string): Promise>; getConferenceById(organisationEmail: string, conferenceId: string, timeZone?: string, mode?: QUERY_TYPE): Promise>; deleteConferenceById(organisationEmail: string, conferenceId: string): Promise; createConference(organisationEmail: string, conference: ConferenceEntity, timeZone?: string): Promise; updateConference(organisationEmail: string, conferenceId: string, conference: ConferenceEntity, timeZone?: string): Promise; getAllConferenceSpeakers(organisationEmail: string, conferenceId: string): Promise>; getConferenceSpeakerById(organisationEmail: string, conferenceId: string, speakerId: string): Promise>; deleteConferenceSpeakerById(organisationEmail: string, conferenceId: string, speakerId: string): Promise; createConferenceSpeaker(organisationEmail: string, conferenceId: string, entity: ConferenceSpeakerEntity): Promise; addConferenceSpeakers(organisationEmail: string, conferenceId: string, speakers: ConferenceSpeakerEntity[]): Promise; updateConferenceSpeaker(organisationEmail: string, conferenceId: string, speakerId: string, entity: ConferenceSpeakerEntity): Promise; getAllConferenceInvitees(organisationEmail: string, conferenceId: string): Promise>; getConferenceInviteeById(organisationEmail: string, conferenceId: string, inviteeId: string): Promise>; deleteConferenceInviteeById(organisationEmail: string, conferenceId: string, inviteeId: string): Promise; createConferenceInvitee(organisationEmail: string, conferenceId: string, entity: ConferenceInviteeEntity): Promise; updateConferenceInvitee(organisationEmail: string, conferenceId: string, inviteeId: string, entity: ConferenceInviteeEntity): Promise; getAllConferenceSessions(organisationEmail: string, conferenceId: string, mode?: QUERY_TYPE): Promise>; searchConferenceSessions(organisationEmail: string, searchBody: ConferenceSessionsSearchBodyEntity): Promise; getConferenceSessionById(organisationEmail: string, conferenceId: string, sessionId: string): Promise>; deleteConferenceSessionById(organisationEmail: string, conferenceId: string, sessionId: string): Promise; createConferenceSession(organisationEmail: string, conferenceId: string, timeZone: string, entity: ConferenceSessionEntity): Promise; updateConferenceSession(organisationEmail: string, conferenceId: string, sessionId: string, entity: ConferenceSessionEntity): Promise; getAllConferenceRegistrationBySession(organisationEmail: string, conferenceId: string, sessionId: string, withCancel?: boolean, mode?: QUERY_TYPE): Promise>; generateConferenceRegistrationExportCsv(organisationEmail: string, options: { conferenceId?: string; sessionId?: string; locale?: string; }): Promise; cancelRegistration(organisationEmail: string, conferenceId: string, sessionId: string, registrationId: string, cancelEntity?: ConferenceRegistrationCancelEntity): Promise; updateRegistration(organisationEmail: string, conferenceId: string, sessionId: string, registration: ConferenceRegistrationEntity): Promise; getAllCustomStatus(organisationEmail: string, appointmentId?: string, mode?: QUERY_TYPE): Promise>; getCustomStatus(organisationEmail: string, customStatusId: string, mode?: QUERY_TYPE): Promise>; createCustomStatus(organisationEmail: string, customStatus: CustomStatusEntity): Promise; updateCustomStatus(organisationEmail: string, customStatusId: string, customStatus: CustomStatusEntity): Promise; deleteCustomStatus(organisationEmail: string, customStatusId: string): Promise; getAllConferenceTags(organisationEmail: string, mode?: QUERY_TYPE): Promise>; getConferenceTag(organisationEmail: string, tagId: string, mode?: QUERY_TYPE): Promise>; createConferenceTag(organisationEmail: string, tag: ConferenceTagEntity): Promise; updateConferenceTag(organisationEmail: string, tagId: string, tag: ConferenceTagEntity): Promise; deleteConferenceTag(organisationEmail: string, tagId: string): Promise; getAllUsersOfDirectory(organisationEmail: string, mode?: QUERY_TYPE): Promise>; getCRMSettings(organisationEmail: string, mode?: QUERY_TYPE): Promise>; getAllNotifications(organisationEmail: string, syncToken?: number, scope?: ShortPollingNotificationScope[]): Promise>; getAllNotificationsLocally(): Promise; getOrganisationSettings(organisationEmail: string, mode?: QUERY_TYPE): Promise>; getConnectors(organisation: string, locale: string): Promise>; getIntegrations(organisation: string, locale: string): Promise>; deleteLocalExternalEvents(): Promise; getDashboardStructure(organisationEmail: string, mode?: QUERY_TYPE): Promise>; getKeyFigures(organisationEmail: string, types: KeyFigureType[], range: string): Promise; }