client-api: Make id_server and id_access_token in ThirdpartyIdCredentials optional fields

This commit is contained in:
Mikoto 2024-06-18 21:19:22 +00:00 committed by GitHub
parent b8f0cb8fac
commit afb5ae0102
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 13 deletions

View File

@ -6,6 +6,7 @@ Breaking changes:
as before.
- Change type of `client_secret` field in `ThirdpartyIdCredentials`
from `Box<ClientSecret>` to `OwnedClientSecret`
- Make `id_server` and `id_access_token` in `ThirdpartyIdCredentials` optional
Improvements:

View File

@ -542,29 +542,25 @@ pub struct IncomingCustomThirdPartyId {
#[derive(Clone, Deserialize, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct ThirdpartyIdCredentials {
/// Identity server session ID.
/// Identity server (or homeserver) session ID.
pub sid: OwnedSessionId,
/// Identity server client secret.
/// Identity server (or homeserver) client secret.
pub client_secret: OwnedClientSecret,
/// Identity server URL.
pub id_server: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub id_server: Option<String>,
/// Identity server access token.
pub id_access_token: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub id_access_token: Option<String>,
}
impl ThirdpartyIdCredentials {
/// Creates a new `ThirdpartyIdCredentials` with the given session ID, client secret, identity
/// server address and access token.
pub fn new(
sid: OwnedSessionId,
client_secret: OwnedClientSecret,
id_server: String,
id_access_token: String,
) -> Self {
Self { sid, client_secret, id_server, id_access_token }
/// Creates a new `ThirdpartyIdCredentials` with the given session ID and client secret.
pub fn new(sid: OwnedSessionId, client_secret: OwnedClientSecret) -> Self {
Self { sid, client_secret, id_server: None, id_access_token: None }
}
}