identity-service-api: Add terms of service acceptance endpoint

This commit is contained in:
Adam 2021-04-04 21:37:46 +02:00 committed by GitHub
parent f67f44c8aa
commit ffcf50fb4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 0 deletions

View File

@ -1,3 +1,4 @@
//! Endpoints to retreive and accept terms of service of an identity server.
pub mod accept_terms_of_service;
pub mod get_terms_of_service;

View File

@ -0,0 +1,3 @@
//! Endpoint to send acceptance of the terms of service of an identity server.
pub mod v2;

View File

@ -0,0 +1,38 @@
//! [POST /_matrix/identity/v2/terms](https://matrix.org/docs/spec/identity_service/r0.3.0#post-matrix-identity-v2-terms)
use ruma_api::ruma_api;
ruma_api! {
metadata: {
description: "Called by a client to indicate that the user has accepted/agreed to the included set of URLs.",
method: POST,
name: "accept_terms_of_service",
path: "/_matrix/identity/v2/terms",
authentication: AccessToken,
rate_limited: false,
}
request: {
/// The URLs the user is accepting in this request.
///
/// An example is "https://example.org/somewhere/terms-2.0-en.html".
pub user_accepts: Vec<String>,
}
#[derive(Default)]
response: {}
}
impl Request {
/// Creates a new `Request` with the given URLs which the user accepts.
pub fn new(user_accepts: Vec<String>) -> Self {
Self { user_accepts }
}
}
impl Response {
/// Creates an empty `Response`.
pub fn new() -> Self {
Self
}
}