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.5",
"version": "0.31.6",
"description": "Abstract Puppet for Wechaty",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions src/puppet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,10 @@ export abstract class Puppet extends PuppetEventEmitter {
public abstract async contactPhone (contactId: string) : Promise<string[]>
public abstract async contactPhone (contactId: string, phoneList: string[]) : Promise<void>

public abstract async contactCorporationRemark (contactId: string, corpRemark: string): Promise<void>

public abstract async contactDescription (contactId: string, desc: string): Promise<void>

public abstract async contactList () : Promise<string[]>

protected abstract async contactRawPayload (contactId: string) : Promise<any>
Expand Down
12 changes: 9 additions & 3 deletions src/schemas/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ export enum ContactGender {
* Huan(202004) TODO: Lock the ENUM number (like protobuf) ?
*/
export enum ContactType {
Unknown = 0,
Individual = 1,
Official = 2,
Unknown = 0,
Individual = 1,
Official = 2,
Corporation = 3,

/**
* Huan(202004):
Expand Down Expand Up @@ -41,6 +42,11 @@ export interface ContactPayload {
signature? : string,
star? : boolean,
weixin? : string,

corporation? : string,
title? : string,
description? : string,
coworker? : boolean,
}

/** @hidden */
Expand Down
4 changes: 4 additions & 0 deletions tests/fixtures/puppet-test/puppet-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export class PuppetTest extends Puppet {

public async contactList () : Promise<string[]> { return {} as any }

public async contactCorporationRemark () : Promise<void> { return {} as any }

public async contactDescription (): Promise<void> { return {} as any }

public async contactRawPayload (id: string) : Promise<any> { return { id } as any }
public async contactRawPayloadParser (rawPayload: any) : Promise<ContactPayload> { return { rawPayload } as any }

Expand Down
4 changes: 4 additions & 0 deletions tests/fixtures/smoke-testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ class PuppetTest extends Puppet {

public async contactList () : Promise<string[]> { return {} as any }

public async contactCorporationRemark () : Promise<void> { return {} as any }

public async contactDescription (): Promise<void> { return {} as any }

public async contactRawPayload (id: string) : Promise<any> { return { id } as any }
public async contactRawPayloadParser (rawPayload: any) : Promise<ContactPayload> { return { rawPayload } as any }

Expand Down