Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

讨论:支持 TypeScript 的类型注解 #891

Closed
greenhat616 opened this issue Aug 19, 2020 · 12 comments
Closed

讨论:支持 TypeScript 的类型注解 #891

greenhat616 opened this issue Aug 19, 2020 · 12 comments

Comments

@greenhat616
Copy link
Contributor

起因

现在的 Module 还没有一套能使用的类型注解,这对于使用 TypeScript 的同学带来诸多不便。

目的

  1. 得出对应接口的响应结构
  2. 得出参数,响应结构非常见的坑

如果讨论顺利的话,我可以提交 PR 以支持 @types

@Binaryify
Copy link
Owner

不怕麻烦的话可以加

@greenhat616
Copy link
Contributor Author

好,等我回来我就启动这项工作。

@greenhat616
Copy link
Contributor Author

草案: #908 ,当工作完成时,将标记为可合并

@Binaryify
Copy link
Owner

@greenhat616
Copy link
Contributor Author

@Binaryify https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/module/avatar_upload.js 这个接口有办法在node端使用嘛,有的话例子能不能给一个呢

@greenhat616
Copy link
Contributor Author

@Binaryify
Copy link
Owner

Binaryify commented Sep 5, 2020

const { avatar_upload, login_cellphone } = require('./main')
const fs = require('fs')
const path = require('path')

async function main() {
  const result = await login_cellphone({
    phone: '手机号',
    password: '密码'
  })
  const filePath = './test.jpg'
  await avatar_upload({
    imgFile: {
      name: path.basename(filePath),
      data: fs.readFileSync(filePath)
    },
    cookie: result.body.cookie
  })
}
main()

这样

@Binaryify
Copy link
Owner

@Binaryify
Copy link
Owner

image

@Binaryify
Copy link
Owner

Binaryify commented Sep 5, 2020

俩上传接口的参数和返回结果内容大同小异,只是歌单封面上传需要多传一个歌单id

@greenhat616
Copy link
Contributor Author

好,稍晚我更新下这两个接口的注解

@Binaryify
Copy link
Owner

好~

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants