Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Feature] Room.{create,addMember,delMember,quit,modTopic} support #32

Closed
huan opened this issue Sep 29, 2016 · 0 comments
Closed

[New Feature] Room.{create,addMember,delMember,quit,modTopic} support #32

huan opened this issue Sep 29, 2016 · 0 comments
Assignees
Milestone

Comments

@huan
Copy link
Member

huan commented Sep 29, 2016

according to the original issue #14

Room Factory of WxApp

type ChatroomResponse {
  BaseResponse: {
    Ret: number
  }
  , ChatRoomName: string
}

class chatroomFactory {
  create(e: userId[]): Promise<{BaseResponse.Ret:number}>

  addMember(roomId, userList: UserName[].join(','), cb: ({BaseResponse.Ret:number}) => void )
  delMember(roomId, userList: string)
  quit(roomId) // un-implenment?
  modTopic(roomId, newTopic)
}

type ContactQuery = {
  filterContacts: UserName[]
  , noHeader: boolean
  , showFriendHeader: boolean
  , isWithoutStar: boolean
  , isWithoutBrand: boolean 
  , isSaved: boolean
}

type PickQuery = {
  all?: ContactQuery
  , friend?: ContactQuery
  , star?: ContactQuery
  , brand?: ContactQuery
}

class contactFactory {
  pictContacts(typeList: string[], query: PickQuery, clone: boolean): Contact[]
  getAllChatroomContact(query: ContactQuery)
  getAllFriendContact(query: ContactQuery)
  getContact(query: ContactQuery)
}

Room Class of Wechaty

type Query = { name: string|Regex }
Room.find(query : Query) : Room | null
Room.findAll(query : Query) : Room[]

1. static Room.find(query: Query): Promise<Room|null>

2. static Room.findAll(query: Query): Promise<Room[]>

3. static Room.create(contactList: Contact[]): Promise

4. Room.add(contact: Contact): Promise

const friend = message.get('from')
const room = Room.find({ name: 'Group Name' })
if (room) {
  room.add(friend)
}

5. Room.del(contact: Contact): void

6. Room.topic(newTopic?: string): string

7. Room.nick(contact: Contact): string

8. Room.has(contact Contact): boolean

10. Room.on('join', (invitee, inviter) => void)

Event join: Room New Member

room.on('join', (invitee, inviter) => {
  console.log(`user ${invitee} joined the room ${room}, invited by ${inviter}`)
})

11. Room.on('leave', (leaver) => void)

12. Room.refresh(): Promise

13. Room.owner(): Contact|null

14. Room.member(name: string): Contact|null

@huan huan added this to the v0.4 milestone Sep 29, 2016
@huan huan self-assigned this Sep 29, 2016
huan added a commit that referenced this issue Oct 1, 2016
huan added a commit that referenced this issue Oct 1, 2016
huan added a commit that referenced this issue Oct 4, 2016
huan added a commit that referenced this issue Oct 4, 2016
huan added a commit that referenced this issue Oct 4, 2016
huan added a commit that referenced this issue Oct 5, 2016
huan added a commit that referenced this issue Oct 5, 2016
huan added a commit that referenced this issue Oct 5, 2016
huan added a commit that referenced this issue Oct 6, 2016
@huan huan closed this as completed Oct 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant