From 319e68da06699008f196f3a785c24774e0654e68 Mon Sep 17 00:00:00 2001 From: H1rono <54711422+H1rono@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:00:35 +0000 Subject: [PATCH] CI: regenerate --- .openapi-generator/FILES | 8 +++- docs/MeApi.md | 28 +++++++++++ docs/OidcTraqUserInfo.md | 21 +++++++++ docs/OidcUserInfo.md | 16 +++++++ docs/README.md | 5 +- docs/Session.md | 12 +++++ docs/WebRtcUserState.md | 2 +- src/apis/me_api.rs | 50 ++++++++++++++++++++ src/models/mod.rs | 8 +++- src/models/o_auth2_scope.rs | 8 +++- src/models/oidc_traq_user_info.rs | 78 +++++++++++++++++++++++++++++++ src/models/oidc_user_info.rs | 51 ++++++++++++++++++++ src/models/session.rs | 25 ++++++++++ src/models/user_permission.rs | 3 ++ src/models/web_rtc_user_state.rs | 4 +- 15 files changed, 310 insertions(+), 9 deletions(-) create mode 100644 docs/OidcTraqUserInfo.md create mode 100644 docs/OidcUserInfo.md create mode 100644 docs/Session.md create mode 100644 src/models/oidc_traq_user_info.rs create mode 100644 src/models/oidc_user_info.rs create mode 100644 src/models/session.rs 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/me_api.rs b/src/apis/me_api.rs index e1cf65c..19075b4 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)] @@ -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/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_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,