ocm-types 0.2.1

Types required to implement the OpenCloudMesh filesharing protocol
Documentation
// SPDX-FileCopyrightText: 2026 Matthias Kraus <info@opengeomesh.org>
//
// SPDX-License-Identifier: LGPL-3.0-or-later

use serde::{Deserialize, Serialize};


#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
struct TokenRequest{

    /// FQDN of the Receiving Server.
    /// example: receiver.org
    client_id: String,
    /// Secret received in the Share Creation Notification
    /// example: xyz
    code: String,
    /// Must be set to 'authorization_code'
    /// example: authorization_code
    grant_type: GrantType, 
    /// Optional parameter that MUST be ignored by the server
    /// example: https://receiver.org/ocm/callback
    redirect_uri: Option<String>
}

#[derive(Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
enum GrantType {
    #[default]
    AuthorizationCode
}

#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
struct TokenResponse{
    /// The bearer token to be used to access the protocol-specific API(s)
    /// example: asdfgh
    access_token: String,
    /// Must be set to 'Bearer'
    /// example: Bearer
    token_type: TokenType,
    /// Number of seconds before this access_token will need to be refreshed.
    /// example: 300
    expires_in: u64,
}

#[derive(Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
enum TokenType {
    #[default]
    Bearer
}