@microsoft/microsoft-graph-client

  • Version 2.2.1
  • Published
  • 1.14 MB
  • 3 dependencies
  • MIT license

Install

npm i @microsoft/microsoft-graph-client
yarn add @microsoft/microsoft-graph-client
pnpm add @microsoft/microsoft-graph-client

Overview

Microsoft Graph Client Library

Index

Classes

Interfaces

Enums

Type Aliases

Classes

class AuthenticationHandler

class AuthenticationHandler implements Middleware {}
  • Middleware Class representing AuthenticationHandler

constructor

constructor(authenticationProvider: AuthenticationProvider);
  • Creates an instance of AuthenticationHandler

    Parameter authenticationProvider

    The authentication provider for the authentication handler

    Modifiers

    • @public

method execute

execute: (context: Context) => Promise<void>;
  • To execute the current middleware

    Parameter context

    The context object of the request

    Returns

    A Promise that resolves to nothing

    Modifiers

    • @public

method setNext

setNext: (next: Middleware) => void;
  • To set the next middleware in the chain

    Parameter next

    The middleware instance

    Returns

    Nothing

    Modifiers

    • @public

class AuthenticationHandlerOptions

class AuthenticationHandlerOptions implements MiddlewareOptions {}
  • MiddlewareOptions Class representing AuthenticationHandlerOptions

constructor

constructor(
authenticationProvider?: AuthenticationProvider,
authenticationProviderOptions?: AuthenticationProviderOptions
);
  • To create an instance of AuthenticationHandlerOptions

    Parameter authenticationProvider

    The authentication provider instance

    Parameter authenticationProviderOptions

    The authentication provider options instance

    Returns

    An instance of AuthenticationHandlerOptions

    Modifiers

    • @public

property authenticationProvider

authenticationProvider: AuthenticationProvider;
  • A member holding an instance of an authentication provider

    Modifiers

    • @public

property authenticationProviderOptions

authenticationProviderOptions: AuthenticationProviderOptions;
  • A member holding an instance of authentication provider options

    Modifiers

    • @public

class BatchRequestContent

class BatchRequestContent {}
  • Class for handling BatchRequestContent

constructor

constructor(requests?: BatchRequestStep[]);
  • Constructs a BatchRequestContent instance

    Parameter requests

    Array of requests value

    Returns

    An instance of a BatchRequestContent

    Modifiers

    • @public

property requests

requests: Map<string, BatchRequestStep>;
  • To keep track of requests, key will be id of the request and value will be the request json

    Modifiers

    • @public

method addDependency

addDependency: (dependentId: string, dependencyId?: string) => void;
  • Adds a dependency for a given dependent request

    Parameter dependentId

    The id of the dependent request

    Parameter dependencyId

    The id of the dependency request, if not specified the preceding request will be considered as a dependency

    Returns

    Nothing

    Modifiers

    • @public

method addRequest

addRequest: (request: BatchRequestStep) => string;
  • Adds a request to the batch request content

    Parameter request

    The request value

    Returns

    The id of the added request

    Modifiers

    • @public

method getContent

getContent: () => Promise<BatchRequestBody>;
  • Serialize content from BatchRequestContent instance

    Returns

    The body content to make batch request

    Modifiers

    • @public

method removeDependency

removeDependency: (dependentId: string, dependencyId?: string) => boolean;
  • Removes a dependency for a given dependent request id

    Parameter dependentId

    The id of the dependent request

    Parameter dependencyId

    The id of the dependency request, if not specified will remove all the dependencies of that request

    Returns

    The boolean indicating removed status

    Modifiers

    • @public

method removeRequest

removeRequest: (requestId: string) => boolean;
  • Removes request from the batch payload and its dependencies from all dependents

    Parameter requestId

    The id of a request that needs to be removed

    Returns

    The boolean indicating removed status

    Modifiers

    • @public

class BatchResponseContent

class BatchResponseContent {}
  • Class that handles BatchResponseContent

constructor

constructor(response: BatchResponseBody);
  • Creates the BatchResponseContent instance

    Parameter response

    The response body returned for batch request from server

    Returns

    An instance of a BatchResponseContent

    Modifiers

    • @public

method getResponseById

getResponseById: (requestId: string) => Response;
  • To get the response of a request for a given request id

    Parameter requestId

    The request id value

    Returns

    The Response object instance for the particular request

    Modifiers

    • @public

method getResponses

getResponses: () => Map<string, Response>;
  • To get all the responses of the batch request

    Returns

    The Map of id and Response objects

    Modifiers

    • @public

method getResponsesIterator

getResponsesIterator: () => IterableIterator<[string, Response]>;
  • To get the iterator for the responses

    Returns

    The Iterable generator for the response objects

    Modifiers

    • @public

method update

update: (response: BatchResponseBody) => void;
  • Updates the Batch response content instance with given responses.

    Parameter response

    The response json representing batch response message

    Returns

    Nothing

    Modifiers

    • @public

class ChaosHandler

class ChaosHandler implements Middleware {}
  • Class representing ChaosHandler Class Middleware

constructor

constructor(
options?: ChaosHandlerOptions,
manualMap?: Map<string, Map<string, number>>
);
  • To create an instance of Testing Handler

    Parameter options

    The testing handler options instance

    Parameter manualMap

    The Map passed by user containing url-statusCode info

    Returns

    An instance of Testing Handler

    Modifiers

    • @public

method execute

execute: (context: Context) => Promise<void>;
  • To execute the current middleware

    Parameter context

    The context object of the request

    Returns

    A Promise that resolves to nothing

    Modifiers

    • @public

method setNext

setNext: (next: Middleware) => void;
  • To set the next middleware in the chain

    Parameter next

    The middleware instance

    Returns

    Nothing

    Modifiers

    • @public

class ChaosHandlerOptions

class ChaosHandlerOptions implements MiddlewareOptions {}
  • Class representing ChaosHandlerOptions Class MiddlewareOptions

constructor

constructor(
chaosStrategy?: ChaosStrategy,
statusMessage?: string,
statusCode?: number,
chaosPercentage?: number,
responseBody?: any
);
  • To create an instance of Testing Handler Options

    Parameter ChaosStrategy

    Specifies the startegy used for the Testing Handler -> RAMDOM/MANUAL

    Parameter statusMessage

    The Message to be returned in the response

    Parameter statusCode

    The statusCode to be returned in the response

    Parameter chaosPercentage

    The percentage of randomness/chaos in the handler

    Parameter responseBody

    The response body to be returned in the response

    Returns

    An instance of ChaosHandlerOptions

    Modifiers

    • @public

property chaosPercentage

chaosPercentage: number;
  • The percentage of randomness/chaos in the handler

    Setting the default value as 10%

    Modifiers

    • @public

property chaosStrategy

chaosStrategy: ChaosStrategy;
  • Specifies the startegy used for the Testing Handler -> RANDOM/MANUAL

    Modifiers

    • @public

property responseBody

responseBody: any;
  • The response body to be returned in the response

    Modifiers

    • @public

property statusCode

statusCode: number;
  • Status code to be returned in the response

    Modifiers

    • @public

property statusMessage

statusMessage: string;
  • The Message to be returned in the response

    Modifiers

    • @public

class Client

class Client {}

    method api

    api: (path: string) => GraphRequest;
    • Entry point to make requests

      Parameter path

      The path string value

      Returns

      The graph request instance

      Modifiers

      • @public

    method init

    static init: (options: Options) => Client;
    • To create a client instance with options and initializes the default middleware chain

      Parameter options

      The options for client instance

      Returns

      The Client instance

      Modifiers

      • @public

    method initWithMiddleware

    static initWithMiddleware: (clientOptions: ClientOptions) => Client;
    • To create a client instance with the Client Options

      Parameter clientOptions

      The options object for initializing the client

      Returns

      The Client instance

      Modifiers

      • @public

    class CustomAuthenticationProvider

    class CustomAuthenticationProvider implements AuthenticationProvider {}
    • Class representing CustomAuthenticationProvider AuthenticationProvider

    constructor

    constructor(provider: AuthProvider);
    • Creates an instance of CustomAuthenticationProvider

      Parameter provider

      An authProvider function

      Returns

      An instance of CustomAuthenticationProvider

      Modifiers

      • @public

    method getAccessToken

    getAccessToken: () => Promise<any>;
    • To get the access token

      Returns

      The promise that resolves to an access token

      Modifiers

      • @public

    class GraphError

    class GraphError extends Error {}
    • Class for GraphError @NOTE: This is NOT what is returned from the Graph GraphError is created from parsing JSON errors returned from the graph Some fields are renamed ie, "request-id" => requestId so you can use dot notation

    constructor

    constructor(statusCode?: number, message?: string, baseError?: Error);
    • Creates an instance of GraphError

      Parameter statusCode

      The status code of the error

      Returns

      An instance of GraphError

      Modifiers

      • @public

    property body

    body: any;
    • A member holding original error response by the graph service

      Modifiers

      • @public

    property code

    code: string;
    • A member holding code i.e name of the error

      Modifiers

      • @public

    property date

    date: Date;
    • A member holding processed date and time of the request

      Modifiers

      • @public

    property requestId

    requestId: string;
    • A member holding request-id i.e identifier of the request

      Modifiers

      • @public

    property statusCode

    statusCode: number;
    • A member holding status code of the error

      Modifiers

      • @public

    class GraphRequest

    class GraphRequest {}
    • A Class representing GraphRequest

    constructor

    constructor(httpClient: HTTPClient, config: ClientOptions, path: string);
    • Creates an instance of GraphRequest

      Parameter httpClient

      The HTTPClient instance

      Parameter config

      The options for making request

      Parameter path

      A path string

      Modifiers

      • @public

    method count

    count: (isCount?: boolean) => GraphRequest;
    • To add boolean for count OData Query param. The URL accepts only one $count Odata Query option and its value is set to the most recently passed boolean value.

      Parameter isCount

      The count boolean

      Returns

      The same GraphRequest instance that is being called with, after adding the boolean value for the $count query option

      Modifiers

      • @public

    method create

    create: (content: any, callback?: GraphRequestCallback) => Promise<any>;
    • Alias for Post request call

      Parameter content

      The content that needs to be sent with the request

      Parameter callback

      The callback function to be called in response with async call

      Returns

      A promise that resolves to the post response

      Modifiers

      • @public

    method del

    del: (callback?: GraphRequestCallback) => Promise<any>;
    • Alias for delete request call

      Parameter callback

      The callback function to be called in response with async call

      Returns

      A promise that resolves to the delete response

      Modifiers

      • @public

    method delete

    delete: (callback?: GraphRequestCallback) => Promise<any>;
    • Makes http request with DELETE method

      Parameter callback

      The callback function to be called in response with async call

      Returns

      A promise that resolves to the delete response

      Modifiers

      • @public

    method expand

    expand: (properties: string | string[]) => GraphRequest;
    • To add properties for expand OData Query param

      Parameter properties

      The Properties value

      Returns

      The same GraphRequest instance that is being called with, after adding the properties for $expand query

      Modifiers

      • @public

    method filter

    filter: (filterStr: string) => GraphRequest;
    • To add query string for filter OData Query param. The request URL accepts only one $filter Odata Query option and its value is set to the most recently passed filter query string.

      Parameter filterStr

      The filter query string

      Returns

      The same GraphRequest instance that is being called with, after adding the $filter query

      Modifiers

      • @public

    method get

    get: (callback?: GraphRequestCallback) => Promise<any>;
    • Makes a http request with GET method

      Parameter callback

      The callback function to be called in response with async call

      Returns

      A promise that resolves to the get response

      Modifiers

      • @public

    method getStream

    getStream: (callback?: GraphRequestCallback) => Promise<any>;
    • Makes a http request with GET method to read response as a stream.

      Parameter callback

      The callback function to be called in response with async call

      Returns

      A promise that resolves to the getStream response

      Modifiers

      • @public

    method header

    header: (headerKey: string, headerValue: string) => GraphRequest;
    • Sets the custom header for a request

      Parameter headerKey

      A header key

      Parameter headerValue

      A header value

      Returns

      The same GraphRequest instance that is being called with

      Modifiers

      • @public

    method headers

    headers: (headers: KeyValuePairObjectStringNumber | HeadersInit) => GraphRequest;
    • Sets the custom headers for a request

      Parameter headers

      The request headers

      Returns

      The same GraphRequest instance that is being called with

      Modifiers

      • @public

    method middlewareOptions

    middlewareOptions: (options: MiddlewareOptions[]) => GraphRequest;
    • Sets the middleware options for a request

      Parameter options

      The array of middleware options

      Returns

      The same GraphRequest instance that is being called with

      Modifiers

      • @public

    method option

    option: (key: string, value: any) => GraphRequest;
    • Sets the option for making a request

      Parameter key

      The key value

      Parameter value

      The value

      Returns

      The same GraphRequest instance that is being called with

      Modifiers

      • @public

    method options

    options: (options: { [key: string]: any }) => GraphRequest;
    • Sets the options for making a request

      Parameter options

      The options key value pair

      Returns

      The same GraphRequest instance that is being called with

      Modifiers

      • @public

    method orderby

    orderby: (properties: string | string[]) => GraphRequest;
    • To add properties for orderby OData Query param

      Parameter properties

      The Properties value

      Returns

      The same GraphRequest instance that is being called with, after adding the properties for $orderby query

      Modifiers

      • @public

    method patch

    patch: (content: any, callback?: GraphRequestCallback) => Promise<any>;
    • Makes http request with PATCH method

      Parameter content

      The content that needs to be sent with the request

      Parameter callback

      The callback function to be called in response with async call

      Returns

      A promise that resolves to the patch response

      Modifiers

      • @public

    method post

    post: (content: any, callback?: GraphRequestCallback) => Promise<any>;
    • Makes a http request with POST method

      Parameter content

      The content that needs to be sent with the request

      Parameter callback

      The callback function to be called in response with async call

      Returns

      A promise that resolves to the post response

      Modifiers

      • @public

    method put

    put: (content: any, callback?: GraphRequestCallback) => Promise<any>;
    • Makes http request with PUT method

      Parameter content

      The content that needs to be sent with the request

      Parameter callback

      The callback function to be called in response with async call

      Returns

      A promise that resolves to the put response

      Modifiers

      • @public

    method putStream

    putStream: (stream: any, callback?: GraphRequestCallback) => Promise<any>;
    • Makes a http request with GET method to read response as a stream.

      Parameter stream

      The stream instance

      Parameter callback

      The callback function to be called in response with async call

      Returns

      A promise that resolves to the putStream response

      Modifiers

      • @public

    method query

    query: (
    queryDictionaryOrString: string | KeyValuePairObjectStringNumber
    ) => GraphRequest;
    • Appends query string to the urlComponent

      Parameter queryDictionaryOrString

      The query value

      Returns

      The same GraphRequest instance that is being called with, after appending the query string to the url component

      Modifiers

      • @public

    method responseType

    responseType: (responseType: ResponseType) => GraphRequest;
    • Sets the api endpoint version for a request

      Parameter responseType

      The response type value

      Returns

      The same GraphRequest instance that is being called with

      Modifiers

      • @public

    method search

    search: (searchStr: string) => GraphRequest;
    • To add criterion for search OData Query param. The request URL accepts only one $search Odata Query option and its value is set to the most recently passed search criterion string.

      Parameter searchStr

      The search criterion string

      Returns

      The same GraphRequest instance that is being called with, after adding the $search query criteria

      Modifiers

      • @public

    method select

    select: (properties: string | string[]) => GraphRequest;
    • To add properties for select OData Query param

      Parameter properties

      The Properties value

      Returns

      The same GraphRequest instance that is being called with, after adding the properties for $select query

      Modifiers

      • @public

    method skip

    skip: (n: number) => GraphRequest;
    • To add number for skip OData Query param. The request URL accepts only one $skip Odata Query option and its value is set to the most recently passed number value.

      Parameter n

      The number value

      Returns

      The same GraphRequest instance that is being called with, after adding the number for the $skip query

      Modifiers

      • @public

    method skipToken

    skipToken: (token: string) => GraphRequest;
    • To add token string for skipToken OData Query param. The request URL accepts only one $skipToken Odata Query option and its value is set to the most recently passed token value.

      Parameter token

      The token value

      Returns

      The same GraphRequest instance that is being called with, after adding the token string for $skipToken query option

      Modifiers

      • @public

    method top

    top: (n: number) => GraphRequest;
    • To add number for top OData Query param. The request URL accepts only one $top Odata Query option and its value is set to the most recently passed number value.

      Parameter n

      The number value

      Returns

      The same GraphRequest instance that is being called with, after adding the number for $top query

      Modifiers

      • @public

    method update

    update: (content: any, callback?: GraphRequestCallback) => Promise<any>;
    • Alias for PATCH request

      Parameter content

      The content that needs to be sent with the request

      Parameter callback

      The callback function to be called in response with async call

      Returns

      A promise that resolves to the patch response

      Modifiers

      • @public

    method version

    version: (version: string) => GraphRequest;
    • Sets the api endpoint version for a request

      Parameter version

      The version value

      Returns

      The same GraphRequest instance that is being called with

      Modifiers

      • @public

    class HTTPMessageHandler

    class HTTPMessageHandler implements Middleware {}
    • Middleware Class for HTTPMessageHandler

    method execute

    execute: (context: Context) => Promise<void>;
    • To execute the current middleware

      Parameter context

      The request context object

      Returns

      A promise that resolves to nothing

      Modifiers

      • @public

    class ImplicitMSALAuthenticationProvider

    class ImplicitMSALAuthenticationProvider implements AuthenticationProvider {}
    • Class representing ImplicitMSALAuthenticationProvider AuthenticationProvider

    constructor

    constructor(msalApplication: any, options: MSALAuthenticationProviderOptions);
    • Creates an instance of ImplicitMSALAuthenticationProvider

      Parameter msalApplication

      An instance of MSAL UserAgentApplication

      Parameter options

      An instance of MSALAuthenticationProviderOptions

      Returns

      An instance of ImplicitMSALAuthenticationProvider

      Modifiers

      • @public

    method getAccessToken

    getAccessToken: (
    authenticationProviderOptions?: AuthenticationProviderOptions
    ) => Promise<string>;
    • To get the access token

      Parameter authenticationProviderOptions

      The authentication provider options object

      Returns

      The promise that resolves to an access token

      Modifiers

      • @public

    class LargeFileUploadTask

    class LargeFileUploadTask {}
    • Class representing LargeFileUploadTask

    constructor

    constructor(
    client: Client,
    file: FileObject,
    uploadSession: LargeFileUploadSession,
    options?: LargeFileUploadTaskOptions
    );
    • Constructs a LargeFileUploadTask

      Parameter client

      The GraphClient instance

      Parameter file

      The FileObject holding details of a file that needs to be uploaded

      Parameter uploadSession

      The upload session to which the upload has to be done

      Parameter options

      The upload task options

      Returns

      An instance of LargeFileUploadTask

      Modifiers

      • @public

    property client

    protected client: Client;
    • The GraphClient instance

    property file

    protected file: FileObject;
    • The object holding file details

    property nextRange

    protected nextRange: Range;
    • The next range needs to be uploaded

    property options

    protected options: LargeFileUploadTaskOptions;
    • The object holding options for the task

    property uploadSession

    protected uploadSession: LargeFileUploadSession;
    • The object for upload session

    method cancel

    cancel: () => Promise<any>;
    • Deletes upload session in the server

      Returns

      The promise resolves to cancelled response

      Modifiers

      • @public

    method createUploadSession

    static createUploadSession: (
    client: Client,
    requestUrl: string,
    payload: any,
    headers?: KeyValuePairObjectStringNumber
    ) => Promise<any>;
    • Makes request to the server to create an upload session

      Parameter client

      The GraphClient instance

      Parameter payload

      The payload that needs to be sent

      Parameter headers

      The headers that needs to be sent

      Returns

      The promise that resolves to LargeFileUploadSession

      Modifiers

      • @public

    method getNextRange

    getNextRange: () => Range;
    • Gets next range that needs to be uploaded

      Returns

      The range instance

      Modifiers

      • @public

    method getStatus

    getStatus: () => Promise<any>;
    • Gets status for the upload session

      Returns

      The promise resolves to the status enquiry response

      Modifiers

      • @public

    method resume

    resume: () => Promise<any>;
    • Resumes upload session and continue uploading the file from the last sent range

      Returns

      The promise resolves to the uploaded response

      Modifiers

      • @public

    method sliceFile

    sliceFile: (range: Range) => ArrayBuffer | Blob;
    • Slices the file content to the given range

      Parameter range

      The range value

      Returns

      The sliced ArrayBuffer or Blob

      Modifiers

      • @public

    method upload

    upload: () => Promise<any>;
    • Uploads file to the server in a sequential order by slicing the file

      Returns

      The promise resolves to uploaded response

      Modifiers

      • @public

    method uploadSlice

    uploadSlice: (
    fileSlice: ArrayBuffer | Blob | File,
    range: Range,
    totalSize: number
    ) => Promise<any>;
    • Uploads given slice to the server

      Parameter fileSlice

      The file slice

      Parameter range

      The range value

      Parameter totalSize

      The total size of a complete file

      Modifiers

      • @public

    class MiddlewareFactory

    class MiddlewareFactory {}
    • Class containing function(s) related to the middleware pipelines.

    method getDefaultMiddlewareChain

    static getDefaultMiddlewareChain: (
    authProvider: AuthenticationProvider
    ) => Middleware[];
    • Returns the default middleware chain an array with the middleware handlers

      Parameter authProvider

      The authentication provider instance

      Returns

      an array of the middleware handlers of the default middleware chain

      Modifiers

      • @public

    class MSALAuthenticationProviderOptions

    class MSALAuthenticationProviderOptions implements AuthenticationProviderOptions {}
    • AuthenticationProviderOptions Class representing MSALAuthenticationProviderOptions

    constructor

    constructor(scopes: string[]);
    • To create an instance of MSALAuthenticationProviderOptions

      Parameter scopes

      An array of scopes

      Returns

      An instance of MSALAuthenticationProviderOptions

      Modifiers

      • @public

    property scopes

    scopes: string[];
    • A member holding array of scopes

      Modifiers

      • @public

    class OneDriveLargeFileUploadTask

    class OneDriveLargeFileUploadTask extends LargeFileUploadTask {}
    • Class representing OneDriveLargeFileUploadTask

    constructor

    constructor(
    client: Client,
    file: FileObject,
    uploadSession: LargeFileUploadSession,
    options: LargeFileUploadTaskOptions
    );
    • Constructs a OneDriveLargeFileUploadTask

      Parameter client

      The GraphClient instance

      Parameter file

      The FileObject holding details of a file that needs to be uploaded

      Parameter uploadSession

      The upload session to which the upload has to be done

      Parameter options

      The upload task options

      Returns

      An instance of OneDriveLargeFileUploadTask

      Modifiers

      • @public

    method commit

    commit: (requestUrl: string) => Promise<any>;
    • Commits upload session to end uploading

      Parameter requestUrl

      The URL to commit the upload session

      Returns

      The promise resolves to committed response

      Modifiers

      • @public

    method create

    static create: (
    client: Client,
    file: Blob | Buffer | File,
    options: OneDriveLargeFileUploadOptions
    ) => Promise<any>;
    • Creates a OneDriveLargeFileUploadTask

      Parameter client

      The GraphClient instance

      Parameter file

      File represented as Blob, Buffer or File

      Parameter options

      The options for upload task

      Returns

      The promise that will be resolves to OneDriveLargeFileUploadTask instance

      Modifiers

      • @public

    method createUploadSession

    static createUploadSession: (
    client: Client,
    requestUrl: string,
    fileName: string
    ) => Promise<any>;
    • Makes request to the server to create an upload session

      Parameter client

      The GraphClient instance

      Parameter requestUrl

      The URL to create the upload session

      Parameter fileName

      The name of a file to upload, (with extension)

      Returns

      The promise that resolves to LargeFileUploadSession

      Modifiers

      • @public

    class PageIterator

    class PageIterator {}
    • Class for PageIterator

    constructor

    constructor(
    client: Client,
    pageCollection: PageCollection,
    callback: PageIteratorCallback,
    requestOptions?: GraphRequestOptions
    );
    • Creates new instance for PageIterator

      Parameter client

      The graph client instance

      Parameter pageCollection

      The page collection object

      Parameter callBack

      The callback function

      Parameter requestOptions

      The request options

      Returns

      An instance of a PageIterator

      Modifiers

      • @public
    getDeltaLink: () => string | undefined;
    • Getter to get the deltaLink in the current response

      Returns

      A deltaLink which is being used to make delta requests in future

      Modifiers

      • @public

    method isComplete

    isComplete: () => boolean;
    • To get the completeness status of the iterator

      Returns

      Boolean indicating the completeness

      Modifiers

      • @public

    method iterate

    iterate: () => Promise<any>;
    • Iterates over the collection and kicks callback for each item on iteration. Fetches next set of data through nextLink and iterates over again This happens until the nextLink is drained out or the user responds with a red flag to continue from callback

      Returns

      A Promise that resolves to nothing on completion and throws error incase of any discrepancy.

      Modifiers

      • @public

    method resume

    resume: () => Promise<any>;
    • To resume the iteration Note: This internally calls the iterate method, It's just for more readability.

      Returns

      A Promise that resolves to nothing on completion and throws error incase of any discrepancy

      Modifiers

      • @public

    class RedirectHandler

    class RedirectHandler implements Middleware {}
    • Class Middleware Class representing RedirectHandler

    constructor

    constructor(options?: RedirectHandlerOptions);
    • To create an instance of RedirectHandler

      Parameter options

      The redirect handler options instance

      Returns

      An instance of RedirectHandler

      Modifiers

      • @public

    method execute

    execute: (context: Context) => Promise<void>;
    • To execute the current middleware

      Parameter context

      The context object of the request

      Returns

      A Promise that resolves to nothing

      Modifiers

      • @public

    method setNext

    setNext: (next: Middleware) => void;
    • To set the next middleware in the chain

      Parameter next

      The middleware instance

      Returns

      Nothing

      Modifiers

      • @public

    class RedirectHandlerOptions

    class RedirectHandlerOptions implements MiddlewareOptions {}
    • MiddlewareOptions A class representing RedirectHandlerOptions

    constructor

    constructor(maxRedirects?: number, shouldRedirect?: ShouldRedirect);
    • To create an instance of RedirectHandlerOptions

      Parameter maxRedirects

      The max redirects value

      Parameter shouldRedirect

      The should redirect callback

      Returns

      An instance of RedirectHandlerOptions

      Modifiers

      • @public

    property maxRedirects

    maxRedirects: number;
    • A member holding max redirects value

      Modifiers

      • @public

    property shouldRedirect

    shouldRedirect: ShouldRedirect;
    • A member holding shouldRedirect callback

      Modifiers

      • @public

    class RetryHandler

    class RetryHandler implements Middleware {}
    • Middleware Class for RetryHandler

    constructor

    constructor(options?: RetryHandlerOptions);
    • To create an instance of RetryHandler

      Parameter options

      The retry handler options value

      Returns

      An instance of RetryHandler

      Modifiers

      • @public

    method execute

    execute: (context: Context) => Promise<void>;
    • To execute the current middleware

      Parameter context

      The context object of the request

      Returns

      A Promise that resolves to nothing

      Modifiers

      • @public

    method setNext

    setNext: (next: Middleware) => void;
    • To set the next middleware in the chain

      Parameter next

      The middleware instance

      Returns

      Nothing

      Modifiers

      • @public

    class RetryHandlerOptions

    class RetryHandlerOptions implements MiddlewareOptions {}
    • MiddlewareOptions Class for RetryHandlerOptions

    constructor

    constructor(delay?: number, maxRetries?: number, shouldRetry?: ShouldRetry);
    • To create an instance of RetryHandlerOptions

      Parameter delay

      The delay value in seconds

      Parameter maxRetries

      The maxRetries value

      Parameter shouldRetry

      The shouldRetry callback function

      Returns

      An instance of RetryHandlerOptions

      Modifiers

      • @public

    property delay

    delay: number;
    • A member holding delay value in seconds

      Modifiers

      • @public

    property maxRetries

    maxRetries: number;
    • A member holding maxRetries value

      Modifiers

      • @public

    property shouldRetry

    shouldRetry: ShouldRetry;
    • A member holding shouldRetry callback

      Modifiers

      • @public

    method getMaxDelay

    getMaxDelay: () => number;
    • To get the maximum delay

      Returns

      A maximum delay

      Modifiers

      • @public

    class TelemetryHandler

    class TelemetryHandler implements Middleware {}
    • Middleware Class for TelemetryHandler

    method execute

    execute: (context: Context) => Promise<void>;
    • To execute the current middleware

      Parameter context

      The context object of the request

      Returns

      A Promise that resolves to nothing

      Modifiers

      • @public

    method setNext

    setNext: (next: Middleware) => void;
    • To set the next middleware in the chain

      Parameter next

      The middleware instance

      Returns

      Nothing

      Modifiers

      • @public

    class TelemetryHandlerOptions

    class TelemetryHandlerOptions implements MiddlewareOptions {}
    • MiddlewareOptions Class for TelemetryHandlerOptions

    method getFeatureUsage

    getFeatureUsage: () => string;
    • To get the feature usage

      Returns

      A feature usage flag as hexadecimal string

      Modifiers

      • @public

    method updateFeatureUsageFlag

    static updateFeatureUsageFlag: (
    context: Context,
    flag: FeatureUsageFlag
    ) => void;
    • To update the feature usage in the context object

      Parameter context

      The request context object containing middleware options

      Parameter flag

      The flag value

      Returns

      nothing

      Modifiers

      • @public

    Interfaces

    interface AuthenticationProvider

    interface AuthenticationProvider {}
    • A signature representing Authentication provider {Function} getAccessToken - The function to get the access token from the authentication provider

    property getAccessToken

    getAccessToken: (
    authenticationProviderOptions?: AuthenticationProviderOptions
    ) => Promise<string>;
    • To get access token from the authentication provider

      Parameter authenticationProviderOptions

      The authentication provider options instance

      Returns

      A promise that resolves to an access token

    interface AuthenticationProviderOptions

    interface AuthenticationProviderOptions {}
    • A signature represents the Authentication provider options {string[]} [scopes] - The array of scopes

    property scopes

    scopes?: string[];

      interface BatchRequestBody

      interface BatchRequestBody {}
      • Signature representing batch request body {BatchRequestData[]} requests - Array of request data, a json representation of requests for batch

      property requests

      requests: BatchRequestData[];

        interface BatchRequestData

        interface BatchRequestData extends RequestData {}
        • Signature representing batch request data {string} id - Unique identity for the request, Should not be an empty string {string[]} [dependsOn] - Array of dependencies

        property dependsOn

        dependsOn?: string[];

          property id

          id: string;

            interface BatchRequestStep

            interface BatchRequestStep {}
            • Signature representing BatchRequestStep data {string} id - Unique identity for the request, Should not be an empty string {string[]} [dependsOn] - Array of dependencies {Request} request - The Request object

            property dependsOn

            dependsOn?: string[];

              property id

              id: string;

                property request

                request: Request;

                  interface ClientOptions

                  interface ClientOptions {}
                  • Options for initializing the Graph Client {Function} [authProvider] - The authentication provider instance {string} [baseUrl] - Base url that needs to be appended to every request {boolean} [debugLogging] - The boolean to enable/disable debug logging {string} [defaultVersion] - The default version that needs to be used while making graph api request {FetchOptions} [fetchOptions] - The options for fetch request {Middleware| Middleware[]} [middleware] - The first middleware of the middleware chain or an array of the Middleware handlers

                  property authProvider

                  authProvider?: AuthenticationProvider;

                    property baseUrl

                    baseUrl?: string;

                      property debugLogging

                      debugLogging?: boolean;

                        property defaultVersion

                        defaultVersion?: string;

                          property fetchOptions

                          fetchOptions?: FetchOptions;

                            property middleware

                            middleware?: Middleware | Middleware[];

                              interface Context

                              interface Context {}
                              • {RequestInfo} request - The request url string or the Request instance {FetchOptions} [options] - The options for the request {Response} [response] - The response content {MiddlewareControl} [middlewareControl] - The options for the middleware chain

                              property middlewareControl

                              middlewareControl?: MiddlewareControl;

                                property options

                                options?: FetchOptions;

                                  property request

                                  request: RequestInfo;

                                    property response

                                    response?: Response;

                                      interface FetchOptions

                                      interface FetchOptions extends RequestInit, NodeFetchInit {}

                                      interface FileObject

                                      interface FileObject {}
                                      • Signature to define the properties and content of the file in upload task {ArrayBuffer | File} content - The actual file content {string} name - Specifies the file name with extension {number} size - Specifies size of the file

                                      property content

                                      content: ArrayBuffer | File;

                                        property name

                                        name: string;

                                          property size

                                          size: number;

                                            interface GraphRequestOptions

                                            interface GraphRequestOptions {}
                                            • Signature to define the request options to be sent during request. The values of the GraphRequestOptions properties are passed to the Graph Request object. {HeadersInit} headers - the header options for the request {MiddlewareOptions[]} middlewareoptions - The middleware options for the request {FetchOptions} options - The fetch options for the request

                                            property headers

                                            headers?: HeadersInit;

                                              property middlewareOptions

                                              middlewareOptions?: MiddlewareOptions[];

                                                property options

                                                options?: FetchOptions;

                                                  interface LargeFileUploadSession

                                                  interface LargeFileUploadSession {}
                                                  • Signature to represent upload session resulting from the session creation in the server {string} url - The URL to which the file upload is made {Date} expiry - The expiration of the time of the upload session

                                                  property expiry

                                                  expiry: Date;

                                                    property url

                                                    url: string;

                                                      interface LargeFileUploadTaskOptions

                                                      interface LargeFileUploadTaskOptions {}
                                                      • Signature to define options for upload task {number} [rangeSize = LargeFileUploadTask.DEFAULT_FILE_SIZE] - Specifies the range chunk size

                                                      property rangeSize

                                                      rangeSize?: number;

                                                        interface Middleware

                                                        interface Middleware {}
                                                        • {Function} execute - The method to execute the middleware {Function} [setNext] - A method to set the next middleware in the chain

                                                        property execute

                                                        execute: (context: Context) => Promise<void>;

                                                          property setNext

                                                          setNext?: (middleware: Middleware) => void;

                                                            interface MiddlewareOptions

                                                            interface MiddlewareOptions {}
                                                            • Signature representing the middleware options

                                                            interface NodeFetchInit

                                                            interface NodeFetchInit {}
                                                            • https://github.com/bitinn/node-fetch/#options Signature to define the fetch request options for node environment {number} [follow] - Maximum redirect count. 0 to not follow redirect {number} [timeout] - Request/Response timeout in milliseconds, it resets on redirect. 0 to disable (OS limit applies) {number} [compress] - Support gzip/deflate content encoding. false to disable {number} [size] - Maximum response body size in bytes. 0 to disable {any} [agent] - HTTP(S).Agent instance, allows custom proxy, certificate, lookup, family etc.

                                                            property agent

                                                            agent?: any;

                                                              property compress

                                                              compress?: boolean;

                                                                property follow

                                                                follow?: number;

                                                                  property size

                                                                  size?: number;

                                                                    property timeout

                                                                    timeout?: number;

                                                                      interface Options

                                                                      interface Options {}
                                                                      • Options for initializing the Graph Client {AuthProvider} authProvider - The function to get the authentication token {string} [baseUrl] - Base url that needs to be appended to every request {boolean} [debugLogging] - The boolean to enable/disable debug logging {string} [defaultVersion] - The default version that needs to be used while making graph api request {FetchOptions} [fetchOptions] - The options for fetch request

                                                                      property authProvider

                                                                      authProvider: AuthProvider;

                                                                        property baseUrl

                                                                        baseUrl?: string;

                                                                          property debugLogging

                                                                          debugLogging?: boolean;

                                                                            property defaultVersion

                                                                            defaultVersion?: string;

                                                                              property fetchOptions

                                                                              fetchOptions?: FetchOptions;

                                                                                interface PageCollection

                                                                                interface PageCollection {}
                                                                                • Signature representing PageCollection {any[]} value - The collection value {string} [@odata.nextLink] - The nextLink value {string} [@odata.deltaLink] - The deltaLink value {any} Additional - Any number of additional properties (This is to accept the any additional data returned by in the response to the nextLink request)

                                                                                property "@odata.deltaLink"

                                                                                '@odata.deltaLink'?: string;

                                                                                  property "@odata.nextLink"

                                                                                  '@odata.nextLink'?: string;

                                                                                    property value

                                                                                    value: any[];

                                                                                      index signature

                                                                                      [Key: string]: any;

                                                                                        interface RequestData

                                                                                        interface RequestData extends RequestInit {}

                                                                                        property url

                                                                                        url: string;

                                                                                          interface URLComponents

                                                                                          interface URLComponents {}
                                                                                          • Signature to define URL components http://graph.microsoft.com/VERSION/PATH?QUERYSTRING&OTHER_QUERY_PARAMS

                                                                                            {string} host - The host to which the request needs to be made {string} version - Version of the graph endpoint {string} [path] - The path of the resource request {KeyValuePairObjectStringNumber} oDataQueryParams - The oData Query Params {KeyValuePairObjectStringNumber} otherURLQueryParams - The other query params for a request {string[]} otherURLQueryOptions - The non key-value query parameters. Example- '/me?$whatif'

                                                                                          property host

                                                                                          host: string;

                                                                                            property oDataQueryParams

                                                                                            oDataQueryParams: KeyValuePairObjectStringNumber;

                                                                                              property otherURLQueryOptions

                                                                                              otherURLQueryOptions?: string[];

                                                                                                property otherURLQueryParams

                                                                                                otherURLQueryParams: KeyValuePairObjectStringNumber;

                                                                                                  property path

                                                                                                  path?: string;

                                                                                                    property version

                                                                                                    version: string;

                                                                                                      Enums

                                                                                                      enum ChaosStrategy

                                                                                                      enum ChaosStrategy {
                                                                                                      MANUAL = 0,
                                                                                                      RANDOM = 1,
                                                                                                      }
                                                                                                      • Strategy used for Testing Handler

                                                                                                      member MANUAL

                                                                                                      MANUAL = 0

                                                                                                        member RANDOM

                                                                                                        RANDOM = 1

                                                                                                          enum FeatureUsageFlag

                                                                                                          enum FeatureUsageFlag {
                                                                                                          NONE = 0,
                                                                                                          REDIRECT_HANDLER_ENABLED = 1,
                                                                                                          RETRY_HANDLER_ENABLED = 2,
                                                                                                          AUTHENTICATION_HANDLER_ENABLED = 4,
                                                                                                          }
                                                                                                          • {number} NONE - The hexadecimal flag value for nothing enabled {number} REDIRECT_HANDLER_ENABLED - The hexadecimal flag value for redirect handler enabled {number} RETRY_HANDLER_ENABLED - The hexadecimal flag value for retry handler enabled {number} AUTHENTICATION_HANDLER_ENABLED - The hexadecimal flag value for the authentication handler enabled

                                                                                                          member AUTHENTICATION_HANDLER_ENABLED

                                                                                                          AUTHENTICATION_HANDLER_ENABLED = 4

                                                                                                            member NONE

                                                                                                            NONE = 0

                                                                                                              member REDIRECT_HANDLER_ENABLED

                                                                                                              REDIRECT_HANDLER_ENABLED = 1

                                                                                                                member RETRY_HANDLER_ENABLED

                                                                                                                RETRY_HANDLER_ENABLED = 2

                                                                                                                  enum ResponseType

                                                                                                                  enum ResponseType {
                                                                                                                  ARRAYBUFFER = 'arraybuffer',
                                                                                                                  BLOB = 'blob',
                                                                                                                  DOCUMENT = 'document',
                                                                                                                  JSON = 'json',
                                                                                                                  RAW = 'raw',
                                                                                                                  STREAM = 'stream',
                                                                                                                  TEXT = 'text',
                                                                                                                  }

                                                                                                                  member ARRAYBUFFER

                                                                                                                  ARRAYBUFFER = 'arraybuffer'

                                                                                                                    member BLOB

                                                                                                                    BLOB = 'blob'

                                                                                                                      member DOCUMENT

                                                                                                                      DOCUMENT = 'document'

                                                                                                                        member JSON

                                                                                                                        JSON = 'json'

                                                                                                                          member RAW

                                                                                                                          RAW = 'raw'

                                                                                                                            member STREAM

                                                                                                                            STREAM = 'stream'

                                                                                                                              member TEXT

                                                                                                                              TEXT = 'text'

                                                                                                                                Type Aliases

                                                                                                                                type AuthProvider

                                                                                                                                type AuthProvider = (done: AuthProviderCallback) => void;
                                                                                                                                • Signature that holds authProvider - The anonymous callback function which takes a single param

                                                                                                                                type AuthProviderCallback

                                                                                                                                type AuthProviderCallback = (error: any, accessToken: string | null) => void;
                                                                                                                                • Signature that defines callback for an authentication provider - The anonymous callback function which takes two params

                                                                                                                                type GraphRequestCallback

                                                                                                                                type GraphRequestCallback = (
                                                                                                                                error: GraphError,
                                                                                                                                response: any,
                                                                                                                                rawResponse?: any
                                                                                                                                ) => void;
                                                                                                                                • Signature to define the GraphRequest callback - The anonymous callback function

                                                                                                                                type PageIteratorCallback

                                                                                                                                type PageIteratorCallback = (data: any) => boolean;
                                                                                                                                • Signature representing callback for page iterator {Function} callback - The callback function which should return boolean to continue the continue/stop the iteration.

                                                                                                                                type ShouldRedirect

                                                                                                                                type ShouldRedirect = (response: Response) => boolean;
                                                                                                                                • A type declaration for shouldRetry callback

                                                                                                                                type ShouldRetry

                                                                                                                                type ShouldRetry = (
                                                                                                                                delay: number,
                                                                                                                                attempt: number,
                                                                                                                                request: RequestInfo,
                                                                                                                                options: FetchOptions | undefined,
                                                                                                                                response: Response
                                                                                                                                ) => boolean;
                                                                                                                                • A type declaration for shouldRetry callback

                                                                                                                                Package Files (37)

                                                                                                                                Dependencies (3)

                                                                                                                                Dev Dependencies (21)

                                                                                                                                Peer Dependencies (0)

                                                                                                                                No peer dependencies.

                                                                                                                                Badge

                                                                                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@microsoft/microsoft-graph-client.

                                                                                                                                • Markdown
                                                                                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@microsoft/microsoft-graph-client)
                                                                                                                                • HTML
                                                                                                                                  <a href="https://www.jsdocs.io/package/@microsoft/microsoft-graph-client"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>