Skip to main content

spatio_sdk/models/
discovery_document.rs

1/*
2 * SpatioAPI
3 *
4 * The REST API that owns every resource in your Spatio workspace: notes, sheets, slides, tasks, calendar events, mail, chat, files, and contacts. SpatioMCP wraps this API; Spatio Desktop reads from it. You can call it directly from your own code.  All requests must be authenticated with a Personal Access Token (`Authorization: Bearer pat_...`) or an OAuth 2.1 access token, and use HTTPS.  Official SDKs (MIT, generated from this spec on every release):  - TypeScript: https://github.com/spatio-labs/spatio-ts (`npm install @spatio-labs/spatio-ts`) - Python: https://github.com/spatio-labs/spatio-py (`pip install spatio-sdk`) - Go: https://github.com/spatio-labs/spatio-go (`go get github.com/spatio-labs/spatio-go`)  This specification is generated from the platform-service Go source on every push to `main`. The spec, not hand-written documentation, is the source of truth: server stubs and SDKs are generated from it, and any drift between the spec and the running service fails CI. 
5 *
6 * The version of the OpenAPI document: v1
7 * Contact: hello@spatio.app
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// DiscoveryDocument : OAuth 2.1 (RFC 8414) + OpenID Connect Discovery 1.0 metadata. Same payload returned from both well-known paths. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DiscoveryDocument {
17    #[serde(rename = "issuer")]
18    pub issuer: String,
19    #[serde(rename = "authorization_endpoint")]
20    pub authorization_endpoint: String,
21    #[serde(rename = "token_endpoint")]
22    pub token_endpoint: String,
23    #[serde(rename = "registration_endpoint", skip_serializing_if = "Option::is_none")]
24    pub registration_endpoint: Option<String>,
25    #[serde(rename = "introspection_endpoint", skip_serializing_if = "Option::is_none")]
26    pub introspection_endpoint: Option<String>,
27    #[serde(rename = "revocation_endpoint", skip_serializing_if = "Option::is_none")]
28    pub revocation_endpoint: Option<String>,
29    #[serde(rename = "userinfo_endpoint", skip_serializing_if = "Option::is_none")]
30    pub userinfo_endpoint: Option<String>,
31    #[serde(rename = "jwks_uri")]
32    pub jwks_uri: String,
33    #[serde(rename = "response_types_supported", skip_serializing_if = "Option::is_none")]
34    pub response_types_supported: Option<Vec<String>>,
35    #[serde(rename = "grant_types_supported", skip_serializing_if = "Option::is_none")]
36    pub grant_types_supported: Option<Vec<String>>,
37    #[serde(rename = "token_endpoint_auth_methods_supported", skip_serializing_if = "Option::is_none")]
38    pub token_endpoint_auth_methods_supported: Option<Vec<String>>,
39    #[serde(rename = "code_challenge_methods_supported", skip_serializing_if = "Option::is_none")]
40    pub code_challenge_methods_supported: Option<Vec<String>>,
41    #[serde(rename = "scopes_supported")]
42    pub scopes_supported: Vec<String>,
43    #[serde(rename = "subject_types_supported", skip_serializing_if = "Option::is_none")]
44    pub subject_types_supported: Option<Vec<String>>,
45    #[serde(rename = "id_token_signing_alg_values_supported", skip_serializing_if = "Option::is_none")]
46    pub id_token_signing_alg_values_supported: Option<Vec<String>>,
47    #[serde(rename = "prompt_values_supported", skip_serializing_if = "Option::is_none")]
48    pub prompt_values_supported: Option<Vec<String>>,
49    #[serde(rename = "claims_supported", skip_serializing_if = "Option::is_none")]
50    pub claims_supported: Option<Vec<String>>,
51    #[serde(rename = "service_documentation", skip_serializing_if = "Option::is_none")]
52    pub service_documentation: Option<String>,
53}
54
55impl DiscoveryDocument {
56    /// OAuth 2.1 (RFC 8414) + OpenID Connect Discovery 1.0 metadata. Same payload returned from both well-known paths. 
57    pub fn new(issuer: String, authorization_endpoint: String, token_endpoint: String, jwks_uri: String, scopes_supported: Vec<String>) -> DiscoveryDocument {
58        DiscoveryDocument {
59            issuer,
60            authorization_endpoint,
61            token_endpoint,
62            registration_endpoint: None,
63            introspection_endpoint: None,
64            revocation_endpoint: None,
65            userinfo_endpoint: None,
66            jwks_uri,
67            response_types_supported: None,
68            grant_types_supported: None,
69            token_endpoint_auth_methods_supported: None,
70            code_challenge_methods_supported: None,
71            scopes_supported,
72            subject_types_supported: None,
73            id_token_signing_alg_values_supported: None,
74            prompt_values_supported: None,
75            claims_supported: None,
76            service_documentation: None,
77        }
78    }
79}
80