diff --git a/notNeededPackages.json b/notNeededPackages.json index be57d76a49..1521fd7426 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -726,6 +726,12 @@ "sourceRepoURL": "https://github.com/prettymuchbryce/node-http-status", "asOfVersion": "1.2.0" }, + { + "libraryName": "i18next-browser-languagedetector", + "typingsPackageName": "i18next-browser-languagedetector", + "sourceRepoURL": "https://github.com/i18next/i18next-browser-languagedetector", + "asOfVersion": "2.0.2" + }, { "libraryName": "i18next-xhr-backend", "typingsPackageName": "i18next-xhr-backend", @@ -1116,6 +1122,12 @@ "sourceRepoURL": "http://onsen.io", "asOfVersion": "2.0.0" }, + { + "libraryName": "p-throttle", + "typingsPackageName": "p-throttle", + "sourceRepoURL": "https://github.com/sindresorhus/p-throttle", + "asOfVersion": "2.0.0" + }, { "libraryName": "param-case", "typingsPackageName": "param-case", diff --git a/package.json b/package.json index 7fc0358f27..1a5124c035 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "lint": "dtslint types" }, "devDependencies": { - "dtslint": "github:Microsoft/dtslint#production", + "dtslint": "latest", "types-publisher": "github:Microsoft/types-publisher#production" }, "dependencies": {} diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 92c090d179..fdd0f395fe 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -97,6 +97,7 @@ let _algoliaIndexSettings: IndexSettings = { minProximity: 0, placeholders: { '': [''] }, camelCaseAttributes: [''], + sortFacetValuesBy: 'count', }; let _algoliaQueryParameters: QueryParameters = { @@ -150,6 +151,7 @@ let _algoliaQueryParameters: QueryParameters = { synonyms: true, replaceSynonymsInHighlight: false, minProximity: 0, + sortFacetValuesBy: 'alpha', }; let client: Client = algoliasearch('', ''); diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 5478fedbac..8e3ba4c5ab 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -5,6 +5,7 @@ // Aurélien Hervé // Samuel Vaillant // Kai Eichinger +// Nery Ortez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -24,25 +25,25 @@ declare namespace algoliasearch { * Query on multiple index * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries */ - search( + search( queries: { indexName: string; query: string; params: QueryParameters; }[], - cb: (err: Error, res: MultiResponse) => void + cb: (err: Error, res: MultiResponse) => void ): void; /** * Query on multiple index * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries */ - search( + search( queries: { indexName: string; query: string; params: QueryParameters; }[] - ): Promise; + ): Promise>; /** * Query for facet values of a specific facet */ @@ -590,14 +591,14 @@ declare namespace algoliasearch { * Search in an index * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search */ - search(params: QueryParameters): Promise; + search(params: QueryParameters): Promise>; /** * Search in an index * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search */ - search( + search( params: QueryParameters, - cb: (err: Error, res: Response) => void + cb: (err: Error, res: Response) => void ): void; /** * Search in an index @@ -1451,6 +1452,11 @@ declare namespace algoliasearch { nbShards?: number; userData?: string | object; + + /** + * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ + */ + sortFacetValuesBy?: 'count' | 'alpha'; } namespace SearchForFacetValues { @@ -1776,14 +1782,16 @@ declare namespace algoliasearch { https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/ */ camelCaseAttributes?: string[]; + + sortFacetValuesBy?: 'count' | 'alpha'; } - interface Response { + interface Response { /** * Contains all the hits matching the query * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ - hits: any[]; + hits: T[]; /** * Current page * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response @@ -1842,8 +1850,8 @@ declare namespace algoliasearch { cursor?: string; } - interface MultiResponse { - results: Response[]; + interface MultiResponse { + results: Response[]; } } diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index ce58d6a428..11e22f5ccf 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -6,6 +6,7 @@ // Samuel Vaillant // Claas Brüggemann // Kai Eichinger +// Nery Ortez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -25,25 +26,25 @@ declare namespace algoliasearch { * Query on multiple index * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries */ - search( + search( queries: { indexName: string; query: string; params: QueryParameters; }[], - cb: (err: Error, res: MultiResponse) => void + cb: (err: Error, res: MultiResponse) => void ): void; /** * Query on multiple index * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries */ - search( + search( queries: { indexName: string; query: string; params: QueryParameters; }[] - ): Promise; + ): Promise>; /** * Query for facet values of a specific facet */ @@ -109,15 +110,15 @@ declare namespace algoliasearch { * Search in an index * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search */ - search( + search( params: QueryParameters, - cb: (err: Error, res: Response) => void + cb: (err: Error, res: Response) => void ): void; /** * Search in an index * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search */ - search(params: QueryParameters): Promise; + search(params: QueryParameters): Promise>; /** * Search in an index * https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/ @@ -531,6 +532,11 @@ declare namespace algoliasearch { nbShards?: number; userData?: string | object; + + /** + * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ + */ + sortFacetValuesBy?: 'count' | 'alpha'; } namespace SearchForFacetValues { @@ -552,12 +558,12 @@ declare namespace algoliasearch { } } - interface Response { + interface Response { /** * Contains all the hits matching the query * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ - hits: any[]; + hits: T[]; /** * Current page * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response @@ -616,8 +622,8 @@ declare namespace algoliasearch { cursor?: string; } - interface MultiResponse { - results: Response[]; + interface MultiResponse { + results: Response[]; } } diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index acc7341a84..6b012d5677 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -346,7 +346,7 @@ declare module 'angular' { interface IMenuService { close(): void; hide(response?: any, options?: any): IPromise; - open(event?: MouseEvent): void; + open(event?: MouseEvent | JQueryEventObject): void; } interface IColorPalette { diff --git a/types/backbone-associations/index.d.ts b/types/backbone-associations/index.d.ts index d0681c6651..c93eb965e8 100644 --- a/types/backbone-associations/index.d.ts +++ b/types/backbone-associations/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Backbone-associations 0.6.4 -// Project: https://github.com/dhruvaray/backbone-associations/ +// Project: http://dhruvaray.github.io/backbone-associations // Definitions by: Craig Brett // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/backbone-relational/index.d.ts b/types/backbone-relational/index.d.ts index f19cfa8daa..e9cc5e71ff 100644 --- a/types/backbone-relational/index.d.ts +++ b/types/backbone-relational/index.d.ts @@ -7,180 +7,163 @@ /// -import { Events, EventsHash, Model as BModel, Collection } from 'backbone'; +import { EventsMixin, Events, Model as BModel, Collection } from 'backbone'; -declare module 'backbone-relational' { - class Model extends BModel { - /** - * Do not use, prefer TypeScript's extend functionality. - **/ - //private static extend(properties:any, classProperties?:any):any; +export class Model extends BModel { + /** + * Do not use, prefer TypeScript's extend functionality. + **/ + //private static extend(properties:any, classProperties?:any):any; - relations:any; - subModelTypes:any; - subModelTypeAttribute:any; + relations:any; + subModelTypes:any; + subModelTypeAttribute:any; - initializeRelations(options:any):void; + initializeRelations(options:any):void; - updateRelations(options:any):void; + updateRelations(options:any):void; - queue(func:any):void; + queue(func:any):void; - processQueue():void; + processQueue():void; - getRelation(name:string):Relation; + getRelation(name:string):Relation; - getRelations():Relation[]; + getRelations():Relation[]; - fetchRelated(key:string, options?:any, update?:boolean):any; + fetchRelated(key:string, options?:any, update?:boolean):any; - toJSON(options?: any):any; + toJSON(options?: any):any; - static setup(); + static setup(); - static build(attributes:any, options?:any); + static build(attributes:any, options?:any); - static findOrCreate(attributes:string, options?:any); + static findOrCreate(attributes:string, options?:any); - static findOrCreate(attributes:number, options?:any); + static findOrCreate(attributes:number, options?:any); - static findOrCreate(attributes:any, options?:any); - } + static findOrCreate(attributes:any, options?:any); +} - export class Relation extends BModel { +export class Relation extends BModel { - options:any; - instance:any; - key:any; - keyContents:any; - relatedModel:any; - relatedCollection:any; - reverseRelation:any; - related:any; + options:any; + instance:any; + key:any; + keyContents:any; + relatedModel:any; + relatedCollection:any; + reverseRelation:any; + related:any; - checkPreconditions():boolean; + checkPreconditions():boolean; - setRelated(related:BModel):void; + setRelated(related:BModel):void; - setRelated(related:Collection):void; + setRelated(related:Collection):void; - getReverseRelations(model:Model):Relation; + getReverseRelations(model:Model):Relation; - destroy():void; - } + destroy():void; +} - export class HasOne extends Relation { - collectionType:any; +export class HasOne extends Relation { + collectionType:any; - findRelated(options:any):BModel; + findRelated(options:any):BModel; - setKeyContents(keyContents:string):void; + setKeyContents(keyContents:string):void; - setKeyContents(keyContents:string[]):void; + setKeyContents(keyContents:string[]):void; - setKeyContents(keyContents:number):void; + setKeyContents(keyContents:number):void; - setKeyContents(keyContents:number[]):void; + setKeyContents(keyContents:number[]):void; - setKeyContents(keyContents:Collection):void; + setKeyContents(keyContents:Collection):void; - onChange(model:BModel, attr:any, options:any):void; + onChange(model:BModel, attr:any, options:any):void; - handleAddition(model:BModel, coll:Collection, options:any):void; + handleAddition(model:BModel, coll:Collection, options:any):void; - handleRemoval(model:BModel, coll:Collection, options:any):void; + handleRemoval(model:BModel, coll:Collection, options:any):void; - handleReset(coll:Collection, options:any):void; + handleReset(coll:Collection, options:any):void; - tryAddRelated(model:BModel, coll:any, options:any):void; + tryAddRelated(model:BModel, coll:any, options:any):void; - addRelated(model:BModel, options:any):void; + addRelated(model:BModel, options:any):void; - removeRelated(model:BModel, coll:any, options:any):void; - - } - - - export class HasMany extends Relation { - collectionType:any; - - findRelated(options:any):BModel; - - setKeyContents(keyContents:string):void; - - setKeyContents(keyContents:number):void; - - setKeyContents(keyContents:BModel):void; - - onChange(model:BModel, attr:any, options:any):void; - - tryAddRelated(model:BModel, coll:any, options:any):void; - - addRelated(model:BModel, options:any):void; - - removeRelated(model:BModel, coll:any, options:any):void; - - } - - export class Store implements Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; - on(eventName: any, callback?: any, context?: any): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; - - initializeRelation(model, relation, options); - - addModelScope(scope:any):void; - - removeModelScope(scope):void; - - addSubModels(subModelTypes:Model, superModelType:Model):void; - - setupSuperModel(modelType:Model):void; - - addReverseRelation(relation:any):void; - - addOrphanRelation(relation:any):void; - - processOrphanRelations():void; - - retroFitRelation(relation:Model, create:boolean):Collection; - - getCollection(type:Model, create:boolean):Collection; - - getObjectByName(name:string):any; - - - resolveIdForItem(type:any, item:any):any; - - static find(type:any, item:string):Model; - - static find(type:any, item:number):Model; - - static find(type:any, item:Model):Model; - - static find(type:any, item:any):Model; - - register(model:Model):void; - - checkId(model:Model, id:any):void; - - update(model:Model):void; - - unregister(model:Model, collection:Collection, options:any):void; - - reset():void; - - - } + removeRelated(model:BModel, coll:any, options:any):void; } + +export class HasMany extends Relation { + collectionType:any; + + findRelated(options:any):BModel; + + setKeyContents(keyContents:string):void; + + setKeyContents(keyContents:number):void; + + setKeyContents(keyContents:BModel):void; + + onChange(model:BModel, attr:any, options:any):void; + + tryAddRelated(model:BModel, coll:any, options:any):void; + + addRelated(model:BModel, options:any):void; + + removeRelated(model:BModel, coll:any, options:any):void; + +} + +export class Store extends EventsMixin implements Events { + initializeRelation(model, relation, options); + + addModelScope(scope:any):void; + + removeModelScope(scope):void; + + addSubModels(subModelTypes:Model, superModelType:Model):void; + + setupSuperModel(modelType:Model):void; + + addReverseRelation(relation:any):void; + + addOrphanRelation(relation:any):void; + + processOrphanRelations():void; + + retroFitRelation(relation:Model, create:boolean):Collection; + + getCollection(type:Model, create:boolean):Collection; + + getObjectByName(name:string):any; + + + resolveIdForItem(type:any, item:any):any; + + static find(type:any, item:string):Model; + + static find(type:any, item:number):Model; + + static find(type:any, item:Model):Model; + + static find(type:any, item:any):Model; + + register(model:Model):void; + + checkId(model:Model, id:any):void; + + update(model:Model):void; + + unregister(model:Model, collection:Collection, options:any):void; + + reset():void; + +} diff --git a/types/backbone-relational/tslint.json b/types/backbone-relational/tslint.json index a41bf5d19a..65e27fce52 100644 --- a/types/backbone-relational/tslint.json +++ b/types/backbone-relational/tslint.json @@ -1,79 +1,24 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, "comment-format": false, "dt-header": false, "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, "jsdoc-format": false, "max-line-length": false, "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, "object-literal-key-quotes": false, - "object-literal-shorthand": false, "one-line": false, - "one-variable-per-declaration": false, "only-arrow-functions": false, - "prefer-conditional-expression": false, "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, "prefer-template": false, - "radix": false, - "semicolon": false, "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, "typedef-whitespace": false, "unified-signatures": false, - "void-return": false, "whitespace": false } } diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 1025940214..f24d80ff4d 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -6,6 +6,7 @@ // Volker Nauruhn , // Ard Timmerman , // J. Joe Koullas +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -407,20 +408,14 @@ export interface ObjectOptions extends RadioMixinOptions { * A base class which other classes can extend from. Object incorporates many * backbone conventions and utilities like initialize and Backbone.Events. */ -export class Object implements CommonMixin, RadioMixin, Backbone.Events { +export class Object extends Backbone.EventsMixin implements CommonMixin, RadioMixin, Backbone.Events { constructor(options?: ObjectOptions); - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; + /** + * Faulty overgeneralization of Backbone.Events.on, for historical + * reasons. + */ on(eventName: any, callback?: any, context?: any): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; /** * Receives a hash of event names and functions and/or function names, diff --git a/types/backbone.radio/index.d.ts b/types/backbone.radio/index.d.ts index ac953aa00b..e6682bd52e 100644 --- a/types/backbone.radio/index.d.ts +++ b/types/backbone.radio/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Backbone.Radio v0.8.3 // Project: https://github.com/marionettejs/backbone.radio // Definitions by: Peter Palotas +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -71,18 +72,12 @@ declare module "backbone" { stopReplying(commandName?: string, callback?: (...args: any[]) => any, context?: any): Requests; } - class Channel implements Commands, Requests, Backbone.Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; + class Channel extends Backbone.EventsMixin implements Commands, Requests, Backbone.Events { + /** + * Faulty overgeneralization of Backbone.Events.on, for historical + * reasons. + */ on(eventName: any, callback?: any, context?: any): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; channelName: string; reset(): Channel; diff --git a/types/backbone/backbone-tests.ts b/types/backbone/backbone-tests.ts index 563c21634c..c36b92ff3f 100644 --- a/types/backbone/backbone-tests.ts +++ b/types/backbone/backbone-tests.ts @@ -15,6 +15,50 @@ function test_events() { object.off(); } +class PubSub implements Backbone.Events { + on: Backbone.Events_On; + off: Backbone.Events_Off; + trigger: Backbone.Events_Trigger; + bind: Backbone.Events_On; + unbind: Backbone.Events_Off; + + once: Backbone.Events_On; + listenTo: Backbone.Events_Listen; + listenToOnce: Backbone.Events_Listen; + stopListening: Backbone.Events_Stop; +} + +Object.assign(PubSub.prototype, Backbone.Events); + +function test_events_shorthands() { + let channel1 = new PubSub(); + let channel2 = new PubSub(); + let onChange = () => alert('whatever'); + + channel1.on("alert", (eventName: string) => alert("Triggered " + eventName)); + channel1.trigger("alert", "an event"); + + channel1.once('invalid', () => { }, this); + channel1.once('invalid', () => { }); + channel1.once({invalid: () => { }, success: () => { }}, this); + channel1.once({invalid: () => { }, success: () => { }}); + + channel1.off("change", onChange); + channel1.off("change"); + channel1.off(null, onChange); + channel1.off(null, null, this); + channel1.off(); + + channel2.listenTo(channel1, 'invalid', () => { }); + channel2.listenTo(channel1, {invalid: () => { }, success: () => { }}); + channel2.listenToOnce(channel1, 'invalid', () => { }); + channel2.listenToOnce(channel1, {invalid: () => { }, success: () => { }}); + + channel2.stopListening(channel1, 'invalid', () => { }); + channel2.stopListening(channel1, 'invalid'); + channel2.stopListening(channel1); +} + class SettingDefaults extends Backbone.Model { // 'defaults' could be set in one of the following ways: @@ -272,18 +316,22 @@ namespace v1Changes { var model = new Employee; model.once('invalid', () => { }, this); model.once('invalid', () => { }); + model.once({invalid: () => { }, success: () => { }}, this); + model.once({invalid: () => { }, success: () => { }}); } function test_listenTo() { var model = new Employee; var view = new Backbone.View(); view.listenTo(model, 'invalid', () => { }); + view.listenTo(model, {invalid: () => { }, success: () => { }}); } function test_listenToOnce() { var model = new Employee; var view = new Backbone.View(); view.listenToOnce(model, 'invalid', () => { }); + view.listenToOnce(model, {invalid: () => { }, success: () => { }}); } function test_stopListening() { @@ -398,7 +446,7 @@ namespace v1Changes { namespace Collection { function test_fetch() { var collection = new EmployeeCollection; - collection.fetch({ + collection.fetch({ reset: true, remove: false }); diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index a881284c8f..58e3735f2b 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -1,9 +1,11 @@ // Type definitions for Backbone 1.3.3 // Project: http://backbonejs.org/ +// https://github.com/jashkenas/backbone // Definitions by: Boris Yankov // Natan Vivo // kenjiru // jjoekoullas +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -91,44 +93,113 @@ declare namespace Backbone { [routePattern: string]: string | {(...urlParts: string[]): void}; } + /** + * DOM events (used in the events property of a View) + */ interface EventsHash { [selector: string]: string | {(eventObject: JQuery.TriggeredEvent): void}; } - export const Events: Events; - interface Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; + /** + * JavaScript events (used in the methods of the Events interface) + */ + interface EventHandler { + (...args: any[]): void; + } + interface EventMap { + [event: string]: EventHandler; } - class ModelBase implements Events { - on(eventName: string, callback?: Function, context?: any): any; - on(eventMap: EventsHash): any; - on(eventName: any, callback?: any, context?: any): any - off(eventName?: string, callback?: Function, context?: any): any - trigger(eventName: string, ...args: any[]): any - bind(eventName: string, callback: Function, context?: any): any - unbind(eventName?: string, callback?: Function, context?: any): any - once(events: string, callback: Function, context?: any): any - listenTo(object: any, events: string, callback: Function):any - listenToOnce(object: any, events: string, callback: Function): any - stopListening(object?: any, events?: string, callback?: Function): any + export const Events: Events; + interface Events extends EventsMixin { } + /** + * Helper shorthands for classes that implement the Events interface. + * Define your class like this: + * + * import { + * Events, + * Events_On, + * Events_Off, + * Events_Trigger, + * Events_Listen, + * Events_Stop, + * } from 'backbone'; + * + * class YourClass implements Events { + * on: Events_On; + * off: Events_Off; + * trigger: Events_Trigger; + * bind: Events_On; + * unbind: Events_Off; + * + * once: Events_On; + * listenTo: Events_Listen; + * listenToOnce: Events_Listen; + * stopListening: Events_Stop; + * + * // ... (other methods) + * } + * + * Object.assign(YourClass.prototype, Events); // can also use _.extend + * + * If you are just writing a class type declaration that doesn't already + * extend some other base class, you can use the EventsMixin instead; + * see below. + */ + interface Events_On { + (this: T, eventName: string, callback: EventHandler, context?: any): T; + (this: T, eventMap: EventMap, context?: any): T; + } + interface Events_Off { + (this: T, eventName?: string, callback?: EventHandler, context?: any): T; + } + interface Events_Trigger { + (this: T, eventName: string, ...args: any[]): T; + } + interface Events_Listen { + (this: T, object: any, events: string, callback: EventHandler): T; + (this: T, object: any, eventMap: EventMap): T; + } + interface Events_Stop { + (this: T, object?: any, events?: string, callback?: EventHandler): T; + } + + /** + * Helper to avoid code repetition in type declarations. + * Backbone.Events cannot be extended, hence a separate abstract + * class with a different name. Both classes and interfaces can + * extend from this helper class to reuse the signatures. + * + * For class type declarations that already extend another base + * class, and for actual class definitions, please see the + * Events_* interfaces above. + */ + abstract class EventsMixin implements Events { + on(eventName: string, callback: EventHandler, context?: any): this; + on(eventMap: EventMap, context?: any): this; + off(eventName?: string, callback?: EventHandler, context?: any): this; + trigger(eventName: string, ...args: any[]): this; + bind(eventName: string, callback: EventHandler, context?: any): this; + bind(eventMap: EventMap, context?: any): this; + unbind(eventName?: string, callback?: EventHandler, context?: any): this; + + once(events: string, callback: EventHandler, context?: any): this; + once(eventMap: EventMap, context?: any): this; + listenTo(object: any, events: string, callback: EventHandler): this; + listenTo(object: any, eventMap: EventMap): this; + listenToOnce(object: any, events: string, callback: EventHandler): this; + listenToOnce(object: any, eventMap: EventMap): this; + stopListening(object?: any, events?: string, callback?: EventHandler): this; + } + + class ModelBase extends EventsMixin { parse(response: any, options?: any): any; toJSON(options?: any): any; sync(...arg: any[]): JQueryXHR; } - class Model extends ModelBase { + class Model extends ModelBase implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -229,7 +300,7 @@ declare namespace Backbone { matches(attrs: any): boolean; } - class Collection extends ModelBase { + class Collection extends ModelBase implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -367,7 +438,7 @@ declare namespace Backbone { without(...values: TModel[]): TModel[]; } - class Router extends EventSignatures { + class Router extends EventsMixin implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -396,7 +467,7 @@ declare namespace Backbone { var history: History; - class History extends EventSignatures { + class History extends EventsMixin implements Events { handlers: any[]; interval: number; @@ -433,7 +504,7 @@ declare namespace Backbone { attributes?: {[id: string]: any}; } - class View extends EventSignatures { + class View extends EventsMixin implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -485,21 +556,3 @@ declare namespace Backbone { function noConflict(): typeof Backbone; var $: JQueryStatic; } - -/** - * This is not for external use and is only here as a convenient way to - * specify signatures for internal implementers of Backbone.Events - */ -declare abstract class EventSignatures implements Backbone.Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: Backbone.EventsHash): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; -} \ No newline at end of file diff --git a/types/backbone/tslint.json b/types/backbone/tslint.json index d67ffb3a73..f5ae3a6788 100644 --- a/types/backbone/tslint.json +++ b/types/backbone/tslint.json @@ -8,73 +8,35 @@ "callable-types": false, "comment-format": false, "dt-header": false, - "eofline": false, "export-just-namespace": false, - "import-spacing": false, "interface-name": false, - "interface-over-type-literal": false, "jsdoc-format": false, "max-line-length": false, "member-access": false, "new-parens": false, "no-angle-bracket-type-assertion": false, "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, "no-namespace": false, "no-object-literal-type-assertion": false, "no-padding": false, "no-redundant-jsdoc": false, "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, "no-var-keyword": false, - "no-var-requires": false, "no-void-expression": false, - "no-trailing-whitespace": false, "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, "only-arrow-functions": false, - "prefer-conditional-expression": false, "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, "prefer-method-signature": false, "prefer-template": false, - "radix": false, "semicolon": false, "space-before-function-paren": false, - "space-within-parens": false, "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, "typedef-whitespace": false, "unified-signatures": false, - "void-return": false, "whitespace": false } } diff --git a/types/bull/bull-tests.tsx b/types/bull/bull-tests.tsx index 46c146272e..13ae21f5a4 100644 --- a/types/bull/bull-tests.tsx +++ b/types/bull/bull-tests.tsx @@ -143,6 +143,8 @@ pdfQueue .on('drained', () => undefined) .on('removed', (job: Queue.Job) => undefined); +pdfQueue.setMaxListeners(42); + // test different process methods const profileQueue = new Queue('profile'); diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index aab2385ea4..cd2d1a9047 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -17,6 +17,7 @@ // TypeScript Version: 2.8 import * as Redis from "ioredis"; +import { EventEmitter } from "events"; /** * This is the Queue constructor. @@ -384,7 +385,7 @@ declare namespace Bull { next: number; } - interface Queue { + interface Queue extends EventEmitter { /** * The name of the queue */ diff --git a/types/cassandra-driver/index.d.ts b/types/cassandra-driver/index.d.ts index 18527ed8c5..86073ec888 100644 --- a/types/cassandra-driver/index.d.ts +++ b/types/cassandra-driver/index.d.ts @@ -116,7 +116,7 @@ export namespace policies { onUnavailable(requestInfo: RequestInfo, consistency: types.consistencies, required: number, alive: number): DecisionInfo; onWriteTimeout(requestInfo: RequestInfo, consistency: types.consistencies, received: number, blockFor: number, writeType: string): DecisionInfo; rethrowResult(): { decision: retryDecision }; - retryResult(): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean }; + retryResult(consistency?: types.consistencies, useCurrentHost?: boolean): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean }; } } diff --git a/types/catbox/catbox-tests.ts b/types/catbox/catbox-tests.ts index e86d2a94af..af85cde068 100644 --- a/types/catbox/catbox-tests.ts +++ b/types/catbox/catbox-tests.ts @@ -18,6 +18,9 @@ const Memory: EnginePrototypeOrObject = { const client = new Client(Memory, { partition: 'cache' }); +client.start().then(() => {}); +client.stop().then(() => {}); + const cache = new Policy({ expiresIn: 5000, }, client, 'cache'); diff --git a/types/catbox/index.d.ts b/types/catbox/index.d.ts index bd41889e07..e90768be20 100644 --- a/types/catbox/index.d.ts +++ b/types/catbox/index.d.ts @@ -23,7 +23,7 @@ export class Client implements ClientApi { /** start() - creates a connection to the cache server. Must be called before any other method is available. */ start(): Promise; /** stop() - terminates the connection to the cache server. */ - stop(): void; + stop(): Promise; /** * get(key, callback) - retrieve an item from the cache engine if found where: * * key - a cache key object (see [ICacheKey]). diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 058bfd78ea..211b6a59d8 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -5246,7 +5246,7 @@ declare namespace chrome.runtime { export interface PortMessageEvent extends chrome.events.Event<(message: any, port: Port) => void> { } - export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response: any) => void) => void> { } + export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void> { } export interface ExtensionConnectEvent extends chrome.events.Event<(port: Port) => void> { } diff --git a/types/co/co-tests.ts b/types/co/co-tests.ts new file mode 100644 index 0000000000..159a2e90fb --- /dev/null +++ b/types/co/co-tests.ts @@ -0,0 +1,30 @@ +import co = require('co'); + +function* gen(num: number, str: string, arr: number[], obj: object, fun: () => void) { + return num; +} + +co(gen, 42, 'forty-two', [42], { value: 42 }, () => {}) + .then((num: number) => {}, (err: Error) => {}) + .catch((err: Error) => {}); + +co.default(gen, 42, 'forty-two', [42], { value: 42 }, () => {}) + .then((num: number) => {}, (err: Error) => {}) + .catch((err: Error) => {}); + +co.co(gen, 42, 'forty-two', [42], { value: 42 }, () => {}) + .then((num: number) => {}, (err: Error) => {}) + .catch((err: Error) => {}); + +co.wrap(gen)(42, 'forty-two', [42], { value: 42 }, () => {}) + .then((num: number) => {}, (err: Error) => {}) + .catch((err: Error) => {}); + +// $ExpectError +co(gen, 42, 'forty-two', [42], { value: 42 }, () => {}).then((str: string) => {}); + +// $ExpectError +co.wrap(gen)(); + +// $ExpectError +co.wrap(gen)('forty-two'); diff --git a/types/co/index.d.ts b/types/co/index.d.ts new file mode 100644 index 0000000000..958c222a14 --- /dev/null +++ b/types/co/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for co 4.6 +// Project: https://github.com/tj/co#readme +// Definitions by: Doniyor Aliyev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.1 + +type ExtractType = T extends IterableIterator ? R : never; + +interface Co { + Generator>(fn: F, ...args: Parameters): Promise>>; + default: Co; + co: Co; + wrap: Generator>(fn: F) => (...args: Parameters) => Promise>>; +} + +declare const co: Co; + +export = co; diff --git a/types/i18next-browser-languagedetector/v0/tsconfig.json b/types/co/tsconfig.json similarity index 62% rename from types/i18next-browser-languagedetector/v0/tsconfig.json rename to types/co/tsconfig.json index 9873c74134..bc5a88eb32 100644 --- a/types/i18next-browser-languagedetector/v0/tsconfig.json +++ b/types/co/tsconfig.json @@ -8,21 +8,16 @@ "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, - "baseUrl": "../../", + "baseUrl": "../", "typeRoots": [ - "../../" + "../" ], - "paths": { - "i18next-browser-languagedetector": [ - "i18next-browser-languagedetector/v0" - ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "i18next-browser-languagedetector-tests.ts" + "co-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/i18next-browser-languagedetector/tslint.json b/types/co/tslint.json similarity index 100% rename from types/i18next-browser-languagedetector/tslint.json rename to types/co/tslint.json diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index df6870c70a..b4ca7de92f 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Cytoscape.js 3.2 +// Type definitions for Cytoscape.js 3.3 // Project: http://js.cytoscape.org/ // Definitions by: Fabian Schmidt and Fred Eisele // Shenghan Gao @@ -464,6 +464,27 @@ declare namespace cytoscape { */ endBatch(): void; + /** + * Attaches the instance to the specified container for visualisation. + * http://js.cytoscape.org/#cy.mount + * + * If the core instance is headless prior to calling cy.mount(), then + * the instance will no longer be headless and the visualisation will + * be shown in the specified container. If the core instance is + * non-headless prior to calling cy.mount(), then the visualisation + * is swapped from the prior container to the specified container. + */ + mount(element: Element): void; + + /** + * Remove the instance from its current container. + * http://js.cytoscape.org/#cy.unmount + * + * This function sets the instance to be headless after unmounting from + * the current container. + */ + unmount(): void; + /** * A convenience function to explicitly destroy the Core. * http://js.cytoscape.org/#cy.destroy diff --git a/types/debug/index.d.ts b/types/debug/index.d.ts index 954ca3a35a..715e7c145e 100644 --- a/types/debug/index.d.ts +++ b/types/debug/index.d.ts @@ -38,7 +38,7 @@ declare namespace debug { (formatter: any, ...args: any[]): void; enabled: boolean; - log: (v: any) => string; + log: (...args: any[]) => any; namespace: string; extend: (namespace: string, delimiter?: string) => Debugger; } diff --git a/types/elliptic/index.d.ts b/types/elliptic/index.d.ts index 722568a6f6..7b1e885d6f 100644 --- a/types/elliptic/index.d.ts +++ b/types/elliptic/index.d.ts @@ -187,7 +187,7 @@ export class ec { export namespace ec { interface GenKeyPairOptions { - pers: any; + pers?: any; entropy: any; persEnc?: string; entropyEnc?: string; diff --git a/types/express-urlrewrite/express-urlrewrite-tests.ts b/types/express-urlrewrite/express-urlrewrite-tests.ts new file mode 100644 index 0000000000..e1c4c780be --- /dev/null +++ b/types/express-urlrewrite/express-urlrewrite-tests.ts @@ -0,0 +1,22 @@ +import * as express from "express"; + +import rewrite = require("express-urlrewrite"); + +declare const app: express.Application; + +app.use(rewrite(/^\/i(\w+)/, "/items/$1")); + +app.use(rewrite("/:src..:dst", "/commits/$1/to/$2")); +app.use(rewrite("/:src..:dst", "/commits/:src/to/:dst")); + +app.use(rewrite("/js/*", "/public/assets/js/$1")); + +app.use(rewrite("/file\\?param=:param", "/file/:param")); + +app.use(rewrite("/path", "/anotherpath?param=some")); + +app.get("/route/:var", rewrite("/rewritten/:var")); + +declare const someMw: express.Handler; + +app.get("/rewritten/:var", someMw); diff --git a/types/express-urlrewrite/index.d.ts b/types/express-urlrewrite/index.d.ts new file mode 100644 index 0000000000..12e74c6ed5 --- /dev/null +++ b/types/express-urlrewrite/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for express-urlrewrite 1.2 +// Project: https://github.com/kapouer/express-urlrewrite +// Definitions by: Melvin Groenhoff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import * as express from "express"; + +declare function rewrite(s: string): express.Handler; +declare function rewrite(s: string | RegExp, t: string): express.Handler; + +export = rewrite; diff --git a/types/express-urlrewrite/tsconfig.json b/types/express-urlrewrite/tsconfig.json new file mode 100644 index 0000000000..0e5659e0eb --- /dev/null +++ b/types/express-urlrewrite/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "express-urlrewrite-tests.ts" + ] +} diff --git a/types/p-throttle/tslint.json b/types/express-urlrewrite/tslint.json similarity index 100% rename from types/p-throttle/tslint.json rename to types/express-urlrewrite/tslint.json diff --git a/types/favicons/index.d.ts b/types/favicons/index.d.ts index 782ad0cb7c..730841dff9 100644 --- a/types/favicons/index.d.ts +++ b/types/favicons/index.d.ts @@ -9,7 +9,7 @@ import { Duplex } from "stream"; declare namespace favicons { - interface Configuration { + interface Configuration { /** Path for overriding default icons path @default "/" */ path: string; /** Your application's name @default null */ @@ -38,6 +38,8 @@ declare namespace favicons { version: string; /** Print logs to console? @default false */ logging: boolean; + /** Use nearest neighbor resampling to preserve hard edges on pixel art @default false */ + pixel_art: boolean; /** * Platform Options: * - offset - offset in percentage @@ -66,18 +68,18 @@ declare namespace favicons { }>; } - interface FavIconResponse { + interface FavIconResponse { images: Array<{ name: string; contents: Buffer }>; files: Array<{ name: string; contents: Buffer }>; html: string[]; } - type Callback = (error: Error | null, response: FavIconResponse) => void; + type Callback = (error: Error | null, response: FavIconResponse) => void; /** You can programmatically access Favicons configuration (icon filenames, HTML, manifest files, etc) with this export */ - const config: Configuration; + const config: Configuration; - function stream(configuration?: Configuration): Duplex; + function stream(configuration?: Configuration): Duplex; } /** * Generate favicons diff --git a/types/firefox-webext-browser/index.d.ts b/types/firefox-webext-browser/index.d.ts index 1dfe1eb809..c0a8896e56 100644 --- a/types/firefox-webext-browser/index.d.ts +++ b/types/firefox-webext-browser/index.d.ts @@ -3188,7 +3188,7 @@ declare namespace browser.storage { * @param changes Object mapping each key that changed to its corresponding `storage.StorageChange` for that item. * @param areaName The name of the storage area (`"sync"`, `"local"` or `"managed"`) the changes are for. */ - const onChanged: WebExtEvent<(changes: StorageChange, areaName: string) => void>; + const onChanged: WebExtEvent<(changes: {[key: string]: StorageChange}, areaName: string) => void>; } /** diff --git a/types/giraffe/index.d.ts b/types/giraffe/index.d.ts index abce777c20..2f0223321c 100644 --- a/types/giraffe/index.d.ts +++ b/types/giraffe/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Giraffe // Project: https://github.com/barc/backbone.giraffe // Definitions by: Matt McCray +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -145,18 +146,12 @@ declare namespace Giraffe { namespace Contrib { - class Controller implements GiraffeObject, Backbone.Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any); - on(eventMap: Backbone.EventsHash); + class Controller extends Backbone.EventsMixin implements GiraffeObject, Backbone.Events { + /** + * Faulty overgeneralization of Backbone.Events.on, for historical + * reasons. + */ on(eventName: any, callback?: any, context?: any) - off(eventName?: string, callback?: (...args: any[]) => void, context?: any) - trigger(eventName: string, ...args: any[]) - bind(eventName: string, callback: (...args: any[]) => void, context?: any) - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any) - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; app: App; } diff --git a/types/i18next-browser-languagedetector/i18next-browser-languagedetector-tests.ts b/types/i18next-browser-languagedetector/i18next-browser-languagedetector-tests.ts deleted file mode 100644 index eadfcea369..0000000000 --- a/types/i18next-browser-languagedetector/i18next-browser-languagedetector-tests.ts +++ /dev/null @@ -1,61 +0,0 @@ -import * as i18next from "i18next"; -import * as LngDetector from "i18next-browser-languagedetector"; - -const options: LngDetector.DetectorOptions = { - // order and from where user language should be detected - order: ["querystring", "cookie", "localStorage", "navigator", "htmlTag"], - - // keys or params to lookup language from - lookupQuerystring: "lng", - lookupCookie: "i18next", - lookupLocalStorage: "i18nextLng", - - // cache user language on - caches: ["localStorage", "cookie"], - excludeCacheFor: ["cimode"], // languages to not persist (cookie, localStorage) - - // optional expire and domain for set cookie - cookieMinutes: 10, - cookieDomain: "myDomain", - - // optional htmlTag with lang attribute, the default is: - htmlTag: document.documentElement -}; - -i18next.use(LngDetector).init({ - detection: options -}); - -const customDetector: LngDetector.CustomDetector = { - name: "myDetectorsName", - - lookup(options: LngDetector.DetectorOptions) { - // options -> are passed in options - return "en"; - }, - - cacheUserLanguage(lng: string, options: LngDetector.DetectorOptions) { - // options -> are passed in options - // lng -> current language, will be called after init and on changeLanguage - - // store it - } -}; - -const customDetector2: LngDetector.CustomDetector = { - name: "myDetectorsName", - lookup(options: LngDetector.DetectorOptions) { - return undefined; - } -}; - -const lngDetector = new LngDetector(null, options); - -lngDetector.init(options); -lngDetector.addDetector(customDetector); - -i18next - .use(lngDetector) - .init({ - detection: options - }); diff --git a/types/i18next-browser-languagedetector/index.d.ts b/types/i18next-browser-languagedetector/index.d.ts deleted file mode 100644 index 88dbe79d8d..0000000000 --- a/types/i18next-browser-languagedetector/index.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Type definitions for i18next-browser-languagedetector 2.0 -// Project: http://i18next.com/, https://github.com/i18next/i18next-browser-languagedetector -// Definitions by: Cyril Schumacher , Giedrius Grabauskas -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -declare namespace i18nextBrowserLanguageDetector { - interface DetectorOptions { - /** - * order and from where user language should be detected - */ - order?: Array<"querystring" | "cookie" | "localStorage" | "navigator" | "htmlTag" | string>; - - /** - * keys or params to lookup language from - */ - lookupQuerystring?: string; - lookupCookie?: string; - lookupLocalStorage?: string; - - /** - * cache user language on - */ - caches?: string[]; - - /** - * languages to not persist (cookie, localStorage) - */ - excludeCacheFor?: string[]; - - /** - * optional expire and domain for set cookie - * @default 10 - */ - cookieMinutes?: number; - cookieDomain?: string; - - /** - * optional htmlTag with lang attribute - * @default document.documentElement - */ - htmlTag?: HTMLElement; - } - - interface CustomDetector { - name: string; - cacheUserLanguage?(lng: string, options: DetectorOptions): void; - lookup(options: DetectorOptions): string | undefined; - } -} - -declare class i18nextBrowserLanguageDetector { - constructor(services?: any, options?: i18nextBrowserLanguageDetector.DetectorOptions); - /** - * Adds detector. - */ - addDetector(detector: i18nextBrowserLanguageDetector.CustomDetector): i18nextBrowserLanguageDetector; - - /** - * Initializes detector. - */ - init(options?: i18nextBrowserLanguageDetector.DetectorOptions): void; -} - -export = i18nextBrowserLanguageDetector; diff --git a/types/i18next-browser-languagedetector/v0/i18next-browser-languagedetector-tests.ts b/types/i18next-browser-languagedetector/v0/i18next-browser-languagedetector-tests.ts deleted file mode 100644 index 0217ca74ce..0000000000 --- a/types/i18next-browser-languagedetector/v0/i18next-browser-languagedetector-tests.ts +++ /dev/null @@ -1,42 +0,0 @@ -import * as i18next from 'i18next'; -import LngDetector from 'i18next-browser-languagedetector'; - -const options = { - // order and from where user language should be detected - order: ['querystring', 'cookie', 'localStorage', 'navigator'], - - // keys or params to lookup language from - lookupQuerystring: 'lng', - lookupCookie: 'i18next', - lookupLocalStorage: 'i18nextLng', - - // cache user language on - caches: ['localStorage', 'cookie'], - - // optional expire and domain for set cookie - cookieMinutes: 10, - cookieDomain: 'myDomain' -}; -const myDetector = { - name: 'myDetectorsName', - - lookup(options: {}) { - // options -> are passed in options - return 'en'; - }, - - cacheUserLanguage(lng: string, options: {}) { - // options -> are passed in options - // lng -> current language, will be called after init and on changeLanguage - - // store it - } -}; - -i18next.use(LngDetector).init({ - detection: options -}); - -const lngDetector = new LngDetector(null, options); -lngDetector.init(options); -lngDetector.addDetector(myDetector); diff --git a/types/i18next-browser-languagedetector/v0/index.d.ts b/types/i18next-browser-languagedetector/v0/index.d.ts deleted file mode 100644 index 8b0f6b6317..0000000000 --- a/types/i18next-browser-languagedetector/v0/index.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -// Type definitions for i18next-browser-languagedetector 0.0 -// Project: http://i18next.com/ -// Definitions by: Cyril Schumacher , Giedrius Grabauskas -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import * as i18next from "i18next"; - -declare namespace I18next { - interface I18nextStatic extends i18nextBrowserLanguageDetector.I18nextStatic { } - interface I18nextOptions extends i18nextBrowserLanguageDetector.I18nextOptions { } -} - -declare namespace i18nextBrowserLanguageDetector { - /** Interface for Language detector options. */ - interface LanguageDetectorOptions { - caches?: string[] | boolean; - cookieDomain?: string; - cookieExpirationDate?: Date; - lookupCookie?: string; - lookupFromPathIndex?: number; - lookupQuerystring?: string; - lookupSession?: string; - order?: string[]; - } - - /** Interface for custom detector. */ - interface CustomDetector { - name: string; - - // todo: Checks parameters type. - cacheUserLanguage(lng: string, options: {}): void; - lookup(options: {}): string; - } - - /** i18next options. */ - interface I18nextOptions { - detection?: LanguageDetectorOptions; - } - - /** i18next interface. */ - interface I18nextStatic { - use(module: LngDetector): I18nextStatic; - } - - /** i18next language detection. */ - class LngDetector { - constructor(services?: any, options?: LanguageDetectorOptions); - - /** Adds detector. */ - addDetector(detector: CustomDetector): LngDetector; - - /** Initializes detector. */ - init(options?: LanguageDetectorOptions): void; - } -} - -export default i18nextBrowserLanguageDetector.LngDetector; diff --git a/types/i18next-browser-languagedetector/v0/tslint.json b/types/i18next-browser-languagedetector/v0/tslint.json deleted file mode 100644 index af6baaddc0..0000000000 --- a/types/i18next-browser-languagedetector/v0/tslint.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "interface-name": [ - false - ], - "no-empty-interface": [ - false - ] - } -} diff --git a/types/ink-spinner/index.d.ts b/types/ink-spinner/index.d.ts new file mode 100644 index 0000000000..db68c31c04 --- /dev/null +++ b/types/ink-spinner/index.d.ts @@ -0,0 +1,39 @@ +// Type definitions for ink-spinner 2.0 +// Project: https://github.com/vadimdemedes/ink-spinner#readme +// Definitions by: Łukasz Ostrowski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { Chalk } from 'chalk'; +import * as cliSpinners from 'cli-spinners'; +import { Component } from 'ink'; + +type StringifyPartial = { + [P in keyof T]?: string; +}; + +type BooleansPartial = { + [P in keyof T]?: boolean; +}; + +type TupleOfNumbersPartial = { + [P in keyof T]?: [number, number, number]; +}; +// Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html +type Omit = Pick>; + +type ChalkColorModels = Pick; +type ChalkKeywordsAndHexes = Pick; +type ChalkCommons = Omit; + +interface SpinnerProps { + type?: cliSpinners.SpinnerName; +} + +type ChalkProps = BooleansPartial + & StringifyPartial + & TupleOfNumbersPartial; + +declare class Spinner extends Component { } + +export = Spinner; diff --git a/types/ink-spinner/ink-spinner-tests.tsx b/types/ink-spinner/ink-spinner-tests.tsx new file mode 100644 index 0000000000..3d91bdf1bb --- /dev/null +++ b/types/ink-spinner/ink-spinner-tests.tsx @@ -0,0 +1,10 @@ +/** @jsx h */ +import { h } from 'ink'; +import Spinner from 'ink-spinner'; +// NOTE: `import Spinner = require('ink-spinner');` will work as well. +// If importing using ES6 default import as above, +// `allowSyntheticDefaultImports` flag in compiler options needs to be set to `true` + +const Demo = () => { + return ; +}; diff --git a/types/ink-spinner/tsconfig.json b/types/ink-spinner/tsconfig.json new file mode 100644 index 0000000000..3b72485a18 --- /dev/null +++ b/types/ink-spinner/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "jsx": "react", + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ink-spinner-tests.tsx" + ] +} diff --git a/types/ink-spinner/tslint.json b/types/ink-spinner/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ink-spinner/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/ink-text-input/index.d.ts b/types/ink-text-input/index.d.ts new file mode 100644 index 0000000000..9aaadd330e --- /dev/null +++ b/types/ink-text-input/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for ink-text-input 2.0 +// Project: https://github.com/vadimdemedes/ink-text-input#readme +// Definitions by: Łukasz Ostrowski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { Component } from 'ink'; + +interface TextInputProps { + focus?: boolean; + onChange?: (value: string) => void; + onSubmit?: (value: string) => void; + placeholder?: string; + value?: string; +} + +declare class TextInput extends Component { } + +export = TextInput; diff --git a/types/ink-text-input/ink-text-input-tests.tsx b/types/ink-text-input/ink-text-input-tests.tsx new file mode 100644 index 0000000000..82b63854a2 --- /dev/null +++ b/types/ink-text-input/ink-text-input-tests.tsx @@ -0,0 +1,47 @@ +/** @jsx h */ +import { h, Component } from 'ink'; +import TextInput from 'ink-text-input'; +// NOTE: `import TextInput = require('ink-text-input');` will work as well +// For importing using ES6 default import as above, +// `allowSyntheticDefaultImports` flag in compiler options needs to be set to `true` + +interface QueryState { + query: string; +} + +class SearchQuery extends Component { + constructor() { + super(); + + this.state = { + query: '' + }; + + this.handleChange = this.handleChange.bind(this); + this.handleSubmit = this.handleSubmit.bind(this); + } + + render(props: {}, state: QueryState) { + return ( +
+ Enter your query: + + +
+ ); + } + + private handleChange(value: string) { + this.setState({ + query: value, + }); + } + + private handleSubmit(value: string) { + console.log(value); + } +} diff --git a/types/ink-text-input/tsconfig.json b/types/ink-text-input/tsconfig.json new file mode 100644 index 0000000000..2582b4325e --- /dev/null +++ b/types/ink-text-input/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "jsx": "react", + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ink-text-input-tests.tsx" + ] +} diff --git a/types/ink-text-input/tslint.json b/types/ink-text-input/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ink-text-input/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/iobroker/index.d.ts b/types/iobroker/index.d.ts index 71fa1b4d78..c3f9cee9d3 100644 --- a/types/iobroker/index.d.ts +++ b/types/iobroker/index.d.ts @@ -900,7 +900,7 @@ declare global { q?: boolean; addID?: boolean; limit?: number; - ignoreNull: boolean; + ignoreNull?: boolean; sessionId?: any; aggregate?: "minmax" | "min" | "max" | "average" | "total" | "count" | "none"; } @@ -1627,11 +1627,11 @@ declare global { removeAllListeners(event?: "ready" | "unload" | "stateChange" | "objectChange" | "message"): this; } // end interface Adapter - type ReadyHandler = () => void; - type ObjectChangeHandler = (id: string, obj: ioBroker.Object | null | undefined) => void; - type StateChangeHandler = (id: string, obj: State | null | undefined) => void; - type MessageHandler = (obj: Message) => void; - type UnloadHandler = (callback: EmptyCallback) => void; + type ReadyHandler = () => void | Promise; + type ObjectChangeHandler = (id: string, obj: ioBroker.Object | null | undefined) => void | Promise; + type StateChangeHandler = (id: string, obj: State | null | undefined) => void | Promise; + type MessageHandler = (obj: Message) => void | Promise; + type UnloadHandler = (callback: EmptyCallback) => void | Promise; type EmptyCallback = () => void; type ErrorCallback = (err?: string) => void; @@ -1682,7 +1682,8 @@ declare global { type SetStateCallback = (err: string | null, id?: string) => void; type SetStateChangedCallback = (err: string | null, id: string, notChanged: boolean) => void; type DeleteStateCallback = (err: string | null, id?: string) => void; - type GetHistoryCallback = (err: string | null, result: Array<(State & { id?: string })>, step: number, sessionId?: string) => void; + type GetHistoryResult = Array<(State & { id?: string })>; + type GetHistoryCallback = (err: string | null, result: GetHistoryResult, step: number, sessionId?: string) => void; /** Contains the return values of readDir */ interface ReadDirResult { diff --git a/types/iobroker/iobroker-tests.ts b/types/iobroker/iobroker-tests.ts index 0302a5041a..49af1f6ebd 100644 --- a/types/iobroker/iobroker-tests.ts +++ b/types/iobroker/iobroker-tests.ts @@ -20,6 +20,16 @@ adapter ; adapter.removeAllListeners(); +// Test adapter constructor options +let adapterOptions: ioBroker.AdapterOptions = { + name: "foo", + ready: readyHandler, + stateChange: stateChangeHandler, + objectChange: objectChangeHandler, + message: messageHandler, + unload: unloadHandler, +}; + function readyHandler() { } function stateChangeHandler(id: string, state: ioBroker.State | null | undefined) { @@ -260,6 +270,8 @@ adapter.subscribeForeignStatesAsync("*").catch(handleError); adapter.unsubscribeStatesAsync("*").catch(handleError); adapter.unsubscribeForeignStatesAsync("*").catch(handleError); +adapter.getHistory("state.id", {}, (err, result: ioBroker.GetHistoryResult) => {}); + // Repro from https://github.com/ioBroker/adapter-core/issues/3 const repro1: ioBroker.ObjectChangeHandler = (id, obj) => { if (!obj || !obj.common) return; diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index d5f829c8fe..743c3c061a 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -489,6 +489,8 @@ declare namespace IORedis { xack(key: KeyType, group: string, ...ids: string[]): any; xadd(key: KeyType, id: string, ...args: string[]): any; + xadd(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', count: number, ...args: string[]): any; + xadd(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', approximate: '~', count: number, ...args: string[]): any; xclaim(key: KeyType, group: string, consumer: string, minIdleTime: number, ...args: any[]): any; diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index 9950a8543f..89e4120f0e 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -177,6 +177,8 @@ new Redis.Cluster([{ redis.xack('streamName', 'groupName', 'id'); redis.xadd('streamName', '*', 'field', 'name'); +redis.xadd('streamName', 'MAXLEN', 100, '*', 'field', 'name'); +redis.xadd('streamName', 'MAXLEN', '~', 100, '*', 'field', 'name'); redis.xclaim('streamName', 'groupName', 'consumerName', 3600000, 'id'); redis.xdel('streamName', 'id'); redis.xgroup('CREATE', 'streamName', 'groupName', '$'); diff --git a/types/jasmine-data_driven_tests/index.d.ts b/types/jasmine-data_driven_tests/index.d.ts index 8c719de652..553987ef60 100644 --- a/types/jasmine-data_driven_tests/index.d.ts +++ b/types/jasmine-data_driven_tests/index.d.ts @@ -34,6 +34,6 @@ interface JasmineDataDrivenTest { assertion: (arg0: T, arg1: U, done: () => void) => void): void; ( description: string, - dataset: T[], + dataset: T[] | Array<[T]>, assertion: (value: T, done: () => void) => void): void; } diff --git a/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts b/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts index 6689159b58..0523a28af0 100644 --- a/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts +++ b/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts @@ -37,6 +37,13 @@ xall("A data driven test can be pending", } ); +all("A data set must consist of array-wrapped arrays, if test expects single array input", + [[[1, 2]], [[3, 4]], [[5, 6]]], + (numberArray: number[]) => { + expect(numberArray.length).toBe(2); + } +); + describe("A suite", () => { let a: number; diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index b5ee488b2b..f9df261fe8 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -991,20 +991,29 @@ declare namespace jest { } /** - * Represents the result of a single call to a mock function. + * Represents the result of a single call to a mock function with a return value. */ - interface MockResult { - /** - * True if the function threw. - * False if the function returned. - */ - isThrow: boolean; - /** - * The value that was either thrown or returned by the function. - */ + interface MockResultReturn { + type: 'return'; + value: T; + } + /** + * Represents the result of a single incomplete call to a mock function. + */ + interface MockResultIncomplete { + type: 'incomplete'; + value: undefined; + } + /** + * Represents the result of a single call to a mock function with a thrown error. + */ + interface MockResultThrow { + type: 'throw'; value: any; } + type MockResult = MockResultReturn | MockResultThrow | MockResultIncomplete; + interface MockContext { calls: Y[]; instances: T[]; @@ -1012,7 +1021,7 @@ declare namespace jest { /** * List of results of calls to the mock function. */ - results: MockResult[]; + results: Array>; } } diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 11b3752a0a..69e68ab6f7 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -316,7 +316,7 @@ interface TestApi { test(x: number): string; } // $ExpectType Mock -const mock12 = jest.fn, ArgsType>(); +const mock12 = jest.fn, jest.ArgsType>(); // $ExpectType number mock1('test'); @@ -485,6 +485,19 @@ mocked.test4.mockRejectedValue(new Error()); // $ExpectError mocked.test4.mockRejectedValueOnce(new Error()); +const mockResult = jest.fn(() => 1).mock.results[0]; +switch (mockResult.type) { + case 'return': + mockResult.value; // $ExpectType number + break; + case 'incomplete': + mockResult.value; // $ExpectType undefined + break; + case 'throw': + mockResult.value; // $ExpectType any + break; +} + /* Snapshot serialization */ const snapshotSerializerPlugin: jest.SnapshotSerializerPlugin = { diff --git a/types/jsoneditor/index.d.ts b/types/jsoneditor/index.d.ts index f095cb8434..3c74a3d789 100644 --- a/types/jsoneditor/index.d.ts +++ b/types/jsoneditor/index.d.ts @@ -1,54 +1,199 @@ -// Type definitions for jsoneditor v5.19.0 +// Type definitions for jsoneditor v5.28.2 // Project: https://github.com/josdejong/jsoneditor // Definitions by: Alejandro Sánchez // Errietta Kostala +// Adam Vigneaux // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// +import { Ajv } from "ajv"; + declare module 'jsoneditor' { - export interface JSONEditorNode { + type JSONPath = (string|number)[]; + + export interface Node { field: string; - value: string; - path: Array; + value?: string; + path: JSONPath; } export type JSONEditorMode = 'tree' | 'view' | 'form' | 'code' | 'text'; + export interface NodeName { + path: string; + type: 'object'|'array'; + size: number; + } + + export interface ValidationError { + path: JSONPath; + message: string; + } + + export interface Template { + text: string; + title: string; + className?: string; + field: string; + value: any; + } + + export type AutoCompleteCompletion = null|string[]|{startFrom: number, options: string[]}; + + export type AutoCompleteOptionsGetter = ( + text: string, path: JSONPath, input: string, editor: JSONEditor, + ) => AutoCompleteCompletion|Promise; + + export interface AutoCompleteOptions { + /** + * @default [39, 35, 9] + */ + confirmKeys?: number[]; + caseSensitive?: boolean; + getOptions?: AutoCompleteOptionsGetter; + } + + export interface SelectionPosition { + row: number; + column: number; + } + + export interface SerializableNode { + value: any; + path: JSONPath; + } + + // Based on the API of https://github.com/Sphinxxxx/vanilla-picker + export interface Color { + rgba: Array; + hsla: Array; + rgbString: string; + rgbaString: string; + hslString: string; + hslaString: string; + hex: string; + } + export interface JSONEditorOptions { ace?: AceAjax.Ace; - ajv?: any; // Any for now, since ajv typings aren't A-Ok + ajv?: Ajv; onChange?: () => void; - onEditable?: (node: JSONEditorNode) => boolean | {field: boolean, value: boolean}; + onChangeJSON?: (json: any) => void; + onChangeText?: (jsonString: string) => void; + onEditable?: (node: Node) => boolean|{field: boolean, value: boolean}; onError?: (error: Error) => void; onModeChange?: (newMode: JSONEditorMode, oldMode: JSONEditorMode) => void; + onNodeName?: (nodeName: NodeName) => string|undefined; + onValidate?: (json: any) => ValidationError[]|Promise; + /** + * @default false + */ escapeUnicode?: boolean; + /** + * @default false + */ sortObjectKeys?: boolean; + /** + * @default true + */ history?: boolean; + /** + * @default 'tree' + */ mode?: JSONEditorMode; - modes?: Array; + modes?: JSONEditorMode[]; + /** + * @default undefined + */ name?: string; - schema?: Object; - schemaRefs?: Object; + schema?: object; + schemaRefs?: object; + /** + * @default true + */ search?: boolean; + /** + * @default 2 + */ indentation?: number; theme?: string; + templates?: Template[]; + autocomplete?: AutoCompleteOptions; + /** + * @default true + */ + mainMenuBar?: boolean; + /** + * @default true + */ + navigationBar?: boolean; + /** + * @default true + */ + statusBar?: boolean; + onTextSelectionChange?: (start: SelectionPosition, end: SelectionPosition, text: string) => void; + onSelectionChange?: (start: SerializableNode, end: SerializableNode) => void; + onEvent?: (node: Node, event: string) => void; + /** + * @default true + */ + colorPicker?: boolean; + onColorPicker?: (parent: HTMLElement, color: string, onChange: (color: Color) => void) => void; + /** + * @default true + */ + timestampTag?: boolean; + language?: string; + languages?: { + [lang: string]: { + [key: string]: string; + }; + }; + modalAnchor?: HTMLElement; + /** + * @default true + */ + enableSort?: boolean; + /** + * @default true + */ + enableTransform?: boolean; + /** + * @default 100 + */ + maxVisibleChilds?: number; + } export default class JSONEditor { - constructor(container: HTMLElement, options?: JSONEditorOptions, json?: Object); + constructor(container: HTMLElement, options?: JSONEditorOptions, json?: any); collapseAll(): void; destroy(): void; expandAll(): void; focus(): void; - set(json: Object): void; - setMode(mode: JSONEditorMode): void; - setName(name?: string): void; - setSchema(schema: Object): void; - setText(jsonString: string): void; get(): any; getMode(): JSONEditorMode; - getName(): string; + getName(): string|undefined; + getNodesByRange(start: {path: JSONPath}, end: {path: JSONPath}): Array; + getSelection(): {start: SerializableNode, end: SerializableNode}; getText(): string; + getTextSelection(): {start: SelectionPosition, end: SelectionPosition, text: string}; + refresh(): void; + set(json: any): void; + setMode(mode: JSONEditorMode): void; + setName(name?: string): void; + setSchema(schema: object, schemaRefs?: object): void; + setSelection(start: {path: JSONPath}, end: {path: JSONPath}): void; + setText(jsonString: string): void; + setTextSelection(start: SelectionPosition, end: SelectionPosition): void; + update(json: any): void; + updateText(jsonString: string): void; + + static VALID_OPTIONS: Array; + static ace: AceAjax.Ace; + static Ajv: Ajv; + static VanillaPicker: any; } } diff --git a/types/jsoneditor/jsoneditor-tests.ts b/types/jsoneditor/jsoneditor-tests.ts index d905e6ba76..b584a14416 100644 --- a/types/jsoneditor/jsoneditor-tests.ts +++ b/types/jsoneditor/jsoneditor-tests.ts @@ -1,11 +1,13 @@ -import JSONEditor, {JSONEditorMode, JSONEditorNode, JSONEditorOptions } from 'jsoneditor'; +import * as Ajv from 'ajv'; +import JSONEditor, {JSONEditorMode, Node, JSONEditorOptions } from 'jsoneditor'; let options: JSONEditorOptions; +options = {}; options = { ace: ace, - //ajv: Ajv({allErrors: true, verbose: true}) + ajv: new Ajv({allErrors: true, verbose: true}), onChange() {}, - onEditable(node: JSONEditorNode) { + onEditable(node: Node) { return true; }, onError(error: Error) {}, @@ -23,7 +25,7 @@ options = { theme: 'default' }; options = { - onEditable(node: JSONEditorNode) { + onEditable(node: Node) { return {field: true, value: false}; } }; diff --git a/types/jsoneditor/package.json b/types/jsoneditor/package.json new file mode 100644 index 0000000000..b47ef67b0a --- /dev/null +++ b/types/jsoneditor/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "ajv": "*" + } +} diff --git a/types/klaw/index.d.ts b/types/klaw/index.d.ts index 7b4e586842..32810990d5 100644 --- a/types/klaw/index.d.ts +++ b/types/klaw/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for klaw v2.1.1 +// Type definitions for klaw v3.0.0 // Project: https://github.com/jprichardson/node-klaw // Definitions by: Matthew McEachen +// Pascal Sthamer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -26,6 +27,7 @@ declare module "klaw" { fs?: any // fs or mock-fs filter?: (path: string) => boolean depthLimit?: number + preserveSymlinks?: boolean } type Event = "close" | "data" | "end" | "readable" | "error" diff --git a/types/klaw/klaw-tests.ts b/types/klaw/klaw-tests.ts index 69406f73e8..baecd656f3 100644 --- a/types/klaw/klaw-tests.ts +++ b/types/klaw/klaw-tests.ts @@ -5,7 +5,7 @@ const path = require('path'); let items: klaw.Item[] = [] // files, directories, symlinks, etc -klaw('/some/dir') +klaw('/some/dir', { preserveSymlinks: false }) .on('data', function(item: klaw.Item) { items.push(item) }) diff --git a/types/knockback/index.d.ts b/types/knockback/index.d.ts index 68b9dc9e0b..59f3e3fa93 100644 --- a/types/knockback/index.d.ts +++ b/types/knockback/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Knockback.js -// Project: http://kmalakoff.github.io/knockback/ +// Project: http://kmalakoff.github.com/knockback // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index eebf89497d..44165c06c3 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -426,7 +426,7 @@ export class Interval { engulfs(other: Interval): boolean; equals(other: Interval): boolean; hasSame(unit: DurationUnit): boolean; - intersection(other: Interval): Interval; + intersection(other: Interval): Interval | null; isAfter(dateTime: DateTime): boolean; isBefore(dateTime: DateTime): boolean; isEmpty(): boolean; diff --git a/types/luxon/luxon-tests.ts b/types/luxon/luxon-tests.ts index 59566c35c3..ecf49e2081 100644 --- a/types/luxon/luxon-tests.ts +++ b/types/luxon/luxon-tests.ts @@ -140,6 +140,7 @@ i.length('years'); // $ExpectType number i.contains(DateTime.local(2019)); // $ExpectType boolean i.set({end: DateTime.local(2020)}); // $ExpectType Interval i.mapEndpoints((d) => d); // $ExpectType Interval +i.intersection(i); // $ExpectType Interval | null i.toISO(); // $ExpectType string i.toString(); // $ExpectType string diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 267163ac80..2a01b58a95 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -337,7 +337,7 @@ declare module "mongoose" { /** Use ssl connection (needs to have a mongod server with ssl support) (default: true) */ ssl?: boolean; /** Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) */ - sslValidate?: object; + sslValidate?: boolean; /** Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. */ poolSize?: number; /** Reconnect on error (default: true) */ diff --git a/types/moveto/index.d.ts b/types/moveto/index.d.ts index f9734ee184..729f70bd78 100644 --- a/types/moveto/index.d.ts +++ b/types/moveto/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for moveto 1.7 +// Type definitions for moveto 1.8 // Project: https://github.com/hsnaydd/moveTo // Definitions by: Rostislav Shermenyov +// pea3nut // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare class MoveTo { @@ -66,6 +67,10 @@ declare namespace MoveTo { * Ease function name */ easing?: string; + /** + * The container been computed and scrolled + */ + container?: Window | HTMLElement; /** * The function to be run after scrolling complete. Target passes as the first argument */ diff --git a/types/moveto/moveto-tests.ts b/types/moveto/moveto-tests.ts index 325cb57f3c..ea65854f25 100644 --- a/types/moveto/moveto-tests.ts +++ b/types/moveto/moveto-tests.ts @@ -2,6 +2,7 @@ const options: MoveTo.MoveToOptions = { tolerance: 70, duration: 300, easing: "easeOutQuart", + container: Math.random() > 0.5 ? window : document.createElement('div'), callback: () => {} }; diff --git a/types/mui-datatables/index.d.ts b/types/mui-datatables/index.d.ts index aa5ad83e5e..2dffabbc53 100644 --- a/types/mui-datatables/index.d.ts +++ b/types/mui-datatables/index.d.ts @@ -85,7 +85,7 @@ interface MUIDataTableTextLabelsSelectedRows { deleteAria: string; } -interface MUIDataTableTextLabels { +export interface MUIDataTableTextLabels { body: MUIDataTableTextLabelsBody; pagination: MUIDataTableTextLabelsPagination; toolbar: MUIDataTableTextLabelsToolbar; diff --git a/types/mui-datatables/mui-datatables-tests.tsx b/types/mui-datatables/mui-datatables-tests.tsx index 47eb181389..c6a477ea08 100644 --- a/types/mui-datatables/mui-datatables-tests.tsx +++ b/types/mui-datatables/mui-datatables-tests.tsx @@ -1,84 +1,76 @@ -import MUIDataTable, { MUIDataTableColumnDef, MUIDataTableOptions } from 'mui-datatables'; +import MUIDataTable, { MUIDataTableOptions, MUIDataTableTextLabels } from 'mui-datatables'; import * as React from 'react'; -const dataSimple: string[][] = [ - ['Joe James', 'Test Corp', 'Yonkers', 'NY'], - ['John Walsh', 'Test Corp', 'Hartford', 'CT'], - ['Bob Herm', 'Test Corp', 'Tampa', 'FL'], - ['James Houston', 'Test Corp', 'Dallas', 'TX'] -]; +interface Props extends MUIDataTableOptions { + data: any; + title: string; + textLabels?: MUIDataTableTextLabels; +} -const columnWithOptions: MUIDataTableColumnDef[] = [ - { - name: 'Name', - label: 'New Name', - options: { - display: 'true', - filter: true, - sort: true, - sortDirection: 'asc', - download: true, +class MuiCustomTable extends React.Component { + private readonly data: string[][] = this.props.data.map((asset: any) => Object.values(asset)); + private readonly columns = this.props.data + .map((entry: any) => Object.keys(entry)) + .flat() + .map((title: string) => title.toUpperCase()) + .filter((element: string, index: number, array: string[]) => array.indexOf(element) === index); + private readonly TableOptions: MUIDataTableOptions = { + filterType: 'checkbox', + responsive: 'scroll', + selectableRows: false, + elevation: 0, + rowsPerPageOptions: [5, 10, 20, 25, 50, 100], + downloadOptions: { + filename: 'filename.csv', + separator: ',' + }, + sortFilterList: false, + textLabels: { + body: { + noMatch: 'Sorry, no matching records found', + toolTip: 'Sort', + }, + pagination: { + next: 'Next Page', + previous: 'Previous Page', + rowsPerPage: 'Rows per page:', + displayRows: 'of', + }, + toolbar: { + search: 'Search', + downloadCsv: 'Download CSV', + print: 'Print', + viewColumns: 'View Columns', + filterTable: 'Filter Table', + }, + filter: { + all: 'All', + title: 'FILTERS', + reset: 'RESET', + }, + viewColumns: { + title: 'Show Columns', + titleAria: 'Show/Hide Table Columns', + }, + selectedRows: { + text: 'rows(s) selected', + delete: 'Delete', + deleteAria: 'Delete Selected Rows', + } } - } -]; + }; -const options: MUIDataTableOptions = { - filterType: 'checkbox', - responsive: 'scroll', - selectableRows: false, - elevation: 0, - rowsPerPageOptions: [5, 10, 20, 25, 50, 100], - downloadOptions: { - filename: 'filename.csv', - separator: ',' - }, - sortFilterList: false, - textLabels: { - body: { - noMatch: 'Sorry, no matching records found', - toolTip: 'Sort', - }, - pagination: { - next: 'Next Page', - previous: 'Previous Page', - rowsPerPage: 'Rows per page:', - displayRows: 'of', - }, - toolbar: { - search: 'Search', - downloadCsv: 'Download CSV', - print: 'Print', - viewColumns: 'View Columns', - filterTable: 'Filter Table', - }, - filter: { - all: 'All', - title: 'FILTERS', - reset: 'RESET', - }, - viewColumns: { - title: 'Show Columns', - titleAria: 'Show/Hide Table Columns', - }, - selectedRows: { - text: 'rows(s) selected', - delete: 'Delete', - deleteAria: 'Delete Selected Rows', - } - } -}; - -class MuiDataTable extends React.Component { render() { - return ( - - ); + return (); } } -; +const TableFruits = [ + {id: 1, name: "Apple", amount: 1}, + {id: 2, name: "Pear", amount: 2}, + {id: 3, name: "Strawberry", amount: 5}, + {id: 4, name: "Banana", amount: 7}, + {id: 5, name: "Orange", amount: 9}, +]; + +; diff --git a/types/mui-datatables/tsconfig.json b/types/mui-datatables/tsconfig.json index 280efbb284..a4d6f99b77 100644 --- a/types/mui-datatables/tsconfig.json +++ b/types/mui-datatables/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ + "es2017.object", "es6", "dom" ], diff --git a/types/natural-compare-lite/index.d.ts b/types/natural-compare-lite/index.d.ts new file mode 100644 index 0000000000..d9dd5f3e6d --- /dev/null +++ b/types/natural-compare-lite/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for natural-compare-lite 1.4 +// Project: https://github.com/litejs/natural-compare-lite +// Definitions by: Doniyor Aliyev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function naturalCompare(a: string, b: string): -1 | 0 | 1; + +export = naturalCompare; diff --git a/types/natural-compare-lite/natural-compare-lite-tests.ts b/types/natural-compare-lite/natural-compare-lite-tests.ts new file mode 100644 index 0000000000..c82a695344 --- /dev/null +++ b/types/natural-compare-lite/natural-compare-lite-tests.ts @@ -0,0 +1,3 @@ +import compare = require("natural-compare-lite"); + +['a', 's', 'd'].sort(compare); diff --git a/types/natural-compare-lite/tsconfig.json b/types/natural-compare-lite/tsconfig.json new file mode 100644 index 0000000000..ddfcb244cb --- /dev/null +++ b/types/natural-compare-lite/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "natural-compare-lite-tests.ts" + ] +} diff --git a/types/natural-compare-lite/tslint.json b/types/natural-compare-lite/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/natural-compare-lite/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/natural-compare/index.d.ts b/types/natural-compare/index.d.ts new file mode 100644 index 0000000000..bb26b925f7 --- /dev/null +++ b/types/natural-compare/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for natural-compare 1.4 +// Project: https://github.com/litejs/natural-compare-lite +// Definitions by: Doniyor Aliyev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function naturalCompare(a: string, b: string): -1 | 0 | 1; + +export = naturalCompare; diff --git a/types/natural-compare/natural-compare-tests.ts b/types/natural-compare/natural-compare-tests.ts new file mode 100644 index 0000000000..d006905f47 --- /dev/null +++ b/types/natural-compare/natural-compare-tests.ts @@ -0,0 +1,3 @@ +import compare = require("natural-compare"); + +['a', 's', 'd'].sort(compare); diff --git a/types/natural-compare/tsconfig.json b/types/natural-compare/tsconfig.json new file mode 100644 index 0000000000..c8af37bb22 --- /dev/null +++ b/types/natural-compare/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "natural-compare-tests.ts" + ] +} diff --git a/types/natural-compare/tslint.json b/types/natural-compare/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/natural-compare/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/node-jose/index.d.ts b/types/node-jose/index.d.ts new file mode 100644 index 0000000000..dc4caaeca5 --- /dev/null +++ b/types/node-jose/index.d.ts @@ -0,0 +1,335 @@ +// Type definitions for node-jose 1.1 +// Project: https://github.com/cisco/node-jose +// Definitions by: Nadun Indunil +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +/// + +export function canYouSee(ks: JWK.Key | JWK.KeyStore, opts: object): JWS.Verifier; + +export namespace JWA { + interface DecryptEncryptOptions { + aad?: Buffer; + adata?: Buffer; + iv?: Buffer; + tag?: Buffer; // Not used in encrypt + mac?: Buffer; // Not used in encrypt + epu?: Buffer; // encryption party info + epv?: Buffer; // encryption party info + kdata?: Buffer; + epk?: Buffer; // ephemeral pub key used in ec + enc?: string; // algorithm to use in ec + alg?: string; // variation of enc, probably oversight in lib code + apu?: Buffer; // agreement party info used in ec + apv?: Buffer; // agreement party info used in ec + p2s?: Buffer; // used in pbes + p2c?: number; // used in pbes + } + + interface DeriveOptions { + length?: number; // key length + otherInfo?: Buffer; // info used in concatkdf + public?: Buffer; // public key used in ecdh + hash?: Buffer; // hash used in ecdh + salt?: Buffer; // salt value used in hkdf + info?: Buffer; // app identifier info used in hkdf + } + + interface EncryptReturn { + data: Buffer; // The cipher text + tag?: Buffer; // The tag used in some algorithms + } + + interface SignReturn { + data: Buffer; // the data passed into the sign function + mac: Buffer; // the signature for `data` + } + + interface SignVerifyOptions { + loose?: boolean; + } + + interface VerifyReturn { + data: Buffer; // the data passed into the verify function + mac: Buffer; // the signature for `data` + valid: boolean; // whether the signature matches the data + } + + function decrypt( + alg: string, + key: string | Buffer, + cdata: string | Buffer, + props?: DecryptEncryptOptions + ): Promise; + + function derive(alg: string, key: string | Buffer, props?: DeriveOptions): Promise; + + function digest(alg: string, data: string | Buffer, props?: any): Promise; + + function encrypt( + alg: string, + key: string | Buffer, + pdata: string | Buffer, + props?: DecryptEncryptOptions + ): Promise; + + function sign( + alg: string, + key: string | Buffer, + pdata: string | Buffer, + props: SignVerifyOptions + ): Promise; + + function verify( + alg: string, + key: string | Buffer, + pdata: string | Buffer, + mac: string | Buffer, + props: SignVerifyOptions + ): Promise; +} + +export namespace JWE { + function createEncrypt(keys: JWK.Key | JWK.Key[]): Encryptor; + function createEncrypt( + options: { + format?: 'compact' | 'flattened'; + zip?: boolean; + fields?: object; + }, + key: JWK.Key + ): Encryptor; + + function createDecrypt(key: JWK.Key | JWK.KeyStore, opts?: any): Decryptor; + + interface Encryptor { + update(input: any): this; + final(): Promise; + } + + interface Decryptor { + decrypt(input: string): Promise; + } + + interface DecryptResult { + /** + * an array of the member names from the "protected" member + */ + protected: string[]; + /** + * the decrypted content (alternate) + */ + plaintext: Buffer; + } +} + +export namespace JWK { + const MODE_DECRYPT: string; + + const MODE_ENCRYPT: string; + + const MODE_SIGN: string; + + const MODE_UNWRAP: string; + + const MODE_VERIFY: string; + + const MODE_WRAP: string; + + function asKey( + key: string | Buffer | object | RawKey, + form?: 'json' | 'private' | 'pkcs8' | 'public' | 'spki' | 'pkix' | 'x509' | 'pem' + ): Promise; + /** + * To import a JWK-set as a keystore + */ + function asKeyStore(ks: object | string): Promise; + + function createKey(kty: any, size: any, props: any): Promise; + /** + * To create an empty keystore + */ + function createKeyStore(): KeyStore; + + function isKey(input: any): input is Key; + + function isKeyStore(input: any): input is KeyStore; + + type KeyUse = 'sig' | 'enc' | 'desc'; + + interface JWEEncryptor { + update(input: any): this; + final(): Promise; + } + + interface RawKey { + alg: string; + kty: string; + use: KeyUse; + + // e and n make up the public key + e: string; + n: string; + } + + interface KeyStoreGetFilter { + kty?: string; + use?: KeyUse; + alg?: string; + } + + interface KeyStoreGetOptions extends KeyStoreGetFilter { + kid: string; + } + + interface KeyStore { + /** + * To export the public keys of a keystore as a JWK-set + */ + toJSON(exportPrivateKeys?: boolean): object; + /** + * To retrieve a key from a keystore + */ + get(kid: string, filter?: KeyStoreGetFilter): RawKey; + get(options: KeyStoreGetOptions): RawKey; + all(options?: Partial): RawKey[]; + add(key: RawKey): Promise; + /** + * @param key + * String serialization of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER + * Buffer of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER + * @param form + * is either a: + * - "json" for a JSON stringified JWK + * - "private" for a DER encoded 'raw' private key + * - "pkcs8" for a DER encoded (unencrypted!) PKCS8 private key + * - "public" for a DER encoded SPKI public key (alternate to 'spki') + * - "spki" for a DER encoded SPKI public key + * - "pkix" for a DER encoded PKIX X.509 certificate + * - "x509" for a DER encoded PKIX X.509 certificate + * - "pem" for a PEM encoded of PKCS8 / SPKI / PKIX + */ + add( + key: string | Buffer | Key | object, + form?: 'json' | 'private' | 'pkcs8' | 'public' | 'spki' | 'pkix' | 'x509' | 'pem' + ): Promise; + + generate(kty: string, size?: string | number, props?: any): Promise; + + remove(key: Key): void; + } + + interface Key { + keystore: KeyStore; + length: number; + kty: string; + kid: string; + use: KeyUse; + alg: string; + + toPEM(isPrivate?: boolean): string; + toJSON(isPrivate?: boolean, excluded?: string[]): object; + thumbprint(hash?: string): Promise; + } +} + +export namespace JWS { + function createSign(keys: JWK.Key | JWK.Key[]): Signer; + function createSign( + options: { + format?: 'compact' | 'flattened'; + alg?: string; + compact?: boolean; + fields?: object; + }, + key: JWK.Key | JWK.Key[] + ): Signer; + + /** + * Using a keystore. + */ + function createVerify( + input?: string | JWK.Key | JWK.KeyStore | object, + opts?: { allowEmbeddedKey?: boolean; algorithms?: string[]; handlers?: any } + ): Verifier; + + interface CreateSignResult { + signResult: object; + } + + interface Signer { + update(input: Buffer | string, encoding?: string): this; + final(): Promise; + } + + interface BaseResult { + /** + * the combined 'protected' and 'unprotected' header members + */ + header: object; + /** + * the signed content + */ + payload: Buffer; + /** + * The key used to verify the signature + */ + key: JWK.Key; + protected: string[]; + } + + interface VerificationResult extends BaseResult { + /** + * the verified signature + */ + signature: Buffer | string; + } + + interface Verifier { + verify(input: string, opts?: { allowEmbeddedKey?: boolean }): Promise; + } + + interface Exp { + complete(jws: any): any; + } + + interface VerifyOptions { + allowEmbeddedKey?: boolean; + algorithms?: string[]; + handlers: { exp: boolean | Exp }; + } +} + +export function parse(input: Buffer | string | object): parse.ParseReturn; + +export namespace parse { + interface ParseReturn { + type: 'JWS' | 'JWE'; + format: 'compact' | 'json'; + input: Buffer | string | object; + header: object; + perform: (ks: JWK.KeyStore) => Promise | Promise; + } + function compact(input: Buffer | string | object): ParseReturn; + + function json(input: Buffer | string | object): ParseReturn; +} + +export namespace util { + function asBuffer(input: string | Buffer, encoding?: string): Buffer; + + function randomBytes(len: number): Buffer; + + namespace base64url { + function decode(base64url: string): string; + + function encode(buffer: string | Buffer, encoding?: string): string; + } + + namespace utf8 { + function decode(input: string): string; + + function encode(input: string): string; + } +} diff --git a/types/node-jose/node-jose-tests.ts b/types/node-jose/node-jose-tests.ts new file mode 100644 index 0000000000..dbeaccc9dc --- /dev/null +++ b/types/node-jose/node-jose-tests.ts @@ -0,0 +1,276 @@ +import * as jose from 'node-jose'; + +const keystore = jose.JWK.createKeyStore(); +const output = keystore.toJSON(); +keystore.toJSON(true); + +jose.JWK.asKeyStore('input').then(result => {}); + +let key = keystore.get('kid'); + +key = keystore.get('kid', { kty: 'RSA' }); + +// ... and by 'use' +key = keystore.get('kid', { use: 'enc' }); + +// ... and by 'alg' +key = keystore.get('kid', { alg: 'RSA-OAEP' }); + +// ... and by 'kty' and 'use' +key = keystore.get('kid', { kty: 'RSA', use: 'enc' }); + +// same as above, but with a single {props} argument +key = keystore.get({ kid: 'kid', kty: 'RSA', use: 'enc' }); + +let everything = keystore.all(); + +// filter by 'kid' +everything = keystore.all({ kid: 'kid' }); + +// filter by 'kty' +everything = keystore.all({ kty: 'RSA' }); + +// filter by 'use' +everything = keystore.all({ use: 'enc' }); + +// filter by 'alg' +everything = keystore.all({ alg: 'RSA-OAEP' }); + +// filter by 'kid' + 'kty' + 'alg' +everything = keystore.all({ kid: 'kid', kty: 'RSA', alg: 'RSA-OAEP' }); + +keystore.add('input').then(result => {}); + +keystore.add('input', 'json').then(result => { + // {result} is a jose.JWK.Key +}); + +keystore.generate('oct', 256).then(result => { + // {result} is a jose.JWK.Key +}); + +// ... with properties +const props = { + kid: 'gBdaS-G8RLax2qgObTD94w', + alg: 'A256GCM', + use: 'enc' +}; + +let key2: jose.JWK.Key; +keystore.generate('oct', 256, props).then(result => { + key2 = result; + keystore.remove(key2); + + jose.JWK.asKey(key2).then(result => {}); + + jose.JWK.asKey('input', 'json').then(result => {}); +}); + +jose.JWK.createKey('oct', 256, { alg: 'A256GCM' }).then(result => { + const output4 = result.toJSON(true); + result.thumbprint('hash').then(print => {}); + + const key = result; + + jose.JWS.createSign(key) + .update('input') + .final() + .then(result => { + // {result} is a JSON object -- JWS using the JSON General Serialization + }); + + jose.JWS.createSign({ format: 'flattened' }, key) + .update('input') + .final() + .then(result => { + // {result} is a JSON object -- JWS using the JSON Flattened Serialization + }); + + jose.JWS.createSign({ format: 'compact' }, key) + .update('input') + .final() + .then(result => { + // {result} is a String -- JWS using the Compact Serialization + }); + + jose.JWS.createSign({ alg: 'PS256' }, key) + .update('input') + .final() + .then(result => { + // .... + }); + + jose.JWS.createSign({ fields: { cty: 'jwk+json' } }, key) + .update('input') + .final() + .then(result => { + // .... + }); + + jose.JWS.createSign(key) + .update('input', 'utf8') + .final() + .then(result => { + // .... + }); + + let opts = { + algorithms: ['PS*'] + }; + jose.JWS.createVerify(key, opts) + .verify('input') + .then(result => { + // ... + }); + + opts = { + algorithms: ['*', '!HS*'] + }; + jose.JWS.createVerify(key, opts) + .verify('input') + .then(result => { + // ... + }); + + const opts2 = { + handlers: { + exp: true + } + }; + + jose.JWS.createVerify(key, opts2) + .verify('input') + .then(result => { + // ... + }); + + jose.JWE.createEncrypt(key) + .update('input') + .final() + .then(result => { + // {result} is a JSON Object -- JWE using the JSON General Serialization + }); + + jose.JWE.createEncrypt({ format: 'compact' }, key) + .update('input') + .final() + .then(result => { + // {result} is a String -- JWE using the Compact Serialization + }); + + jose.JWE.createEncrypt({ format: 'flattened' }, key) + .update('input') + .final() + .then(result => { + // {result} is a JSON Object -- JWE using the JSON Flattened Serialization + }); + + jose.JWE.createEncrypt({ zip: true }, key) + .update('input') + .final() + .then(result => { + // .... + }); + + jose.JWE.createEncrypt({ fields: { cty: 'jwk+json' } }, key) + .update('input') + .final() + .then(result => { + // .... + }); + + jose.JWE.createEncrypt([key, key]) + .update('input') + .final() + .then(result => { + // .... + }); + + jose.JWE.createDecrypt(key) + .decrypt('input') + .then(result => { + // .... + }); + + const opts3 = { + algorithms: ['dir', 'A*GCM'] + }; + jose.JWE.createDecrypt(key, opts3) + .decrypt('input') + .then(result => { + // ... + }); + + const opts4 = { + algorithms: ['*', '!RSA*'] + }; + jose.JWS.createVerify(key, opts4) + .verify('input') + .then(result => { + // ... + }); + + const opts5 = { + handlers: { + exp: true + } + }; + jose.JWE.createDecrypt(key, opts5) + .decrypt('input') + .then(result => { + // ... + }); +}); + +jose.JWS.createVerify(keystore) + .verify('input') + .then(result => { + // {result} is a Object with: + // * header: the combined 'protected' and 'unprotected' header members + // * payload: Buffer of the signed content + // * signature: Buffer of the verified signature + // * key: The key used to verify the signature + }); + +// {key} can be: +// * jose.JWK.Key +// * JSON object representing a JWK +jose.JWS.createVerify(key) + .verify('input') + .then(result => { + // ... + }); + +jose.JWS.createVerify() + .verify('input', { allowEmbeddedKey: true }) + .then(result => { + // ... + }); + +const verifier = jose.JWS.createVerify({ allowEmbeddedKey: true }); + +verifier.verify('input').then(result => { + // ... +}); + +jose.JWE.createDecrypt(keystore) + .decrypt('input') + .then(result => { + // {result} is a Object with: + // * header: the combined 'protected' and 'unprotected' header members + // * protected: an array of the member names from the "protected" member + // * key: Key used to decrypt + // * payload: Buffer of the decrypted content + // * plaintext: Buffer of the decrypted content (alternate) + }); + +jose.util.asBuffer('input'); + +jose.util.base64url.encode('input'); +jose.util.base64url.encode('input', 'utf8'); + +jose.util.base64url.encode('input'); + +jose.util.base64url.decode('input'); + +jose.util.randomBytes(32); diff --git a/types/p-throttle/tsconfig.json b/types/node-jose/tsconfig.json similarity index 93% rename from types/p-throttle/tsconfig.json rename to types/node-jose/tsconfig.json index 81852e4d18..c01c2b1fb7 100644 --- a/types/p-throttle/tsconfig.json +++ b/types/node-jose/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "p-throttle-tests.ts" + "node-jose-tests.ts" ] } \ No newline at end of file diff --git a/types/node-jose/tslint.json b/types/node-jose/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/node-jose/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/node-sass-middleware/index.d.ts b/types/node-sass-middleware/index.d.ts index badbd843d1..53cde2a10a 100644 --- a/types/node-sass-middleware/index.d.ts +++ b/types/node-sass-middleware/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/sass/node-sass-middleware // Definitions by: Pascal Garber // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.7 diff --git a/types/node-sass/index.d.ts b/types/node-sass/index.d.ts index b208b57f19..f5445689b4 100644 --- a/types/node-sass/index.d.ts +++ b/types/node-sass/index.d.ts @@ -1,56 +1,410 @@ -// Type definitions for Node Sass v3.10.1 +// Type definitions for node-sass 4.11 // Project: https://github.com/sass/node-sass -// Definitions by: Asana +// Definitions by: Asana , Chris Eppstein // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 /// -type ImporterReturnType = { file: string } | { contents: string } | Error | null; +export type ImporterReturnType = { file: string } | { file?: string; contents: string } | Error | null | types.Null | types.Error; -interface Importer { - (url: string, prev: string, done: (data: ImporterReturnType) => void): ImporterReturnType | void; +/** + * The context value is a value that is shared for the duration of a single render. + * The context object is the implicit `this` for importers and sass functions + * that are implemented in javascript. + * + * A render can be detected as asynchronous if the `callback` property is set on the context object. + */ +export interface Context { + options: Options; + callback: SassRenderCallback | undefined; + [data: string]: any; } -interface Options { - file?: string; - data?: string; - importer?: Importer | Importer[]; - functions?: { [key: string]: Function }; - includePaths?: string[]; - indentedSyntax?: boolean; - indentType?: string; - indentWidth?: number; - linefeed?: string; - omitSourceMapUrl?: boolean; - outFile?: string; - outputStyle?: "compact" | "compressed" | "expanded" | "nested"; - precision?: number; - sourceComments?: boolean; - sourceMap?: boolean | string; - sourceMapContents?: boolean; - sourceMapEmbed?: boolean; - sourceMapRoot?: string; +export interface AsyncContext extends Context { + callback: SassRenderCallback; } -interface SassError extends Error { - message: string; - line: number; - column: number; - status: number; - file: string; +export interface SyncContext extends Context { + callback: undefined; } -interface Result { - css: Buffer; - map: Buffer; - stats: { - entry: string; - start: number; - end: number; - duration: number; - includedFiles: string[]; - } +export type AsyncImporter = (this: AsyncContext, url: string, prev: string, done: (data: ImporterReturnType) => void) => void; +export type SyncImporter = (this: SyncContext, url: string, prev: string) => ImporterReturnType; +export type Importer = AsyncImporter | SyncImporter; + +// These function types enumerate up to 6 js arguments. More than that will be incorrectly marked by the compiler as an error. + +// ** Sync Sass functions receiving fixed # of arguments *** +export type SyncSassFn = (this: SyncContext, ...$args: types.Value[]) => types.ReturnValue; + +/* tslint:disable:max-line-length */ +// ** Sync Sass functions receiving variable # of arguments *** +export type SyncSassVarArgFn1 = (this: SyncContext, $arg1: types.Value[]) => types.ReturnValue; +export type SyncSassVarArgFn2 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value[]) => types.ReturnValue; +export type SyncSassVarArgFn3 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value[]) => types.ReturnValue; +export type SyncSassVarArgFn4 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value[]) => types.ReturnValue; +export type SyncSassVarArgFn5 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value[]) => types.ReturnValue; +export type SyncSassVarArgFn6 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: types.Value[]) => types.ReturnValue; + +export type SassFunctionCallback = ($result: types.ReturnValue) => void; + +// ** Async Sass functions receiving fixed # of arguments *** +export type AsyncSassFn0 = (this: AsyncContext, cb: SassFunctionCallback) => void; +export type AsyncSassFn1 = (this: AsyncContext, $arg1: types.Value, cb: SassFunctionCallback) => void; +export type AsyncSassFn2 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, cb: SassFunctionCallback) => void; +export type AsyncSassFn3 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, cb: SassFunctionCallback) => void; +export type AsyncSassFn4 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, cb: SassFunctionCallback) => void; +export type AsyncSassFn5 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, cb: SassFunctionCallback) => void; +export type AsyncSassFn6 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: types.Value, cb: SassFunctionCallback) => void; + +// *** Async Sass Functions receiving variable # of arguments *** +export type AsyncSassVarArgFn1 = (this: AsyncContext, $arg1: types.Value[], cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn2 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value[], cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn3 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value[], cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn4 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value[], cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn5 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value[], cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn6 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: types.Value[], cb: SassFunctionCallback) => void; +/* tslint:enable:max-line-length */ + +export type SyncSassFunction = SyncSassFn | SyncSassVarArgFn1 | SyncSassVarArgFn2 | SyncSassVarArgFn3 | SyncSassVarArgFn4 | SyncSassVarArgFn5 | SyncSassVarArgFn6; + +export type AsyncSassFunction = AsyncSassFn0 | AsyncSassFn1 | AsyncSassFn2 | AsyncSassFn3 | AsyncSassFn4 | AsyncSassFn5 | AsyncSassFn6 + | AsyncSassVarArgFn1 | AsyncSassVarArgFn2 | AsyncSassVarArgFn3 | AsyncSassVarArgFn4 | AsyncSassVarArgFn5 | AsyncSassVarArgFn6; + +export type SassFunction = SyncSassFunction | AsyncSassFunction; + +export type FunctionDeclarations = Record; + +export interface Options { + file?: string; + data?: string; + importer?: Importer | Importer[]; + functions?: FunctionDeclarations; + includePaths?: string[]; + indentedSyntax?: boolean; + indentType?: string; + indentWidth?: number; + linefeed?: string; + omitSourceMapUrl?: boolean; + outFile?: string; + outputStyle?: "compact" | "compressed" | "expanded" | "nested"; + precision?: number; + sourceComments?: boolean; + sourceMap?: boolean | string; + sourceMapContents?: boolean; + sourceMapEmbed?: boolean; + sourceMapRoot?: string; + [key: string]: any; } -export declare function render(options: Options, callback: (err: SassError, result: Result) => any): void; -export declare function renderSync(options: Options): Result; +export interface SyncOptions extends Options { + functions?: FunctionDeclarations; + importer?: SyncImporter | SyncImporter[]; +} + +/** + * The error object returned to javascript by sass's render methods. + * + * This is not the same thing as types.Error. + */ +export interface SassError extends Error { + message: string; + line: number; + column: number; + status: number; + file: string; +} + +/** + * The result of successfully compiling a Sass file. + */ +export interface Result { + css: Buffer; + map: Buffer; + stats: { + entry: string; + start: number; + end: number; + duration: number; + includedFiles: string[]; + }; +} +export type SassRenderCallback = (err: SassError, result: Result) => any; + +// Note, most node-sass constructors can be invoked as a function or with a new +// operator. The exception: the types Null and Boolean for which new is +// forbidden. +// +// Because of this, the new-able object notation is used here, a class does not +// work for these types. +export namespace types { + /* eslint-disable @typescript-eslint/ban-types */ + /* tslint:disable:ban-types */ + /** + * Values that are received from Sass as an argument to a javascript function. + */ + export type Value = Null | Number | String | Color | Boolean | List | Map; + + /** + * Values that are legal to return to Sass from a javascript function. + */ + export type ReturnValue = Value | Error; + + // *** Sass Null *** + + export interface Null { + /** + * This property doesn't exist, but its presence forces the typescript + * compiler to properly type check this type. Without it, it seems to + * allow things that aren't types.Null to match it in case statements and + * assignments. + */ + readonly ___NULL___: unique symbol; + } + + interface NullConstructor { + (): Null; + NULL: Null; + } + export const Null: NullConstructor; + + // *** Sass Number *** + + export interface Number { + getValue(): number; + setValue(n: number): void; + getUnit(): string; + setUnit(u: string): void; + } + interface NumberConstructor { + /** + * Constructs a new Sass number. Does not require use of the `new` keyword. + */ + new(value: number, unit?: string): Number; + /** + * Constructs a new Sass number. Can also be used with the `new` keyword. + */ + (value: number, unit?: string): Number; + } + + export const Number: NumberConstructor; + + // *** Sass String *** + + export interface String { + getValue(): string; + setValue(s: string): void; + } + + interface StringConstructor { + /** + * Constructs a new Sass string. Does not require use of the `new` keyword. + */ + new (value: string): String; + /** + * Constructs a new Sass string. Can also be used with the `new` keyword. + */ + (value: string): String; + } + + export const String: StringConstructor; + + // *** Sass Color *** + + export interface Color { + /** + * Get the red component of the color. + * @returns integer between 0 and 255 inclusive; + */ + getR(): number; + /** + * Set the red component of the color. + * @returns integer between 0 and 255 inclusive; + */ + setR(r: number): void; + /** + * Get the green component of the color. + * @returns integer between 0 and 255 inclusive; + */ + getG(): number; + /** + * Set the green component of the color. + * @param g integer between 0 and 255 inclusive; + */ + setG(g: number): void; + /** + * Get the blue component of the color. + * @returns integer between 0 and 255 inclusive; + */ + getB(): number; + /** + * Set the blue component of the color. + * @param b integer between 0 and 255 inclusive; + */ + setB(b: number): void; + /** + * Get the alpha transparency component of the color. + * @returns number between 0 and 1 inclusive; + */ + getA(): number; + /** + * Set the alpha component of the color. + * @param a number between 0 and 1 inclusive; + */ + setA(a: number): void; + } + + interface ColorConstructor { + /** + * Constructs a new Sass color given the RGBA component values. Do not invoke with the `new` keyword. + * + * @param r integer 0-255 inclusive + * @param g integer 0-255 inclusive + * @param b integer 0-255 inclusive + * @param [a] float 0 - 1 inclusive + * @returns a SassColor instance. + */ + new (r: number, g: number, b: number, a?: number): Color; + + /** + * Constructs a new Sass color given a 4 byte number. Do not invoke with the `new` keyword. + * + * If a single number is passed it is assumed to be a number that contains + * all the components which are extracted using bitmasks and bitshifting. + * + * @param hexN A number that is usually written in hexadecimal form. E.g. 0xff0088cc. + * @returns a Sass Color instance. + * @example + * // Comparison with byte array manipulation + * let a = new ArrayBuffer(4); + * let hexN = 0xCCFF0088; // 0xAARRGGBB + * let a32 = new Uint32Array(a); // Uint32Array [ 0 ] + * a32[0] = hexN; + * let a8 = new Uint8Array(a); // Uint8Array [ 136, 0, 255, 204 ] + * let componentBytes = [a8[2], a8[1], a8[0], a8[3] / 255] // [ 136, 0, 255, 0.8 ] + * let c = sass.types.Color(hexN); + * let components = [c.getR(), c.getG(), c.getR(), c.getA()] // [ 136, 0, 255, 0.8 ] + * assert.deepEqual(componentBytes, components); // does not raise. + */ + new (hexN: number): Color; + + /** + * Constructs a new Sass color given the RGBA component values. Do not invoke with the `new` keyword. + * + * @param r integer 0-255 inclusive + * @param g integer 0-255 inclusive + * @param b integer 0-255 inclusive + * @param [a] float 0 - 1 inclusive + * @returns a SassColor instance. + */ + (r: number, g: number, b: number, a?: number): Color; + + /** + * Constructs a new Sass color given a 4 byte number. Do not invoke with the `new` keyword. + * + * If a single number is passed it is assumed to be a number that contains + * all the components which are extracted using bitmasks and bitshifting. + * + * @param hexN A number that is usually written in hexadecimal form. E.g. 0xff0088cc. + * @returns a Sass Color instance. + * @example + * // Comparison with byte array manipulation + * let a = new ArrayBuffer(4); + * let hexN = 0xCCFF0088; // 0xAARRGGBB + * let a32 = new Uint32Array(a); // Uint32Array [ 0 ] + * a32[0] = hexN; + * let a8 = new Uint8Array(a); // Uint8Array [ 136, 0, 255, 204 ] + * let componentBytes = [a8[2], a8[1], a8[0], a8[3] / 255] // [ 136, 0, 255, 0.8 ] + * let c = sass.types.Color(hexN); + * let components = [c.getR(), c.getG(), c.getR(), c.getA()] // [ 136, 0, 255, 0.8 ] + * assert.deepEqual(componentBytes, components); // does not raise. + */ + (hexN: number): Color; + } + + export const Color: ColorConstructor; + + // *** Sass Boolean *** + + export interface Boolean { + getValue(): boolean; + } + + interface BooleanConstructor { + (bool: boolean): Boolean; + TRUE: Boolean; + FALSE: Boolean; + } + + export const Boolean: BooleanConstructor; + + // *** Sass List *** + + export interface Enumerable { + getValue(index: number): Value; + setValue(index: number, value: Value): void; + getLength(): number; + } + + export interface List extends Enumerable { + getSeparator(): boolean; + setSeparator(isComma: boolean): void; + } + interface ListConstructor { + new (length: number, commaSeparator?: boolean): List; + (length: number, commaSeparator?: boolean): List; + } + export const List: ListConstructor; + + // *** Sass Map *** + + export interface Map extends Enumerable { + getKey(index: number): Value; + setKey(index: number, key: Value): void; + } + interface MapConstructor { + new (length: number): Map; + (length: number): Map; + } + export const Map: MapConstructor; + + // *** Sass Error *** + + export interface Error { + /** + * This property doesn't exist, but its presence forces the typescript + * compiler to properly type check this type. Without it, it seems to + * allow things that aren't types.Error to match it in case statements and + * assignments. + */ + readonly ___SASS_ERROR___: unique symbol; + // why isn't there a getMessage() method? + } + + interface ErrorConstructor { + /** + * An error return value for async functions. + * For synchronous functions, this can be returned or a standard error object can be thrown. + */ + new (message: string): Error; + /** + * An error return value for async functions. + * For synchronous functions, this can be returned or a standard error object can be thrown. + */ + (message: string): Error; + } + export const Error: ErrorConstructor; + + /* eslint-enable @typescript-eslint/ban-types */ + /* tslint:enable:ban-types */ +} + +// *** Top level Constants *** + +export const NULL: types.Null; +export const TRUE: types.Boolean; +export const FALSE: types.Boolean; +export const info: string; +export function render(options: Options, callback: SassRenderCallback): void; +export function renderSync(options: SyncOptions): Result; diff --git a/types/node-sass/node-sass-tests.ts b/types/node-sass/node-sass-tests.ts index 4de32d7d06..e8ae73cef7 100644 --- a/types/node-sass/node-sass-tests.ts +++ b/types/node-sass/node-sass-tests.ts @@ -1,48 +1,193 @@ import * as sass from 'node-sass'; -sass.render({ - file: '/path/to/myFile.scss', - data: 'body{background:blue; a{color:black;}}', - importer: function(url, prev, done) { - someAsyncFunction(url, prev, function(result) { - if (result == null) { - // return null to opt out of handling this path - // compiler will fall to next importer in array (or its own default) - return null; - } - // only one of them is required, see section Sepcial Behaviours. - done({ file: result.path }); - done({ contents: result.data }); - }); - }, - includePaths: ['lib/', 'mod/'], - outputStyle: 'compressed' -}, function(error, result) { // node-style callback from v3.0.0 onwards +console.log(sass.info); + +const syncImporter: sass.SyncImporter = function(url, prev) { + if (url.startsWith('!')) { + return sass.NULL; + } + if (url.endsWith('?')) { + return sass.types.Error("cannot question mark"); + } + console.log(typeof this.callback); // "undefined" + return { file: [prev, url].join('/') }; +}; + +const asyncImporter: sass.AsyncImporter = function(url, prev, done) { + if (url.startsWith('!')) { + // shouldn't really call twice, just checking for compiler validity + done(null); + done(sass.NULL); + } + if (url.endsWith('?')) { + // shouldn't really call twice, just checking for compiler validity + done(new sass.types.Error('Cannot accept this file')); + done(new Error('Cannot accept this file')); + } else { + console.log(this.options.file); // "string" + console.log(typeof this.callback); // "function" + done({ file: [prev, url].join('/') }); + } +}; + +const anotherAsyncImporter: sass.AsyncImporter = (url, prev, done) => { + someAsyncFunction(url, prev, (result) => { + if (result == null) { + // return null to opt out of handling this path + // compiler will fall to next importer in array (or its own default) + done(null); + } + // only one of them is required, see section Special Behaviors. + done({ file: result.path }); + done({ contents: result.data }); + }); +}; + +const handleAsyncResult: sass.SassRenderCallback = (error, result) => { // node-style callback from v3.0.0 onwards if (error) { console.log(error.status, error.column, error.message, error.line); - } - else { + } else { console.log(result.stats); console.log(result.css.toString()); console.log(result.map.toString()); // or better console.log(JSON.stringify(result.map)); // note, JSON.stringify accepts Buffer too } -}); +}; + +const syncFunction: Record = { + "pow($base, $exp)"($base, $exp) { + console.log(this.options.file); // "string" + console.log(typeof this.callback); // "undefined" + if ($base instanceof sass.types.Number && $exp instanceof sass.types.Number) { + if ($base.getUnit() !== "" || $exp.getUnit() !== "") { + throw new Error("Cannot have units in an exponent"); + } + return new sass.types.Number(Math.pow($base.getValue(), $exp.getValue())); + } else { + throw new Error("Number expected"); + } + } +}; + +const syncVarArg: Record = { + "add-all($n1, $n2, $ns...)"($n1, $n2, $ns) { + if (!($n1 instanceof sass.types.Number)) { + throw new Error("Expected a number"); + } + if (!($n2 instanceof sass.types.Number)) { + throw new Error("Expected a number"); + } + const unit = $n1.getUnit(); + if ($n2.getUnit() !== unit) { + throw new Error("units don't match"); + } + let accum = $n1.getValue() + $n2.getValue(); + $ns.forEach(($n) => { + if (!($n instanceof sass.types.Number)) { + throw new Error("Expected a number"); + } + if ($n.getUnit() !== unit) { + throw new Error("units don't match"); + } + accum = accum + $n.getValue(); + }); + return sass.types.Number(accum, unit); + } +}; + +const syncFunctions: Record = {...syncFunction, ...syncVarArg}; + +const asyncFunction: Record = { + "pow-async($base, $exp)"($base, $exp, done) { + console.log(this.options.file); // "string" + console.log(typeof this.callback); // "function" + if ($base instanceof sass.types.Number && $exp instanceof sass.types.Number) { + if ($base.getUnit() !== "" || $exp.getUnit() !== "") { + done(new sass.types.Error("Cannot have units in an exponent")); + } + done(new sass.types.Number(Math.pow($base.getValue(), $exp.getValue()))); + } else { + done(new sass.types.Error("Number expected")); + } + } +}; + +const asyncVarArg: Record = { + "add-all-async($n1, $n2, $ns...)"($n1, $n2, $ns, done) { + if (!($n1 instanceof sass.types.Number)) { + done(new sass.types.Error("Expected a number")); + return; + } + if (!($n2 instanceof sass.types.Number)) { + done(new sass.types.Error("Expected a number")); + return; + } + const unit = $n1.getUnit(); + if ($n2.getUnit() !== unit) { + done(new sass.types.Error("units don't match")); + return; + } + let accum = $n1.getValue() + $n2.getValue(); + for (const $n of $ns) { + if (!($n instanceof sass.types.Number)) { + done(new sass.types.Error("Expected a number")); + return; + } + if ($n.getUnit() !== unit) { + done(new sass.types.Error("units don't match")); + return; + } + accum = accum + $n.getValue(); + } + done(sass.types.Number(accum, unit)); + } +}; + +const asyncFunctions: Record = {...asyncFunction, ...asyncVarArg}; + +const functions: sass.FunctionDeclarations = {...syncFunctions, ...asyncFunctions}; + +sass.render({ + file: '/path/to/myFile.scss', + data: 'body{background:blue; a{color:black;}}', + functions, + importer: [anotherAsyncImporter, asyncImporter, syncImporter], + includePaths: ['lib/', 'mod/'], + outputStyle: 'compressed' +}, handleAsyncResult); + // OR + +sass.render({ + file: '/path/to/myFile.scss', + data: 'body{background:blue; a{color:black;}}', + importer: asyncImporter, + includePaths: ['lib/', 'mod/'], + outputStyle: 'compressed' +}, handleAsyncResult); + +// OR + +sass.render({ + file: '/path/to/myFile.scss', + data: 'body{background:blue; a{color:black;}}', + importer: syncImporter, + includePaths: ['lib/', 'mod/'], + outputStyle: 'compressed' +}, handleAsyncResult); + +// OR + const result = sass.renderSync({ file: '/path/to/file.scss', data: 'body{background:blue; a{color:black;}}', outputStyle: 'compressed', + functions: syncFunctions, outFile: '/to/my/output.css', sourceMap: true, // or an absolute or relative (to outFile) path sourceMapRoot: '.', - importer: function(url, prev) { - if (url.startsWith('!')) { - return new Error('Cannot accept this file'); - } - return { file: [prev, url].join('/') }; - }, + importer: syncImporter, }); console.log(result.css); @@ -50,6 +195,104 @@ console.log(result.map); console.log(result.stats); function someAsyncFunction(url: string, prev: string, callback: (result: { path: string; data: string }) => void): void { } -function someSyncFunction(url: string, prev: string): { path: string; data: string } { - return null; + +function sameType(v1: V, v2: V): boolean { + return v1.constructor === v2.constructor; } + +// function-based Constructors and instance methods for types +const true1 = sass.types.Boolean(true); +true1.getValue(); // true +const true2 = sass.types.Boolean.TRUE; +const true3 = sass.TRUE; +sameType(true2, true3); +true2 === true3; // true +const false1 = sass.types.Boolean(false); +const false2 = sass.types.Boolean.FALSE; +const false3 = sass.FALSE; +false2 === false3; // true +false1.getValue(); // false +const null1 = sass.types.Null(); +const null2 = sass.types.Null.NULL; +const null3 = sass.NULL; +sameType(null2, null3); +null1 === null2; // true +null1 === null3; // true +const ident = sass.types.String("x"); +ident.getValue(); // 'x' +const stringQuoted = sass.types.String("'x'"); +stringQuoted.getValue(); // '\'x\'' +const number = sass.types.Number(5); +number.getUnit(); // "" +number.getValue(); // 5 +const dimension = sass.types.Number(5, "px"); +dimension.getUnit(); // "px" +const redOpaque = sass.types.Color(240, 15, 0); +redOpaque.getR(); // 240 +redOpaque.getG(); // 15 +redOpaque.getB(); // 0 +redOpaque.getA(); // 1 +const redTranslucent = sass.types.Color(240, 15, 0, 0.5); +redTranslucent.getA(); // 0.5 +const redOpaque2 = sass.types.Color(0xF00F00FF); +redOpaque2.getR(); // 240 +redOpaque2.getG(); // 15 +redOpaque2.getB(); // 0 +redOpaque2.getA(); // 1 +const redTranslucent2 = sass.types.Color(0xF00F007F); +redTranslucent.getA(); // 0.5 +const spaceList1 = sass.types.List(1); +spaceList1.getLength(); // 1 +spaceList1.getSeparator(); // false +spaceList1.setValue(0, ident); +spaceList1.setValue(0, true1); +spaceList1.setValue(0, false1); +spaceList1.setValue(0, null1); +spaceList1.setValue(0, dimension); +spaceList1.setValue(0, redOpaque); +spaceList1.getValue(0) === redOpaque; // true +const spaceList2 = sass.types.List(1, false); +spaceList2.setValue(0, sass.types.String("s")); +const commaList1 = sass.types.List(2, true); +commaList1.getLength(); // 2 +commaList1.getSeparator(); // true (it's a comma) +commaList1.setValue(0, spaceList1); +commaList1.setValue(2, spaceList2); +const map1 = sass.types.Map(2); +map1.getLength(); // 2 +map1.setKey(0, ident); +map1.setValue(0, spaceList1); +ident === map1.getKey(0); // true +spaceList1 === map1.getValue(1); // true +sameType(ident, map1.getKey(0)); // true +const error = new sass.types.Error("message"); + +function valuesOf(enumerable: sass.types.Enumerable): sass.types.Value[] { + const values = new Array(); + for (let i = 0; i < enumerable.getLength(); i++) { + values.push(enumerable.getValue(i)); + } + return values; +} + +let arr = valuesOf(map1); +console.dir(arr); +arr = valuesOf(commaList1); +console.dir(arr); + +// new-based Constructors +// boolean and null raise a runtime error if constructed with new. +// const newTrue = new sass.types.Boolean(true); +// const newFalse = new sass.types.Boolean(false); +// const newNull = new sass.types.Null(); +const newIdent = new sass.types.String("x"); +const newNumber = new sass.types.Number(5); +const newDimension = new sass.types.Number(5, "px"); +const newRedOpaque = new sass.types.Color(240, 15, 0); +const newRedTranslucent = new sass.types.Color(240, 15, 0, 0.5); +const newRedOpaque2 = new sass.types.Color(0xF00F00FF); +const newSpaceList1 = new sass.types.List(1); +const newSpaceList2 = new sass.types.List(1, false); +const newCommaList1 = new sass.types.List(2, true); +const newMap1 = new sass.types.Map(2); +const newError = new sass.types.Error("message"); diff --git a/types/node-sass/tsconfig.json b/types/node-sass/tsconfig.json index a1e4cdb079..172d6270c7 100644 --- a/types/node-sass/tsconfig.json +++ b/types/node-sass/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/node-sass/tslint.json b/types/node-sass/tslint.json index a41bf5d19a..0b6d65eeac 100644 --- a/types/node-sass/tslint.json +++ b/types/node-sass/tslint.json @@ -1,79 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + // We don't want to export the Constructor interfaces + // and I can't figure out how to disable this lint using + // `export {}` + "strict-export-declare-modifiers": false } } diff --git a/types/npm-registry-package-info/index.d.ts b/types/npm-registry-package-info/index.d.ts new file mode 100644 index 0000000000..e66d3ae1b1 --- /dev/null +++ b/types/npm-registry-package-info/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for npm-registry-package-info 1.0 +// Project: https://github.com/kgryte/npm-registry-package-info#readme +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace pkginfo { + interface Options { + /** Boolean indicating whether to return only the latest package information from a registry. */ + latest?: boolean; + /** Array of package names (required). */ + packages: string[]; + /** Registry port. Default: 443 (HTTPS) or 80 (HTTP). */ + port?: number; + /** Registry protocol. Default: 'https'. */ + protocol?: 'http' | 'https'; + /** Registry. Default: 'registry.npmjs.org'. */ + registry?: string; + } + + interface Data { + data: any; + meta: { + failure: number; + success: number; + total: number; + }; + } + + type Callback = (error: Error | null, data: Data) => void; + + function factory(opts: Options, callback: Callback): () => void; +} + +declare function pkginfo(opts: pkginfo.Options, callback: pkginfo.Callback): void; + +export = pkginfo; diff --git a/types/npm-registry-package-info/npm-registry-package-info-tests.ts b/types/npm-registry-package-info/npm-registry-package-info-tests.ts new file mode 100644 index 0000000000..3b0183b13a --- /dev/null +++ b/types/npm-registry-package-info/npm-registry-package-info-tests.ts @@ -0,0 +1,21 @@ +import pkginfo = require('npm-registry-package-info'); + +const opts: pkginfo.Options = { + latest: true, + packages: ['dstructs-array', 'flow-map', 'utils-merge2'], + port: 80, + protocol: 'http', + registry: 'my.favorite.npm/registry', +}; + +pkginfo(opts, (error, data) => { + data; // $ExpectType Data +}); + +const pkgs = ['dstructs-matrix', 'compute-stdev', 'compute-variance']; + +const get = pkginfo.factory({ packages: pkgs }, (error, data) => { + data; // $ExpectType Data +}); + +get(); diff --git a/types/npm-registry-package-info/tsconfig.json b/types/npm-registry-package-info/tsconfig.json new file mode 100644 index 0000000000..d20c3201d2 --- /dev/null +++ b/types/npm-registry-package-info/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "npm-registry-package-info-tests.ts" + ] +} diff --git a/types/npm-registry-package-info/tslint.json b/types/npm-registry-package-info/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/npm-registry-package-info/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/npm/index.d.ts b/types/npm/index.d.ts index 21ee933e59..066a932440 100644 --- a/types/npm/index.d.ts +++ b/types/npm/index.d.ts @@ -167,8 +167,8 @@ declare namespace NPM { Conf: ConfigStatic; defs: ConfigDefs; - get(setting: string): string; - set(setting: string, value: string): void; + get(setting: string): any; + set(setting: string, value: any): void; loadPrefix(cb: ErrorCallback): void; loadCAFile(caFilePath: string, cb: ErrorCallback): void; diff --git a/types/npm/npm-tests.ts b/types/npm/npm-tests.ts index 8ca5f01887..460e6f450a 100644 --- a/types/npm/npm-tests.ts +++ b/types/npm/npm-tests.ts @@ -22,4 +22,6 @@ npm.load({}, function (er) { npm.on("log", function (message: string) { console.log(message); }); + + npm.config.set('audit', false); }) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 1049535c12..42544390d9 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -10591,6 +10591,18 @@ declare namespace Office { * */ optionalAttendees: string[] | EmailAddressDetails[]; + /** + * Provides access to the resources of an event. Returns an array of strings containing the resources required for the appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
+ */ resources: string[]; /** * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. @@ -10770,7 +10782,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coercionType: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(coercionType: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns the current body in a specified format. * @@ -10792,27 +10804,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; - /** - * Returns the current body in a specified format. - * - * This method returns the entire current body in the format specified by coercionType. - * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. - * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. - * The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param coercionType - The format for the returned body. - */ - getAsync(coercionType: Office.CoercionType): void; + getAsync(coercionType: Office.CoercionType, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a value that indicates whether the content is in HTML or text format. * @@ -10829,7 +10821,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The content type is returned as one of the CoercionType values in the asyncResult.value property. */ - getTypeAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getTypeAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a value that indicates whether the content is in HTML or text format. * @@ -10844,20 +10836,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The content type is returned as one of the CoercionType values in the asyncResult.value property. */ - getTypeAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets a value that indicates whether the content is in HTML or text format. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - */ - getTypeAsync(): void; + getTypeAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds the specified content to the beginning of the item body. * @@ -10883,7 +10862,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - prependAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + prependAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds the specified content to the beginning of the item body. * @@ -10906,28 +10885,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - prependAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Adds the specified content to the beginning of the item body. - * - * The prependAsync method inserts the specified string at the beginning of the item body. - * After insertion, the cursor is returned to its original place, relative to the inserted content. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
- * - * @param data - The string to be inserted at the beginning of the body. The string is limited to 1,000,000 characters. - */ - prependAsync(data: string): void; + prependAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * @@ -10955,7 +10913,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * @@ -10980,30 +10938,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Replaces the entire body with the specified text. - * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. - * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method - * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.
- * - * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. - */ - setAsync(data: string): void; + setAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. @@ -11032,7 +10967,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. * @@ -11057,30 +10992,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Replaces the selection in the body with the specified text. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in - * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the - * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.
- * - * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. - */ - setSelectedDataAsync(data: string): void; + setSelectedDataAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Represents a contact stored on the server. Read mode only. @@ -11213,52 +11125,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - saveAsync(callback?: (result: Office.AsyncResult) => void, asyncContext?: any): void; - /** - * Saves item-specific custom properties to the server. - * - * You must call the saveAsync method to persist any changes made with the set method or the remove method of the CustomProperties object. - * The saving action is asynchronous. - * - * It's a good practice to have your callback function check for and handle errors from saveAsync. - * In particular, a read add-in can be activated while the user is in a connected state in a read form, and subsequently the user becomes - * disconnected. - * If the add-in calls saveAsync while in the disconnected state, saveAsync would return an error. - * Your callback method should handle this error accordingly. - * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Saves item-specific custom properties to the server. - * - * You must call the saveAsync method to persist any changes made with the set method or the remove method of the CustomProperties object. - * The saving action is asynchronous. - * - * It's a good practice to have your callback function check for and handle errors from saveAsync. - * In particular, a read add-in can be activated while the user is in a connected state in a read form, and subsequently the user becomes - * disconnected. - * If the add-in calls saveAsync while in the disconnected state, saveAsync would return an error. - * Your callback method should handle this error accordingly. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(): void; + saveAsync(callback?: (asyncResult: Office.AsyncResult) => void, asyncContext?: any): void; } /** * Provides diagnostic information to an Outlook add-in. @@ -11414,7 +11281,7 @@ declare namespace Office { * * @beta */ - addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; + addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Adds to the set of locations associated with the appointment. * @@ -11433,24 +11300,7 @@ declare namespace Office { * * @beta */ - addAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; - /** - * Adds to the set of locations associated with the appointment. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidFormatError - The format of the specified data object is not valid.
- * - * @param locationIdentifiers The locations to be added to the current list of locations. - * - * @beta - */ - addAsync(locationIdentifiers: LocationIdentifier[]): void; + addAsync(locationIdentifiers: LocationIdentifier[], callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Gets the set of locations associated with the appointment. * @@ -11469,7 +11319,7 @@ declare namespace Office { * * @beta */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the set of locations associated with the appointment. * @@ -11486,21 +11336,7 @@ declare namespace Office { * * @beta */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the set of locations associated with the appointment. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @beta - */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the set of locations associated with the appointment. * @@ -11522,7 +11358,7 @@ declare namespace Office { * * @beta */ - removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; + removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Removes the set of locations associated with the appointment. * @@ -11542,25 +11378,7 @@ declare namespace Office { * * @beta */ - removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; - /** - * Removes the set of locations associated with the appointment. - * - * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param locationIdentifiers The locations to be removed from the current list of locations. - * - * @beta - */ - removeAsync(locationIdentifiers: LocationIdentifier[]): void; + removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (asyncResult: Office.AsyncResultStatus) => void): void; } /** * Represents a collection of entities found in an email message or appointment. Read mode only. @@ -11651,12 +11469,13 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. - * The `value` property of the result is message's from value, as an EmailAddressDetails object. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * The `value` property of the result is the item's from value, as an EmailAddressDetails object. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the from value of a message. * @@ -11673,27 +11492,11 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. - * The `value` property of the result is message's from value, as an EmailAddressDetails object. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * The `value` property of the result is the item's from value, as an EmailAddressDetails object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the from value of a message. - * - * The getAsync method starts an asynchronous call to the Exchange server to get the from value of a message. - * - * The from value of the item is provided as an {@link Office.EmailAddressDetails} in the asyncResult.value property. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -11733,7 +11536,7 @@ declare namespace Office { * * @beta */ - getAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. * If the add-in requests an x-header that is not available, that x-header will not be returned in the results. @@ -11752,24 +11555,7 @@ declare namespace Office { * * @beta */ - getAsync(names: string[], callback?: (result: Office.AsyncResult) => void): void; - /** - * Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. - * If the add-in requests an x-header that is not available, that x-header will not be returned in the results. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param names - The names of the internet headers to be returned. - * - * @beta - */ - getAsync(names: string[]): void; + getAsync(names: string[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method removes the specified headers from the internet header collection. * @@ -11789,7 +11575,7 @@ declare namespace Office { * * @beta */ - removeAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + removeAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method removes the specified headers from the internet header collection. * @@ -11807,23 +11593,7 @@ declare namespace Office { * * @beta */ - removeAsync(names: string[], callback?: (result: Office.AsyncResult) => void): void; - /** - * Given an array of internet header names, this method removes the specified headers from the internet header collection. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param names - The names of the internet headers to be removed. - * - * @beta - */ - removeAsync(names: string[]): void; + removeAsync(names: string[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the specified internet headers to the specified values. * @@ -11847,7 +11617,7 @@ declare namespace Office { * * @beta */ - setAsync(headers: Object, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(headers: Object, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the specified internet headers to the specified values. * @@ -11869,27 +11639,7 @@ declare namespace Office { * * @beta */ - setAsync(headers: Object, callback?: (result: Office.AsyncResult) => void): void; - /** - * Sets the specified internet headers to the specified values. - * - * The setAsync method creates a new header if the specified header does not already exist; otherwise, the existing value is replaced with - * the new value. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param headers - The names and corresponding values of the headers to be set. Should be a dictionary object with keys being the names of the - * internet headers and values being the values of the internet headers. - * - * @beta - */ - setAsync(headers: Object): void; + setAsync(headers: Object, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -11974,10 +11724,10 @@ declare namespace Office { * * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an asyncResult object. - * The `value` property of the result is message's organizer value, as an EmailAddressDetails object. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * The `value` property of the result is the appointment's organizer value, as an EmailAddressDetails object. */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the organizer value of an appointment as an {@link Office.EmailAddressDetails} in the asyncResult.value property. * @@ -11989,22 +11739,10 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an asyncResult object. - * The `value` property of the result is message's organizer value, as an EmailAddressDetails object. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * The `value` property of the result is the appointment's organizer value, as an EmailAddressDetails object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the organizer value of an appointment as an {@link Office.EmailAddressDetails} in the asyncResult.value property. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -12263,11 +12001,11 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12288,33 +12026,11 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12338,13 +12054,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12365,37 +12081,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentFromBase64Async method uploads the file from the base64 encoding and attaches it to the item in the compose form. This method returns the attachment identifier in the asyncResult.value object. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param base64File - The base64 encoded content of an image or file to be added to an email or event. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -12419,7 +12111,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -12441,27 +12133,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -12486,13 +12158,13 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -12517,37 +12189,11 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. - * You can use the options parameter to pass state information to the callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed * @@ -12589,7 +12235,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -12608,22 +12254,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -12648,7 +12279,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -12671,26 +12302,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -12718,7 +12330,7 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -12745,7 +12357,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. * @@ -12771,31 +12383,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes an attachment from a message or appointment. * @@ -12821,29 +12409,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -12869,7 +12435,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -12891,7 +12457,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -12911,25 +12477,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -12961,44 +12509,11 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - */ - saveAsync(): void; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -13029,9 +12544,9 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -13051,7 +12566,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -13060,10 +12575,10 @@ declare namespace Office { * If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -13083,31 +12598,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -13478,7 +12972,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -13500,27 +12994,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the * selected appointment. @@ -13548,33 +13022,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -13602,33 +13050,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -13654,7 +13076,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -13677,24 +13099,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -13736,7 +13141,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -13930,31 +13335,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. @@ -13977,7 +13358,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -13997,25 +13378,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -14122,7 +13485,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. @@ -14145,28 +13508,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. @@ -14196,32 +13538,7 @@ declare namespace Office { * * @beta */ - getAttachmentContentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. - * - * The `getAttachmentContentAsync` method gets the attachment with the specified identifier from the item. As a best practice, you should use - * the identifier to retrieve an attachment in the same session that the attachmentIds were retrieved with the `getAttachmentsAsync` or - * `item.attachments` call. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment you want to get. - * - * @beta - */ - getAttachmentContentAsync(attachmentId: string): void; + getAttachmentContentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. @@ -14249,7 +13566,7 @@ declare namespace Office { * * @beta */ - getAttachmentContentAsync(attachmentId: string, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentContentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -14276,7 +13593,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -14301,26 +13618,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the properties of an appointment or message in a shared folder, calendar, or mailbox. @@ -14341,7 +13639,7 @@ declare namespace Office { * * @beta */ - getSharedPropertiesAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSharedPropertiesAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the properties of an appointment or message in a shared folder, calendar, or mailbox. @@ -14360,7 +13658,7 @@ declare namespace Office { * * @beta */ - getSharedPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + getSharedPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. @@ -14387,32 +13685,8 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. @@ -14435,7 +13709,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. @@ -14456,26 +13730,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * The compose mode of {@link Office.Item | Office.context.mailbox.item}. @@ -14502,6 +13757,7 @@ declare namespace Office { * */ subject: Subject; + /** * Adds a file to a message or appointment as an attachment. * @@ -14526,12 +13782,12 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the * attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14552,34 +13808,12 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. @@ -14604,13 +13838,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14631,37 +13865,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentFromBase64Async method uploads the file from the base64 encoding and attaches it to the item in the compose form. This method returns the attachment identifier in the asyncResult.value object. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param base64File - The base64 encoded content of an image or file to be added to an email or event. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. @@ -14687,14 +13897,14 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -14719,38 +13929,12 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the - * callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed @@ -14793,7 +13977,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -14812,22 +13996,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -14854,7 +14023,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -14879,26 +14048,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -14927,7 +14077,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -14954,7 +14104,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -14981,53 +14131,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - */ - removeAttachmentAsync(attachmentId: string, options: Office.AsyncContextOptions): void; + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -15052,7 +14156,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. @@ -15085,13 +14189,13 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -15123,44 +14227,11 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - */ - saveAsync(): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -15180,7 +14251,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -15189,10 +14260,10 @@ declare namespace Office { * If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -15212,31 +14283,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -15383,33 +14433,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -15437,33 +14461,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -15489,7 +14487,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -15513,25 +14511,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -15574,7 +14554,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -15989,12 +14969,12 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the * attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16015,34 +14995,12 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16066,13 +15024,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16093,13 +15051,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -16123,7 +15081,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -16145,27 +15103,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -16190,14 +15128,14 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -16222,38 +15160,12 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. - * You can use the options parameter to pass state information to the callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed * @@ -16295,7 +15207,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -16314,22 +15226,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -16357,7 +15254,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -16383,27 +15280,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -16432,7 +15309,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -16459,7 +15336,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. * @@ -16485,19 +15362,66 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** - * Asynchronously loads custom properties for this add-in on the selected item. + * Removes an attachment from a message or appointment. * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. + * [Api set: Mailbox 1.1] * - * [Api set: Mailbox 1.0] + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param attachmentId - The identifier of the attachment to remove. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param attachmentId - The identifier of the attachment to remove. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes the event handlers for a supported event type. + * + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. + * + * [Api set: Mailbox 1.7] * * @remarks * @@ -16505,251 +15429,106 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose * + * + * @param eventType - The event that should revoke the handler. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes the event handlers for a supported event type. + * + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. + * + * [Api set: Mailbox 1.7] + * + * @remarks + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
+ * + * @param eventType - The event that should revoke the handler. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. + * + * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. + * + * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param options - An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + */ + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. + * + * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. + * + * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
* * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. - */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. - */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should revoke the handler. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should revoke the handler. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - */ - saveAsync(): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -16769,7 +15548,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -16777,10 +15556,10 @@ declare namespace Office { * applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -16800,31 +15579,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The message read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -17209,7 +15967,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -17231,27 +15989,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the * selected appointment. @@ -17279,33 +16017,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -17333,33 +16045,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -17386,7 +16072,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -17411,26 +16097,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is - * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the - * web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -17474,7 +16141,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -17668,31 +16335,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. * @@ -17714,7 +16357,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -17734,25 +16377,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -17819,9 +16444,9 @@ declare namespace Office { * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. * The location of the appointment is provided as a string in the asyncResult.value property. * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * * [Api set: Mailbox 1.1] @@ -17832,14 +16457,14 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the location of an appointment. * * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. * The location of the appointment is provided as a string in the asyncResult.value property. * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * * [Api set: Mailbox 1.1] @@ -17850,22 +16475,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * */ - getAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Gets the location of an appointment. - * - * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. - * The location of the appointment is provided as a string in the asyncResult.value property. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the location of an appointment. * @@ -17887,25 +16497,7 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters. * */ - setAsync(location: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Sets the location of an appointment. - * - * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. - * Setting the location of an appointment overwrites the current location. - * - * @param location - The location of the appointment. The string is limited to 255 characters. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters.
- */ - setAsync(location: string): void; + setAsync(location: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the location of an appointment. * @@ -17925,7 +16517,7 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters. * */ - setAsync(location: string, callback: (result: Office.AsyncResult) => void): void; + setAsync(location: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Provides access to the Outlook Add-in object model for Microsoft Outlook and Microsoft Outlook on the web. @@ -18051,7 +16643,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -18072,26 +16664,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently, the only supported event type is `Office.EventType.ItemChanged`. In Preview, `Office.EventType.OfficeThemeChanged` is also supported. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Converts an item ID formatted for REST into EWS format. * @@ -18353,36 +16926,7 @@ declare namespace Office { * type Office.AsyncResult. The token is provided as a string in the `asyncResult.value` property. * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. */ - getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (result: Office.AsyncResult) => void): void; - /** - * Gets a string that contains a token used to get an attachment or item from an Exchange Server. - * - * The getCallbackTokenAsync method makes an asynchronous call to get an opaque token from the Exchange Server that hosts the user's mailbox. - * The lifetime of the callback token is 5 minutes. - * - * You can pass the token and an attachment identifier or item identifier to a third-party system. - * The third-party system uses the token as a bearer authorization token to call the Exchange Web Services (EWS) GetAttachment or - * GetItem operation to return an attachment or item. For example, you can create a remote service to get attachments from the selected item. - * - * Your app must have the ReadItem permission specified in its manifest to call the getCallbackTokenAsync method in read mode. - * - * In compose mode you must call the saveAsync method to get an item identifier to pass to the getCallbackTokenAsync method. - * Your app must have ReadWriteItem permissions to call the saveAsync method. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. - * The token is provided as a string in the `asyncResult.value` property. - * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. - */ - getCallbackTokenAsync(callback: (result: Office.AsyncResult) => void): void; + getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a string that contains a token used to get an attachment or item from an Exchange Server. * @@ -18412,7 +16956,7 @@ declare namespace Office { * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. * @param userContext - Optional. Any state data that is passed to the asynchronous method. */ - getCallbackTokenAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + getCallbackTokenAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Gets a token identifying the user and the Office Add-in. * @@ -18436,30 +16980,7 @@ declare namespace Office { * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. * @param userContext - Optional. Any state data that is passed to the asynchronous method.| */ - getUserIdentityTokenAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Gets a token identifying the user and the Office Add-in. - * - * The token is provided as a string in the asyncResult.value property. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * The getUserIdentityTokenAsync method returns a token that you can use to identify and - * {@link https://docs.microsoft.com/outlook/add-ins/authentication | authenticate the add-in and user with a third-party system}. - * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * The token is provided as a string in the `asyncResult.value` property. - * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. - */ - getUserIdentityTokenAsync(callback: (result: Office.AsyncResult) => void): void; + getUserIdentityTokenAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Makes an asynchronous request to an Exchange Web Services (EWS) service on the Exchange server that hosts the user's mailbox. * @@ -18513,60 +17034,7 @@ declare namespace Office { * If the result exceeds 1 MB in size, an error message is returned instead. * @param userContext - Optional. Any state data that is passed to the asynchronous method. */ - makeEwsRequestAsync(data: any, callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Makes an asynchronous request to an Exchange Web Services (EWS) service on the Exchange server that hosts the user's mailbox. - * - * In these cases, add-ins should use REST APIs to access the user's mailbox instead. - * - * The makeEwsRequestAsync method sends an EWS request on behalf of the add-in to Exchange. - * - * You cannot request Folder Associated Items with the makeEwsRequestAsync method. - * - * The XML request must specify UTF-8 encoding. \ - * - * Your add-in must have the ReadWriteMailbox permission to use the makeEwsRequestAsync method. - * For information about using the ReadWriteMailbox permission and the EWS operations that you can call with the makeEwsRequestAsync method, - * see {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Specify permissions for mail add-in access to the user's mailbox}. - * - * The XML result of the EWS call is provided as a string in the asyncResult.value property. - * If the result exceeds 1 MB in size, an error message is returned instead. - * - * **Note**: This method is not supported in the following scenarios: - * - * - In Outlook for iOS or Outlook for Android. - * - * - When the add-in is loaded in a Gmail mailbox. - * - * **Note**: The server administrator must set OAuthAuthentication to true on the Client Access Server EWS directory to enable the - * makeEwsRequestAsync method to make EWS requests. - * - * *Version differences* - * - * When you use the makeEwsRequestAsync method in mail apps running in Outlook versions earlier than version 15.0.4535.1004, you should set - * the encoding value to ISO-8859-1. - * - * `` - * - * You do not need to set the encoding value when your mail app is running in Outlook on the web. - * You can determine whether your mail app is running in Outlook or Outlook on the web by using the mailbox.diagnostics.hostName property. - * You can determine what version of Outlook is running by using the mailbox.diagnostics.hostVersion property. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteMailbox
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param data - The EWS request. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. - * The `value` property of the result is the XML of the EWS request provided as a string. - * If the result exceeds 1 MB in size, an error message is returned instead. - */ - makeEwsRequestAsync(data: any, callback: (result: Office.AsyncResult) => void): void; + makeEwsRequestAsync(data: any, callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. * @@ -18586,7 +17054,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeHandlerAsync(eventType: Office.EventType, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -18605,24 +17073,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently, the only supported event type is `Office.EventType.ItemChanged`. In Preview, `Office.EventType.OfficeThemeChanged` is also supported. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -18744,26 +17195,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - addAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a notification to an item. - * - * There are a maximum of 5 notifications per message. Setting more will return a NumberOfNotificationMessagesExceeded error. - * - * @param key - A developer-specified key used to reference this notification message. Developers can use it to modify this message later. - * It can't be longer than 32 characters. - * @param JSONmessage - A JSON object that contains the notification message to be added to the item. - * It contains a NotificationMessageDetails object. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - addAsync(key: string, JSONmessage: NotificationMessageDetails): void; + addAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a notification to an item. * @@ -18784,7 +17216,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - addAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: Office.AsyncResult) => void): void; + addAsync(key: string, JSONmessage: NotificationMessageDetails, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns all keys and messages for an item. * @@ -18796,16 +17228,12 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * In addition to this signature, this method also has the following signature: - * - * `getAllAsync(callback: (result: Office.AsyncResult) => void): void;` - * * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is an array of NotificationMessageDetails objects. */ - getAllAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAllAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns all keys and messages for an item. * @@ -18820,19 +17248,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is an array of NotificationMessageDetails objects. */ - getAllAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Returns all keys and messages for an item. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - getAllAsync(): void; + getAllAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes a notification message for an item. * @@ -18845,24 +17261,12 @@ declare namespace Office { * * * @param key - The key for the notification message to remove. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeAsync(key: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes a notification message for an item. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param key - The key for the notification message to remove. - */ - removeAsync(key: string): void; + removeAsync(key: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes a notification message for an item. * @@ -18878,7 +17282,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeAsync(key: string, callback: (result: Office.AsyncResult) => void): void; + removeAsync(key: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces a notification message that has a given key with another message. * @@ -18900,25 +17304,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Replaces a notification message that has a given key with another message. - * - * If a notification message with the specified key doesn't exist, replaceAsync will add the notification. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param key - The key for the notification message to replace. It can't be longer than 32 characters. - * @param JSONmessage - A JSON object that contains the new notification message to replace the existing message. - * It contains a NotificationMessageDetails object. - */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails): void; + replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces a notification message that has a given key with another message. * @@ -18938,7 +17324,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: Office.AsyncResult) => void): void; + replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Represents a phone number identified in an item. Read mode only. @@ -19004,30 +17390,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code. */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a recipient list to the existing recipients for an appointment or message. - * - * The recipients parameter can be an array of one of the following: - * - * - Strings containing SMTP email addresses - * - * - EmailUser objects - * - * - EmailAddressDetails objects - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
- * - * @param recipients - The recipients to add to the recipients list. - */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void; + addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a recipient list to the existing recipients for an appointment or message. * @@ -19045,14 +17408,14 @@ declare namespace Office { * * * - * + * *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
* * @param recipients - The recipients to add to the recipients list. * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code. */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: Office.AsyncResult) => void): void; + addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * @@ -19072,7 +17435,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is an array of EmailAddressDetails objects. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * @@ -19090,7 +17453,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is an array of EmailAddressDetails objects. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets a recipient list for an appointment or message. * @@ -19114,14 +17477,14 @@ declare namespace Office { * * * @param recipients - The recipients to add to the recipients list. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred * while adding the data. */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets a recipient list for an appointment or message. * @@ -19145,38 +17508,12 @@ declare namespace Office { * * * @param recipients - The recipients to add to the recipients list. - */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void; - /** - * Sets a recipient list for an appointment or message. - * - * The setAsync method overwrites the current recipient list. - * - * The recipients parameter can be an array of one of the following: - * - * - Strings containing SMTP email addresses - * - * - {@link Office.EmailUser} objects - * - * - {@link Office.EmailAddressDetails} objects - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
- * - * @param recipients - The recipients to add to the recipients list. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred * while adding the data. */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: Office.AsyncResult) => void): void; - + setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -19311,7 +17648,7 @@ declare namespace Office { * asyncResult, which is an Office.AsyncResult object. * The `value` property of the result is a Recurrence object. */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns the current recurrence object of an appointment series. @@ -19331,23 +17668,7 @@ declare namespace Office { * asyncResult, which is an Office.AsyncResult object. * The `value` property of the result is a Recurrence object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - - /** - * Returns the current recurrence object of an appointment series. - * - * This method returns the entire recurrence object for the appointment series. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the recurrence pattern of an appointment series. @@ -19370,7 +17691,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - setAsync(recurrencePattern: Recurrence, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(recurrencePattern: Recurrence, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the recurrence pattern of an appointment series. @@ -19391,28 +17712,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - setAsync(recurrencePattern: Recurrence, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Sets the recurrence pattern of an appointment series. - * - * **Note**: setAsync should only be available for series items and not instance items. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidEndTime - The appointment end time is before its start time.
- * - * @param recurrencePattern - A recurrence object. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - setAsync(recurrencePattern: Recurrence): void; + setAsync(recurrencePattern: Recurrence, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -19524,9 +17824,9 @@ declare namespace Office { attachments?: ReplyFormAttachment[]; /** * When the reply display call completes, the function passed in the callback parameter is called with a single parameter, - *asyncResult, which is an Office.AsyncResult object. + * asyncResult, which is an Office.AsyncResult object. */ - callback?: (result: Office.AsyncResult) => void; + callback?: (asyncResult: Office.AsyncResult) => void; } /** * The settings created by using the methods of the RoamingSettings object are saved per add-in and per user. @@ -19601,23 +17901,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - saveAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Saves the settings. - * - * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use - * the set and get methods to work with the in-memory copy of the settings property bag. - * When you want to persist the settings so that they are available the next time the add-in is used, use the saveAsync method. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}Restricted
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(): void; + saveAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets or creates the specified setting. * @@ -19899,7 +18183,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is the subject of the item. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the subject of an appointment or message. * @@ -19916,7 +18200,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is the subject of the item. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the subject of an appointment or message. * @@ -19933,12 +18217,12 @@ declare namespace Office { * * * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code. */ - setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the subject of an appointment or message. * @@ -19955,28 +18239,10 @@ declare namespace Office { * * * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - */ - setAsync(data: string): void; - /** - * Sets the subject of an appointment or message. - * - * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. - * Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The subject parameter is longer than 255 characters.
- * - * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code. */ - setAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -20034,7 +18300,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is a Date object. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the start or end time of an appointment. * @@ -20052,7 +18318,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is a Date object. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the start or end time of an appointment. * @@ -20071,13 +18337,13 @@ declare namespace Office { * * * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the date and time fails, the asyncResult.error property will contain an error code. */ - setAsync(dateTime: Date, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(dateTime: Date, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the start or end time of an appointment. * @@ -20096,31 +18362,11 @@ declare namespace Office { * * * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - */ - setAsync(dateTime: Date): void; - /** - * Sets the start or end time of an appointment. - * - * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as - * previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. - * - * The time must be in UTC; you can get the correct UTC time by using the convertToUtcClientTime method. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidEndTime - The appointment end time is before the appointment start time.
- * - * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the date and time fails, the asyncResult.error property will contain an error code. */ - setAsync(dateTime: Date, callback: (result: Office.AsyncResult) => void): void; + setAsync(dateTime: Date, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -20131,7 +18377,8 @@ declare namespace Office { * @remarks * * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
+ * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read + * */ interface UserProfile { /** @@ -22715,7 +20962,7 @@ declare namespace Excel { copy(positionType?: "None" | "Before" | "After" | "Beginning" | "End", relativeTo?: Excel.Worksheet): Excel.Worksheet; /** * - * Deletes the worksheet from the workbook. + * Deletes the worksheet from the workbook. Note that if the worksheet's visibility is set to "VeryHidden", the delete operation will fail with a GeneralException. * * [Api set: ExcelApi 1.1] */ diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 3a82c8e70e..c207b00668 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -10591,6 +10591,18 @@ declare namespace Office { * */ optionalAttendees: string[] | EmailAddressDetails[]; + /** + * Provides access to the resources of an event. Returns an array of strings containing the resources required for the appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
+ */ resources: string[]; /** * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. @@ -10770,7 +10782,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coercionType: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(coercionType: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns the current body in a specified format. * @@ -10792,27 +10804,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; - /** - * Returns the current body in a specified format. - * - * This method returns the entire current body in the format specified by coercionType. - * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. - * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. - * The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param coercionType - The format for the returned body. - */ - getAsync(coercionType: Office.CoercionType): void; + getAsync(coercionType: Office.CoercionType, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a value that indicates whether the content is in HTML or text format. * @@ -10829,7 +10821,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The content type is returned as one of the CoercionType values in the asyncResult.value property. */ - getTypeAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getTypeAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a value that indicates whether the content is in HTML or text format. * @@ -10844,20 +10836,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The content type is returned as one of the CoercionType values in the asyncResult.value property. */ - getTypeAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets a value that indicates whether the content is in HTML or text format. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - */ - getTypeAsync(): void; + getTypeAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds the specified content to the beginning of the item body. * @@ -10883,7 +10862,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - prependAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + prependAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds the specified content to the beginning of the item body. * @@ -10906,28 +10885,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - prependAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Adds the specified content to the beginning of the item body. - * - * The prependAsync method inserts the specified string at the beginning of the item body. - * After insertion, the cursor is returned to its original place, relative to the inserted content. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
- * - * @param data - The string to be inserted at the beginning of the body. The string is limited to 1,000,000 characters. - */ - prependAsync(data: string): void; + prependAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * @@ -10955,7 +10913,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * @@ -10980,30 +10938,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Replaces the entire body with the specified text. - * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. - * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method - * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.
- * - * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. - */ - setAsync(data: string): void; + setAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. @@ -11032,7 +10967,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. * @@ -11057,30 +10992,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Replaces the selection in the body with the specified text. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in - * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the - * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.
- * - * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. - */ - setSelectedDataAsync(data: string): void; + setSelectedDataAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Represents a contact stored on the server. Read mode only. @@ -11213,52 +11125,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - saveAsync(callback?: (result: Office.AsyncResult) => void, asyncContext?: any): void; - /** - * Saves item-specific custom properties to the server. - * - * You must call the saveAsync method to persist any changes made with the set method or the remove method of the CustomProperties object. - * The saving action is asynchronous. - * - * It's a good practice to have your callback function check for and handle errors from saveAsync. - * In particular, a read add-in can be activated while the user is in a connected state in a read form, and subsequently the user becomes - * disconnected. - * If the add-in calls saveAsync while in the disconnected state, saveAsync would return an error. - * Your callback method should handle this error accordingly. - * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Saves item-specific custom properties to the server. - * - * You must call the saveAsync method to persist any changes made with the set method or the remove method of the CustomProperties object. - * The saving action is asynchronous. - * - * It's a good practice to have your callback function check for and handle errors from saveAsync. - * In particular, a read add-in can be activated while the user is in a connected state in a read form, and subsequently the user becomes - * disconnected. - * If the add-in calls saveAsync while in the disconnected state, saveAsync would return an error. - * Your callback method should handle this error accordingly. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(): void; + saveAsync(callback?: (asyncResult: Office.AsyncResult) => void, asyncContext?: any): void; } /** * Provides diagnostic information to an Outlook add-in. @@ -11414,7 +11281,7 @@ declare namespace Office { * * @beta */ - addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; + addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Adds to the set of locations associated with the appointment. * @@ -11433,24 +11300,7 @@ declare namespace Office { * * @beta */ - addAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; - /** - * Adds to the set of locations associated with the appointment. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidFormatError - The format of the specified data object is not valid.
- * - * @param locationIdentifiers The locations to be added to the current list of locations. - * - * @beta - */ - addAsync(locationIdentifiers: LocationIdentifier[]): void; + addAsync(locationIdentifiers: LocationIdentifier[], callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Gets the set of locations associated with the appointment. * @@ -11469,7 +11319,7 @@ declare namespace Office { * * @beta */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the set of locations associated with the appointment. * @@ -11486,21 +11336,7 @@ declare namespace Office { * * @beta */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the set of locations associated with the appointment. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @beta - */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the set of locations associated with the appointment. * @@ -11522,7 +11358,7 @@ declare namespace Office { * * @beta */ - removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; + removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Removes the set of locations associated with the appointment. * @@ -11542,25 +11378,7 @@ declare namespace Office { * * @beta */ - removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; - /** - * Removes the set of locations associated with the appointment. - * - * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param locationIdentifiers The locations to be removed from the current list of locations. - * - * @beta - */ - removeAsync(locationIdentifiers: LocationIdentifier[]): void; + removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (asyncResult: Office.AsyncResultStatus) => void): void; } /** * Represents a collection of entities found in an email message or appointment. Read mode only. @@ -11651,12 +11469,13 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. - * The `value` property of the result is message's from value, as an EmailAddressDetails object. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * The `value` property of the result is the item's from value, as an EmailAddressDetails object. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the from value of a message. * @@ -11673,27 +11492,11 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. - * The `value` property of the result is message's from value, as an EmailAddressDetails object. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * The `value` property of the result is the item's from value, as an EmailAddressDetails object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the from value of a message. - * - * The getAsync method starts an asynchronous call to the Exchange server to get the from value of a message. - * - * The from value of the item is provided as an {@link Office.EmailAddressDetails} in the asyncResult.value property. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -11733,7 +11536,7 @@ declare namespace Office { * * @beta */ - getAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. * If the add-in requests an x-header that is not available, that x-header will not be returned in the results. @@ -11752,24 +11555,7 @@ declare namespace Office { * * @beta */ - getAsync(names: string[], callback?: (result: Office.AsyncResult) => void): void; - /** - * Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. - * If the add-in requests an x-header that is not available, that x-header will not be returned in the results. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param names - The names of the internet headers to be returned. - * - * @beta - */ - getAsync(names: string[]): void; + getAsync(names: string[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method removes the specified headers from the internet header collection. * @@ -11789,7 +11575,7 @@ declare namespace Office { * * @beta */ - removeAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + removeAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method removes the specified headers from the internet header collection. * @@ -11807,23 +11593,7 @@ declare namespace Office { * * @beta */ - removeAsync(names: string[], callback?: (result: Office.AsyncResult) => void): void; - /** - * Given an array of internet header names, this method removes the specified headers from the internet header collection. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param names - The names of the internet headers to be removed. - * - * @beta - */ - removeAsync(names: string[]): void; + removeAsync(names: string[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the specified internet headers to the specified values. * @@ -11847,7 +11617,7 @@ declare namespace Office { * * @beta */ - setAsync(headers: Object, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(headers: Object, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the specified internet headers to the specified values. * @@ -11869,27 +11639,7 @@ declare namespace Office { * * @beta */ - setAsync(headers: Object, callback?: (result: Office.AsyncResult) => void): void; - /** - * Sets the specified internet headers to the specified values. - * - * The setAsync method creates a new header if the specified header does not already exist; otherwise, the existing value is replaced with - * the new value. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param headers - The names and corresponding values of the headers to be set. Should be a dictionary object with keys being the names of the - * internet headers and values being the values of the internet headers. - * - * @beta - */ - setAsync(headers: Object): void; + setAsync(headers: Object, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -11974,10 +11724,10 @@ declare namespace Office { * * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an asyncResult object. - * The `value` property of the result is message's organizer value, as an EmailAddressDetails object. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * The `value` property of the result is the appointment's organizer value, as an EmailAddressDetails object. */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the organizer value of an appointment as an {@link Office.EmailAddressDetails} in the asyncResult.value property. * @@ -11989,22 +11739,10 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an asyncResult object. - * The `value` property of the result is message's organizer value, as an EmailAddressDetails object. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * The `value` property of the result is the appointment's organizer value, as an EmailAddressDetails object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the organizer value of an appointment as an {@link Office.EmailAddressDetails} in the asyncResult.value property. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -12263,11 +12001,11 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12288,33 +12026,11 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12338,13 +12054,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12365,37 +12081,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentFromBase64Async method uploads the file from the base64 encoding and attaches it to the item in the compose form. This method returns the attachment identifier in the asyncResult.value object. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param base64File - The base64 encoded content of an image or file to be added to an email or event. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -12419,7 +12111,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -12441,27 +12133,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -12486,13 +12158,13 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -12517,37 +12189,11 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. - * You can use the options parameter to pass state information to the callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed * @@ -12589,7 +12235,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -12608,22 +12254,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -12648,7 +12279,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -12671,26 +12302,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -12718,7 +12330,7 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -12745,7 +12357,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. * @@ -12771,31 +12383,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes an attachment from a message or appointment. * @@ -12821,29 +12409,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -12869,7 +12435,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -12891,7 +12457,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -12911,25 +12477,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -12961,44 +12509,11 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - */ - saveAsync(): void; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -13029,9 +12544,9 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -13051,7 +12566,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -13060,10 +12575,10 @@ declare namespace Office { * If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -13083,31 +12598,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -13478,7 +12972,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -13500,27 +12994,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the * selected appointment. @@ -13548,33 +13022,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -13602,33 +13050,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -13654,7 +13076,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -13677,24 +13099,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -13736,7 +13141,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -13930,31 +13335,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. @@ -13977,7 +13358,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -13997,25 +13378,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -14122,7 +13485,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. @@ -14145,28 +13508,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. @@ -14196,32 +13538,7 @@ declare namespace Office { * * @beta */ - getAttachmentContentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. - * - * The `getAttachmentContentAsync` method gets the attachment with the specified identifier from the item. As a best practice, you should use - * the identifier to retrieve an attachment in the same session that the attachmentIds were retrieved with the `getAttachmentsAsync` or - * `item.attachments` call. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment you want to get. - * - * @beta - */ - getAttachmentContentAsync(attachmentId: string): void; + getAttachmentContentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. @@ -14249,7 +13566,7 @@ declare namespace Office { * * @beta */ - getAttachmentContentAsync(attachmentId: string, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentContentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -14276,7 +13593,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -14301,26 +13618,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the properties of an appointment or message in a shared folder, calendar, or mailbox. @@ -14341,7 +13639,7 @@ declare namespace Office { * * @beta */ - getSharedPropertiesAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSharedPropertiesAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the properties of an appointment or message in a shared folder, calendar, or mailbox. @@ -14360,7 +13658,7 @@ declare namespace Office { * * @beta */ - getSharedPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + getSharedPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. @@ -14387,32 +13685,8 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. @@ -14435,7 +13709,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. @@ -14456,26 +13730,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * The compose mode of {@link Office.Item | Office.context.mailbox.item}. @@ -14502,6 +13757,7 @@ declare namespace Office { * */ subject: Subject; + /** * Adds a file to a message or appointment as an attachment. * @@ -14526,12 +13782,12 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the * attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14552,34 +13808,12 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. @@ -14604,13 +13838,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14631,37 +13865,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentFromBase64Async method uploads the file from the base64 encoding and attaches it to the item in the compose form. This method returns the attachment identifier in the asyncResult.value object. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param base64File - The base64 encoded content of an image or file to be added to an email or event. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. @@ -14687,14 +13897,14 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -14719,38 +13929,12 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the - * callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed @@ -14793,7 +13977,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -14812,22 +13996,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -14854,7 +14023,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -14879,26 +14048,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -14927,7 +14077,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -14954,7 +14104,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -14981,53 +14131,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - */ - removeAttachmentAsync(attachmentId: string, options: Office.AsyncContextOptions): void; + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -15052,7 +14156,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. @@ -15085,13 +14189,13 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -15123,44 +14227,11 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - */ - saveAsync(): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -15180,7 +14251,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -15189,10 +14260,10 @@ declare namespace Office { * If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -15212,31 +14283,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -15383,33 +14433,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -15437,33 +14461,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -15489,7 +14487,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -15513,25 +14511,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -15574,7 +14554,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -15989,12 +14969,12 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the * attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16015,34 +14995,12 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16066,13 +15024,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16093,13 +15051,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -16123,7 +15081,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -16145,27 +15103,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -16190,14 +15128,14 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -16222,38 +15160,12 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. - * You can use the options parameter to pass state information to the callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed * @@ -16295,7 +15207,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -16314,22 +15226,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -16357,7 +15254,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -16383,27 +15280,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -16432,7 +15309,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -16459,7 +15336,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. * @@ -16485,19 +15362,66 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** - * Asynchronously loads custom properties for this add-in on the selected item. + * Removes an attachment from a message or appointment. * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. + * [Api set: Mailbox 1.1] * - * [Api set: Mailbox 1.0] + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param attachmentId - The identifier of the attachment to remove. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param attachmentId - The identifier of the attachment to remove. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes the event handlers for a supported event type. + * + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. + * + * [Api set: Mailbox 1.7] * * @remarks * @@ -16505,251 +15429,106 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose * + * + * @param eventType - The event that should revoke the handler. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes the event handlers for a supported event type. + * + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. + * + * [Api set: Mailbox 1.7] + * + * @remarks + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
+ * + * @param eventType - The event that should revoke the handler. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. + * + * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. + * + * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param options - An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + */ + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. + * + * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. + * + * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
* * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. - */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. - */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should revoke the handler. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should revoke the handler. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - */ - saveAsync(): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -16769,7 +15548,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -16777,10 +15556,10 @@ declare namespace Office { * applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -16800,31 +15579,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The message read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -17209,7 +15967,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -17231,27 +15989,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the * selected appointment. @@ -17279,33 +16017,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -17333,33 +16045,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -17386,7 +16072,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -17411,26 +16097,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is - * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the - * web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -17474,7 +16141,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -17668,31 +16335,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. * @@ -17714,7 +16357,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -17734,25 +16377,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -17819,9 +16444,9 @@ declare namespace Office { * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. * The location of the appointment is provided as a string in the asyncResult.value property. * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * * [Api set: Mailbox 1.1] @@ -17832,14 +16457,14 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the location of an appointment. * * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. * The location of the appointment is provided as a string in the asyncResult.value property. * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * * [Api set: Mailbox 1.1] @@ -17850,22 +16475,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * */ - getAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Gets the location of an appointment. - * - * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. - * The location of the appointment is provided as a string in the asyncResult.value property. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the location of an appointment. * @@ -17887,25 +16497,7 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters. * */ - setAsync(location: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Sets the location of an appointment. - * - * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. - * Setting the location of an appointment overwrites the current location. - * - * @param location - The location of the appointment. The string is limited to 255 characters. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters.
- */ - setAsync(location: string): void; + setAsync(location: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the location of an appointment. * @@ -17925,7 +16517,7 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters. * */ - setAsync(location: string, callback: (result: Office.AsyncResult) => void): void; + setAsync(location: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Provides access to the Outlook Add-in object model for Microsoft Outlook and Microsoft Outlook on the web. @@ -18051,7 +16643,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -18072,26 +16664,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently, the only supported event type is `Office.EventType.ItemChanged`. In Preview, `Office.EventType.OfficeThemeChanged` is also supported. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Converts an item ID formatted for REST into EWS format. * @@ -18353,36 +16926,7 @@ declare namespace Office { * type Office.AsyncResult. The token is provided as a string in the `asyncResult.value` property. * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. */ - getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (result: Office.AsyncResult) => void): void; - /** - * Gets a string that contains a token used to get an attachment or item from an Exchange Server. - * - * The getCallbackTokenAsync method makes an asynchronous call to get an opaque token from the Exchange Server that hosts the user's mailbox. - * The lifetime of the callback token is 5 minutes. - * - * You can pass the token and an attachment identifier or item identifier to a third-party system. - * The third-party system uses the token as a bearer authorization token to call the Exchange Web Services (EWS) GetAttachment or - * GetItem operation to return an attachment or item. For example, you can create a remote service to get attachments from the selected item. - * - * Your app must have the ReadItem permission specified in its manifest to call the getCallbackTokenAsync method in read mode. - * - * In compose mode you must call the saveAsync method to get an item identifier to pass to the getCallbackTokenAsync method. - * Your app must have ReadWriteItem permissions to call the saveAsync method. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. - * The token is provided as a string in the `asyncResult.value` property. - * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. - */ - getCallbackTokenAsync(callback: (result: Office.AsyncResult) => void): void; + getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a string that contains a token used to get an attachment or item from an Exchange Server. * @@ -18412,7 +16956,7 @@ declare namespace Office { * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. * @param userContext - Optional. Any state data that is passed to the asynchronous method. */ - getCallbackTokenAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + getCallbackTokenAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Gets a token identifying the user and the Office Add-in. * @@ -18436,30 +16980,7 @@ declare namespace Office { * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. * @param userContext - Optional. Any state data that is passed to the asynchronous method.| */ - getUserIdentityTokenAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Gets a token identifying the user and the Office Add-in. - * - * The token is provided as a string in the asyncResult.value property. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * The getUserIdentityTokenAsync method returns a token that you can use to identify and - * {@link https://docs.microsoft.com/outlook/add-ins/authentication | authenticate the add-in and user with a third-party system}. - * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * The token is provided as a string in the `asyncResult.value` property. - * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. - */ - getUserIdentityTokenAsync(callback: (result: Office.AsyncResult) => void): void; + getUserIdentityTokenAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Makes an asynchronous request to an Exchange Web Services (EWS) service on the Exchange server that hosts the user's mailbox. * @@ -18513,60 +17034,7 @@ declare namespace Office { * If the result exceeds 1 MB in size, an error message is returned instead. * @param userContext - Optional. Any state data that is passed to the asynchronous method. */ - makeEwsRequestAsync(data: any, callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Makes an asynchronous request to an Exchange Web Services (EWS) service on the Exchange server that hosts the user's mailbox. - * - * In these cases, add-ins should use REST APIs to access the user's mailbox instead. - * - * The makeEwsRequestAsync method sends an EWS request on behalf of the add-in to Exchange. - * - * You cannot request Folder Associated Items with the makeEwsRequestAsync method. - * - * The XML request must specify UTF-8 encoding. \ - * - * Your add-in must have the ReadWriteMailbox permission to use the makeEwsRequestAsync method. - * For information about using the ReadWriteMailbox permission and the EWS operations that you can call with the makeEwsRequestAsync method, - * see {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Specify permissions for mail add-in access to the user's mailbox}. - * - * The XML result of the EWS call is provided as a string in the asyncResult.value property. - * If the result exceeds 1 MB in size, an error message is returned instead. - * - * **Note**: This method is not supported in the following scenarios: - * - * - In Outlook for iOS or Outlook for Android. - * - * - When the add-in is loaded in a Gmail mailbox. - * - * **Note**: The server administrator must set OAuthAuthentication to true on the Client Access Server EWS directory to enable the - * makeEwsRequestAsync method to make EWS requests. - * - * *Version differences* - * - * When you use the makeEwsRequestAsync method in mail apps running in Outlook versions earlier than version 15.0.4535.1004, you should set - * the encoding value to ISO-8859-1. - * - * `` - * - * You do not need to set the encoding value when your mail app is running in Outlook on the web. - * You can determine whether your mail app is running in Outlook or Outlook on the web by using the mailbox.diagnostics.hostName property. - * You can determine what version of Outlook is running by using the mailbox.diagnostics.hostVersion property. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteMailbox
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param data - The EWS request. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. - * The `value` property of the result is the XML of the EWS request provided as a string. - * If the result exceeds 1 MB in size, an error message is returned instead. - */ - makeEwsRequestAsync(data: any, callback: (result: Office.AsyncResult) => void): void; + makeEwsRequestAsync(data: any, callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. * @@ -18586,7 +17054,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeHandlerAsync(eventType: Office.EventType, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -18605,24 +17073,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently, the only supported event type is `Office.EventType.ItemChanged`. In Preview, `Office.EventType.OfficeThemeChanged` is also supported. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -18744,26 +17195,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - addAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a notification to an item. - * - * There are a maximum of 5 notifications per message. Setting more will return a NumberOfNotificationMessagesExceeded error. - * - * @param key - A developer-specified key used to reference this notification message. Developers can use it to modify this message later. - * It can't be longer than 32 characters. - * @param JSONmessage - A JSON object that contains the notification message to be added to the item. - * It contains a NotificationMessageDetails object. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - addAsync(key: string, JSONmessage: NotificationMessageDetails): void; + addAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a notification to an item. * @@ -18784,7 +17216,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - addAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: Office.AsyncResult) => void): void; + addAsync(key: string, JSONmessage: NotificationMessageDetails, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns all keys and messages for an item. * @@ -18796,16 +17228,12 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * In addition to this signature, this method also has the following signature: - * - * `getAllAsync(callback: (result: Office.AsyncResult) => void): void;` - * * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is an array of NotificationMessageDetails objects. */ - getAllAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAllAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns all keys and messages for an item. * @@ -18820,19 +17248,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is an array of NotificationMessageDetails objects. */ - getAllAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Returns all keys and messages for an item. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - getAllAsync(): void; + getAllAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes a notification message for an item. * @@ -18845,24 +17261,12 @@ declare namespace Office { * * * @param key - The key for the notification message to remove. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeAsync(key: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes a notification message for an item. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param key - The key for the notification message to remove. - */ - removeAsync(key: string): void; + removeAsync(key: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes a notification message for an item. * @@ -18878,7 +17282,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeAsync(key: string, callback: (result: Office.AsyncResult) => void): void; + removeAsync(key: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces a notification message that has a given key with another message. * @@ -18900,25 +17304,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Replaces a notification message that has a given key with another message. - * - * If a notification message with the specified key doesn't exist, replaceAsync will add the notification. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param key - The key for the notification message to replace. It can't be longer than 32 characters. - * @param JSONmessage - A JSON object that contains the new notification message to replace the existing message. - * It contains a NotificationMessageDetails object. - */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails): void; + replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces a notification message that has a given key with another message. * @@ -18938,7 +17324,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: Office.AsyncResult) => void): void; + replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Represents a phone number identified in an item. Read mode only. @@ -19004,30 +17390,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code. */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a recipient list to the existing recipients for an appointment or message. - * - * The recipients parameter can be an array of one of the following: - * - * - Strings containing SMTP email addresses - * - * - EmailUser objects - * - * - EmailAddressDetails objects - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
- * - * @param recipients - The recipients to add to the recipients list. - */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void; + addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a recipient list to the existing recipients for an appointment or message. * @@ -19045,14 +17408,14 @@ declare namespace Office { * * * - * + * *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
* * @param recipients - The recipients to add to the recipients list. * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code. */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: Office.AsyncResult) => void): void; + addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * @@ -19072,7 +17435,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is an array of EmailAddressDetails objects. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * @@ -19090,7 +17453,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is an array of EmailAddressDetails objects. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets a recipient list for an appointment or message. * @@ -19114,14 +17477,14 @@ declare namespace Office { * * * @param recipients - The recipients to add to the recipients list. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred * while adding the data. */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets a recipient list for an appointment or message. * @@ -19145,38 +17508,12 @@ declare namespace Office { * * * @param recipients - The recipients to add to the recipients list. - */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void; - /** - * Sets a recipient list for an appointment or message. - * - * The setAsync method overwrites the current recipient list. - * - * The recipients parameter can be an array of one of the following: - * - * - Strings containing SMTP email addresses - * - * - {@link Office.EmailUser} objects - * - * - {@link Office.EmailAddressDetails} objects - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
- * - * @param recipients - The recipients to add to the recipients list. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred * while adding the data. */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: Office.AsyncResult) => void): void; - + setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -19311,7 +17648,7 @@ declare namespace Office { * asyncResult, which is an Office.AsyncResult object. * The `value` property of the result is a Recurrence object. */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns the current recurrence object of an appointment series. @@ -19331,23 +17668,7 @@ declare namespace Office { * asyncResult, which is an Office.AsyncResult object. * The `value` property of the result is a Recurrence object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - - /** - * Returns the current recurrence object of an appointment series. - * - * This method returns the entire recurrence object for the appointment series. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the recurrence pattern of an appointment series. @@ -19370,7 +17691,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - setAsync(recurrencePattern: Recurrence, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(recurrencePattern: Recurrence, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the recurrence pattern of an appointment series. @@ -19391,28 +17712,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - setAsync(recurrencePattern: Recurrence, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Sets the recurrence pattern of an appointment series. - * - * **Note**: setAsync should only be available for series items and not instance items. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidEndTime - The appointment end time is before its start time.
- * - * @param recurrencePattern - A recurrence object. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - setAsync(recurrencePattern: Recurrence): void; + setAsync(recurrencePattern: Recurrence, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -19524,9 +17824,9 @@ declare namespace Office { attachments?: ReplyFormAttachment[]; /** * When the reply display call completes, the function passed in the callback parameter is called with a single parameter, - *asyncResult, which is an Office.AsyncResult object. + * asyncResult, which is an Office.AsyncResult object. */ - callback?: (result: Office.AsyncResult) => void; + callback?: (asyncResult: Office.AsyncResult) => void; } /** * The settings created by using the methods of the RoamingSettings object are saved per add-in and per user. @@ -19601,23 +17901,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - saveAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Saves the settings. - * - * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use - * the set and get methods to work with the in-memory copy of the settings property bag. - * When you want to persist the settings so that they are available the next time the add-in is used, use the saveAsync method. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}Restricted
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(): void; + saveAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets or creates the specified setting. * @@ -19899,7 +18183,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is the subject of the item. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the subject of an appointment or message. * @@ -19916,7 +18200,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is the subject of the item. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the subject of an appointment or message. * @@ -19933,12 +18217,12 @@ declare namespace Office { * * * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code. */ - setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the subject of an appointment or message. * @@ -19955,28 +18239,10 @@ declare namespace Office { * * * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - */ - setAsync(data: string): void; - /** - * Sets the subject of an appointment or message. - * - * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. - * Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The subject parameter is longer than 255 characters.
- * - * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code. */ - setAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -20034,7 +18300,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is a Date object. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the start or end time of an appointment. * @@ -20052,7 +18318,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is a Date object. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the start or end time of an appointment. * @@ -20071,13 +18337,13 @@ declare namespace Office { * * * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the date and time fails, the asyncResult.error property will contain an error code. */ - setAsync(dateTime: Date, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(dateTime: Date, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the start or end time of an appointment. * @@ -20096,31 +18362,11 @@ declare namespace Office { * * * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - */ - setAsync(dateTime: Date): void; - /** - * Sets the start or end time of an appointment. - * - * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as - * previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. - * - * The time must be in UTC; you can get the correct UTC time by using the convertToUtcClientTime method. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidEndTime - The appointment end time is before the appointment start time.
- * - * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the date and time fails, the asyncResult.error property will contain an error code. */ - setAsync(dateTime: Date, callback: (result: Office.AsyncResult) => void): void; + setAsync(dateTime: Date, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -20131,7 +18377,8 @@ declare namespace Office { * @remarks * * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
+ * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read + * */ interface UserProfile { /** @@ -21971,7 +20218,7 @@ declare namespace Excel { copy(positionType?: "None" | "Before" | "After" | "Beginning" | "End", relativeTo?: Excel.Worksheet): Excel.Worksheet; /** * - * Deletes the worksheet from the workbook. + * Deletes the worksheet from the workbook. Note that if the worksheet's visibility is set to "VeryHidden", the delete operation will fail with a GeneralException. * * [Api set: ExcelApi 1.1] */ diff --git a/types/p-throttle/index.d.ts b/types/p-throttle/index.d.ts deleted file mode 100644 index ae331e1ca2..0000000000 --- a/types/p-throttle/index.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -// Type definitions for p-throttle 1.1 -// Project: https://github.com/sindresorhus/p-throttle#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pThrottle; - -declare function pThrottle(fn: () => PromiseLike | R, limit: number, interval: number): (() => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1) => PromiseLike | R, limit: number, interval: number): ((arg1: T1) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1, arg2: T2) => PromiseLike | R, limit: number, interval: number): ((arg1: T1, arg2: T2) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1, arg2: T2, arg3: T3) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise) & { abort(): void; }; -declare function pThrottle( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7) => Promise) & { abort(): void; }; -declare function pThrottle( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8) => Promise) & { abort(): void; }; -declare function pThrottle( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9) => Promise) & { abort(): void; }; -declare function pThrottle( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (...args: any[]) => PromiseLike | R, limit: number, interval: number): ((...args: any[]) => Promise) & { abort(): void; }; - -declare namespace pThrottle { - class AbortError extends Error { - readonly name: 'AbortError'; - - constructor(); - } -} diff --git a/types/p-throttle/p-throttle-tests.ts b/types/p-throttle/p-throttle-tests.ts deleted file mode 100644 index 713d445e6b..0000000000 --- a/types/p-throttle/p-throttle-tests.ts +++ /dev/null @@ -1,47 +0,0 @@ -import pThrottle = require('p-throttle'); - -const now = Date.now(); - -const throttled = pThrottle((i: number) => { - const secDiff = ((Date.now() - now) / 1000).toFixed(); - return Promise.resolve(`${i}: ${secDiff}s`); -}, 2, 1000); - -for (let i = 1; i <= 6; i++) { - throttled(i).then(res => { - const str: string = res; - }); -} - -throttled.abort(); - -pThrottle(() => true, 2, 3).abort(); -pThrottle(() => true, 2, 3)(); -pThrottle((n: number, s: string) => true, 2, 3).abort(); -pThrottle((n: number, s: string) => true, 2, 3)(1, 's'); -pThrottle((n: number, s: string, b: boolean) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean) => true, 2, 3)(1, 's', true); -pThrottle((n: number, s: string, b: boolean, n2: number) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number) => true, 2, 3)(1, 's', true, 1); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string) => true, 2, 3)(1, 's', true, 1, 's'); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean) => true, 2, 3)(1, 's', true, 1, 's', false); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1, 2); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1, 2, 3); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1, 2, 3, 4); -pThrottle( - (n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number, s3: string) => true, - 2, - 3).abort(); -pThrottle( - (n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number, s3: string) => true, - 2, - 3)(1, 's', true, 1, 's', false, 1, 2, 3, 4, 'as'); - -throw new pThrottle.AbortError(); diff --git a/types/parse-unit/index.d.ts b/types/parse-unit/index.d.ts index 238f3cfc06..7b37d0e64b 100644 --- a/types/parse-unit/index.d.ts +++ b/types/parse-unit/index.d.ts @@ -3,5 +3,5 @@ // Definitions by: Jack Works // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function parse(value: string): [number, string]; +declare function parse(value: string | number): [number, string]; export = parse; diff --git a/types/parse-unit/parse-unit-tests.ts b/types/parse-unit/parse-unit-tests.ts index dd5dcb7e9f..5cd4b180b8 100644 --- a/types/parse-unit/parse-unit-tests.ts +++ b/types/parse-unit/parse-unit-tests.ts @@ -2,3 +2,7 @@ import parse = require('parse-unit'); const [number, length] = parse('10px'); number === 50; length === 'px'; + +parse(10).length === 2; +parse(10)[0] === 10; +parse(10)[1] === ''; diff --git a/types/pikaday/index.d.ts b/types/pikaday/index.d.ts index fad074ae33..2233fa9b4c 100644 --- a/types/pikaday/index.d.ts +++ b/types/pikaday/index.d.ts @@ -44,7 +44,7 @@ declare class Pikaday { * can optionally be passed as the second parameter to prevent triggering * of the onSelect callback, allowing the date to be set silently. */ - setDate(date: string | Date, preventOnSelect?: boolean): void; + setDate(date: string | Date | null, preventOnSelect?: boolean): void; /** * Returns a Moment.js object for the selected date (Moment must be @@ -101,13 +101,13 @@ declare class Pikaday { * Update the range start date. For using two Pikaday instances to * select a date range. */ - setStartRange(date: Date): void; + setStartRange(date: Date | null): void; /** * Update the range end date. For using two Pikaday instances to select * a date range. */ - setEndRange(date: Date): void; + setEndRange(date: Date | null): void; /** * Update the HTML. @@ -138,6 +138,11 @@ declare class Pikaday { * Hide the picker and remove all event listeners - no going back! */ destroy(): void; + + /** + * Clear and reset the date + */ + clear(): void; } // merge the Pikaday class declaration with a module diff --git a/types/pikaday/pikaday-tests.ts b/types/pikaday/pikaday-tests.ts index 7a532efb6f..230104daf7 100644 --- a/types/pikaday/pikaday-tests.ts +++ b/types/pikaday/pikaday-tests.ts @@ -31,6 +31,8 @@ new Pikaday({field: $('#datepicker')[0]}); picker.getDate(); picker.setDate('2015-01-01'); picker.setDate('2015-01-01', true); + picker.setDate(null); + picker.setDate(null, true); picker.getMoment(); picker.setMoment(moment('14th February 2014', 'DDo MMMM YYYY')); picker.setMoment(moment('14th February 2014', 'DDo MMMM YYYY'), true); @@ -45,11 +47,14 @@ new Pikaday({field: $('#datepicker')[0]}); picker.setMinDate(null); picker.setMaxDate(null); picker.setStartRange(new Date()); + picker.setStartRange(null); picker.setEndRange(new Date()); + picker.setEndRange(null); picker.isVisible(); picker.show(); picker.adjustPosition(); picker.hide(); + picker.clear(); picker.destroy(); })(); diff --git a/types/pkgcloud/README.md b/types/pkgcloud/README.md new file mode 100644 index 0000000000..20815adfb4 --- /dev/null +++ b/types/pkgcloud/README.md @@ -0,0 +1,7 @@ +This file exists for reminding contributors that this definition is **WIP**. + +### Note + +pkgcloud has a large number of client types and providers. Only some clients and providers have types defined. + +You are welcome to contribute definitions for other clients and providers and add provider specific properties. diff --git a/types/pkgcloud/index.d.ts b/types/pkgcloud/index.d.ts new file mode 100644 index 0000000000..7a0a55a773 --- /dev/null +++ b/types/pkgcloud/index.d.ts @@ -0,0 +1,131 @@ +// Type definitions for pkgcloud 1.7 +// Project: https://github.com/pkgcloud/pkgcloud#readme +// Definitions by: Daniel Friesen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +export const version: string; + +export interface ClientError extends Error { + provider?: Providers; + method?: string; + failCode?: string; + statusCode?: number; + href?: string; + headers?: { [headerName: string]: string }; + result?: any; +} + +export type Providers = + | 'amazon' + | 'azure' + | 'digitalocean' + | 'google' + | 'hp' + | 'iriscouch' + | 'joyent' + | 'mongohq' + | 'mongolab' + | 'oneandone' + | 'openstack' + | 'rackspace' + | 'redistogo' + | 'telefonic'; + +export interface BaseProviderOptions { + provider: Providers; +} + +export interface AmazonProviderOptions { + provider: 'amazon'; + keyId: string; + key: string; + region?: string; +} + +export interface AzureProviderOptions { + provider: 'azure'; + storageAccount: string; + storageAccessKey: string; + location?: string; +} + +export type ProviderOptions = BaseProviderOptions & Partial< + | AmazonProviderOptions + | AzureProviderOptions +>; + +/** + * Storage + */ + +export namespace storage { + interface StorageUploadOptions { + container: string; + remote: string; + } + + interface StorageDownloadOptions { + container: string; + remote: string; + } + + interface Client { + provider: string; + config: ProviderOptions; + protocol: string; + + getContainers( + callback: (err: ClientError, containers: Container[]) => any, + ): void; + createContainer( + options: any, + callback: (err: ClientError, container: Container) => any, + ): void; + destroyContainer( + containerName: string, + callback: (err: ClientError) => any, + ): void; + getContainer( + containerName: string, + callback: (err: ClientError, container: Container) => any, + ): void; + upload(options: StorageUploadOptions): NodeJS.WriteStream; + download(options: StorageDownloadOptions): NodeJS.ReadStream; + getFiles( + containerName: string, + callback: (err: ClientError, files: File[]) => any, + ): void; + getFile( + containerName: string, + file: string, + callback: (err: ClientError, file: File) => any, + ): void; + removeFile( + containerName: string, + file: string, + callback: (err: ClientError) => any, + ): void; + // Logs + on( + eventName: string, + callback: (message: string, object?: any) => any, + ): void; + } + + interface Container { + // files: ? + client: Client; + } + + interface File { + container: string; + name: string; + size: number; + client: Client; + } + + function createClient(options: ProviderOptions): Client; +} diff --git a/types/pkgcloud/pkgcloud-tests.ts b/types/pkgcloud/pkgcloud-tests.ts new file mode 100644 index 0000000000..62846b6b55 --- /dev/null +++ b/types/pkgcloud/pkgcloud-tests.ts @@ -0,0 +1,64 @@ +import { createReadStream, createWriteStream } from "fs"; +import * as pkgcloud from "pkgcloud"; + +/** + * Storage + */ + +// Amazon +pkgcloud.storage.createClient({ + provider: 'amazon', + keyId: 'ABDEFGHI', + key: 'AABDEF==', +}); + +// Azure +pkgcloud.storage.createClient({ + provider: 'azure', + storageAccount: 'abcdefg', + storageAccessKey: 'AABDEF==', +}); + +// Upload a File +{ + const client = pkgcloud.storage.createClient({ + provider: 'amazon' + }); + + const readStream = createReadStream('a-file.txt'); + const writeStream = client.upload({ + container: 'a-container', + remote: 'remote-file-name.txt' + }); + + writeStream.on('error', (err: pkgcloud.ClientError) => {}); + writeStream.on('success', (file: pkgcloud.storage.File) => {}); + readStream.pipe(writeStream); +} + +// Download a File +{ + const client = pkgcloud.storage.createClient({ + provider: 'amazon' + }); + + const readStream = client.download({ + container: 'a-container', + remote: 'remote-file-name.txt' + }); + readStream.pipe(createWriteStream('a-file.txt')); +} + +// Logs +{ + const client = pkgcloud.storage.createClient({ + provider: 'amazon' + }); + + client.on('log::*', (message, object) => { + console.log(message); + if (object) { + console.dir(object); + } + }); +} diff --git a/types/pkgcloud/tsconfig.json b/types/pkgcloud/tsconfig.json new file mode 100644 index 0000000000..f36ed5e952 --- /dev/null +++ b/types/pkgcloud/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pkgcloud-tests.ts" + ] +} diff --git a/types/pkgcloud/tslint.json b/types/pkgcloud/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pkgcloud/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/postman-collection/index.d.ts b/types/postman-collection/index.d.ts index 7a05c39128..0b32209b4f 100644 --- a/types/postman-collection/index.d.ts +++ b/types/postman-collection/index.d.ts @@ -154,7 +154,7 @@ export interface ItemGroupDefinition extends PropertyDefinition { export class ItemGroup extends Property { auth?: RequestAuth; - items: PropertyList; + items: PropertyList>; events: EventList; constructor(definition?: ItemGroupDefinition); diff --git a/types/postman-collection/postman-collection-tests.ts b/types/postman-collection/postman-collection-tests.ts index d203ed68f0..6b00083e74 100644 --- a/types/postman-collection/postman-collection-tests.ts +++ b/types/postman-collection/postman-collection-tests.ts @@ -137,7 +137,7 @@ igDef.event; // $ExpectType EventDefinition[] | undefined // ItemGroup Tests const ig = new pmCollection.ItemGroup(); ig.auth; // $ExpectType RequestAuth | undefined -ig.items; // $ExpectType PropertyList +ig.items; // $ExpectType PropertyList> ig.events; // $ExpectType EventList ig.authorizeRequestsUsing("string"); // $ExpectType void diff --git a/types/react-aria-menubutton/index.d.ts b/types/react-aria-menubutton/index.d.ts index 157fdff642..dc3d975d64 100644 --- a/types/react-aria-menubutton/index.d.ts +++ b/types/react-aria-menubutton/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-aria-menubutton 6.1 +// Type definitions for react-aria-menubutton 6.2 // Project: https://github.com/davidtheclark/react-aria-menubutton // Definitions by: Muhammad Fawwaz Orabi // Chris Rohlfs @@ -100,7 +100,7 @@ export interface MenuItemProps * If value has a value, it will be passed to the onSelection handler * when the `MenuItem` is selected */ - value?: string | boolean | number; + value?: any; /** * If `text` has a value, its first letter will be the letter a user can diff --git a/types/react-aria-menubutton/react-aria-menubutton-tests.tsx b/types/react-aria-menubutton/react-aria-menubutton-tests.tsx index f284e932a4..e3b543103a 100644 --- a/types/react-aria-menubutton/react-aria-menubutton-tests.tsx +++ b/types/react-aria-menubutton/react-aria-menubutton-tests.tsx @@ -121,3 +121,18 @@ closeMenu("", { focusMenu: true }); openMenu(""); openMenu("", { focusMenu: true }); + +class ObjectMenuItem extends React.Component { + render() { + const itemValue = { name: "Test name", label: "Only item to select" }; + return ( + console.log(value.name)}> +
  • + {itemValue.label} +
  • +
    + ); + } +} + +ReactDOM.render(, document.body); diff --git a/types/react-big-calendar/index.d.ts b/types/react-big-calendar/index.d.ts index 3607086e06..7a6bebe1c2 100644 --- a/types/react-big-calendar/index.d.ts +++ b/types/react-big-calendar/index.d.ts @@ -114,7 +114,7 @@ export interface HeaderProps { } export interface Components { - event?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + event?: React.ComponentType; eventWrapper?: React.ComponentType; eventContainerWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; dayWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; @@ -157,6 +157,11 @@ export interface ToolbarProps { children?: React.ReactNode; } +export interface EventProps { + event: T; + title: string; +} + export interface EventWrapperProps { // https://github.com/intljusticemission/react-big-calendar/blob/27a2656b40ac8729634d24376dff8ea781a66d50/src/TimeGridEvent.js#L28 style?: React.CSSProperties & { xOffset: number }; diff --git a/types/react-dom/index.d.ts b/types/react-dom/index.d.ts index f81bbf4021..19c842f5a2 100644 --- a/types/react-dom/index.d.ts +++ b/types/react-dom/index.d.ts @@ -17,7 +17,7 @@ import { DOMAttributes, DOMElement, ReactNode, ReactPortal } from 'react'; -export function findDOMNode(instance: ReactInstance): Element | null | Text; +export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text; export function unmountComponentAtNode(container: Element): boolean; export function createPortal(children: ReactNode, container: Element, key?: null | string): ReactPortal; diff --git a/types/react-dom/react-dom-tests.tsx b/types/react-dom/react-dom-tests.tsx index 46274e3ffd..20bfda53ea 100644 --- a/types/react-dom/react-dom-tests.tsx +++ b/types/react-dom/react-dom-tests.tsx @@ -30,6 +30,8 @@ describe('ReactDOM', () => { const rootElement = document.createElement('div'); ReactDOM.render(React.createElement('div'), rootElement); ReactDOM.findDOMNode(rootElement); + ReactDOM.findDOMNode(null); + ReactDOM.findDOMNode(undefined); }); it('createPortal', () => { diff --git a/types/react-dom/v15/index.d.ts b/types/react-dom/v15/index.d.ts index 8a22fd9bc2..653469b277 100644 --- a/types/react-dom/v15/index.d.ts +++ b/types/react-dom/v15/index.d.ts @@ -15,7 +15,7 @@ import { DOMAttributes, DOMElement } from 'react'; -export function findDOMNode(instance: ReactInstance): E; +export function findDOMNode(instance: ReactInstance | null | undefined): E; export function findDOMNode(instance: ReactInstance): Element; export function render

    , T extends Element>( diff --git a/types/react-dom/v15/react-dom-tests.ts b/types/react-dom/v15/react-dom-tests.ts index 865d74e386..5f5b149594 100644 --- a/types/react-dom/v15/react-dom-tests.ts +++ b/types/react-dom/v15/react-dom-tests.ts @@ -25,6 +25,8 @@ describe('ReactDOM', () => { const rootElement = document.createElement('div'); ReactDOM.render(React.createElement('div'), rootElement); ReactDOM.findDOMNode(rootElement); + ReactDOM.findDOMNode(null); + ReactDOM.findDOMNode(undefined); }); }); diff --git a/types/react-draft-wysiwyg/index.d.ts b/types/react-draft-wysiwyg/index.d.ts index 7b9b3577d8..46fab16511 100644 --- a/types/react-draft-wysiwyg/index.d.ts +++ b/types/react-draft-wysiwyg/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jpuri/react-draft-wysiwyg#readme // Definitions by: imechZhangLY // brunoMaurice +// ldanet // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -18,9 +19,9 @@ export class ContentBlock extends Draft.ContentBlock {} export class SelectionState extends Draft.SelectionState {} export interface EditorProps { - onChange?(contentState: ContentState): RawDraftContentState; + onChange?(contentState: RawDraftContentState): void; onEditorStateChange?(editorState: EditorState): void; - onContentStateChange?(contentState: ContentState): RawDraftContentState; + onContentStateChange?(contentState: RawDraftContentState): void; initialContentState?: RawDraftContentState; defaultContentState?: RawDraftContentState; contentState?: RawDraftContentState; diff --git a/types/react-draft-wysiwyg/test/uncontrolled-raw-draft-content-state.tsx b/types/react-draft-wysiwyg/test/uncontrolled-raw-draft-content-state.tsx new file mode 100644 index 0000000000..4118ce2d09 --- /dev/null +++ b/types/react-draft-wysiwyg/test/uncontrolled-raw-draft-content-state.tsx @@ -0,0 +1,48 @@ +// From https://github.com/jpuri/react-draft-wysiwyg/blob/master/docs/src/components/Docs/Props/EditorStateProp/index.js#L125 + +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import { Editor, RawDraftContentState } from "react-draft-wysiwyg"; + +class UncontrolledEditor extends React.Component< + {}, + { contentState: RawDraftContentState } +> { + constructor(props: any) { + super(props); + this.state = { + contentState: JSON.parse(`{ + "entityMap":{}, + "blocks":[{ + "key":"1ljs", + "text":"Initializing from content state", + "type":"unstyled", + "depth":0, + "inlineStyleRanges":[], + "entityRanges":[], + "data":{} + }] + }`) + }; + } + + onContentStateChange = (contentState: RawDraftContentState) => { + this.setState({ + contentState + }); + } + + render() { + const { contentState } = this.state; + return ( + + ); + } +} + +ReactDOM.render(, document.getElementById("target")); diff --git a/types/react-draft-wysiwyg/tsconfig.json b/types/react-draft-wysiwyg/tsconfig.json index 35720c1979..0218edab95 100644 --- a/types/react-draft-wysiwyg/tsconfig.json +++ b/types/react-draft-wysiwyg/tsconfig.json @@ -24,6 +24,7 @@ "test/basic-controlled-tests.tsx", "test/basic-tests.tsx", "test/custom-toolbar-tests.tsx", - "test/focus-blur-callbacks-tests.tsx" + "test/focus-blur-callbacks-tests.tsx", + "test/uncontrolled-raw-draft-content-state.tsx" ] } diff --git a/types/react-lottie/index.d.ts b/types/react-lottie/index.d.ts index a57da91307..d547396a11 100644 --- a/types/react-lottie/index.d.ts +++ b/types/react-lottie/index.d.ts @@ -21,7 +21,7 @@ export interface Options { */ animationData: any; rendererSettings?: { - preserveAspectRatio?: boolean; + preserveAspectRatio?: string; /** * The canvas context */ diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 99865ac3be..0cee14dfd2 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -7662,6 +7662,9 @@ export interface PanResponderStatic { export interface Rationale { title: string; message: string; + buttonPositive: string; + buttonNegative?: string; + buttonNeutral?: string; } export type Permission = diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index df678c4ed9..860d54523e 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -31,6 +31,7 @@ // Fellipe Chagas // Deniss Borisovs // Kenneth Skovhus +// Aaron Rosen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -623,7 +624,7 @@ export interface NavigationEventSubscription { } export interface NavigationEventsProps extends ViewProps { - navigation?: NavigationNavigator; + navigation?: NavigationScreenProp; onWillFocus?: NavigationEventCallback; onDidFocus?: NavigationEventCallback; onWillBlur?: NavigationEventCallback; @@ -1367,3 +1368,5 @@ export interface SafeAreaViewProps extends ViewProps { } export const SafeAreaView: React.ComponentClass; + +export const NavigationContext: React.Context>; diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index d30714fadb..777a8fa9f3 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -42,6 +42,7 @@ import { HeaderBackButton, Header, NavigationContainer, + NavigationContext, NavigationParams, NavigationPopAction, NavigationPopToTopAction, @@ -681,3 +682,14 @@ const ViewWithNavigationEvents = ( onDidBlur={console.log} /> ); + +// Test NavigationContext +const componentWithNavigationContext = ( + + { + navigationContext => ( + + ) + } + +); diff --git a/types/react-places-autocomplete/index.d.ts b/types/react-places-autocomplete/index.d.ts index dffcbf29f8..bf11a9fa30 100644 --- a/types/react-places-autocomplete/index.d.ts +++ b/types/react-places-autocomplete/index.d.ts @@ -53,24 +53,24 @@ export interface PropTypes { role: 'combobox'; 'aria-autocomplete': 'list'; 'aria-expanded': boolean; - 'aria-activedescendant': string | null; + 'aria-activedescendant': string | undefined; disabled: boolean; onKeyDown: React.KeyboardEventHandler; - onBlur: () => void; + onBlur: React.FocusEventHandler; value: string | undefined; onChange: (ev: { target: { value: string }}) => void; } & InputProps; getSuggestionItemProps: (suggestion: Suggestion, options?: SuggestionProps) => { key: number; - id: string | null; + id: string | undefined; role: 'option'; - onMouseEnter: () => void; - onMouseLeave: () => void; + onMouseEnter: React.MouseEventHandler; + onMouseLeave: React.MouseEventHandler; onMouseDown: React.MouseEventHandler; - onMouseUp: () => void; - onTouchStart: () => void; - onTouchEnd: () => void; - onClick: (event?: Event) => void; + onMouseUp: React.MouseEventHandler; + onTouchStart: React.TouchEventHandler; + onTouchEnd: React.TouchEventHandler; + onClick: React.MouseEventHandler; } & SuggestionProps; }>) => React.ReactNode; } diff --git a/types/react-places-autocomplete/react-places-autocomplete-tests.tsx b/types/react-places-autocomplete/react-places-autocomplete-tests.tsx index 7d72ac4397..3da7a4e81c 100644 --- a/types/react-places-autocomplete/react-places-autocomplete-tests.tsx +++ b/types/react-places-autocomplete/react-places-autocomplete-tests.tsx @@ -31,18 +31,30 @@ class Test extends React.Component { return (

    - {({getInputProps, getSuggestionItemProps, suggestions}) => ( - <> - -
    - {suggestions.map(suggestion => ( -
    - {suggestion.description} -
    - ))} -
    - - )} + {({getInputProps, suggestions, getSuggestionItemProps, loading}) => { + const inputProps = getInputProps({ + required: true, + className: loading ? 'is-pending' : '' + }); + return ( + <> + +
    + {suggestions.map(suggestion => { + const divProps = getSuggestionItemProps(suggestion, { + className: suggestion.active ? 'active' : '' + }); + return ( +
    + {suggestion.description} +
    + ); + })} +
    + + ); + } + }
    ); diff --git a/types/react-select/lib/components/Option.d.ts b/types/react-select/lib/components/Option.d.ts index 1075e6d069..d7d20ec325 100644 --- a/types/react-select/lib/components/Option.d.ts +++ b/types/react-select/lib/components/Option.d.ts @@ -4,9 +4,9 @@ import { colors, spacing } from '../theme'; import { CommonProps, PropsWithStyles, InnerRef } from '../types'; interface State { - /** Wether the option is disabled. */ + /** Whether the option is disabled. */ isDisabled: boolean; - /** Wether the option is focused. */ + /** Whether the option is focused. */ isFocused: boolean; /** Whether the option is selected. */ isSelected: boolean; diff --git a/types/react/index.d.ts b/types/react/index.d.ts index bc9c4ce342..97adab18d4 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -807,6 +807,14 @@ declare namespace React { * @see https://reactjs.org/docs/hooks-reference.html#usestate */ function useState(initialState: S | (() => S)): [S, Dispatch>]; + // convenience overload when first argument is ommitted + /** + * Returns a stateful value, and a function to update it. + * + * @version 16.8.0 + * @see https://reactjs.org/docs/hooks-reference.html#usestate + */ + function useState(): [S | undefined, Dispatch>]; /** * An alternative to `useState`. * @@ -894,6 +902,20 @@ declare namespace React { */ // TODO (TypeScript 3.0): function useRef(initialValue: T|null): RefObject; + // convenience overload for potentially undefined initialValue / call with 0 arguments + // has a default to stop it from defaulting to {} instead + /** + * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument + * (`initialValue`). The returned object will persist for the full lifetime of the component. + * + * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable + * value around similar to how you’d use instance fields in classes. + * + * @version 16.8.0 + * @see https://reactjs.org/docs/hooks-reference.html#useref + */ + // TODO (TypeScript 3.0): + function useRef(): MutableRefObject; /** * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations. * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside @@ -958,7 +980,8 @@ declare namespace React { * @version 16.8.0 * @see https://reactjs.org/docs/hooks-reference.html#usememo */ - function useMemo(factory: () => T, deps: DependencyList): T; + // allow undefined, but don't make it optional as that is very likely a mistake + function useMemo(factory: () => T, deps: DependencyList | undefined): T; /** * `useDebugValue` can be used to display a label for custom hooks in React DevTools. * diff --git a/types/react/test/hooks.tsx b/types/react/test/hooks.tsx index 26ff634e89..70ea9a0ce7 100644 --- a/types/react/test/hooks.tsx +++ b/types/react/test/hooks.tsx @@ -100,9 +100,46 @@ function useEveryHook(ref: React.Ref<{ id: number }>|undefined): () => boolean { // inline object, to (manually) check if autocomplete works React.useReducer(reducer, { age: 42, name: 'The Answer' }); - // make sure this is not going to the |null overload - // $ExpectType MutableRefObject - const didLayout = React.useRef(false); + // test useRef and its convenience overloads + // $ExpectType MutableRefObject + React.useRef(0); + + // these are not very useful (can't assign anything else to .current) + // but it's the only safe way to resolve them + // $ExpectType MutableRefObject + React.useRef(null); + // $ExpectType MutableRefObject + React.useRef(undefined); + + // |null convenience overload + // it should _not_ be mutable if the generic argument doesn't include null + // $ExpectType RefObject + React.useRef(null); + // but it should be mutable if it does (i.e. is not the convenience overload) + // $ExpectType MutableRefObject + React.useRef(null); + + // |undefined convenience overload + // with no contextual type or generic argument it should default to undefined only (not {} or unknown!) + // $ExpectType MutableRefObject + React.useRef(); + // $ExpectType MutableRefObject + React.useRef(); + // don't just accept a potential undefined if there is a generic argument + // $ExpectError + React.useRef(undefined); + // make sure once again there's no |undefined if the initial value doesn't either + // $ExpectType MutableRefObject + React.useRef(1); + // and also that it is not getting erased if the parameter is wider + // $ExpectType MutableRefObject + React.useRef(1); + + // should be contextually typed + const a: React.MutableRefObject = React.useRef(undefined); + const b: React.MutableRefObject = React.useRef(); + const c: React.MutableRefObject = React.useRef(null); + const d: React.RefObject = React.useRef(null); const id = React.useMemo(() => Math.random(), []); React.useImperativeHandle(ref, () => ({ id }), [id]); @@ -110,6 +147,10 @@ function useEveryHook(ref: React.Ref<{ id: number }>|undefined): () => boolean { // $ExpectError React.useImperativeMethods(ref, () => ({}), [id]); + // make sure again this is not going to the |null convenience overload + // $ExpectType MutableRefObject + const didLayout = React.useRef(false); + React.useLayoutEffect(() => { setState(1); setState(prevState => prevState - 1); @@ -140,6 +181,29 @@ function useEveryHook(ref: React.Ref<{ id: number }>|undefined): () => boolean { React.useDebugValue(id, value => value.toFixed()); React.useDebugValue(id); + // allow passing an explicit undefined + React.useMemo(() => {}, undefined); + // but don't allow it to be missing + // $ExpectError + React.useMemo(() => {}); + + // useState convenience overload + // default to undefined only (not that useful, but type-safe -- no {} or unknown!) + // $ExpectType undefined + React.useState()[0]; + // $ExpectType number | undefined + React.useState()[0]; + // default overload + // $ExpectType number + React.useState(0)[0]; + // $ExpectType undefined + React.useState(undefined)[0]; + // make sure the generic argument does reject actual potentially undefined inputs + // $ExpectError + React.useState(undefined)[0]; + + // useReducer convenience overload + return React.useCallback(() => didLayout.current, []); } diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index af656e8621..7682bbc68c 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -4,99 +4,111 @@ // ryee-dev // jamesmckenzie // sara f-p +// angusfretwell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.9 import * as React from "react"; +import * as StyledComponents from "styled-components"; +import * as StyledSystem from "styled-system"; -export interface BaseProps extends React.ClassAttributes { - className?: string; - as?: any; +export {}; + +type Omit = Pick>; + +export interface BaseProps extends React.Props { + as?: React.ReactType; + css?: StyledComponents.CSSObject; } -export interface SpaceProps extends BaseProps { - m?: number | string | ReadonlyArray; - mt?: number | string | ReadonlyArray; - mr?: number | string | ReadonlyArray; - mb?: number | string | ReadonlyArray; - ml?: number | string | ReadonlyArray; - mx?: number | string | ReadonlyArray; - my?: number | string | ReadonlyArray; - p?: number | string | ReadonlyArray; - pt?: number | string | ReadonlyArray; - pr?: number | string | ReadonlyArray; - pb?: number | string | ReadonlyArray; - pl?: number | string | ReadonlyArray; - px?: number | string | ReadonlyArray; - py?: number | string | ReadonlyArray; -} +interface BoxKnownProps + extends BaseProps, + StyledSystem.SpaceProps, + StyledSystem.WidthProps, + StyledSystem.FontSizeProps, + StyledSystem.ColorProps, + StyledSystem.FlexProps, + StyledSystem.OrderProps, + StyledSystem.AlignSelfProps {} +export interface BoxProps + extends BoxKnownProps, + Omit, keyof BoxKnownProps> {} +export const Box: React.FunctionComponent; -export interface BoxProps extends SpaceProps { - className?: string; - width?: number | string | ReadonlyArray; - fontSize?: number | ReadonlyArray; - css?: object; - color?: string; - bg?: string; -} -// tslint:disable-next-line:strict-export-declare-modifiers -type BoxClass = React.FunctionComponent; -export const Box: BoxClass; - -export interface ButtonProps extends BoxProps { - fontWeight?: string; - border?: number | string; - borderColor?: string; - borderRadius?: number | string; - variant?: string; -} +interface ButtonKnownProps + extends BoxKnownProps, + StyledSystem.FontWeightProps, + StyledSystem.BorderProps, + StyledSystem.BordersProps, + StyledSystem.BorderColorProps, + StyledSystem.BorderRadiusProps, + StyledSystem.ButtonStyleProps {} +export interface ButtonProps + extends ButtonKnownProps, + Omit, keyof ButtonKnownProps> {} export const Button: React.FunctionComponent; -export interface CardProps extends BoxProps { - border?: number | string; - borderColor?: string; - borderRadius?: number | string; - boxShadow?: string; - backgroundImage?: string; - backgroundSize?: string; - backgroundPosition?: string; - backgroundRepeat?: string; - opacity?: number; - variant?: string; +interface CardKnownProps + extends BoxKnownProps, + StyledSystem.BorderProps, + StyledSystem.BordersProps, + StyledSystem.BorderColorProps, + StyledSystem.BorderRadiusProps, + StyledSystem.BoxShadowProps, + StyledSystem.BackgroundImageProps, + StyledSystem.BackgroundSizeProps, + StyledSystem.BackgroundPositionProps, + StyledSystem.BackgroundRepeatProps, + StyledSystem.OpacityProps { + variant?: StyledSystem.ResponsiveValue; } +export interface CardProps + extends CardKnownProps, + Omit, keyof CardKnownProps> {} export const Card: React.FunctionComponent; -export interface FlexProps extends BoxProps { - alignItems?: string; - justifyContent?: string; - flexDirection?: string; - flexWrap?: string; -} +interface FlexKnownProps + extends BoxKnownProps, + StyledSystem.FlexWrapProps, + StyledSystem.FlexDirectionProps, + StyledSystem.AlignItemsProps, + StyledSystem.JustifyContentProps {} +export interface FlexProps + extends FlexKnownProps, + Omit, keyof FlexKnownProps> {} export const Flex: React.FunctionComponent; -export interface ImageProps extends BoxProps { - height?: number | string; - borderRadius?: number | string; - src?: string; - alt?: string; -} +interface ImageKnownProps + extends BoxKnownProps, + StyledSystem.HeightProps, + StyledSystem.BorderRadiusProps {} +export interface ImageProps + extends ImageKnownProps, + Omit, keyof ImageKnownProps> {} export const Image: React.FunctionComponent; -export interface LinkProps extends BoxProps { - href?: string; -} +// tslint:disable-next-line no-empty-interface +interface LinkKnownProps extends BoxKnownProps {} +export interface LinkProps + extends LinkKnownProps, + Omit, keyof LinkKnownProps> {} export const Link: React.FunctionComponent; -export interface TextProps extends BoxProps { - fontSize?: number | ReadonlyArray; - fontWeight?: string; - color?: string; - fontFamily?: string; - textAlign?: string; - lineHeight?: number | string; - letterSpacing?: number | string; -} +interface TextKnownProps + extends BoxKnownProps, + StyledSystem.FontFamilyProps, + StyledSystem.FontWeightProps, + StyledSystem.TextAlignProps, + StyledSystem.LineHeightProps, + StyledSystem.LetterSpacingProps {} +export interface TextProps + extends TextKnownProps, + Omit, keyof TextKnownProps> {} export const Text: React.FunctionComponent; -export type HeadingProps = TextProps; +// tslint:disable-next-line no-empty-interface +interface HeadingKnownProps extends TextKnownProps {} +export interface HeadingProps + extends HeadingKnownProps, + Omit, keyof HeadingKnownProps> {} export const Heading: React.FunctionComponent; diff --git a/types/rebass/rebass-tests.tsx b/types/rebass/rebass-tests.tsx index 53735775ff..87df64f323 100644 --- a/types/rebass/rebass-tests.tsx +++ b/types/rebass/rebass-tests.tsx @@ -1,13 +1,26 @@ -import * as React from 'react'; -import { Box, Flex, Text, Heading, Button, Link, Image, Card } from 'rebass'; +import * as React from "react"; +import styled from "styled-components"; +import { Box, Flex, Text, Heading, Button, Link, Image, Card } from "rebass"; + +const CustomComponent: React.FunctionComponent = ({ children }) => { + return
    {children}
    ; +}; + +const ExtendedBox = styled(Box)` + color: red; +`; + +ExtendedBox.defaultProps = { + p: 3 +}; () => ( - + Hi, I'm a heading. - + Hi, I'm text. - Link + + Link + + + CustomComponent + + ExtendedBox ); diff --git a/types/redux-form/lib/Field.d.ts b/types/redux-form/lib/Field.d.ts index 87a8947717..194a322408 100644 --- a/types/redux-form/lib/Field.d.ts +++ b/types/redux-form/lib/Field.d.ts @@ -61,7 +61,7 @@ export type GenericFieldHTMLAttributes = SelectHTMLAttributes | TextareaHTMLAttributes; -export class Field

    extends Component & P> { +export class Field

    extends Component

    { dirty: boolean; name: string; pristine: boolean; diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index 56d782eda7..8ad71bbc42 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -290,6 +290,12 @@ const Test = reduxForm({ component="select" /> + + ; -} +export type ConcreteFragment = any; +export type ConcreteRequest = any; +export type ConcreteBatchRequest = any; export function getRequest(taggedNode: GraphQLTaggedNode): ConcreteRequest; diff --git a/types/sass-webpack-plugin/index.d.ts b/types/sass-webpack-plugin/index.d.ts index df589ca034..1299429790 100644 --- a/types/sass-webpack-plugin/index.d.ts +++ b/types/sass-webpack-plugin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/jalkoby/sass-webpack-plugin // Definitions by: AEPKILL // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.7 import { Options } from 'node-sass'; import { Plugin } from 'webpack'; diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 5d1131684c..d89dac0d4a 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3286,6 +3286,11 @@ declare namespace sequelize { * if true, it will also eager load the relations of the child models, recursively. */ nested?: boolean; + + /** + * If true, runs a separate query to fetch the associated instances, only supported for hasMany associations + */ + separate?: boolean; } /** @@ -6510,6 +6515,16 @@ declare namespace sequelize { */ logging?: Function; + /** + * Specify the parent transaction so that this transaction is nested or a save point within the parent + */ + transaction?: Transaction; + + /** + * Sets the constraints to be deferred or immediately checked. + */ + deferrable?: Deferrable[keyof Deferrable]; + } // diff --git a/types/serverless/classes/PluginManager.d.ts b/types/serverless/classes/PluginManager.d.ts index 95e01f721a..76f3479c84 100644 --- a/types/serverless/classes/PluginManager.d.ts +++ b/types/serverless/classes/PluginManager.d.ts @@ -14,6 +14,7 @@ declare class PluginManager { loadServicePlugins(servicePlugins: {}): void; loadCommand(pluginName: string, details: {}, key: string): {}; loadCommands(pluginInstance: Plugin): void; + spawn(commandsArray: string | string[], options?: any): Promise; cliOptions: {}; cliCommands: {}; diff --git a/types/serverless/classes/Service.d.ts b/types/serverless/classes/Service.d.ts index 2f05f3b7c0..040a45f825 100644 --- a/types/serverless/classes/Service.d.ts +++ b/types/serverless/classes/Service.d.ts @@ -15,6 +15,11 @@ declare class Service { }; name: string; + stage: string; + region: string; + runtime?: string; + timeout?: number; + versionFunctions: boolean; }; constructor(serverless: Serverless, data: {}); diff --git a/types/serverless/index.d.ts b/types/serverless/index.d.ts index 01f9d7a73e..d720ec2382 100644 --- a/types/serverless/index.d.ts +++ b/types/serverless/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for serverless 1.18 // Project: https://github.com/serverless/serverless#readme // Definitions by: Hassan Khan +// Jonathan M. Wilbur // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import Service = require("./classes/Service"); @@ -12,6 +13,9 @@ import AwsProvider = require("./plugins/aws/provider/awsProvider"); declare namespace Serverless { interface Options { + function?: string; + watch?: boolean; + extraServicePath?: string; stage: string | null; region: string | null; noDeploy?: boolean; @@ -23,11 +27,24 @@ declare namespace Serverless { interface FunctionDefinition { name: string; + package: Package; + runtime?: string; + handler: string; + timeout?: number; + memorySize?: number; + environment?: { [ name: string ]: string }; } interface Event { eventName: string; } + + interface Package { + include: string[]; + exclude: string[]; + artifact?: string; + individually?: boolean; + } } declare class Serverless { diff --git a/types/ssh2/index.d.ts b/types/ssh2/index.d.ts index cf88fff5f1..8e03805817 100644 --- a/types/ssh2/index.d.ts +++ b/types/ssh2/index.d.ts @@ -729,6 +729,8 @@ export interface ServerConfig { /** Explicit overrides for the default transport layer algorithms used for the connection. */ algorithms?: Algorithms; /** A message that is sent to clients immediately upon connection, before handshaking begins. */ + greeting?: string + /** A message that is sent to clients once, right before authentication begins. */ banner?: string; /** A custom server software name/version identifier. */ ident?: string; diff --git a/types/swagger-node-runner/index.d.ts b/types/swagger-node-runner/index.d.ts index 3e8016a73f..02421cbe08 100644 --- a/types/swagger-node-runner/index.d.ts +++ b/types/swagger-node-runner/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for swagger-node-runner 0.5 +// Type definitions for swagger-node-runner 0.6 // Project: https://github.com/theganyo/swagger-node-runner // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -36,6 +36,7 @@ import { Spec } from "swagger-schema-official"; import { EventEmitter } from "events"; import * as Hapi from "hapi"; import * as Restify from "restify"; +import { OutgoingHttpHeaders } from "http"; /** * Config object for SwaggerNodeRunner @@ -117,12 +118,18 @@ export type SwaggerToolsMiddleware = (req: any, res: any, next: any) => any; /** * @param callback - Error is returned if request is unauthorized. - * The Error may include "message", "state", and "code" fields to be conveyed to the client in the response body and a + * The Error may include "message", and "code" fields to be conveyed to the client in the response body and a * "headers" field containing an object representing headers to be set on the response to the client. * In addition, if the Error has a statusCode field, the response statusCode will be set to match - * otherwise, the statusCode will be set to 403. */ -export type SwaggerToolsSecurityHandler = (request: any, securityDefinition: any, scopes: any, callback: (err: Error) => void) => void; +export interface SwaggerToolsSecurityHandlerCallbackError { + code?: string; + headers?: OutgoingHttpHeaders; + message?: string; + statusCode?: number; +} +export type SwaggerToolsSecurityHandler = (request: any, securityDefinition: any, scopes: any, callback: (err?: Error | SwaggerToolsSecurityHandlerCallbackError, result?: any) => void) => void; /** * The keys match SecurityDefinition names and the associated values are functions that accept the following parameters: diff --git a/types/swagger-node-runner/swagger-node-runner-tests.ts b/types/swagger-node-runner/swagger-node-runner-tests.ts index 1deae28f23..bccbac5d94 100644 --- a/types/swagger-node-runner/swagger-node-runner-tests.ts +++ b/types/swagger-node-runner/swagger-node-runner-tests.ts @@ -84,7 +84,7 @@ SwaggerNodeRunner.create(config, (err, runner) => { app.listen(port); }); -const swaggerSecurityHandlerCb = (err: Error) => { +const swaggerSecurityHandlerCb = (err?: Error) => { // do nothing }; @@ -98,7 +98,34 @@ const configComplex: SwaggerNodeRunner.Config = { swaggerSecurityHandlers: { // did not manage to research the typings of first 3 arguments someHandlerName: ({}, {}, {}, swaggerSecurityHandlerCb) => { - // do nothing + swaggerSecurityHandlerCb(new Error('foo')); + } + }, + validateResponse: true +}; + +const handlerWithoutError: SwaggerNodeRunner.Config = { + appRoot: __dirname, + swaggerSecurityHandlers: { + // did not manage to research the typings of first 3 arguments + someHandlerName: ({}, {}, {}, swaggerSecurityHandlerCb) => { + swaggerSecurityHandlerCb(); + } + }, + validateResponse: true +}; + +const handlerWithHeaders: SwaggerNodeRunner.Config = { + appRoot: __dirname, + swaggerSecurityHandlers: { + // did not manage to research the typings of first 3 arguments + someHandlerName: ({}, {}, {}, swaggerSecurityHandlerCb) => { + swaggerSecurityHandlerCb({ + headers: { + foo: 'bar', + baz: 2, + some: ['a', 'b'], + }}); } }, validateResponse: true diff --git a/types/tern/lib/tern/index.d.ts b/types/tern/lib/tern/index.d.ts index 0e48925914..7ecb4ac73e 100644 --- a/types/tern/lib/tern/index.d.ts +++ b/types/tern/lib/tern/index.d.ts @@ -164,17 +164,20 @@ export interface BaseQuery { docFormat?: "full"; } +export interface BaseQueryWithFile extends BaseQuery { + /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ + file: string; +} + export interface Position { ch: number; line: number; } /** Asks the server for a set of completions at the given point. */ -export interface CompletionsQuery extends BaseQuery { +export interface CompletionsQuery extends BaseQueryWithFile { /** Asks the server for a set of completions at the given point. */ type: "completions"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location to complete at. */ end: number | Position; /** Whether to include the types of the completions in the result data. Default `false` */ @@ -233,11 +236,9 @@ export interface CompletionsQueryResult { } /** Query the type of something. */ -export interface TypeQuery extends BaseQuery { +export interface TypeQuery extends BaseQueryWithFile { /** Query the type of something. */ type: "type"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location of the expression. */ end: number | Position; /** Specify the location of the expression. */ @@ -282,7 +283,7 @@ export interface TypeQueryResult { * type is not an object or function (other types don’t store their definition site), * it will fail to return useful information. */ -export interface DefinitionQuery extends BaseQuery { +export interface DefinitionQuery extends BaseQueryWithFile { /** * Asks for the definition of something. This will try, for a variable or property, * to return the point at which it was defined. If that fails, or the chosen @@ -292,8 +293,6 @@ export interface DefinitionQuery extends BaseQuery { * it will fail to return useful information. */ type: "definition"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location of the expression. */ end: number | Position; /** Specify the location of the expression. */ @@ -320,11 +319,9 @@ export interface DefinitionQueryResult { } /** Get the documentation string and URL for a given expression, if any. */ -export interface DocumentationQuery extends BaseQuery { +export interface DocumentationQuery extends BaseQueryWithFile { /** Get the documentation string and URL for a given expression, if any. */ type: "documentation"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location of the expression. */ end: number | Position; /** Specify the location of the expression. */ @@ -341,11 +338,9 @@ export interface DocumentationQueryResult { } /** Used to find all references to a given variable or property. */ -export interface RefsQuery extends BaseQuery { +export interface RefsQuery extends BaseQueryWithFile { /** Used to find all references to a given variable or property. */ type: "refs"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location of the expression. */ end: number | Position; /** Specify the location of the expression. */ @@ -365,11 +360,9 @@ export interface RefsQueryResult { } /** Rename a variable in a scope-aware way. */ -export interface RenameQuery extends BaseQuery { +export interface RenameQuery extends BaseQueryWithFile { /** Rename a variable in a scope-aware way. */ type: "rename"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location of the variable. */ end: number | Position; /** Specify the location of the variable. */ @@ -467,7 +460,7 @@ export function registerPlugin(name: string, init: (server: Server, options?: Co export interface Desc { run(Server: Server, query: QueryRegistry[T]["query"], file?: File): QueryRegistry[T]["result"]; - takesfile?: boolean; + takesFile?: boolean; } /** diff --git a/types/theo/index.d.ts b/types/theo/index.d.ts index d60a797159..de15c0238a 100644 --- a/types/theo/index.d.ts +++ b/types/theo/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for theo 8.1 +// Type definitions for Theo 8.1 // Project: https://github.com/salesforce-ux/theo // Definitions by: Pete Petrash // Niko Laitinen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 import { Collection, Map, List, OrderedMap } from "immutable"; @@ -35,21 +35,16 @@ export type Format = | "android.xml" | "aura.tokens"; -export function convert(options: ConvertOptions): Promise; -export function convertSync(options: ConvertOptions): string; -export function registerFormat( - name: string, - format: FormatResultFn | string -): void; -export function registerTransform( - name: string, - valueTransforms: string[] -): void; -export function registerValueTransform( - name: string, - predicate: (prop: Prop) => boolean, - transform: (prop: Prop) => string | number -): void; +export type Transform = "raw" | "ios" | "android" | "web"; + +export type ValueTransform = + | "color/rgb" + | "color/hex" + | "color/hex8rgba" + | "color/hex8argb" + | "percentage/float" + | "relative/pixel" + | "relative/pixelValue"; export type Prop = Map; export type Props = List; @@ -78,8 +73,8 @@ export interface ConvertOptions { resolveMetaAliases?: boolean; } -export interface TransformOptions { - type?: string; +export interface TransformOptions { + type?: Transform | T; file: string; data?: string; } @@ -91,3 +86,19 @@ export interface FormatOptions { transformPropName?: (name: string) => string ) => void; } + +export function convert(options: ConvertOptions): Promise; +export function convertSync(options: ConvertOptions): string; +export function registerFormat( + name: Format | T, + format: FormatResultFn | string +): void; +export function registerTransform( + name: Transform | T, + valueTransforms: ValueTransform[] | T[] +): void; +export function registerValueTransform( + name: ValueTransform | T, + predicate: (prop: Prop) => boolean, + transform: (prop: Prop) => string | number +): void; diff --git a/types/theo/tslint.json b/types/theo/tslint.json index 3db14f85ea..71ee04c4e1 100644 --- a/types/theo/tslint.json +++ b/types/theo/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-unnecessary-generics": false + } +} diff --git a/types/three/index.d.ts b/types/three/index.d.ts index 08b64250c8..f929ef2383 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -17,7 +17,6 @@ // Daniel Hritzkiv , // Apurva Ojas , // Tiger Oakes , -// Seth Kingsley , // Ethan Kay , // Methuselah96 // Dilip Ramirez @@ -25,6 +24,7 @@ // Zhang Hao // Konstantin Lukaschenko // Daniel Yim +// Philippe Suter // Definitions: https://github.com//DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 7d871cae58..e7291b9402 100755 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -5273,13 +5273,23 @@ export class Line extends Object3D { geometry: Geometry | BufferGeometry; material: Material | Material[]; - type: "Line"; + type: "Line" | "LineLoop" | "LineSegments"; isLine: true; computeLineDistances(): this; raycast(raycaster: Raycaster, intersects: Intersection[]): void; } +export class LineLoop extends Line { + constructor( + geometry?: Geometry | BufferGeometry, + material?: Material | Material[] + ); + + type: "LineLoop"; + isLineLoop: true; +} + /** * @deprecated */ @@ -5295,6 +5305,9 @@ export class LineSegments extends Line { material?: Material | Material[], mode?: number ); + + type: "LineSegments"; + isLineSegments: true; } export class Mesh extends Object3D { diff --git a/types/tinycon/index.d.ts b/types/tinycon/index.d.ts index 3f385603cc..03d1ce4dc8 100644 --- a/types/tinycon/index.d.ts +++ b/types/tinycon/index.d.ts @@ -1,9 +1,10 @@ // Type definitions for tinycon 0.6 // Project: https://github.com/tommoor/tinycon // Definitions by: Daniel Waxweiler +// Julian Hundeloh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export function setBubble(count: number): void; +export function setBubble(count: number | string | null): void; export function setOptions(options: TinyconOptions): void; @@ -11,7 +12,7 @@ export interface TinyconOptions { abbreviate?: boolean; background?: string; color?: string; - fallback?: boolean; + fallback?: boolean | 'force'; font?: string; height?: number; width?: number; diff --git a/types/tinycon/tinycon-tests.ts b/types/tinycon/tinycon-tests.ts index b4bcc304ac..fb898630e7 100644 --- a/types/tinycon/tinycon-tests.ts +++ b/types/tinycon/tinycon-tests.ts @@ -10,4 +10,16 @@ Tinycon.setOptions({ width: 7 }); +Tinycon.setOptions({ + abbreviate: false, + background: '#549A2F', + color: '#ffffff', + fallback: 'force', + font: '10px arial', + height: 9, + width: 7 +}); + Tinycon.setBubble(7); + +Tinycon.setBubble(null); diff --git a/types/vue-chartkick/index.d.ts b/types/vue-chartkick/index.d.ts new file mode 100644 index 0000000000..79f70d084d --- /dev/null +++ b/types/vue-chartkick/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for vue-chartkick 0.5 +// Project: https://github.com/ankane/vue-chartkick#readme +// Definitions by: CNS Media +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { PluginObject } from "vue"; + +interface VueChartkickPlugin extends PluginObject<{ adapter: any }> { + version: string; + addAdapter: (library: any) => void; +} + +declare const VueChartkick: VueChartkickPlugin; +export default VueChartkick; diff --git a/types/vue-chartkick/package.json b/types/vue-chartkick/package.json new file mode 100644 index 0000000000..1c62b73c5c --- /dev/null +++ b/types/vue-chartkick/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "vue": ">=2.0.0" + } +} diff --git a/types/i18next-browser-languagedetector/tsconfig.json b/types/vue-chartkick/tsconfig.json similarity index 90% rename from types/i18next-browser-languagedetector/tsconfig.json rename to types/vue-chartkick/tsconfig.json index 32755315aa..2d517d3efd 100644 --- a/types/i18next-browser-languagedetector/tsconfig.json +++ b/types/vue-chartkick/tsconfig.json @@ -19,6 +19,6 @@ }, "files": [ "index.d.ts", - "i18next-browser-languagedetector-tests.ts" + "vue-chartkick-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/vue-chartkick/tslint.json b/types/vue-chartkick/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/vue-chartkick/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vue-chartkick/vue-chartkick-tests.ts b/types/vue-chartkick/vue-chartkick-tests.ts new file mode 100644 index 0000000000..4f938eb54e --- /dev/null +++ b/types/vue-chartkick/vue-chartkick-tests.ts @@ -0,0 +1,5 @@ +import VueChartkick from 'vue-chartkick'; +import Vue from "vue"; +import * as Chart from "chart.js"; + +Vue.use(VueChartkick, {adapter: Chart}); diff --git a/types/youtube-player/dist/FunctionStateMap.d.ts b/types/youtube-player/dist/FunctionStateMap.d.ts new file mode 100644 index 0000000000..5ee7b07081 --- /dev/null +++ b/types/youtube-player/dist/FunctionStateMap.d.ts @@ -0,0 +1,31 @@ +import PlayerStates from './constants/PlayerStates'; + +declare const FUNCTION_STATE_MAP: { + pauseVideo: { + acceptableStates: [ + PlayerStates.ENDED, + PlayerStates.PAUSED + ], + stateChangeRequired: false, + }, + playVideo: { + acceptableStates: [ + PlayerStates.ENDED, + PlayerStates.PLAYING + ], + stateChangeRequired: false, + }, + seekTo: { + acceptableStates: [ + PlayerStates.ENDED, + PlayerStates.PLAYING, + PlayerStates.PAUSED + ], + stateChangeRequired: true, + + // TRICKY: `seekTo` may not cause a state change if no buffering is required. + timeout: 3000, + }, +}; + +export default FUNCTION_STATE_MAP; diff --git a/types/youtube-player/dist/YouTubePlayer.d.ts b/types/youtube-player/dist/YouTubePlayer.d.ts new file mode 100644 index 0000000000..7716ca739c --- /dev/null +++ b/types/youtube-player/dist/YouTubePlayer.d.ts @@ -0,0 +1,12 @@ +import { EmitterType, YouTubePlayer } from './types'; + +export interface EventHandlerMapType { + [key: string]: (event: object) => void; +} + +declare const YouTubePlayerHelpers: { + proxyEvents(emitter: EmitterType): EventHandlerMapType, + promisifyPlayer(playerAPIReady: Promise, strictState?: boolean): YouTubePlayer, +}; + +export default YouTubePlayerHelpers; diff --git a/types/youtube-player/dist/constants/PlayerStates.d.ts b/types/youtube-player/dist/constants/PlayerStates.d.ts new file mode 100644 index 0000000000..a5beac4fa7 --- /dev/null +++ b/types/youtube-player/dist/constants/PlayerStates.d.ts @@ -0,0 +1,10 @@ +declare enum PlayerStates { + BUFFERING = 3, + ENDED = 0, + PAUSED = 2, + PLAYING = 1, + UNSTARTED = -1, + VIDEO_CUED = 5, +} + +export default PlayerStates; diff --git a/types/youtube-player/dist/eventNames.d.ts b/types/youtube-player/dist/eventNames.d.ts new file mode 100644 index 0000000000..a86d3b5625 --- /dev/null +++ b/types/youtube-player/dist/eventNames.d.ts @@ -0,0 +1,20 @@ +declare const EVENT_NAMES: [ + 'ready', + 'stateChange', + 'playbackQualityChange', + 'playbackRateChange', + 'error', + 'apiChange', + 'volumeChange' +]; + +export default EVENT_NAMES; + +export type EventType = + 'ready' | + 'stateChange' | + 'playbackQualityChange' | + 'playbackRateChange' | + 'error' | + 'apiChange' | + 'volumeChange'; diff --git a/types/youtube-player/dist/functionNames.d.ts b/types/youtube-player/dist/functionNames.d.ts new file mode 100644 index 0000000000..1e317d7391 --- /dev/null +++ b/types/youtube-player/dist/functionNames.d.ts @@ -0,0 +1,46 @@ +declare const FUNCTION_NAMES: [ + 'cueVideoById', + 'loadVideoById', + 'cueVideoByUrl', + 'loadVideoByUrl', + 'playVideo', + 'pauseVideo', + 'stopVideo', + 'getVideoLoadedFraction', + 'cuePlaylist', + 'loadPlaylist', + 'nextVideo', + 'previousVideo', + 'playVideoAt', + 'setShuffle', + 'setLoop', + 'getPlaylist', + 'getPlaylistIndex', + 'setOption', + 'mute', + 'unMute', + 'isMuted', + 'setVolume', + 'getVolume', + 'seekTo', + 'getPlayerState', + 'getPlaybackRate', + 'setPlaybackRate', + 'getAvailablePlaybackRates', + 'getPlaybackQuality', + 'setPlaybackQuality', + 'getAvailableQualityLevels', + 'getCurrentTime', + 'getDuration', + 'removeEventListener', + 'getVideoUrl', + 'getVideoEmbedCode', + 'getOptions', + 'getOption', + 'addEventListener', + 'destroy', + 'setSize', + 'getIframe' +]; + +export default FUNCTION_NAMES; diff --git a/types/youtube-player/dist/index.d.ts b/types/youtube-player/dist/index.d.ts new file mode 100644 index 0000000000..09f07ff9c8 --- /dev/null +++ b/types/youtube-player/dist/index.d.ts @@ -0,0 +1,9 @@ +import { Options, YouTubePlayer } from './types'; + +declare function PlayerFactory( + maybeElementId: YouTubePlayer | HTMLElement | string, + options?: Options, + strictState?: boolean, +): YouTubePlayer; + +export default PlayerFactory; diff --git a/types/youtube-player/dist/loadYouTubeIframeApi.d.ts b/types/youtube-player/dist/loadYouTubeIframeApi.d.ts new file mode 100644 index 0000000000..7faddafbb9 --- /dev/null +++ b/types/youtube-player/dist/loadYouTubeIframeApi.d.ts @@ -0,0 +1,4 @@ +import { EmitterType, IframeApiType } from './types'; + +declare function Loader(emitter: EmitterType): Promise; +export default Loader; diff --git a/types/youtube-player/dist/types.d.ts b/types/youtube-player/dist/types.d.ts new file mode 100644 index 0000000000..fa64feda04 --- /dev/null +++ b/types/youtube-player/dist/types.d.ts @@ -0,0 +1,142 @@ +import PlayerState from './constants/PlayerStates'; +import { EventType } from './eventNames'; + +export interface EmitterType { + trigger: (eventName: string, event: object) => void; +} + +export interface Options { + width?: number; + height?: number; + videoId?: string; + playerVars?: { + autoplay?: 0 | 1, + cc_lang_pref?: string, + cc_load_policy?: 1, + color?: 'red' | 'white', + controls?: 0 | 1, + disablekb?: 0 | 1, + enablejsapi?: 0 | 1, + end?: number, + fs?: 0 | 1, + hl?: string, + iv_load_policy?: 1 | 3, + list?: string, + listType?: 'playlist' | 'search' | 'user_uploads', + loop?: 0 | 1, + modestbranding?: 1, + origin?: string, + playlist: string, + playsinline?: 0 | 1, + rel?: 0 | 1, + start?: number, + widget_referrer?: string, + }; + events?: { + [eventType in EventType]: (event: CustomEvent) => void + }; +} + +export interface IframeApiType { + Player: {new(elementId: string, options: Options): YouTubePlayer}; +} + +/** + * @see https://developers.google.com/youtube/iframe_api_reference + */ +export interface YouTubePlayer { + addEventListener(event: string, listener: (event: CustomEvent) => void): void; + destroy(): void; + getAvailablePlaybackRates(): ReadonlyArray; + getAvailableQualityLevels(): ReadonlyArray; + getCurrentTime(): number; + getDuration(): number; + getIframe(): HTMLIFrameElement; + getOption(module: string, option: string): any; + getOptions(): string[]; + getOptions(module: string): object; + setOption(module: string, option: string, value: any): void; + setOptions(): void; + cuePlaylist( + playlist: string | ReadonlyArray, + index?: number, + startSeconds?: number, + suggestedQuality?: string, + ): void; + cuePlaylist(playlist: { + listType: string, + list?: string, + index?: number, + startSeconds?: number, + suggestedQuality?: string, + }): void; + loadPlaylist( + playlist: string | ReadonlyArray, + index?: number, + startSeconds?: number, + suggestedQuality?: string, + ): void; + loadPlaylist(playlist: { + listType: string, + list?: string, + index?: number, + startSeconds?: number, + suggestedQuality?: string, + }): void; + getPlaylist(): ReadonlyArray; + getPlaylistIndex(): number; + getPlaybackQuality(): string; + getPlaybackRate(): number; + getPlayerState(): PlayerState; + getVideoEmbedCode(): string; + getVideoLoadedFraction(): number; + getVideoUrl(): string; + getVolume(): number; + cueVideoById(videoId: string, startSeconds?: number, suggestedQuality?: string): void; + cueVideoById(video: { + videoId: string, + startSeconds?: number, + endSeconds?: number, + suggestedQuality?: string, + }): void; + cueVideoByUrl(mediaContentUrl: string, startSeconds?: number, suggestedQuality?: string): void; + cueVideoByUrl(video: { + mediaContentUrl: string, + startSeconds?: number, + endSeconds?: number, + suggestedQuality?: string, + }): void; + loadVideoByUrl(mediaContentUrl: string, startSeconds?: number, suggestedQuality?: string): void; + loadVideoByUrl(video: { + mediaContentUrl: string, + startSeconds?: number, + endSeconds?: number, + suggestedQuality?: string, + }): void; + loadVideoById(videoId: string, startSeconds?: number, suggestedQuality?: string): void; + loadVideoById(video: { + videoId: string, + startSeconds?: number, + endSeconds?: number, + suggestedQuality?: string, + }): void; + isMuted(): boolean; + mute(): void; + nextVideo(): void; + pauseVideo(): void; + playVideo(): void; + playVideoAt(index: number): void; + previousVideo(): void; + removeEventListener(event: string, listener: (event: CustomEvent) => void): void; + seekTo(seconds: number, allowSeekAhead: boolean): void; + setLoop(loopPlaylists: boolean): void; + setPlaybackQuality(suggestedQuality: string): void; + setPlaybackRate(suggestedRate: number): void; + setShuffle(shufflePlaylist: boolean): void; + setSize(width: number, height: number): object; + setVolume(volume: number): void; + stopVideo(): void; + unMute(): void; + on(eventType: 'stateChange', listener: (event: CustomEvent & {data: number}) => void): void; + on(eventType: EventType, listener: (event: CustomEvent) => void): void; +} diff --git a/types/youtube-player/index.d.ts b/types/youtube-player/index.d.ts new file mode 100644 index 0000000000..f34f8e3505 --- /dev/null +++ b/types/youtube-player/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for youtube-player 5.5 +// Project: https://github.com/gajus/youtube-player#readme +// Definitions by: Martin Jurča +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +import PlayerFactory from './dist/index'; + +export default PlayerFactory; diff --git a/types/youtube-player/tsconfig.json b/types/youtube-player/tsconfig.json new file mode 100644 index 0000000000..1abbcc804c --- /dev/null +++ b/types/youtube-player/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dist/constants/PlayerStates.d.ts", + "dist/eventNames.d.ts", + "dist/functionNames.d.ts", + "dist/FunctionStateMap.d.ts", + "dist/index.d.ts", + "dist/loadYouTubeIframeApi.d.ts", + "dist/types.d.ts", + "dist/YouTubePlayer.d.ts", + "youtube-player-tests.ts" + ] +} diff --git a/types/youtube-player/tslint.json b/types/youtube-player/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/youtube-player/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/youtube-player/youtube-player-tests.ts b/types/youtube-player/youtube-player-tests.ts new file mode 100644 index 0000000000..cb60168cea --- /dev/null +++ b/types/youtube-player/youtube-player-tests.ts @@ -0,0 +1,81 @@ +import youTubePlayerFactory from 'youtube-player'; +import PlayerStates from 'youtube-player/dist/constants/PlayerStates'; +import { YouTubePlayer } from 'youtube-player/dist/types'; + +youTubePlayerFactory('foo'); +const player: YouTubePlayer = youTubePlayerFactory( + document.getElementById('bar')!, + { + width: 640, + height: 300, + videoId: 'aaaaaaaaaa', + playerVars: { + autoplay: 1, + cc_lang_pref: 'en_US', + cc_load_policy: 1, + color: 'white', + controls: 1, + disablekb: 0, + enablejsapi: 1, + end: 60, + fs: 0, + hl: 'fooBar', + iv_load_policy: 3, + list: 'bbbbbbbbbb', + listType: 'search', + loop: 0, + modestbranding: 1, + origin: 'https://definitelytyped.org/', + playlist: 'cccccccccc', + playsinline: 0, + rel: 1, + start: 3, + widget_referrer: 'nothing', + }, + events: { + ready: (event: CustomEvent): void => {}, + stateChange: (event: CustomEvent): void => { + console.log(player.getPlayerState() === PlayerStates.PLAYING); + }, + playbackQualityChange: (event: CustomEvent): void => {}, + playbackRateChange: (event: CustomEvent): void => {}, + error: (event: CustomEvent): void => {}, + apiChange: (event: CustomEvent): void => {}, + volumeChange: (event: CustomEvent): void => {}, + }, + }, + true, +); + +player.cueVideoById('xyzabc123'); +player.loadVideoById('doesNotExist'); +player.playVideo(); +player.pauseVideo(); +player.setSize(320, 200); +if (player.isMuted()) { + player.unMute(); +} else { + player.mute(); +} +player.setVolume(player.getVolume() / 2); + +player.on('stateChange', (event: CustomEvent & {data: number}) => { + switch (event.data) { + case PlayerStates.PLAYING: + console.log('playing'); + break; + case PlayerStates.PAUSED: + console.log('paused'); + break; + case PlayerStates.ENDED: + console.log('ended'); + break; + default: + break; + } +}); +player.on('error', (event: CustomEvent) => { + console.error('player error', event.detail); +}); + +player.destroy();