https://github.com/open-jike/jike-sdk
Ⓙ Jike SDK for Node.js / Deno / browser
https://github.com/open-jike/jike-sdk
api deno jike nodejs sdk typescript
Last synced: 9 months ago
JSON representation
Ⓙ Jike SDK for Node.js / Deno / browser
- Host: GitHub
- URL: https://github.com/open-jike/jike-sdk
- Owner: open-jike
- License: agpl-3.0
- Created: 2021-12-14T13:46:55.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T17:57:06.000Z (about 1 year ago)
- Last Synced: 2024-10-29T19:15:07.010Z (about 1 year ago)
- Topics: api, deno, jike, nodejs, sdk, typescript
- Language: TypeScript
- Homepage: https://jike-sdk.sxzz.moe
- Size: 1.02 MB
- Stars: 57
- Watchers: 1
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# jike-sdk Ⓙ Jike SDK
[](https://github.com/open-jike/jike-sdk/actions/workflows/unit-test.yml)
[](https://github.com/open-jike/jike-sdk)
[](https://www.npmjs.com/package/jike-sdk)
[](https://www.npmjs.com/package/jike-sdk)
[](https://github.com/open-jike/jike-sdk)
[](https://github.com/open-jike/jike-sdk)
[](https://web.okjike.com/u/5C505995-681E-4C1E-AD4A-1CC683627B6E)
**本项目仅供学习交流使用,在使用过程中对你或他人造成的任何损失我们概不负责。**
> [!CAUTION]
> 本项目不再积极维护。
## Features
- 🌈 可能是东半球最全的第三方 SDK
- ⭐️ 同时支持 Node.js / 浏览器 / Deno / Bun
- 🦾 自带 TypeScript 类型声明
API 列表
- [用户](https://jike-sdk.sxzz.moe/modules/api_users.html)
- [x] [获取用户信息](https://jike-sdk.sxzz.moe/functions/api_users.profile.html)
- [x] [刷新 Access Token](https://jike-sdk.sxzz.moe/functions/api_users.refreshToken.html)
- [x] [发送登录验证码](https://jike-sdk.sxzz.moe/functions/api_users.getSmsCode.html)
- [x] [短信登录](https://jike-sdk.sxzz.moe/functions/api_users.loginWithSmsCode.html)
- [x] [手机号与密码登录](https://jike-sdk.sxzz.moe/functions/api_users.loginWithPhoneAndPassword.html)
- [x] [弹一弹头像](https://jike-sdk.sxzz.moe/functions/api_users.avatarGreet.html)
- [x] [修改用户信息](https://jike-sdk.sxzz.moe/functions/api_users.editProfile.html)
- [ ] ~~保存设备 Token~~
- [用户关系](https://jike-sdk.sxzz.moe/modules/api_user_relation.html)
- [x] [获取关注列表](https://jike-sdk.sxzz.moe/functions/api_user_relation.getFollowingList.html)
- [x] [获取被关注列表](https://jike-sdk.sxzz.moe/functions/api_user_relation.getFollowerList.html)
- [x] [关注](https://jike-sdk.sxzz.moe/functions/api_user_relation.follow.html)
- [x] [取消关注](https://jike-sdk.sxzz.moe/functions/api_user_relation.unfollow.html)
- [x] [是否关注用户](https://jike-sdk.sxzz.moe/classes/index.JikeUser.html#isFollowing)
- [x] [不看 TA 的内容](https://jike-sdk.sxzz.moe/functions/api_user_relation.mute.html)
- [x] [重新看 TA 的内容](https://jike-sdk.sxzz.moe/functions/api_user_relation.unmute.html)
- [x] [加入黑名单](https://jike-sdk.sxzz.moe/functions/api_user_relation.addBlock.html)
- [x] [解除黑名单](https://jike-sdk.sxzz.moe/functions/api_user_relation.removeBlock.html)
- [动态帖子](https://jike-sdk.sxzz.moe/modules/api_posts.html)
- [x] [发送动态](https://jike-sdk.sxzz.moe/functions/api_posts.create.html)
- [x] [获取动态详情](https://jike-sdk.sxzz.moe/functions/api_posts.get.html)
- [x] [删除动态](https://jike-sdk.sxzz.moe/functions/api_posts.remove.html)
- [x] [分享动态](https://jike-sdk.sxzz.moe/functions/api_posts.share.html)
- [x] [点赞](https://jike-sdk.sxzz.moe/functions/api_posts.like.html)
- [x] [取消点赞](https://jike-sdk.sxzz.moe/functions/api_posts.unlike.html)
- [x] [获取点赞用户列表](https://jike-sdk.sxzz.moe/functions/api_posts.listLikedUsers.html)
- [x] [隐藏动态](https://jike-sdk.sxzz.moe/functions/api_posts.hide.html)
- [x] [动态转为公开](https://jike-sdk.sxzz.moe/functions/api_posts.recover.html)
- [动态广场](https://jike-sdk.sxzz.moe/modules/api_recommend_feed.html)
- [x] [获取动态推荐](https://jike-sdk.sxzz.moe/functions/api_recommend_feed.list.html)
- [评论](https://jike-sdk.sxzz.moe/modules/api_comments.html)
- [x] [获取动态下评论](https://jike-sdk.sxzz.moe/functions/api_comments.listPrimary.html)
- [x] [获取评论](https://jike-sdk.sxzz.moe/functions/api_comments.list.html)
- [x] [发送评论](https://jike-sdk.sxzz.moe/functions/api_comments.add.html) (发送子评论)
- [x] [点赞](https://jike-sdk.sxzz.moe/functions/api_comments.like.html)
- [x] [取消点赞](https://jike-sdk.sxzz.moe/functions/api_comments.unlike.html)
- [x] [删除评论](https://jike-sdk.sxzz.moe/functions/api_comments.remove.html)
- [动态](https://jike-sdk.sxzz.moe/modules/api_personal_update.html)
- [x] [获取用户动态](https://jike-sdk.sxzz.moe/functions/api_personal_update.single.html)
- [x] [获取关注动态](https://jike-sdk.sxzz.moe/functions/api_personal_update.followingUpdates.html)
- [x] [置顶动态](https://jike-sdk.sxzz.moe/functions/api_personal_update.pin.html)
- [x] [取消置顶动态](https://jike-sdk.sxzz.moe/functions/api_personal_update.unpin.html)
- [通知](https://jike-sdk.sxzz.moe/modules/api_notifications.html)
- [x] [获取通知列表](https://jike-sdk.sxzz.moe/functions/api_notifications.list.html)
- [x] [获取合并通知列表](https://jike-sdk.sxzz.moe/functions/api_notifications.listMergedMentions.html)
- [x] [获取通知列表(自动展开合并通知)](https://jike-sdk.sxzz.moe/functions/api_notifications.listWithMerged.html)
- [上传](https://jike-sdk.sxzz.moe/modules/api_upload.html)
- [x] [获取上传 token](https://jike-sdk.sxzz.moe/functions/api_upload.token.html)
- [x] [上传图片](https://jike-sdk.sxzz.moe/functions/api_upload.upload.html)
- [日记](https://jike-sdk.sxzz.moe/modules/api_stories.html)
- [x] [获取关注用户日记列表](https://jike-sdk.sxzz.moe/functions/api_stories.followingFeed.html)
- [x] [获取用户的日记详情](https://jike-sdk.sxzz.moe/functions/api_stories.listUserStories.html)
- [圈子](https://jike-sdk.sxzz.moe/modules/api_topics.html)
- [x] [获取圈子热门动态](https://jike-sdk.sxzz.moe/functions/api_topics.getTabsSelectedFeed.html)
- [x] [获取圈子动态](https://jike-sdk.sxzz.moe/functions/api_topics.getTabsSquareFeed.html)
- [x] [搜索圈子](https://jike-sdk.sxzz.moe/functions/api_topics.search.html)
## Installation
### Node.js
Node.js >= v18.12.0
```bash
npm i jike-sdk
```
#### ESM 导入
如果使用 ESM 方式导入,需要把 `package.json` 的 `type` 设置为 `module`,或将后缀名改为 `.mjs`。
```ts
// index.mjs
// 使用此版本需 node >= 18 或 自行 ployfill fetch。
import { setApiConfig } from 'jike-sdk'
setApiConfig({
// ...
})
```
#### CJS 导入
```ts
const { setApiConfig } = require('jike-sdk')
setApiConfig({
// ...
})
```
### Bun
Bun >= 0.5.8
```bash
bun i jike-sdk
```
```ts
// index.ts
import { setApiConfig } from 'jike-sdk'
setApiConfig({
// ...
})
```
### Deno
```ts
import { setApiConfig } from 'https://cdn.skypack.dev/jike-sdk/index?dts'
```
### 浏览器
```ts
import { setApiConfig } from 'jike-sdk'
```
或使用 CDN 的方式加载(与 Deno 一致)
```html
import { setApiConfig } from 'https://cdn.skypack.dev/jike-sdk/index'
```
**由于 CORS 策略的原因,第三方网站无法直接请求外部服务器。但可以使用浏览器扩展的能力请求。**
## Usage
[API Reference](https://jike-sdk.sxzz.moe/)
```ts
import { ApiClient, api, setAccessToken, setApiConfig } from 'jike-sdk'
// 自行在 GitHub 搜索「jike endpoint」探索配置
const apiConfig = {
endpointId: 'jike',
endpointUrl: '', // 请自行替换
bundleId: '', // 请自行替换
buildNo: '', // 请自行替换
userAgent: '', // 请自行替换
accessToken: '', // 请自行替换
}
setApiConfig(apiConfig)
setAccessToken('update-access-token')
api.userRelation.getFollowingList('82D23B32-CF36-4C59-AD6F-D05E3552CBF3', {
limit: 100,
})
// 或使用 ApiClient
const client = ApiClient(apiConfig)
client.users.profile()
```
## Contributing [](https://makeapullrequest.com)
see [CONTRIBUTING.md](./CONTRIBUTING.md)
## Sponsors
## License
[AGPL-3.0](./LICENSE) License © 2021-PRESENT [三咲智子](https://github.com/sxzz)