import * as Axios from 'axios'; declare type XomApiQueryParam = | '$skiptoken' | '$orderby' | '$select' | '$filter' | '$expand' | '$skip' | '$top' declare type XomApiQueryString = Range declare type XomApiQueryString = XomApiQueryString | string declare interface XomApiRequestConfig extends Axios.AxiosRequestConfig { interceptors?: { request: Axios.AxiosInterceptorManager response: Axios.AxiosInterceptorManager } requestDigest?: Promise digest?: boolean } declare interface XomApiResponse { __response: Axios.AxiosResponse [key: string]: any } declare interface XomApiClient extends Axios.AxiosInstance { defaults: XomApiRequestConfig get>(url: string, config?: XomApiRequestConfig): Promise delete>(url: string, config?: XomApiRequestConfig): Promise post>(url: string, data?: any, config?: XomApiRequestConfig): Promise patch>(url: string, data?: any, config?: XomApiRequestConfig): Promise } /** * Instantiate the object with the necessary information to connect to a SharePoint list through its REST API. */ declare class XomSharePointList { private _title; private _http; private _itemsType; constructor(listTitle: string, httpInstance: XomApiClient); get title(): string; /** * Returns the list fields metadata; */ getFields(params?: XomApiQueryString): Promise; /** * Returns a list of the items stored in the list. */ getItems(params?: XomApiQueryString): Promise; /** * Returns a single list item with the given ID. */ findItem(itemId: number, params?: XomApiQueryString): Promise; /** * Creates or updates a record based on an existing ID. */ saveItem(data: any): Promise; saveItem(itemId: number, data: any): Promise; /** * Saves a new record in the SharePoint list. */ createItem(data: any): Promise; /** * Updates an existing record in the SharePoint list. */ updateItem(item: any): Promise; updateItem(itemId: number, data: any): Promise; /** * Deletes an existing record from the SharePoint list. */ deleteItem(item: any): Promise; deleteItem(itemId: number): Promise; /** * Return a list of the attached files in the list item. */ getAttachments(item: any): Promise; getAttachments(itemId: number): Promise; /** * Uploads a file attachment to a list item. */ addAttachment(item: any, fileName: string, fileArrayBuffer: ArrayBuffer): Promise; addAttachment(item: any, fileName: string, blobInstance: Blob): Promise; addAttachment(item: any, fileName: string, querySelector: string): Promise; addAttachment(item: any, fileName: string, fileInputElement: HTMLInputElement): Promise; addAttachment(item: any, fileName: string, fileInputContent: FileList): Promise; addAttachment(item: any, fileName: string, fileInstance: File): Promise; addAttachment(itemId: number, fileName: string, fileArrayBuffer: ArrayBuffer): Promise; addAttachment(itemId: number, fileName: string, blobInstance: Blob): Promise; addAttachment(itemId: number, fileName: string, querySelector: string): Promise; addAttachment(itemId: number, fileName: string, fileInputElement: HTMLInputElement): Promise; addAttachment(itemId: number, fileName: string, fileInputContent: FileList): Promise; addAttachment(itemId: number, fileName: string, fileInstance: File): Promise; /** * Renames a given file attachment. */ renameAttachment(item: any, currentName: string, newName: string): Promise; renameAttachment(itemId: number, currentName: string, newName: string): Promise; /** * Removes a given file attachment from the list item. */ deleteAttachment(item: any, fileName: string): Promise; deleteAttachment(itemId: number, fileName: string): Promise; } /** * Instantiate the object with the necessary information to connect to a SharePoint survey through its REST API. */ declare class XomSharePointSurvey { private _title; private _http; private _itemsType; constructor(surveyTitle: string, httpInstance: XomApiClient); get title(): string; /** * Gets fields that corresponds to the questions and their choices. */ getQuestions(): Promise; /** * Returns a list of the responses stored in the survey list. */ getResponses(params?: XomApiQueryString): Promise; /** * Returns a single response by its ID. */ findResponse(id: number, params?: XomApiQueryString): Promise; /** * Saves a new response in the SharePoint survey list. */ submitResponse(data: any): Promise; /** * Updates an existing response. */ changeResponse(id: number, data: any): Promise; /** * Deletes an existing response. */ delete(id: number): Promise; } /** * Instantiate the object with the necessary information to connect to a SharePoint file library through its REST API. */ declare class XomSharePointLibrary { private _address; private _http; private _filesType; constructor(folderAddress: string, httpInstance: XomApiClient); get relativeUrl(): string; /** * Returns a list of the folders within the folder. */ listSubfolders(params?: XomApiQueryString): Promise; /** * Creates a folder within this folder. */ createSubfolder(folderName: string): Promise; /** * Returns a list of the files within this folder. */ listFiles(params?: XomApiQueryString): Promise; /** * Uploads a file into the folder. */ uploadFile(fileName: string, fileArrayBuffer: ArrayBuffer): Promise; uploadFile(fileName: string, blobInstance: Blob): Promise; uploadFile(fileName: string, querySelector: string): Promise; uploadFile(fileName: string, fileInputElement: HTMLInputElement): Promise; uploadFile(fileName: string, fileInputContent: FileList): Promise; uploadFile(fileName: string, fileInstance: File): Promise; } /** * Instantiate the object with the necessary information to connect to a SharePoint site through its REST API. */ declare class XomSharePointSite { private _http; private _currUser; constructor(baseSiteUrl: string); get http(): XomApiClient; get baseUrl(): string | undefined; /** * Gets the SharePoint site metadata. */ getInfo(): Promise; /** * Queries the SharePoint API to get user information. Inform nothing to get * current user information or pass an specific user ID. */ getUserInfo(id?: number): Promise; /** * Queries SharePoint API searching for user name. */ searchUser(search: string): Promise; /** * Returns a reference to connect to a SharePoint list. */ getList(listTitle: string): XomSharePointList; /** * Creates a new SharePoint list. */ createList(listTitle: string): Promise; /** * Deletes an existing SharePoint list. */ deleteList(listTitle: string): Promise; /** * Returns a reference to connect to a SharePoint survey. */ getSurvey(surveyTitle: string): XomSharePointSurvey; /** * Returns a reference to connect to a SharePoint file library. */ getFolder(folderAddress: string): XomSharePointLibrary; } /** * Instantiate a XomSharePoint object to connect to a SharePoint site and, * therefore, exchange data with its contents (lists, libraries, permissions) * through SharePoint native REST API */ declare function xomSharePoint(baseSiteUrl: string): XomSharePointSite; export default xomSharePoint;