identity-service-api: Add terms of service acceptance endpoint
This commit is contained in:
		
							parent
							
								
									f67f44c8aa
								
							
						
					
					
						commit
						ffcf50fb4f
					
				| @ -1,3 +1,4 @@ | |||||||
| //! Endpoints to retreive and accept terms of service of an identity server.
 | //! Endpoints to retreive and accept terms of service of an identity server.
 | ||||||
| 
 | 
 | ||||||
|  | pub mod accept_terms_of_service; | ||||||
| pub mod get_terms_of_service; | pub mod get_terms_of_service; | ||||||
|  | |||||||
| @ -0,0 +1,3 @@ | |||||||
|  | //! Endpoint to send acceptance of the terms of service of an identity server.
 | ||||||
|  | 
 | ||||||
|  | pub mod v2; | ||||||
| @ -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 | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user