all files / firebase/modules/notifications/ AndroidChannelGroup.js

0% Statements 0/9
0% Branches 0/4
0% Functions 0/4
0% Lines 0/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43                                                                                     
/**
 * @flow
 * AndroidChannelGroup representation wrapper
 */
 
type NativeAndroidChannelGroup = {|
  groupId: string,
  name: string,
|};
 
export default class AndroidChannelGroup {
  _groupId: string;
  _name: string;
 
  constructor(groupId: string, name: string) {
    this._groupId = groupId;
    this._name = name;
  }
 
  get groupId(): string {
    return this._groupId;
  }
 
  get name(): string {
    return this._name;
  }
 
  build(): NativeAndroidChannelGroup {
    if (!this._groupId) {
      throw new Error(
        'AndroidChannelGroup: Missing required `groupId` property'
      );
    } else if (!this._name) {
      throw new Error('AndroidChannelGroup: Missing required `name` property');
    }
 
    return {
      groupId: this._groupId,
      name: this._name,
    };
  }
}