Skip to content

Commit

Permalink
feat(people): create person status enum
Browse files Browse the repository at this point in the history
  • Loading branch information
akoushke committed Aug 20, 2019
1 parent 4907a72 commit 27843f8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
42 changes: 28 additions & 14 deletions src/adapters/PeopleAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,43 @@ import {throwError} from 'rxjs';

import WebexAdapter from './WebexAdapter';

/**
* Enum for person status values.
*
* @readonly
* @enum {string}
*/
export const PersonStatus = {
ACTIVE: 'active',
BOT: 'bot',
CALL: 'call',
DO_NOT_DISTURB: 'dnd',
INACTIVE: 'inactive',
MEETING: 'meeting',
OUT_OF_OFFICE: 'ooo',
PRESENTING: 'presenting',
SELF: 'self',
TYPING: 'typing',
};

/**
* This is a base class that defines the interface that maps people data.
* Developers that want to extend `PeopleAdapter` must implement all of its methods,
* adhering to the exact parameters and structure of the returned objects.
*/
export default class PeopleAdapter extends WebexAdapter {
/**
* The status a person can have.
* @typedef {null|'active'|'bot'|'call'|'dnd'|'group'|'inactive'|'meeting'|'ooo'|'presenting'|'self'|'typing'} PersonStatus
*/

/**
* A Person object with details about the person.
* @typedef {Object} Person
* @property {string} ID The person identifier.
* @property {Array.<string>} emails An array of emails for the person.
* @property {string} displayName The name to be displayed for the person.
* @property {string} firstName The first name of the person.
* @property {string} lastName The last name of the person.
* @property {string} nickName The short name for the person.
* @property {string} avatar The full url to the person's avatar.
* @property {string} orgID The ID of the organization the person belongs to.
* @property {PersonStatus} status The presence status of the user.
* @property {string} ID The person identifier.
* @property {Array.<string>} emails An array of emails for the person.
* @property {string} displayName The name to be displayed for the person.
* @property {string} firstName The first name of the person.
* @property {string} lastName The last name of the person.
* @property {string} nickName The short name for the person.
* @property {string} avatar The full url to the person's avatar.
* @property {string} orgID The ID of the organization the person belongs to.
* @property {null|PersonStatus} status The presence status of the user. @see PersonStatus enum
*/

/**
Expand Down
5 changes: 5 additions & 0 deletions src/adapters/PeopleJSONAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import {Observable} from 'rxjs';
import PeopleAdapter from './PeopleAdapter';

export default class PeopleJSONAdapter extends PeopleAdapter {
constructor(datasource) {
super(datasource);
this.getPerson = this.getPerson.bind(this);
}

/**
* @typedef PeopleJSON
* @param {object} datasource An object that contains a set of people keyed by ID.
Expand Down

0 comments on commit 27843f8

Please sign in to comment.