diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 1c5f771..843617f 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -60,6 +60,8 @@ docs/Oauth2Api.md docs/Ogp.md docs/OgpApi.md docs/OgpMedia.md +docs/OidcTraqUserInfo.md +docs/OidcUserInfo.md docs/ParentChangedEvent.md docs/PatchBotRequest.md docs/PatchChannelRequest.md @@ -106,6 +108,7 @@ docs/PutChannelTopicRequest.md docs/PutMyPasswordRequest.md docs/PutNotifyCitationRequest.md docs/PutUserPasswordRequest.md +docs/Session.md docs/Stamp.md docs/StampApi.md docs/StampHistoryEntry.md @@ -137,7 +140,6 @@ docs/VersionFlags.md docs/VisibilityChangedEvent.md docs/WebRtcAuthenticateResult.md docs/WebRtcUserState.md -docs/WebRtcUserStateSessionsInner.md docs/Webhook.md docs/WebhookApi.md docs/WebrtcApi.md @@ -214,6 +216,8 @@ src/models/o_auth2_scope.rs src/models/o_auth2_token.rs src/models/ogp.rs src/models/ogp_media.rs +src/models/oidc_traq_user_info.rs +src/models/oidc_user_info.rs src/models/parent_changed_event.rs src/models/patch_bot_request.rs src/models/patch_channel_request.rs @@ -258,6 +262,7 @@ src/models/put_channel_topic_request.rs src/models/put_my_password_request.rs src/models/put_notify_citation_request.rs src/models/put_user_password_request.rs +src/models/session.rs src/models/stamp.rs src/models/stamp_history_entry.rs src/models/stamp_palette.rs @@ -285,5 +290,4 @@ src/models/version_flags.rs src/models/visibility_changed_event.rs src/models/web_rtc_authenticate_result.rs src/models/web_rtc_user_state.rs -src/models/web_rtc_user_state_sessions_inner.rs src/models/webhook.rs diff --git a/docs/MeApi.md b/docs/MeApi.md index af7561e..4045be2 100644 --- a/docs/MeApi.md +++ b/docs/MeApi.md @@ -24,6 +24,7 @@ Method | HTTP request | Description [**get_my_unread_channels**](MeApi.md#get_my_unread_channels) | **GET** /users/me/unread | 未読チャンネルを取得 [**get_my_user_tags**](MeApi.md#get_my_user_tags) | **GET** /users/me/tags | 自分のタグリストを取得 [**get_my_view_states**](MeApi.md#get_my_view_states) | **GET** /users/me/view-states | 自身のチャンネル閲覧状態一覧を取得 +[**get_oidc_user_info**](MeApi.md#get_oidc_user_info) | **GET** /users/me/oidc | 自分のユーザー詳細を取得 (OIDC UserInfo) [**get_user_settings**](MeApi.md#get_user_settings) | **GET** /users/me/settings | ユーザー設定を取得 [**link_external_account**](MeApi.md#link_external_account) | **POST** /users/me/ex-accounts/link | 外部ログインアカウントを紐付ける [**read_channel**](MeApi.md#read_channel) | **DELETE** /users/me/unread/{channelId} | チャンネルを既読にする @@ -605,6 +606,33 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_oidc_user_info + +> crate::models::OidcUserInfo get_oidc_user_info() +自分のユーザー詳細を取得 (OIDC UserInfo) + +OIDCトークンを用いてユーザー詳細を取得します。 OIDC UserInfo Endpointです。 + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**crate::models::OidcUserInfo**](OIDCUserInfo.md) + +### Authorization + +[OAuth2](../README.md#OAuth2), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_user_settings > crate::models::UserSettings get_user_settings() diff --git a/docs/OidcTraqUserInfo.md b/docs/OidcTraqUserInfo.md new file mode 100644 index 0000000..ce5cf96 --- /dev/null +++ b/docs/OidcTraqUserInfo.md @@ -0,0 +1,21 @@ +# OidcTraqUserInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bio** | **String** | 自己紹介(biography) | +**groups** | [**Vec**](uuid::Uuid.md) | 所属グループのUUIDの配列 | +**tags** | [**Vec**](UserTag.md) | タグリスト | +**last_online** | Option<**String**> | 最終オンライン日時 | +**twitter_id** | **String** | Twitter ID | +**display_name** | **String** | ユーザー表示名 | +**icon_file_id** | [**uuid::Uuid**](uuid::Uuid.md) | アイコンファイルUUID | +**bot** | **bool** | BOTかどうか | +**state** | [**crate::models::UserAccountState**](UserAccountState.md) | | +**permissions** | [**Vec**](UserPermission.md) | 所有している権限の配列 | +**home_channel** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | ホームチャンネル | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OidcUserInfo.md b/docs/OidcUserInfo.md new file mode 100644 index 0000000..0e1bef8 --- /dev/null +++ b/docs/OidcUserInfo.md @@ -0,0 +1,16 @@ +# OidcUserInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sub** | [**uuid::Uuid**](uuid::Uuid.md) | ユーザーUUID | +**name** | **String** | ユーザー名 | +**preferred_username** | **String** | ユーザー名 | +**picture** | **String** | アイコン画像URL | +**updated_at** | Option<**i64**> | 更新日時 | [optional] +**traq** | Option<[**crate::models::OidcTraqUserInfo**](OIDCTraqUserInfo.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/README.md b/docs/README.md index b03128f..73a00a1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -115,6 +115,7 @@ Class | Method | HTTP request | Description *MeApi* | [**get_my_unread_channels**](MeApi.md#get_my_unread_channels) | **GET** /users/me/unread | 未読チャンネルを取得 *MeApi* | [**get_my_user_tags**](MeApi.md#get_my_user_tags) | **GET** /users/me/tags | 自分のタグリストを取得 *MeApi* | [**get_my_view_states**](MeApi.md#get_my_view_states) | **GET** /users/me/view-states | 自身のチャンネル閲覧状態一覧を取得 +*MeApi* | [**get_oidc_user_info**](MeApi.md#get_oidc_user_info) | **GET** /users/me/oidc | 自分のユーザー詳細を取得 (OIDC UserInfo) *MeApi* | [**get_user_settings**](MeApi.md#get_user_settings) | **GET** /users/me/settings | ユーザー設定を取得 *MeApi* | [**link_external_account**](MeApi.md#link_external_account) | **POST** /users/me/ex-accounts/link | 外部ログインアカウントを紐付ける *MeApi* | [**read_channel**](MeApi.md#read_channel) | **DELETE** /users/me/unread/{channelId} | チャンネルを既読にする @@ -278,6 +279,8 @@ Class | Method | HTTP request | Description - [OAuth2Token](OAuth2Token.md) - [Ogp](Ogp.md) - [OgpMedia](OgpMedia.md) + - [OidcTraqUserInfo](OidcTraqUserInfo.md) + - [OidcUserInfo](OidcUserInfo.md) - [ParentChangedEvent](ParentChangedEvent.md) - [PatchBotRequest](PatchBotRequest.md) - [PatchChannelRequest](PatchChannelRequest.md) @@ -322,6 +325,7 @@ Class | Method | HTTP request | Description - [PutMyPasswordRequest](PutMyPasswordRequest.md) - [PutNotifyCitationRequest](PutNotifyCitationRequest.md) - [PutUserPasswordRequest](PutUserPasswordRequest.md) + - [Session](Session.md) - [Stamp](Stamp.md) - [StampHistoryEntry](StampHistoryEntry.md) - [StampPalette](StampPalette.md) @@ -349,7 +353,6 @@ Class | Method | HTTP request | Description - [VisibilityChangedEvent](VisibilityChangedEvent.md) - [WebRtcAuthenticateResult](WebRtcAuthenticateResult.md) - [WebRtcUserState](WebRtcUserState.md) - - [WebRtcUserStateSessionsInner](WebRtcUserStateSessionsInner.md) - [Webhook](Webhook.md) diff --git a/docs/Session.md b/docs/Session.md new file mode 100644 index 0000000..b53aae2 --- /dev/null +++ b/docs/Session.md @@ -0,0 +1,12 @@ +# Session + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**state** | **String** | 状態 | +**session_id** | **String** | セッションID | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebRtcUserState.md b/docs/WebRtcUserState.md index 3ba8fde..e85e336 100644 --- a/docs/WebRtcUserState.md +++ b/docs/WebRtcUserState.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **user_id** | [**uuid::Uuid**](uuid::Uuid.md) | ユーザーUUID | **channel_id** | [**uuid::Uuid**](uuid::Uuid.md) | チャンネルUUID | -**sessions** | [**Vec**](WebRTCUserState_sessions_inner.md) | セッションの配列 | +**sessions** | [**Vec**](Session.md) | セッションの配列 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/src/apis/bot_api.rs b/src/apis/bot_api.rs index 427effe..48903e0 100644 --- a/src/apis/bot_api.rs +++ b/src/apis/bot_api.rs @@ -199,7 +199,7 @@ pub async fn activate_bot( pub async fn change_bot_icon( configuration: &configuration::Configuration, bot_id: &str, - _file: std::path::PathBuf, + file: std::path::PathBuf, ) -> Result<(), Error> { let local_var_configuration = configuration; @@ -223,7 +223,7 @@ pub async fn change_bot_icon( if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); }; - let local_var_form = reqwest::multipart::Form::new(); + let mut local_var_form = reqwest::multipart::Form::new(); // TODO: support file upload for 'file' parameter local_var_req_builder = local_var_req_builder.multipart(local_var_form); diff --git a/src/apis/file_api.rs b/src/apis/file_api.rs index c2c6cd6..1011223 100644 --- a/src/apis/file_api.rs +++ b/src/apis/file_api.rs @@ -11,7 +11,7 @@ use reqwest; use super::{configuration, Error}; -use crate::{apis::ResponseContent, models::ThumbnailType}; +use crate::apis::ResponseContent; /// struct for typed errors of method [`delete_file`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -352,7 +352,7 @@ pub async fn get_thumbnail_image( /// 指定したチャンネルにファイルをアップロードします。 アーカイブされているチャンネルにはアップロード出来ません。 pub async fn post_file( configuration: &configuration::Configuration, - _file: std::path::PathBuf, + file: std::path::PathBuf, channel_id: &str, ) -> Result> { let local_var_configuration = configuration; diff --git a/src/apis/group_api.rs b/src/apis/group_api.rs index 0978d18..29bfc87 100644 --- a/src/apis/group_api.rs +++ b/src/apis/group_api.rs @@ -237,7 +237,7 @@ pub async fn add_user_group_member( pub async fn change_user_group_icon( configuration: &configuration::Configuration, group_id: &str, - _file: std::path::PathBuf, + file: std::path::PathBuf, ) -> Result<(), Error> { let local_var_configuration = configuration; @@ -261,7 +261,7 @@ pub async fn change_user_group_icon( if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); }; - let local_var_form = reqwest::multipart::Form::new(); + let mut local_var_form = reqwest::multipart::Form::new(); // TODO: support file upload for 'file' parameter local_var_req_builder = local_var_req_builder.multipart(local_var_form); diff --git a/src/apis/me_api.rs b/src/apis/me_api.rs index e1cf65c..df28a4e 100644 --- a/src/apis/me_api.rs +++ b/src/apis/me_api.rs @@ -165,6 +165,13 @@ pub enum GetMyViewStatesError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_oidc_user_info`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetOidcUserInfoError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_user_settings`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -336,7 +343,7 @@ pub async fn add_my_user_tag( /// 自分のアイコン画像を変更します。 pub async fn change_my_icon( configuration: &configuration::Configuration, - _file: std::path::PathBuf, + file: std::path::PathBuf, ) -> Result<(), Error> { let local_var_configuration = configuration; @@ -356,7 +363,7 @@ pub async fn change_my_icon( if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); }; - let local_var_form = reqwest::multipart::Form::new(); + let mut local_var_form = reqwest::multipart::Form::new(); // TODO: support file upload for 'file' parameter local_var_req_builder = local_var_req_builder.multipart(local_var_form); @@ -1144,6 +1151,49 @@ pub async fn get_my_view_states( } } +/// OIDCトークンを用いてユーザー詳細を取得します。 OIDC UserInfo Endpointです。 +pub async fn get_oidc_user_info( + configuration: &configuration::Configuration, +) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/users/me/oidc", local_var_configuration.base_path); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { + local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); + }; + if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { + local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; + Err(Error::ResponseError(local_var_error)) + } +} + /// ユーザー設定を取得します。 pub async fn get_user_settings( configuration: &configuration::Configuration, diff --git a/src/apis/oauth2_api.rs b/src/apis/oauth2_api.rs index 3522549..a848a57 100644 --- a/src/apis/oauth2_api.rs +++ b/src/apis/oauth2_api.rs @@ -11,10 +11,7 @@ use reqwest; use super::{configuration, Error}; -use crate::{ - apis::ResponseContent, - models::{OAuth2Prompt, OAuth2ResponseType}, -}; +use crate::apis::ResponseContent; /// struct for typed errors of method [`create_client`] #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/src/apis/stamp_api.rs b/src/apis/stamp_api.rs index 81baeab..da1f981 100644 --- a/src/apis/stamp_api.rs +++ b/src/apis/stamp_api.rs @@ -214,7 +214,7 @@ pub async fn add_message_stamp( pub async fn change_stamp_image( configuration: &configuration::Configuration, stamp_id: &str, - _file: std::path::PathBuf, + file: std::path::PathBuf, ) -> Result<(), Error> { let local_var_configuration = configuration; @@ -238,7 +238,7 @@ pub async fn change_stamp_image( if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); }; - let local_var_form = reqwest::multipart::Form::new(); + let mut local_var_form = reqwest::multipart::Form::new(); // TODO: support file upload for 'file' parameter local_var_req_builder = local_var_req_builder.multipart(local_var_form); @@ -266,7 +266,7 @@ pub async fn change_stamp_image( pub async fn create_stamp( configuration: &configuration::Configuration, name: &str, - _file: std::path::PathBuf, + file: std::path::PathBuf, ) -> Result> { let local_var_configuration = configuration; diff --git a/src/apis/user_api.rs b/src/apis/user_api.rs index 61a133d..0881736 100644 --- a/src/apis/user_api.rs +++ b/src/apis/user_api.rs @@ -203,7 +203,7 @@ pub async fn add_user_tag( pub async fn change_user_icon( configuration: &configuration::Configuration, user_id: &str, - _file: std::path::PathBuf, + file: std::path::PathBuf, ) -> Result<(), Error> { let local_var_configuration = configuration; @@ -227,7 +227,7 @@ pub async fn change_user_icon( if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); }; - let local_var_form = reqwest::multipart::Form::new(); + let mut local_var_form = reqwest::multipart::Form::new(); // TODO: support file upload for 'file' parameter local_var_req_builder = local_var_req_builder.multipart(local_var_form); diff --git a/src/apis/webhook_api.rs b/src/apis/webhook_api.rs index 76bf370..c9ea462 100644 --- a/src/apis/webhook_api.rs +++ b/src/apis/webhook_api.rs @@ -93,7 +93,7 @@ pub enum PostWebhookError { pub async fn change_webhook_icon( configuration: &configuration::Configuration, webhook_id: &str, - _file: std::path::PathBuf, + file: std::path::PathBuf, ) -> Result<(), Error> { let local_var_configuration = configuration; @@ -117,7 +117,7 @@ pub async fn change_webhook_icon( if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); }; - let local_var_form = reqwest::multipart::Form::new(); + let mut local_var_form = reqwest::multipart::Form::new(); // TODO: support file upload for 'file' parameter local_var_req_builder = local_var_req_builder.multipart(local_var_form); diff --git a/src/models/bot_state.rs b/src/models/bot_state.rs index 16f091e..03f04df 100644 --- a/src/models/bot_state.rs +++ b/src/models/bot_state.rs @@ -8,33 +8,31 @@ * Generated by: https://openapi-generator.tech */ -use serde_repr::{Deserialize_repr, Serialize_repr}; - /// BotState : BOT状態 0: 停止 1: 有効 2: 一時停止 /// BOT状態 0: 停止 1: 有効 2: 一時停止 -#[derive( - Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr, -)] -#[repr(u8)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum BotState { - Deactivated = 0, - Active = 1, - Suspended = 2, + #[serde(rename = "0")] + deactivated, + #[serde(rename = "1")] + active, + #[serde(rename = "2")] + suspended, } impl ToString for BotState { fn to_string(&self) -> String { match self { - Self::Deactivated => String::from("0"), - Self::Active => String::from("1"), - Self::Suspended => String::from("2"), + Self::deactivated => String::from("0"), + Self::active => String::from("1"), + Self::suspended => String::from("2"), } } } impl Default for BotState { fn default() -> BotState { - Self::Deactivated + Self::deactivated } } diff --git a/src/models/channel_subscribe_level.rs b/src/models/channel_subscribe_level.rs index 701c646..f3c0b66 100644 --- a/src/models/channel_subscribe_level.rs +++ b/src/models/channel_subscribe_level.rs @@ -8,33 +8,31 @@ * Generated by: https://openapi-generator.tech */ -use serde_repr::{Deserialize_repr, Serialize_repr}; - /// ChannelSubscribeLevel : チャンネル購読レベル 0:無し 1:未読管理 2:未読管理+通知 /// チャンネル購読レベル 0:無し 1:未読管理 2:未読管理+通知 -#[derive( - Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr, -)] -#[repr(u8)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum ChannelSubscribeLevel { - None = 0, - Subscribed = 1, - Notified = 2, + #[serde(rename = "0")] + none, + #[serde(rename = "1")] + subscribed, + #[serde(rename = "2")] + notified, } impl ToString for ChannelSubscribeLevel { fn to_string(&self) -> String { match self { - Self::None => String::from("0"), - Self::Subscribed => String::from("1"), - Self::Notified => String::from("2"), + Self::none => String::from("0"), + Self::subscribed => String::from("1"), + Self::notified => String::from("2"), } } } impl Default for ChannelSubscribeLevel { fn default() -> ChannelSubscribeLevel { - Self::None + Self::none } } diff --git a/src/models/file_info.rs b/src/models/file_info.rs index 9a97bbb..b15cdd4 100644 --- a/src/models/file_info.rs +++ b/src/models/file_info.rs @@ -69,7 +69,11 @@ impl FileInfo { is_animated_image, created_at, thumbnails, - thumbnail: thumbnail.map(Box::new), + thumbnail: if let Some(x) = thumbnail { + Some(Box::new(x)) + } else { + None + }, channel_id, uploader_id, } diff --git a/src/models/mod.rs b/src/models/mod.rs index d53757d..05628e9 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -96,6 +96,10 @@ pub mod ogp; pub use self::ogp::Ogp; pub mod ogp_media; pub use self::ogp_media::OgpMedia; +pub mod oidc_traq_user_info; +pub use self::oidc_traq_user_info::OidcTraqUserInfo; +pub mod oidc_user_info; +pub use self::oidc_user_info::OidcUserInfo; pub mod parent_changed_event; pub use self::parent_changed_event::ParentChangedEvent; pub mod patch_bot_request; @@ -184,6 +188,8 @@ pub mod put_notify_citation_request; pub use self::put_notify_citation_request::PutNotifyCitationRequest; pub mod put_user_password_request; pub use self::put_user_password_request::PutUserPasswordRequest; +pub mod session; +pub use self::session::Session; pub mod stamp; pub use self::stamp::Stamp; pub mod stamp_history_entry; @@ -238,7 +244,5 @@ pub mod web_rtc_authenticate_result; pub use self::web_rtc_authenticate_result::WebRtcAuthenticateResult; pub mod web_rtc_user_state; pub use self::web_rtc_user_state::WebRtcUserState; -pub mod web_rtc_user_state_sessions_inner; -pub use self::web_rtc_user_state_sessions_inner::WebRtcUserStateSessionsInner; pub mod webhook; pub use self::webhook::Webhook; diff --git a/src/models/o_auth2_scope.rs b/src/models/o_auth2_scope.rs index 63ab039..c839cbf 100644 --- a/src/models/o_auth2_scope.rs +++ b/src/models/o_auth2_scope.rs @@ -13,6 +13,10 @@ /// OAuth2スコープ #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum OAuth2Scope { + #[serde(rename = "openid")] + Openid, + #[serde(rename = "profile")] + Profile, #[serde(rename = "read")] Read, #[serde(rename = "write")] @@ -24,6 +28,8 @@ pub enum OAuth2Scope { impl ToString for OAuth2Scope { fn to_string(&self) -> String { match self { + Self::Openid => String::from("openid"), + Self::Profile => String::from("profile"), Self::Read => String::from("read"), Self::Write => String::from("write"), Self::ManageBot => String::from("manage_bot"), @@ -33,6 +39,6 @@ impl ToString for OAuth2Scope { impl Default for OAuth2Scope { fn default() -> OAuth2Scope { - Self::Read + Self::Openid } } diff --git a/src/models/oidc_traq_user_info.rs b/src/models/oidc_traq_user_info.rs new file mode 100644 index 0000000..275e1fb --- /dev/null +++ b/src/models/oidc_traq_user_info.rs @@ -0,0 +1,78 @@ +/* + * traQ v3 + * + * traQ v3 API + * + * The version of the OpenAPI document: 3.0 + * + * Generated by: https://openapi-generator.tech + */ + +/// OidcTraqUserInfo : traQ特有のユーザー詳細情報 + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct OidcTraqUserInfo { + /// 自己紹介(biography) + #[serde(rename = "bio")] + pub bio: String, + /// 所属グループのUUIDの配列 + #[serde(rename = "groups")] + pub groups: Vec, + /// タグリスト + #[serde(rename = "tags")] + pub tags: Vec, + /// 最終オンライン日時 + #[serde(rename = "last_online", deserialize_with = "Option::deserialize")] + pub last_online: Option, + /// Twitter ID + #[serde(rename = "twitter_id")] + pub twitter_id: String, + /// ユーザー表示名 + #[serde(rename = "display_name")] + pub display_name: String, + /// アイコンファイルUUID + #[serde(rename = "icon_file_id")] + pub icon_file_id: uuid::Uuid, + /// BOTかどうか + #[serde(rename = "bot")] + pub bot: bool, + #[serde(rename = "state")] + pub state: crate::models::UserAccountState, + /// 所有している権限の配列 + #[serde(rename = "permissions")] + pub permissions: Vec, + /// ホームチャンネル + #[serde(rename = "home_channel", deserialize_with = "Option::deserialize")] + pub home_channel: Option, +} + +impl OidcTraqUserInfo { + /// traQ特有のユーザー詳細情報 + pub fn new( + bio: String, + groups: Vec, + tags: Vec, + last_online: Option, + twitter_id: String, + display_name: String, + icon_file_id: uuid::Uuid, + bot: bool, + state: crate::models::UserAccountState, + permissions: Vec, + home_channel: Option, + ) -> OidcTraqUserInfo { + OidcTraqUserInfo { + bio, + groups, + tags, + last_online, + twitter_id, + display_name, + icon_file_id, + bot, + state, + permissions, + home_channel, + } + } +} diff --git a/src/models/oidc_user_info.rs b/src/models/oidc_user_info.rs new file mode 100644 index 0000000..858bc16 --- /dev/null +++ b/src/models/oidc_user_info.rs @@ -0,0 +1,51 @@ +/* + * traQ v3 + * + * traQ v3 API + * + * The version of the OpenAPI document: 3.0 + * + * Generated by: https://openapi-generator.tech + */ + +/// OidcUserInfo : 自分のユーザー詳細情報 + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct OidcUserInfo { + /// ユーザーUUID + #[serde(rename = "sub")] + pub sub: uuid::Uuid, + /// ユーザー名 + #[serde(rename = "name")] + pub name: String, + /// ユーザー名 + #[serde(rename = "preferred_username")] + pub preferred_username: String, + /// アイコン画像URL + #[serde(rename = "picture")] + pub picture: String, + /// 更新日時 + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + #[serde(rename = "traq", skip_serializing_if = "Option::is_none")] + pub traq: Option>, +} + +impl OidcUserInfo { + /// 自分のユーザー詳細情報 + pub fn new( + sub: uuid::Uuid, + name: String, + preferred_username: String, + picture: String, + ) -> OidcUserInfo { + OidcUserInfo { + sub, + name, + preferred_username, + picture, + updated_at: None, + traq: None, + } + } +} diff --git a/src/models/session.rs b/src/models/session.rs new file mode 100644 index 0000000..123edc5 --- /dev/null +++ b/src/models/session.rs @@ -0,0 +1,25 @@ +/* + * traQ v3 + * + * traQ v3 API + * + * The version of the OpenAPI document: 3.0 + * + * Generated by: https://openapi-generator.tech + */ + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Session { + /// 状態 + #[serde(rename = "state")] + pub state: String, + /// セッションID + #[serde(rename = "sessionId")] + pub session_id: String, +} + +impl Session { + pub fn new(state: String, session_id: String) -> Session { + Session { state, session_id } + } +} diff --git a/src/models/user_account_state.rs b/src/models/user_account_state.rs index a2f77cb..ebc7d43 100644 --- a/src/models/user_account_state.rs +++ b/src/models/user_account_state.rs @@ -8,33 +8,31 @@ * Generated by: https://openapi-generator.tech */ -use serde_repr::{Deserialize_repr, Serialize_repr}; - /// UserAccountState : ユーザーアカウント状態 0: 停止 1: 有効 2: 一時停止 /// ユーザーアカウント状態 0: 停止 1: 有効 2: 一時停止 -#[derive( - Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr, -)] -#[repr(u8)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum UserAccountState { - Deactivated = 0, - Active = 1, - Suspended = 2, + #[serde(rename = "0")] + deactivated, + #[serde(rename = "1")] + active, + #[serde(rename = "2")] + suspended, } impl ToString for UserAccountState { fn to_string(&self) -> String { match self { - Self::Deactivated => String::from("0"), - Self::Active => String::from("1"), - Self::Suspended => String::from("2"), + Self::deactivated => String::from("0"), + Self::active => String::from("1"), + Self::suspended => String::from("2"), } } } impl Default for UserAccountState { fn default() -> UserAccountState { - Self::Deactivated + Self::deactivated } } diff --git a/src/models/user_permission.rs b/src/models/user_permission.rs index 27a4444..3b1ca32 100644 --- a/src/models/user_permission.rs +++ b/src/models/user_permission.rs @@ -127,6 +127,8 @@ pub enum UserPermission { RegisterUser, #[serde(rename = "get_me")] GetMe, + #[serde(rename = "get_oidc_userinfo")] + GetOIDCUserInfo, #[serde(rename = "edit_me")] EditMe, #[serde(rename = "change_my_icon")] @@ -237,6 +239,7 @@ impl ToString for UserPermission { Self::GetUser => String::from("get_user"), Self::RegisterUser => String::from("register_user"), Self::GetMe => String::from("get_me"), + Self::GetOIDCUserInfo => String::from("get_oidc_userinfo"), Self::EditMe => String::from("edit_me"), Self::ChangeMyIcon => String::from("change_my_icon"), Self::ChangeMyPassword => String::from("change_my_password"), diff --git a/src/models/web_rtc_user_state.rs b/src/models/web_rtc_user_state.rs index 36f58dc..09c9c7e 100644 --- a/src/models/web_rtc_user_state.rs +++ b/src/models/web_rtc_user_state.rs @@ -20,7 +20,7 @@ pub struct WebRtcUserState { pub channel_id: uuid::Uuid, /// セッションの配列 #[serde(rename = "sessions")] - pub sessions: Vec, + pub sessions: Vec, } impl WebRtcUserState { @@ -28,7 +28,7 @@ impl WebRtcUserState { pub fn new( user_id: uuid::Uuid, channel_id: uuid::Uuid, - sessions: Vec, + sessions: Vec, ) -> WebRtcUserState { WebRtcUserState { user_id,