@microsoft/mgt
Version:
The Microsoft Graph Toolkit
295 lines (294 loc) • 10.7 kB
TypeScript
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
import { Client } from '@microsoft/microsoft-graph-client';
import * as MicrosoftGraph from '@microsoft/microsoft-graph-types';
import * as MicrosoftGraphBeta from '@microsoft/microsoft-graph-types-beta';
import { IProvider } from './providers/IProvider';
import { Batch } from './utils/Batch';
/**
* Creates async methods for requesting data from the Graph
*
* @export
* @class Graph
*/
export declare class Graph {
/**
* middleware authentication handler
*
* @type {Client}
* @memberof Graph
*/
client: Client;
constructor(provider: IProvider);
/**
* creates batch request
*
* @returns
* @memberof Graph
*/
createBatch(): Batch;
/**
* async promise, returns Graph User data relating to the user logged in
*
* @returns {Promise<MicrosoftGraph.User>}
* @memberof Graph
*/
getMe(): Promise<MicrosoftGraph.User>;
/**
* async promise, returns all Graph users associated with the userPrincipleName provided
*
* @param {string} userPrincipleName
* @returns {Promise<MicrosoftGraph.User>}
* @memberof Graph
*/
getUser(userPrincipleName: string): Promise<MicrosoftGraph.User>;
/**
* async promise, returns all Graph people who are most relevant contacts to the signed in user.
*
* @param {string} query
* @returns {Promise<MicrosoftGraph.Person[]>}
* @memberof Graph
*/
findPerson(query: string): Promise<MicrosoftGraph.Person[]>;
/**
* async promise, returns a Graph contact associated with the email provided
*
* @param {string} email
* @returns {Promise<MicrosoftGraph.Contact[]>}
* @memberof Graph
*/
findContactByEmail(email: string): Promise<MicrosoftGraph.Contact[]>;
/**
* async promise, returns Graph contact and/or Person associated with the email provided
* Uses: Graph.findPerson(email) and Graph.findContactByEmail(email)
*
* @param {string} email
* @returns {(Promise<Array<MicrosoftGraph.Person | MicrosoftGraph.Contact>>)}
* @memberof Graph
*/
findUserByEmail(email: string): Promise<Array<MicrosoftGraph.Person | MicrosoftGraph.Contact>>;
/**
* async promise, returns Graph photo associated with the logged in user
*
* @returns {Promise<string>}
* @memberof Graph
*/
myPhoto(): Promise<string>;
/**
* async promise, returns Graph photo associated with provided userId
*
* @param {string} userId
* @returns {Promise<string>}
* @memberof Graph
*/
getUserPhoto(userId: string): Promise<string>;
/**
* async promise, returns Graph photos associated with contacts of the logged in user
*
* @param {string} contactId
* @returns {Promise<string>}
* @memberof Graph
*/
getContactPhoto(contactId: string): Promise<string>;
/**
* async promise, returns Calender events associated with either the logged in user or a specific groupId
*
* @param {Date} startDateTime
* @param {Date} endDateTime
* @param {string} [groupId]
* @returns {Promise<MicrosoftGraph.Event[]>}
* @memberof Graph
*/
getEvents(startDateTime: Date, endDateTime: Date, groupId?: string): Promise<MicrosoftGraph.Event[]>;
/**
* async promise to the Graph for People, by default, it will request the most frequent contacts for the signed in user.
*
* @returns {Promise<MicrosoftGraph.Person[]>}
* @memberof Graph
*/
getPeople(): Promise<MicrosoftGraph.Person[]>;
/**
* async promise to the Graph for People, defined by a group id
*
* @param {string} groupId
* @returns {Promise<MicrosoftGraph.Person[]>}
* @memberof Graph
*/
getPeopleFromGroup(groupId: string): Promise<MicrosoftGraph.Person[]>;
/**
* async promise, returns all planner plans associated with the group id
*
* @param {string} groupId
* @returns {Promise<MicrosoftGraph.PlannerPlan[]>}
* @memberof Graph
*/
getPlansForGroup(groupId: string): Promise<MicrosoftGraph.PlannerPlan[]>;
/**
* async promise, returns all planner plans associated with the user logged in
*
* @returns {Promise<MicrosoftGraph.PlannerPlan[]>}
* @memberof Graph
*/
planner_getAllMyPlans(): Promise<MicrosoftGraph.PlannerPlan[]>;
/**
* async promise, returns a single plan from the Graph associated with the planId
*
* @param {string} planId
* @returns {Promise<MicrosoftGraph.PlannerPlan>}
* @memberof Graph
*/
planner_getSinglePlan(planId: string): Promise<MicrosoftGraph.PlannerPlan>;
/**
* async promise, returns bucket (for tasks) associated with a planId
*
* @param {string} planId
* @returns {Promise<MicrosoftGraph.PlannerBucket[]>}
* @memberof Graph
*/
planner_getBucketsForPlan(planId: string): Promise<MicrosoftGraph.PlannerBucket[]>;
/**
* async promise, returns all tasks from planner associated with a bucketId
*
* @param {string} bucketId
* @returns {Promise<MicrosoftGraph.PlannerTask[]>}
* @memberof Graph
*/
planner_getTasksForBucket(bucketId: string): Promise<MicrosoftGraph.PlannerTask[]>;
/**
* async promise, allows developer to set details of planner task associated with a taskId
*
* @param {string} taskId
* @param {MicrosoftGraph.PlannerTask} details
* @param {string} eTag
* @returns {Promise<any>}
* @memberof Graph
*/
planner_setTaskDetails(taskId: string, details: MicrosoftGraph.PlannerTask, eTag: string): Promise<any>;
/**
* async promise, allows developer to set a task to complete, associated with taskId
*
* @param {string} taskId
* @param {string} eTag
* @returns {Promise<any>}
* @memberof Graph
*/
planner_setTaskComplete(taskId: string, eTag: string): Promise<any>;
/**
* async promise, allows developer to set a task to incomplete, associated with taskId
*
* @param {string} taskId
* @param {string} eTag
* @returns {Promise<any>}
* @memberof Graph
*/
planner_setTaskIncomplete(taskId: string, eTag: string): Promise<any>;
/**
* async promise, allows developer to assign people to task
*
* @param {string} taskId
* @param {*} people
* @param {string} eTag
* @returns {Promise<any>}
* @memberof Graph
*/
planner_assignPeopleToTask(taskId: string, people: any, eTag: string): Promise<any>;
/**
* async promise, allows developer to create new Planner task
*
* @param {MicrosoftGraph.PlannerTask} newTask
* @returns {Promise<any>}
* @memberof Graph
*/
planner_addTask(newTask: MicrosoftGraph.PlannerTask): Promise<any>;
/**
* async promise, allows developer to remove Planner task associated with taskId
*
* @param {string} taskId
* @param {string} eTag
* @returns {Promise<any>}
* @memberof Graph
*/
planner_removeTask(taskId: string, eTag: string): Promise<any>;
/**
* async promise, returns all Outlook taskGroups associated with the logged in user
*
* @returns {Promise<MicrosoftGraphBeta.OutlookTaskGroup[]>}
* @memberof Graph
*/
todo_getAllMyGroups(): Promise<MicrosoftGraphBeta.OutlookTaskGroup[]>;
/**
* async promise, returns to-do tasks from Outlook groups associated with a groupId
*
* @param {string} groupId
* @returns {Promise<MicrosoftGraphBeta.OutlookTaskGroup>}
* @memberof Graph
*/
todo_getSingleGroup(groupId: string): Promise<MicrosoftGraphBeta.OutlookTaskGroup>;
/**
* async promise, returns all Outlook taskFolders associated with groupId
*
* @param {string} groupId
* @returns {Promise<MicrosoftGraphBeta.OutlookTaskFolder[]>}
* @memberof Graph
*/
todo_getFoldersForGroup(groupId: string): Promise<MicrosoftGraphBeta.OutlookTaskFolder[]>;
/**
* async promise, returns all Outlook tasks associated with a taskFolder with folderId
*
* @param {string} folderId
* @returns {Promise<MicrosoftGraphBeta.OutlookTask[]>}
* @memberof Graph
*/
todo_getAllTasksForFolder(folderId: string): Promise<MicrosoftGraphBeta.OutlookTask[]>;
/**
* async promise, allows developer to redefine to-do Task details associated with a taskId
*
* @param {string} taskId
* @param {*} task
* @param {string} eTag
* @returns {Promise<MicrosoftGraphBeta.OutlookTask>}
* @memberof Graph
*/
todo_setTaskDetails(taskId: string, task: any, eTag: string): Promise<MicrosoftGraphBeta.OutlookTask>;
/**
* async promise, allows developer to set to-do task to completed state
*
* @param {string} taskId
* @param {string} eTag
* @returns {Promise<MicrosoftGraphBeta.OutlookTask>}
* @memberof Graph
*/
todo_setTaskComplete(taskId: string, eTag: string): Promise<MicrosoftGraphBeta.OutlookTask>;
/**
* async promise, allows developer to set to-do task to incomplete state
*
* @param {string} taskId
* @param {string} eTag
* @returns {Promise<MicrosoftGraphBeta.OutlookTask>}
* @memberof Graph
*/
todo_setTaskIncomplete(taskId: string, eTag: string): Promise<MicrosoftGraphBeta.OutlookTask>;
/**
* async promise, allows developer to add new to-do task
*
* @param {*} newTask
* @returns {Promise<MicrosoftGraphBeta.OutlookTask>}
* @memberof Graph
*/
todo_addTask(newTask: any): Promise<MicrosoftGraphBeta.OutlookTask>;
/**
* async promise, allows developer to remove task based on taskId
*
* @param {string} taskId
* @param {string} eTag
* @returns {Promise<any>}
* @memberof Graph
*/
todo_removeTask(taskId: string, eTag: string): Promise<any>;
private blobToBase64;
private getPhotoForResource;
}