ocm_types/token.rs
1use serde::{Deserialize, Serialize};
2
3
4#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
5struct TokenRequest{
6
7 /// FQDN of the Receiving Server.
8 /// example: receiver.org
9 client_id: String,
10 /// Code received in the Share Creation Notification
11 /// example: xyz
12 code: String,
13 /// Must be set to 'ocm_authorization_code'
14 /// example: ocm_authorization_code
15 grant_type: GrantType,
16}
17
18#[derive(Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
19enum GrantType {
20 #[default]
21 OcmAuthorizationCode
22}
23
24#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
25struct TokenResponse{
26 /// The bearer token to be used to access the protocol-specific API(s)
27 /// example: asdfgh
28 access_token: String,
29 /// Must be set to 'bearer'
30 /// example: bearer
31 token_type: TokenType,
32 /// Number of seconds before this access_token will need to be refreshed.
33 /// example: 3600
34 expires_in: i64,
35 /// A refresh token
36 /// example: qwertyuiop
37 refresh_token: String
38}
39
40#[derive(Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
41enum TokenType {
42 #[default]
43 Bearer
44}