Skip to content

Commit

Permalink
change protected to jsdoc (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
huan committed Oct 14, 2021
1 parent 2f14bdd commit 5ca2fae
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 20 deletions.
29 changes: 25 additions & 4 deletions src/mixins/contact-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,19 @@ const contactMixin = <TBase extends CacheMixin>(Base: TBase) => {

abstract contactList () : Promise<string[]>

protected abstract contactRawPayload (contactId: string) : Promise<any>
protected abstract contactRawPayloadParser (rawPayload: any) : Promise<ContactPayload>
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract contactRawPayload (contactId: string) : Promise<any>

/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract contactRawPayloadParser (rawPayload: any) : Promise<ContactPayload>

// async contactRoomList (
// contactId: string,
Expand Down Expand Up @@ -158,7 +169,12 @@ const contactMixin = <TBase extends CacheMixin>(Base: TBase) => {
this.cache.contact.delete(contactId)
}

protected contactQueryFilterFactory (
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
contactQueryFilterFactory (
query: ContactQueryFilter,
): ContactPayloadFilterFunction {
log.verbose('Puppet', 'contactQueryFilterFactory(%s)',
Expand Down Expand Up @@ -221,7 +237,12 @@ const contactMixin = <TBase extends CacheMixin>(Base: TBase) => {
return true
}

protected contactPayloadCache (contactId: string): undefined | ContactPayload {
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
contactPayloadCache (contactId: string): undefined | ContactPayload {
// log.silly('Puppet', 'contactPayloadCache(id=%s) @ %s', contactId, this)
if (!contactId) {
throw new Error('no id')
Expand Down
22 changes: 19 additions & 3 deletions src/mixins/friendship-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,19 @@ const friendshipMixin = <TBase extends CacheMixin>(Base: TBase) => {
abstract friendshipSearchPhone (phone: string) : Promise<null | string>
abstract friendshipSearchWeixin (weixin: string) : Promise<null | string>

protected abstract friendshipRawPayload (friendshipId: string) : Promise<any>
protected abstract friendshipRawPayloadParser (rawPayload: any) : Promise<FriendshipPayload>
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract friendshipRawPayload (friendshipId: string) : Promise<any>

/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract friendshipRawPayloadParser (rawPayload: any) : Promise<FriendshipPayload>

async friendshipSearch (
searchQueryFilter: FriendshipSearchQueryFilter,
Expand All @@ -49,7 +60,12 @@ const friendshipMixin = <TBase extends CacheMixin>(Base: TBase) => {
throw new Error(`unknown key from searchQueryFilter: ${Object.keys(searchQueryFilter).join('')}`)
}

protected friendshipPayloadCache (friendshipId: string): undefined | FriendshipPayload {
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
friendshipPayloadCache (friendshipId: string): undefined | FriendshipPayload {
log.silly('Puppet', 'friendshipPayloadCache(id=%s) @ %s', friendshipId, this)

if (!friendshipId) {
Expand Down
29 changes: 25 additions & 4 deletions src/mixins/message-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,26 @@ const messageMixin = <TBase extends CacheMixin>(Base: TBase) => {

abstract messageRecall (messageId: string) : Promise<boolean>

protected abstract messageRawPayload (messageId: string) : Promise<any>
protected abstract messageRawPayloadParser (rawPayload: any) : Promise<MessagePayload>
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract messageRawPayload (messageId: string) : Promise<any>

/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract messageRawPayloadParser (rawPayload: any) : Promise<MessagePayload>

protected messagePayloadCache (messageId: string): undefined | MessagePayload {
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
messagePayloadCache (messageId: string): undefined | MessagePayload {
// log.silly('Puppet', 'messagePayloadCache(id=%s) @ %s', messageId, this)
if (!messageId) {
throw new Error('no id')
Expand Down Expand Up @@ -142,7 +158,12 @@ const messageMixin = <TBase extends CacheMixin>(Base: TBase) => {
return messageIdList
}

protected messageQueryFilterFactory (
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
messageQueryFilterFactory (
query: MessageQueryFilter,
): MessagePayloadFilterFunction {
log.verbose('Puppet', 'messageQueryFilterFactory(%s)',
Expand Down
23 changes: 20 additions & 3 deletions src/mixins/room-invitation-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ const roomInvitationMixin = <TBase extends CacheMixin>(Base: TBase) => {
* Room Invitation
*
*/
protected roomInvitationPayloadCache (

/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
roomInvitationPayloadCache (
roomInvitationId: string,
): undefined | RoomInvitationPayload {
// log.silly('Puppet', 'roomInvitationPayloadCache(id=%s) @ %s', friendshipId, this)
Expand All @@ -41,8 +47,19 @@ const roomInvitationMixin = <TBase extends CacheMixin>(Base: TBase) => {

abstract roomInvitationAccept (roomInvitationId: string): Promise<void>

protected abstract roomInvitationRawPayload (roomInvitationId: string) : Promise<any>
protected abstract roomInvitationRawPayloadParser (rawPayload: any) : Promise<RoomInvitationPayload>
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract roomInvitationRawPayload (roomInvitationId: string) : Promise<any>

/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract roomInvitationRawPayloadParser (rawPayload: any) : Promise<RoomInvitationPayload>

/**
* Get & Set
Expand Down
44 changes: 38 additions & 6 deletions src/mixins/room-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,19 @@ const roomMixin = <TBase extends RoomMixinDependency>(Base: TBase) => {
abstract roomTopic (roomId: string) : Promise<string>
abstract roomTopic (roomId: string, topic: string) : Promise<void>

protected abstract roomRawPayload (roomId: string) : Promise<any>
protected abstract roomRawPayloadParser (rawPayload: any) : Promise<RoomPayload>
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract roomRawPayload (roomId: string) : Promise<any>

/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract roomRawPayloadParser (rawPayload: any) : Promise<RoomPayload>

/**
*
Expand All @@ -62,8 +73,19 @@ const roomMixin = <TBase extends RoomMixinDependency>(Base: TBase) => {
abstract roomAnnounce (roomId: string, text: string) : Promise<void>
abstract roomMemberList (roomId: string) : Promise<string[]>

protected abstract roomMemberRawPayload (roomId: string, contactId: string) : Promise<any>
protected abstract roomMemberRawPayloadParser (rawPayload: any) : Promise<RoomMemberPayload>
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract roomMemberRawPayload (roomId: string, contactId: string) : Promise<any>

/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
abstract roomMemberRawPayloadParser (rawPayload: any) : Promise<RoomMemberPayload>

async roomMemberSearch (
roomId : string,
Expand Down Expand Up @@ -200,7 +222,12 @@ const roomMixin = <TBase extends RoomMixinDependency>(Base: TBase) => {
return roomIdList
}

protected roomQueryFilterFactory (
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
roomQueryFilterFactory (
query: RoomQueryFilter,
): RoomPayloadFilterFunction {
log.verbose('Puppet', 'roomQueryFilterFactory(%s)',
Expand Down Expand Up @@ -250,7 +277,12 @@ const roomMixin = <TBase extends RoomMixinDependency>(Base: TBase) => {
return true
}

protected roomPayloadCache (roomId: string): undefined | RoomPayload {
/**
* Issue #155 - https://github.com/wechaty/puppet/issues/155
*
* @protected
*/
roomPayloadCache (roomId: string): undefined | RoomPayload {
// log.silly('Puppet', 'roomPayloadCache(id=%s) @ %s', roomId, this)
if (!roomId) {
throw new Error('no id')
Expand Down

0 comments on commit 5ca2fae

Please sign in to comment.