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

封装 request 类,处理所有api请求 #21

Closed
1 of 3 tasks
su-chang opened this issue Jan 6, 2022 · 10 comments
Closed
1 of 3 tasks

封装 request 类,处理所有api请求 #21

su-chang opened this issue Jan 6, 2022 · 10 comments
Assignees

Comments

@su-chang
Copy link
Member

su-chang commented Jan 6, 2022

  • 构建公共基础请求类
  • 定义各个请求的枚举类型
  • 将请求和响应进行匹配(类似trace等手段,目前还不清楚whatsapp本身是否支持该功能)
@su-chang su-chang mentioned this issue Jan 6, 2022
42 tasks
@hcfw007 hcfw007 self-assigned this Jan 6, 2022
@hcfw007
Copy link
Member

hcfw007 commented Jan 7, 2022

预计完成时间:1.9 - 1.12

@huan
Copy link
Member

huan commented Jan 7, 2022

I think this is a very strange layer and I can not understand why we need it.

@su-chang
Copy link
Member Author

su-chang commented Jan 7, 2022

The aim for control all requests related WhatsApp in one class, e.g.

  • match request and response
  • add rate queue for some requests
  • other services could call request methods in this class with type and params

@huan
Copy link
Member

huan commented Jan 7, 2022

@su-chang Thanks for the explanation.

I think what you described is very like the Wechaty Redux layer, you can have a look at https://github.com/wechaty/redux/blob/main/src/duck/actions.ts .

Please feel free to go ahead and keep me updated, thanks.

@hcfw007
Copy link
Member

hcfw007 commented Jan 11, 2022

#36

@hcfw007
Copy link
Member

hcfw007 commented Jan 11, 2022

任务二 定义各个请求的枚举类型 是否是个实际的需求?因为并非通过API.Type进行调用。 @su-chang

@hcfw007
Copy link
Member

hcfw007 commented Jan 11, 2022

任务三 将请求和响应进行匹配 应该也并不需要,因为所有请求本身都会返回包含结果的Promise

@su-chang
Copy link
Member Author

任务二 定义各个请求的枚举类型 是否是个实际的需求?因为并非通过API.Type进行调用。 @su-chang

不是实际需求,当时只是大致的一个想法,具体按实际需要来定。

@su-chang
Copy link
Member Author

任务三 将请求和响应进行匹配 应该也并不需要,因为所有请求本身都会返回包含结果的Promise

如果是这样的话,最好了。我们可以省去一些不必要的匹配代码。
但是目前还是处于存疑状态,需要看看后续是否会有一些请求的响应结果中没有包含我们所需要的信息而是需要从回调中获取的情况。

@hcfw007
Copy link
Member

hcfw007 commented Jan 12, 2022

#40

@hcfw007 hcfw007 closed this as completed Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants