UNPKG

@peakys/chatwork-api

Version:

Chatwork API https://developer.chatwork.com/reference

24 lines (20 loc) 977 B
# chatwork-api [Chatwork API](https://developer.chatwork.com/reference) をパッケージ化したものです。 ## インストール ``` npm install @peakys/chatwork-api ``` ``` import chatwork from '@peakys/chatwork-api' ``` ## 使い方 例えば、エンドポイント`https://api.chatwork.com/v2/rooms/{room_id}/messages/{message_id}`に対し、`get`メソッドを実行したい場合は次のようにする。 ``` await chatwork(APIKEY).rooms(roomId).messages(messageId).get() ``` `get()`メソッドの引数にはクエリパラメータを渡すことができ、URI`?`の後に続く式を文字列として渡す。 例えば、エンドポイント`https://api.chatwork.com/v2/rooms/{room_id}/messages`に対し、`post`メソッドを実行したい場合は次のようにする。 ``` await chatwork(APIKEY).rooms(roomId).messages().post(body) ``` `post()`, `put()`, `delete()` メソッドには、普通 `body` が引数として渡される。