friend-request.ts 1.2 KB
Newer Older
1
/**
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
2
 *   Wechaty - https://github.com/chatie/wechaty
3
 *
4
 *   @copyright 2016-2017 Huan LI <zixia@zixia.net>
5
 *
6 7 8
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
9
 *
10 11 12 13 14 15 16
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
17 18 19
 *
 */

Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
20
import {
21
  config,
L
lijiarui 已提交
22
  log,
Huan (李卓桓)'s avatar
merge  
Huan (李卓桓) 已提交
23 24
}               from './config'
import Contact  from './contact'
25

26
export abstract class FriendRequest {
27 28 29

  public contact: Contact
  public hello: string
30
  public type: 'send' | 'receive' | 'confirm'
31

32
  constructor() {
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
33 34
    log.verbose('FriendRequest', 'constructor()')

35
    if (!config.puppetInstance()) {
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
36
      throw new Error('no Config.puppetInstance() instanciated')
37 38 39
    }
  }

40 41
  public abstract send(contact: Contact, hello: string): Promise<boolean>
  public abstract accept(): Promise<boolean>
42 43

}
Huan (李卓桓)'s avatar
merge  
Huan (李卓桓) 已提交
44 45

export default FriendRequest