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

add corp base info to contact #109

Merged
merged 13 commits into from
Aug 21, 2020
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wechaty-puppet",
"version": "0.31.3",
"version": "0.31.4",
"description": "Abstract Puppet for Wechaty",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand Down
18 changes: 13 additions & 5 deletions src/puppet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import {
ContactGender,
ContactPayload,
ContactType,
BaseType,
} from './schemas/contact'
import {
MessagePayload,
Expand Down Expand Up @@ -42,31 +42,39 @@ test('contactQueryFilterFunction()', async t => {
gender : ContactGender.Unknown,
id : 'id1',
name : TEXT_REGEX,
type : ContactType.Personal,
type : {
baseType: BaseType.Personal,
},
},
{
alias : TEXT_REGEX,
avatar : 'mock',
gender : ContactGender.Unknown,
id : 'id2',
name : TEXT_TEXT,
type : ContactType.Personal,
type : {
baseType: BaseType.Personal,
},
},
{
alias : TEXT_TEXT,
avatar : 'mock',
gender : ContactGender.Unknown,
id : 'id3',
name : TEXT_REGEX,
type : ContactType.Personal,
type : {
baseType: BaseType.Personal,
},
},
{
alias : TEXT_REGEX,
avatar : 'mock',
gender : ContactGender.Unknown,
id : 'id4',
name : TEXT_TEXT,
type : ContactType.Personal,
type : {
baseType: BaseType.Personal,
},
},
]

Expand Down
12 changes: 11 additions & 1 deletion src/schemas/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export enum ContactGender {
/**
* Huan(202004) TODO: Lock the ENUM number (like protobuf) ?
*/
export enum ContactType {
export enum BaseType {
Unknown = 0,
Individual = 1,
Official = 2,
Corp = 3,
windmemory marked this conversation as resolved.
Show resolved Hide resolved

/**
* Huan(202004):
Expand All @@ -19,6 +20,11 @@ export enum ContactType {
Personal = Individual,
}

export interface ContactType {
baseType: BaseType,
corpInternal?: boolean,
windmemory marked this conversation as resolved.
Show resolved Hide resolved
}

export interface ContactQueryFilter {
alias?: string | RegExp,
id?: string,
Expand All @@ -41,6 +47,10 @@ export interface ContactPayload {
signature? : string,
star? : boolean,
weixin? : string,

corp? : string,
title? : string,
description? : string,
}

/** @hidden */
Expand Down