@ua/react-native-airship
Version:
Airship plugin for React Native apps.
121 lines (108 loc) • 2.83 kB
JavaScript
;
import { AttributeEditor } from "./AttributeEditor.js";
import { SubscriptionListEditor } from "./SubscriptionListEditor.js";
import { TagGroupEditor } from "./TagGroupEditor.js";
import { TagEditor } from "./TagEditor.js";
/**
* Airship channel.
*/
export class AirshipChannel {
constructor(module) {
this.module = module;
}
/**
* Enables channel creation if channel creation has been delayed.
* It is only necessary to call this when isChannelCreationDelayEnabled
* has been set to `true` in the airship config.
* Deprecated. Use the Private Manager to disable all features instead.
*/
enableChannelCreation() {
return this.module.channelEnableChannelCreation();
}
/**
* Adds a device tag.
* Deprecated. Use editTags() instead.
* @param tag The tag.
* @returns A promise.
*/
addTag(tag) {
return this.module.channelAddTag(tag);
}
/**
* Removes a device tag.
* Deprecated. Use editTags() instead.
* @param tag The tag.
* @returns A promise.
*/
removeTag(tag) {
return this.module.channelRemoveTag(tag);
}
/**
* Edits device tags.
* @returns A tag editor.
*/
editTags() {
return new TagEditor(operations => {
return this.module.channelEditTags(operations);
});
}
/**
* Gets the device tags.
* @returns A promise with the result.
*/
getTags() {
return this.module.channelGetTags();
}
/**
* Gets the channel Id.
*
* @returns A promise with the result.
*/
getChannelId() {
return this.module.channelGetChannelId();
}
/**
* Returns the channel ID. If the channel ID is not yet created the function it will wait for it before returning. After
* the channel ID is created, this method functions the same as `getChannelId()`.
*
* @returns A promise with the result.
*/
waitForChannelId() {
return this.module.channelWaitForChannelId();
}
/**
* Gets a list of the channel's subscriptions.
* @returns A promise with the result.
*/
getSubscriptionLists() {
return this.module.channelGetSubscriptionLists();
}
/**
* Edits tag groups.
* @returns A tag group editor.
*/
editTagGroups() {
return new TagGroupEditor(operations => {
return this.module.channelEditTagGroups(operations);
});
}
/**
* Edits attributes.
* @returns An attribute editor.
*/
editAttributes() {
return new AttributeEditor(operations => {
return this.module.channelEditAttributes(operations);
});
}
/**
* Edits subscription lists.
* @returns A subscription list editor.
*/
editSubscriptionLists() {
return new SubscriptionListEditor(operations => {
return this.module.channelEditSubscriptionLists(operations);
});
}
}
//# sourceMappingURL=AirshipChannel.js.map