Skip to content

Commit

Permalink
Merge f6ddcad into d0df7a8
Browse files Browse the repository at this point in the history
  • Loading branch information
ax4 committed Mar 31, 2017
2 parents d0df7a8 + f6ddcad commit be82878
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions src/contact.ts
Expand Up @@ -440,7 +440,7 @@ export class Contact implements Sayable {
public alias(): string | null

/**
* set the alias for contact
* Set the alias for contact
*
* tests show it will failed if set alias too frequently(60 times in one minute).
*
Expand All @@ -449,7 +449,7 @@ export class Contact implements Sayable {
*
* @example
* ```ts
* const ret = await contact.remark('lijiarui')
* const ret = await contact.alias('lijiarui')
* if (ret) {
* console.log(`change ${contact.name()}'s alias successfully!`)
* } else {
Expand All @@ -467,7 +467,7 @@ export class Contact implements Sayable {
*
* @example
* ```ts
* const ret = await contact.remark(null)
* const ret = await contact.alias(null)
* if (ret) {
* console.log('ok!')
* } else {
Expand All @@ -477,6 +477,37 @@ export class Contact implements Sayable {
*/
public alias(empty: null): Promise<boolean>

/**
* GET / SET / DELETE the alias for a contact
*
* @param {(none | string | null)} newAlias ,
* @returns {(string | null | Promise<boolean>)}
*
* @example GET the alias for a contact
* ```ts
* const alias = contact.alias() //@returns {(string | null)}
* ```
*
* @example SET the alias for a contact
* ```ts
* const ret = await contact.alias('lijiarui') //@returns {Promise<boolean>}
* if (ret) {
* console.log(`change ${contact.name()}'s alias successfully!`)
* } else {
* console.error('failed to change ${contact.name()}'s alias!')
* }
* ```
*
* @example DELETE the alias for a contact
* ```ts
* const ret = await contact.alias(null) //@returns {Promise<boolean>}
* if (ret) {
* console.log('ok!')
* } else {
* console.error('fail!')
* }
* ```
*/
public alias(newAlias?: string|null): Promise<boolean> | string | null {
log.silly('Contact', 'alias(%s)', newAlias || '')

Expand Down

0 comments on commit be82878

Please sign in to comment.