Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.32.1",
"version": "0.32.2",
"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.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ test('contactQueryFilterFunction()', async t => {
gender : ContactGender.Unknown,
id : 'id1',
name : TEXT_REGEX,
phone : [],
type : ContactType.Individual,
},
{
Expand All @@ -50,6 +51,7 @@ test('contactQueryFilterFunction()', async t => {
gender : ContactGender.Unknown,
id : 'id2',
name : TEXT_TEXT,
phone : [],
type : ContactType.Individual,
},
{
Expand All @@ -58,6 +60,7 @@ test('contactQueryFilterFunction()', async t => {
gender : ContactGender.Unknown,
id : 'id3',
name : TEXT_REGEX,
phone : [],
type : ContactType.Individual,
},
{
Expand All @@ -66,6 +69,7 @@ test('contactQueryFilterFunction()', async t => {
gender : ContactGender.Unknown,
id : 'id4',
name : TEXT_TEXT,
phone : [],
type : ContactType.Individual,
},
]
Expand Down
5 changes: 2 additions & 3 deletions src/puppet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,11 @@ export abstract class Puppet extends PuppetEventEmitter {
public abstract async contactAvatar (contactId: string) : Promise<FileBox>
public abstract async contactAvatar (contactId: string, file: FileBox) : Promise<void>

public abstract async contactPhone (contactId: string) : Promise<string[]>
public abstract async contactPhone (contactId: string, phoneList: string[]) : Promise<void>

public abstract async contactCorporationRemark (contactId: string, corporationRemark: string): Promise<void>
public abstract async contactCorporationRemark (contactId: string, corporationRemark: string | null): Promise<void>

public abstract async contactDescription (contactId: string, description: string): Promise<void>
public abstract async contactDescription (contactId: string, description: string | null): Promise<void>

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

Expand Down
1 change: 1 addition & 0 deletions src/schemas/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface ContactPayload {
star? : boolean,
weixin? : string,

phone : string[],
corporation? : string,
title? : string,
description? : string,
Expand Down
8 changes: 3 additions & 5 deletions tests/fixtures/puppet-test/puppet-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,13 @@ export class PuppetTest extends Puppet {
public async contactAvatar (contactId: string, file: FileBox) : Promise<void>
public async contactAvatar (contactId: string, file?: FileBox) : Promise<void | FileBox> { return { contactId, file } as any }

public async contactPhone (contactId: string): Promise<string[]>
public async contactPhone (contactId: string, phoneList: string[]): Promise<void>
public async contactPhone (contactId: string, phoneList?: string[]): Promise<void | string[]> { return { contactId, phoneList } as any }
public async contactPhone (contactId: string, phoneList: string[]): Promise<void> { return { contactId, phoneList } as any }

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

public async contactCorporationRemark (contactId: string, corporationRemark: string) : Promise<void> { return { contactId, corporationRemark } as any }
public async contactCorporationRemark (contactId: string, corporationRemark: string | null) : Promise<void> { return { contactId, corporationRemark } as any }

public async contactDescription (contactId: string, description: string): Promise<void> { return { contactId, description } as any }
public async contactDescription (contactId: string, description: string | null): Promise<void> { return { contactId, description } 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
8 changes: 3 additions & 5 deletions tests/fixtures/smoke-testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,13 @@ class PuppetTest extends Puppet {
public async contactAvatar (contactId: string, file: FileBox) : Promise<void>
public async contactAvatar (contactId: string, file?: FileBox) : Promise<void | FileBox> { return { contactId, file } as any }

public async contactPhone (contactId: string): Promise<string[]>
public async contactPhone (contactId: string, phoneList: string[]): Promise<void>
public async contactPhone (contactId: string, phoneList?: string[]): Promise<void | string[]> { return { contactId, phoneList } as any }
public async contactPhone (contactId: string, phoneList: string[]): Promise<void> { return { contactId, phoneList } as any }

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

public async contactCorporationRemark (contactId: string, corporationRemark: string) : Promise<void> { return { contactId, corporationRemark } as any }
public async contactCorporationRemark (contactId: string, corporationRemark: string | null) : Promise<void> { return { contactId, corporationRemark } as any }

public async contactDescription (contactId: string, description: string): Promise<void> { return { contactId, description } as any }
public async contactDescription (contactId: string, description: string | null): Promise<void> { return { contactId, description } 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