UNPKG

aijinkela-wechaty

Version:

Wechaty is a RPA SDK for Chatbot Makers.

92 lines 3.57 kB
import type { Constructor } from 'clone-class'; import { ContactInterface, ContactImpl } from './contact.js'; import { FavoriteInterface, FavoriteImpl } from './favorite.js'; declare const MixinBase: ((abstract new (...args: any[]) => {}) & { _pool?: Map<string, TagInterface> | undefined; readonly pool: Map<string, TagInterface>; load<L extends import("clone-class/dist/esm/src/constructor.js").ClassInterface<{}> & { new (...args: any[]): any; prototype: any; } & import("../user-mixins/poolify.js").PoolifyMixin<TagInterface>>(this: L, id: string): TagInterface; }) & ((abstract new (...args: any[]) => { readonly wechaty: import("../wechaty/wechaty-impl.js").WechatyInterface; }) & { readonly wechaty: import("../wechaty/wechaty-impl.js").WechatyInterface; }) & { new (): {}; }; declare class TagMixin extends MixinBase { readonly id: string; /** * @hideconstructor */ constructor(id: string); /** * Get a Tag instance for "tag" * * > Tips: * This function is depending on the Puppet Implementation, see [puppet-compatible-table](https://github.com/Chatie/wechaty/wiki/Puppet#3-puppet-compatible-table) * * @static * @param {string} [tag] the tag name which want to create * @returns {Promise<TagImpl>} * @example * const bot = new Wechaty() * await bot.Tag.get('TagName') */ static get(tag: string): Promise<TagInterface>; /** * Delete a tag from Wechat * * If you want to delete a tag, please make sure there's no more Contact/Favorite(s) are using this tag. * If this tag is be used by any Contact/Favorite, then it can not be deleted. * (This is for protecting the tag being deleted by mistake) * * @static * @returns {Promise<TagInterface[]>} * @example * const tag = wechaty.Tag.get('tag') * await wechaty.Tag.delete(tag) */ /** * TODO: refactoring the target: do not use ContactIml or FavoriteImpl */ static delete(tag: TagInterface, target?: typeof ContactImpl | typeof FavoriteImpl): Promise<void>; /** * Add tag for contact * * > Tips: * This function is depending on the Puppet Implementation, see [puppet-compatible-table](https://github.com/Chatie/wechaty/wiki/Puppet#3-puppet-compatible-table) * * @param {ContactInterface} [to] the contact which need to add tag * @returns {Promise<void>} * @example * await tag.add(contact) */ add(to: ContactInterface | FavoriteInterface): Promise<void>; /** * Remove this tag from Contact/Favorite * * > Tips: * This function is depending on the Puppet Implementation, see [puppet-compatible-table](https://github.com/Chatie/wechaty/wiki/Puppet#3-puppet-compatible-table) * * @returns {Promise<void>} * @example * await tag.remove(contact) */ remove(from: ContactInterface | FavoriteInterface): Promise<void>; } declare const TagImpl_base: { new (...args: any[]): {}; valid: (o: any) => o is TagInterface; validInstance: (target: any) => target is TagMixin; validInterface: (target: any) => target is any; } & typeof TagMixin; declare class TagImpl extends TagImpl_base { } interface TagInterface extends TagImpl { } type TagConstructor = Constructor<TagInterface, typeof TagImpl>; export type { TagConstructor, TagInterface, }; export { TagImpl, }; //# sourceMappingURL=tag.d.ts.map