DefinitelyTyped/types/office-runtime/office-runtime-tests.ts
Sudhi Ramamurthy 8043169d09 Addition of new auth API (preview) and ApiInformation interface. (#40018)
* Office Runtime Auth Public Preview APIs

* Add isSetSupported from ApiInformation interface

* Example addition

* Fixes to API description

* Fix trailing space and blank lines

* Fixes to comment alignment

* adding example in test file for SSO

* adding example in test file for SSO with semi-colon
2019-11-04 15:47:32 -08:00

34 lines
1018 B
TypeScript

/*
office-runtime
Copyright (c) Microsoft Corporation
*/
OfficeRuntime.storage.getItem("foo");
OfficeRuntime.storage.getItems(["foo", "bar"]);
OfficeRuntime.storage.setItem("foo", "bar");
OfficeRuntime.storage.setItems({ foo: "value1", bar: "value2" });
OfficeRuntime.storage.removeItem("foo");
OfficeRuntime.storage.removeItems(["foo", "bar"]);
OfficeRuntime.storage.getKeys();
OfficeRuntime.displayWebDialog("https://localhost:3000", {
displayInIFrame: false
});
OfficeRuntime.displayWebDialog("https://localhost:3000", {
onClose: () => {
console.log("closed");
}
});
// Check for the support of the requirement-set (note that it only accepts strings.)
const supported = OfficeRuntime.apiInformation.isSetSupported("ExcelApi", "1.9");
// For SSO auth API, refer to the public documentation at the site: https://github.com/OfficeDev/Office-Add-in-NodeJS-SSO
OfficeRuntime.auth.getAccessToken({ allowSignInPrompt: true, forMSGraphAccess: true }).then(token => {
console.log(token);
});