docs(contacts): improve docs

This commit is contained in:
Ibby 2016-10-04 13:59:32 -04:00
parent 7ababc4d67
commit 0bc73e525d

View File

@ -1,9 +1,11 @@
import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin'; import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin';
declare var window: any, declare var window: any,
navigator: any; navigator: any;
/**
* @private
*/
export interface IContactProperties { export interface IContactProperties {
/** A globally unique identifier. */ /** A globally unique identifier. */
id?: string; id?: string;
@ -75,6 +77,9 @@ export class Contact implements IContactProperties {
save(): Promise<any> { return; } save(): Promise<any> { return; }
} }
/**
* @private
*/
interface IContactError { interface IContactError {
/** Error code */ /** Error code */
code: number; code: number;
@ -82,6 +87,9 @@ interface IContactError {
message: string; message: string;
} }
/**
* @private
*/
declare var ContactError: { declare var ContactError: {
new (code: number): IContactError; new (code: number): IContactError;
UNKNOWN_ERROR: number; UNKNOWN_ERROR: number;
@ -186,13 +194,21 @@ export class ContactAddress implements IContactAddress {
this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country); this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country);
} }
/** Set to true if this ContactAddress contains the user's preferred value. */
@InstanceProperty get pref(): boolean { return; } @InstanceProperty get pref(): boolean { return; }
/** A string indicating what type of field this is, home for example. */
@InstanceProperty get type(): string { return; } @InstanceProperty get type(): string { return; }
/** The full address formatted for display. */
@InstanceProperty get formatted(): string { return; } @InstanceProperty get formatted(): string { return; }
/** The full street address. */
@InstanceProperty get streetAddress(): string { return; } @InstanceProperty get streetAddress(): string { return; }
/** The city or locality. */
@InstanceProperty get locality(): string { return; } @InstanceProperty get locality(): string { return; }
/** The state or region. */
@InstanceProperty get region(): string { return; } @InstanceProperty get region(): string { return; }
/** The zip code or postal code. */
@InstanceProperty get postalCode(): string { return; } @InstanceProperty get postalCode(): string { return; }
/** The country name. */
@InstanceProperty get country(): string { return; } @InstanceProperty get country(): string { return; }
} }
@ -217,10 +233,15 @@ export class ContactOrganization implements IContactOrganization {
constructor() { constructor() {
this._objectInstance = new window.ContactOrganization(); this._objectInstance = new window.ContactOrganization();
} }
/** Set to true if this ContactOrganization contains the user's preferred value. */
@InstanceProperty get pref(): boolean { return; } @InstanceProperty get pref(): boolean { return; }
/** A string that indicates what type of field this is, home for example. */
@InstanceProperty get type(): string { return; } @InstanceProperty get type(): string { return; }
/** The name of the organization. */
@InstanceProperty get name(): string { return; } @InstanceProperty get name(): string { return; }
/** The department the contract works for. */
@InstanceProperty get department(): string { return; } @InstanceProperty get department(): string { return; }
/** The contact's title at the organization. */
@InstanceProperty get title(): string { return; } @InstanceProperty get title(): string { return; }
} }
@ -232,6 +253,10 @@ export interface IContactFindOptions {
multiple?: boolean; multiple?: boolean;
/* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */ /* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. */
desiredFields?: string[]; desiredFields?: string[];
/**
* (Android only): Filters the search to only return contacts with a phone number informed.
*/
hasPhoneNumber?: boolean;
} }
/** /**
@ -244,9 +269,24 @@ export class ContactFindOptions implements IContactFindOptions {
this._objectInstance = new window.ContactFindOptions(); this._objectInstance = new window.ContactFindOptions();
} }
/**
* The search string used to find navigator.contacts. (Default: "")
*/
@InstanceProperty get filter(): string { return; } @InstanceProperty get filter(): string { return; }
/**
* Determines if the find operation returns multiple navigator.contacts. (Default: false)
*/
@InstanceProperty get multiple(): boolean { return; } @InstanceProperty get multiple(): boolean { return; }
/**
* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields.
*/
@InstanceProperty get desiredFields(): any { return; } @InstanceProperty get desiredFields(): any { return; }
/**
* (Android only): Filters the search to only return contacts with a phone number informed.
*/
@InstanceProperty get hasPhoneNumber(): boolean { return; } @InstanceProperty get hasPhoneNumber(): boolean { return; }
} }
@ -268,8 +308,12 @@ export class ContactFindOptions implements IContactFindOptions {
* (error: any) => console.error('Error saving contact.', error) * (error: any) => console.error('Error saving contact.', error)
* ); * );
* ``` * ```
* * @interfaces
* * IContactProperties
* @classes
* ContactFindOptions
* ContactOrganization
* ContactAddress
*/ */
@Plugin({ @Plugin({
plugin: 'cordova-plugin-contacts', plugin: 'cordova-plugin-contacts',