Skip to content

Latest commit

 

History

History
462 lines (418 loc) · 36.9 KB

README.md

File metadata and controls

462 lines (418 loc) · 36.9 KB

traq

traQ v3 API

This Python package is automatically generated by the OpenAPI Generator project:

Requirements.

Python >=3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import traq

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import traq

Getting Started

Please follow the installation procedure and then run the following:

import time
import traq
from pprint import pprint
from traq.api import activity_api
from traq.model.activity_timeline_message import ActivityTimelineMessage
# Defining the host is optional and defaults to https://q.trap.jp/api/v3
# See configuration.py for a list of all supported configuration parameters.
configuration = traq.Configuration(
    host = "https://q.trap.jp/api/v3"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure OAuth2 access token for authorization: OAuth2
configuration = traq.Configuration(
    host = "https://q.trap.jp/api/v3"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'


# Enter a context with an instance of the API client
with traq.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = activity_api.ActivityApi(api_client)
    limit = 50 # int | 取得する件数 (optional) (default to 50)
all = False # bool | 全てのチャンネルのタイムラインを取得する (optional) (default to False)
per_channel = False # bool | 同じチャンネルのメッセージは最新のもののみ取得するか (optional) (default to False)

    try:
        # アクテビティタイムラインを取得
        api_response = api_instance.get_activity_timeline(limit=limit, all=all, per_channel=per_channel)
        pprint(api_response)
    except traq.ApiException as e:
        print("Exception when calling ActivityApi->get_activity_timeline: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://q.trap.jp/api/v3

Class Method HTTP request Description
ActivityApi get_activity_timeline GET /activity/timeline アクテビティタイムラインを取得
ActivityApi get_online_users GET /activity/onlines オンラインユーザーリストを取得
AuthenticationApi get_my_external_accounts GET /users/me/ex-accounts 外部ログインアカウント一覧を取得
AuthenticationApi get_my_sessions GET /users/me/sessions 自分のログインセッションリストを取得
AuthenticationApi link_external_account POST /users/me/ex-accounts/link 外部ログインアカウントを紐付ける
AuthenticationApi login POST /# ログイン
AuthenticationApi logout POST /logout ログアウト
AuthenticationApi revoke_my_session DELETE /users/me/sessions/{sessionId} セッションを無効化
AuthenticationApi unlink_external_account POST /users/me/ex-accounts/unlink 外部ログインアカウントの紐付けを解除
BotApi activate_bot POST /bots/{botId}/actions/activate BOTをアクティベート
BotApi change_bot_icon PUT /bots/{botId}/icon BOTのアイコン画像を変更
BotApi connect_bot_ws GET /bots/ws WebSocket Mode BOT用通知ストリームに接続します
BotApi create_bot POST /bots BOTを作成
BotApi delete_bot DELETE /bots/{botId} BOTを削除
BotApi edit_bot PATCH /bots/{botId} BOT情報を変更
BotApi get_bot GET /bots/{botId} BOT情報を取得
BotApi get_bot_icon GET /bots/{botId}/icon BOTのアイコン画像を取得
BotApi get_bot_logs GET /bots/{botId}/logs BOTのイベントログを取得
BotApi get_bots GET /bots BOTリストを取得
BotApi get_channel_bots GET /channels/{channelId}/bots チャンネル参加中のBOTのリストを取得
BotApi inactivate_bot POST /bots/{botId}/actions/inactivate BOTをインアクティベート
BotApi let_bot_join_channel POST /bots/{botId}/actions/join BOTをチャンネルに参加させる
BotApi let_bot_leave_channel POST /bots/{botId}/actions/leave BOTをチャンネルから退出させる
BotApi reissue_bot POST /bots/{botId}/actions/reissue BOTのトークンを再発行
ChannelApi create_channel POST /channels チャンネルを作成
ChannelApi edit_channel PATCH /channels/{channelId} チャンネル情報を変更
ChannelApi edit_channel_subscribers PATCH /channels/{channelId}/subscribers チャンネルの通知購読者を編集
ChannelApi edit_channel_topic PUT /channels/{channelId}/topic チャンネルトピックを編集
ChannelApi get_channel GET /channels/{channelId} チャンネル情報を取得
ChannelApi get_channel_bots GET /channels/{channelId}/bots チャンネル参加中のBOTのリストを取得
ChannelApi get_channel_events GET /channels/{channelId}/events チャンネルイベントのリストを取得
ChannelApi get_channel_pins GET /channels/{channelId}/pins チャンネルピンのリストを取得
ChannelApi get_channel_stats GET /channels/{channelId}/stats チャンネル統計情報を取得
ChannelApi get_channel_subscribers GET /channels/{channelId}/subscribers チャンネルの通知購読者のリストを取得
ChannelApi get_channel_topic GET /channels/{channelId}/topic チャンネルトピックを取得
ChannelApi get_channel_viewers GET /channels/{channelId}/viewers チャンネル閲覧者リストを取得
ChannelApi get_channels GET /channels チャンネルリストを取得
ChannelApi get_messages GET /channels/{channelId}/messages チャンネルメッセージのリストを取得
ChannelApi get_user_dm_channel GET /users/{userId}/dm-channel DMチャンネル情報を取得
ChannelApi post_message POST /channels/{channelId}/messages チャンネルにメッセージを投稿
ChannelApi set_channel_subscribers PUT /channels/{channelId}/subscribers チャンネルの通知購読者を設定
ClipApi clip_message POST /clip-folders/{folderId}/messages メッセージをクリップフォルダに追加
ClipApi create_clip_folder POST /clip-folders クリップフォルダを作成
ClipApi delete_clip_folder DELETE /clip-folders/{folderId} クリップフォルダを削除
ClipApi edit_clip_folder PATCH /clip-folders/{folderId} クリップフォルダ情報を編集
ClipApi get_clip_folder GET /clip-folders/{folderId} クリップフォルダ情報を取得
ClipApi get_clip_folders GET /clip-folders クリップフォルダのリストを取得
ClipApi get_clips GET /clip-folders/{folderId}/messages フォルダ内のクリップのリストを取得
ClipApi get_message_clips GET /messages/{messageId}/clips 自分のクリップを取得
ClipApi unclip_message DELETE /clip-folders/{folderId}/messages/{messageId} メッセージをクリップフォルダから除外
FileApi delete_file DELETE /files/{fileId} ファイルを削除
FileApi get_file GET /files/{fileId} ファイルをダウンロード
FileApi get_file_meta GET /files/{fileId}/meta ファイルメタを取得
FileApi get_files GET /files ファイルメタのリストを取得
FileApi get_thumbnail_image GET /files/{fileId}/thumbnail サムネイル画像を取得
FileApi post_file POST /files ファイルをアップロード
GroupApi add_user_group_admin POST /groups/{groupId}/admins グループ管理者を追加
GroupApi add_user_group_member POST /groups/{groupId}/members グループメンバーを追加
GroupApi change_user_group_icon PUT /groups/{groupId}/icon ユーザーグループのアイコンを変更
GroupApi create_user_group POST /groups ユーザーグループを作成
GroupApi delete_user_group DELETE /groups/{groupId} ユーザーグループを削除
GroupApi edit_user_group PATCH /groups/{groupId} ユーザーグループを編集
GroupApi edit_user_group_member PATCH /groups/{groupId}/members/{userId} グループメンバーを編集
GroupApi get_user_group GET /groups/{groupId} ユーザーグループを取得
GroupApi get_user_group_admins GET /groups/{groupId}/admins グループ管理者を取得
GroupApi get_user_group_members GET /groups/{groupId}/members グループメンバーを取得
GroupApi get_user_groups GET /groups ユーザーグループのリストを取得
GroupApi remove_user_group_admin DELETE /groups/{groupId}/admins/{userId} グループ管理者を削除
GroupApi remove_user_group_member DELETE /groups/{groupId}/members/{userId} グループメンバーを削除
MeApi add_my_star POST /users/me/stars チャンネルをスターに追加
MeApi add_my_user_tag POST /users/me/tags 自分にタグを追加
MeApi change_my_icon PUT /users/me/icon 自分のアイコン画像を変更
MeApi change_my_notify_citation PUT /users/me/settings/notify-citation メッセージ引用通知の設定情報を変更
MeApi change_my_password PUT /users/me/password 自分のパスワードを変更
MeApi edit_me PATCH /users/me 自分のユーザー情報を変更
MeApi edit_my_user_tag PATCH /users/me/tags/{tagId} 自分のタグを編集
MeApi get_me GET /users/me 自分のユーザー詳細を取得
MeApi get_my_channel_subscriptions GET /users/me/subscriptions 自分のチャンネル購読状態を取得
MeApi get_my_external_accounts GET /users/me/ex-accounts 外部ログインアカウント一覧を取得
MeApi get_my_icon GET /users/me/icon 自分のアイコン画像を取得
MeApi get_my_notify_citation GET /users/me/settings/notify-citation メッセージ引用通知の設定情報を取得
MeApi get_my_qr_code GET /users/me/qr-code QRコードを取得
MeApi get_my_sessions GET /users/me/sessions 自分のログインセッションリストを取得
MeApi get_my_stamp_history GET /users/me/stamp-history スタンプ履歴を取得
MeApi get_my_stars GET /users/me/stars スターチャンネルリストを取得
MeApi get_my_tokens GET /users/me/tokens 有効トークンのリストを取得
MeApi get_my_unread_channels GET /users/me/unread 未読チャンネルを取得
MeApi get_my_user_tags GET /users/me/tags 自分のタグリストを取得
MeApi get_my_view_states GET /users/me/view-states 自身のチャンネル閲覧状態一覧を取得
MeApi get_user_settings GET /users/me/settings ユーザー設定を取得
MeApi link_external_account POST /users/me/ex-accounts/link 外部ログインアカウントを紐付ける
MeApi read_channel DELETE /users/me/unread/{channelId} チャンネルを既読にする
MeApi register_fcm_device POST /users/me/fcm-device FCMデバイスを登録
MeApi remove_my_star DELETE /users/me/stars/{channelId} チャンネルをスターから削除します
MeApi remove_my_user_tag DELETE /users/me/tags/{tagId} 自分からタグを削除します
MeApi revoke_my_session DELETE /users/me/sessions/{sessionId} セッションを無効化
MeApi revoke_my_token DELETE /users/me/tokens/{tokenId} トークンの認可を取り消す
MeApi set_channel_subscribe_level PUT /users/me/subscriptions/{channelId} チャンネル購読レベルを設定
MeApi unlink_external_account POST /users/me/ex-accounts/unlink 外部ログインアカウントの紐付けを解除
MessageApi add_message_stamp POST /messages/{messageId}/stamps/{stampId} スタンプを押す
MessageApi create_pin POST /messages/{messageId}/pin ピン留めする
MessageApi delete_message DELETE /messages/{messageId} メッセージを削除
MessageApi edit_message PUT /messages/{messageId} メッセージを編集
MessageApi get_direct_messages GET /users/{userId}/messages ダイレクトメッセージのリストを取得
MessageApi get_message GET /messages/{messageId} メッセージを取得
MessageApi get_message_clips GET /messages/{messageId}/clips 自分のクリップを取得
MessageApi get_message_stamps GET /messages/{messageId}/stamps メッセージのスタンプリストを取得
MessageApi get_messages GET /channels/{channelId}/messages チャンネルメッセージのリストを取得
MessageApi get_pin GET /messages/{messageId}/pin ピン留めを取得
MessageApi post_direct_message POST /users/{userId}/messages ダイレクトメッセージを送信
MessageApi post_message POST /channels/{channelId}/messages チャンネルにメッセージを投稿
MessageApi remove_message_stamp DELETE /messages/{messageId}/stamps/{stampId} スタンプを消す
MessageApi remove_pin DELETE /messages/{messageId}/pin ピン留めを外す
MessageApi search_messages GET /messages メッセージを検索
NotificationApi edit_channel_subscribers PATCH /channels/{channelId}/subscribers チャンネルの通知購読者を編集
NotificationApi get_channel_subscribers GET /channels/{channelId}/subscribers チャンネルの通知購読者のリストを取得
NotificationApi get_my_channel_subscriptions GET /users/me/subscriptions 自分のチャンネル購読状態を取得
NotificationApi get_my_unread_channels GET /users/me/unread 未読チャンネルを取得
NotificationApi get_my_view_states GET /users/me/view-states 自身のチャンネル閲覧状態一覧を取得
NotificationApi read_channel DELETE /users/me/unread/{channelId} チャンネルを既読にする
NotificationApi register_fcm_device POST /users/me/fcm-device FCMデバイスを登録
NotificationApi set_channel_subscribe_level PUT /users/me/subscriptions/{channelId} チャンネル購読レベルを設定
NotificationApi set_channel_subscribers PUT /channels/{channelId}/subscribers チャンネルの通知購読者を設定
NotificationApi ws GET /ws WebSocket通知ストリームに接続します
Oauth2Api create_client POST /clients OAuth2クライアントを作成
Oauth2Api delete_client DELETE /clients/{clientId} OAuth2クライアントを削除
Oauth2Api edit_client PATCH /clients/{clientId} OAuth2クライアント情報を変更
Oauth2Api get_client GET /clients/{clientId} OAuth2クライアント情報を取得
Oauth2Api get_clients GET /clients OAuth2クライアントのリストを取得
Oauth2Api get_my_tokens GET /users/me/tokens 有効トークンのリストを取得
Oauth2Api get_o_auth2_authorize GET /oauth2/authorize OAuth2 認可エンドポイント
Oauth2Api post_o_auth2_authorize POST /oauth2/authorize OAuth2 認可エンドポイント
Oauth2Api post_o_auth2_authorize_decide POST /oauth2/authorize/decide OAuth2 認可承諾API
Oauth2Api post_o_auth2_token POST /oauth2/token OAuth2 トークンエンドポイント
Oauth2Api revoke_my_token DELETE /users/me/tokens/{tokenId} トークンの認可を取り消す
Oauth2Api revoke_o_auth2_token POST /oauth2/revoke OAuth2 トークン無効化エンドポイント
OgpApi get_ogp GET /ogp OGP情報を取得
PinApi create_pin POST /messages/{messageId}/pin ピン留めする
PinApi get_channel_pins GET /channels/{channelId}/pins チャンネルピンのリストを取得
PinApi get_pin GET /messages/{messageId}/pin ピン留めを取得
PinApi remove_pin DELETE /messages/{messageId}/pin ピン留めを外す
PublicApi get_public_user_icon GET /public/icon/{username} ユーザーのアイコン画像を取得
PublicApi get_server_version GET /version バージョンを取得
StampApi add_message_stamp POST /messages/{messageId}/stamps/{stampId} スタンプを押す
StampApi change_stamp_image PUT /stamps/{stampId}/image スタンプ画像を変更
StampApi create_stamp POST /stamps スタンプを作成
StampApi create_stamp_palette POST /stamp-palettes スタンプパレットを作成
StampApi delete_stamp DELETE /stamps/{stampId} スタンプを削除
StampApi delete_stamp_palette DELETE /stamp-palettes/{paletteId} スタンプパレットを削除
StampApi edit_stamp PATCH /stamps/{stampId} スタンプ情報を変更
StampApi edit_stamp_palette PATCH /stamp-palettes/{paletteId} スタンプパレットを編集
StampApi get_message_stamps GET /messages/{messageId}/stamps メッセージのスタンプリストを取得
StampApi get_my_stamp_history GET /users/me/stamp-history スタンプ履歴を取得
StampApi get_stamp GET /stamps/{stampId} スタンプ情報を取得
StampApi get_stamp_image GET /stamps/{stampId}/image スタンプ画像を取得
StampApi get_stamp_palette GET /stamp-palettes/{paletteId} スタンプパレットを取得
StampApi get_stamp_palettes GET /stamp-palettes スタンプパレットのリストを取得
StampApi get_stamp_stats GET /stamps/{stampId}/stats スタンプ統計情報を取得
StampApi get_stamps GET /stamps スタンプリストを取得
StampApi remove_message_stamp DELETE /messages/{messageId}/stamps/{stampId} スタンプを消す
StarApi add_my_star POST /users/me/stars チャンネルをスターに追加
StarApi get_my_stars GET /users/me/stars スターチャンネルリストを取得
StarApi remove_my_star DELETE /users/me/stars/{channelId} チャンネルをスターから削除します
UserApi add_user_tag POST /users/{userId}/tags ユーザーにタグを追加
UserApi change_user_icon PUT /users/{userId}/icon ユーザーのアイコン画像を変更します
UserApi change_user_password PUT /users/{userId}/password ユーザーのパスワードを変更
UserApi create_user POST /users ユーザーを登録
UserApi edit_user PATCH /users/{userId} ユーザー情報を変更
UserApi edit_user_tag PATCH /users/{userId}/tags/{tagId} ユーザーのタグを編集
UserApi get_direct_messages GET /users/{userId}/messages ダイレクトメッセージのリストを取得
UserApi get_user GET /users/{userId} ユーザー詳細情報を取得
UserApi get_user_dm_channel GET /users/{userId}/dm-channel DMチャンネル情報を取得
UserApi get_user_icon GET /users/{userId}/icon ユーザーのアイコン画像を取得
UserApi get_user_stats GET /users/{userId}/stats ユーザー統計情報を取得
UserApi get_user_tags GET /users/{userId}/tags ユーザーのタグリストを取得
UserApi get_users GET /users ユーザーのリストを取得
UserApi post_direct_message POST /users/{userId}/messages ダイレクトメッセージを送信
UserApi remove_user_tag DELETE /users/{userId}/tags/{tagId} ユーザーからタグを削除します
UserTagApi add_my_user_tag POST /users/me/tags 自分にタグを追加
UserTagApi add_user_tag POST /users/{userId}/tags ユーザーにタグを追加
UserTagApi edit_my_user_tag PATCH /users/me/tags/{tagId} 自分のタグを編集
UserTagApi edit_user_tag PATCH /users/{userId}/tags/{tagId} ユーザーのタグを編集
UserTagApi get_my_user_tags GET /users/me/tags 自分のタグリストを取得
UserTagApi get_tag GET /tags/{tagId} タグ情報を取得
UserTagApi get_user_tags GET /users/{userId}/tags ユーザーのタグリストを取得
UserTagApi remove_my_user_tag DELETE /users/me/tags/{tagId} 自分からタグを削除します
UserTagApi remove_user_tag DELETE /users/{userId}/tags/{tagId} ユーザーからタグを削除します
WebhookApi change_webhook_icon PUT /webhooks/{webhookId}/icon Webhookのアイコンを変更
WebhookApi create_webhook POST /webhooks Webhookを新規作成
WebhookApi delete_webhook DELETE /webhooks/{webhookId} Webhookを削除
WebhookApi edit_webhook PATCH /webhooks/{webhookId} Webhook情報を変更
WebhookApi get_webhook GET /webhooks/{webhookId} Webhook情報を取得
WebhookApi get_webhook_icon GET /webhooks/{webhookId}/icon Webhookのアイコンを取得
WebhookApi get_webhook_messages GET /webhooks/{webhookId}/messages Webhookの投稿メッセージのリストを取得
WebhookApi get_webhooks GET /webhooks Webhook情報のリストを取得します
WebhookApi post_webhook POST /webhooks/{webhookId} Webhookを送信
WebrtcApi get_web_rtc_state GET /webrtc/state WebRTC状態を取得
WebrtcApi post_web_rtc_authenticate POST /webrtc/authenticate Skyway用認証API

Documentation For Models

Documentation For Authorization

OAuth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: /api/v3/oauth2/authorize
  • Scopes:
  • read: 読み取りスコープ
  • write: 書き込みスコープ
  • manage_bot: bot関連読み書きスコープ

cookieAuth

  • Type: API key
  • API key parameter name: r_session
  • Location:

Author

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in traq.apis and traq.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from traq.api.default_api import DefaultApi
  • from traq.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import traq
from traq.apis import *
from traq.models import *