this repo has no description
1use crate::types::Did; 2use axum::{Json, response::IntoResponse}; 3use serde::Serialize; 4 5#[derive(Debug, Serialize)] 6pub struct EmptyResponse {} 7 8impl EmptyResponse { 9 pub fn ok() -> impl IntoResponse { 10 Json(Self {}) 11 } 12} 13 14#[derive(Debug, Serialize)] 15pub struct SuccessResponse { 16 pub success: bool, 17} 18 19impl SuccessResponse { 20 pub fn ok() -> impl IntoResponse { 21 Json(Self { success: true }) 22 } 23} 24 25#[derive(Debug, Serialize)] 26pub struct DidResponse { 27 pub did: Did, 28} 29 30impl DidResponse { 31 pub fn new(did: impl Into<Did>) -> impl IntoResponse { 32 Json(Self { did: did.into() }) 33 } 34} 35 36#[derive(Debug, Serialize)] 37#[serde(rename_all = "camelCase")] 38pub struct TokenRequiredResponse { 39 pub token_required: bool, 40} 41 42impl TokenRequiredResponse { 43 pub fn new(required: bool) -> impl IntoResponse { 44 Json(Self { token_required: required }) 45 } 46} 47 48#[derive(Debug, Serialize)] 49#[serde(rename_all = "camelCase")] 50pub struct HasPasswordResponse { 51 pub has_password: bool, 52} 53 54impl HasPasswordResponse { 55 pub fn new(has_password: bool) -> impl IntoResponse { 56 Json(Self { has_password }) 57 } 58} 59 60#[derive(Debug, Serialize)] 61pub struct VerifiedResponse { 62 pub verified: bool, 63} 64 65impl VerifiedResponse { 66 pub fn new(verified: bool) -> impl IntoResponse { 67 Json(Self { verified }) 68 } 69} 70 71#[derive(Debug, Serialize)] 72pub struct EnabledResponse { 73 pub enabled: bool, 74} 75 76impl EnabledResponse { 77 pub fn new(enabled: bool) -> impl IntoResponse { 78 Json(Self { enabled }) 79 } 80} 81 82#[derive(Debug, Serialize)] 83pub struct StatusResponse { 84 pub status: String, 85} 86 87impl StatusResponse { 88 pub fn new(status: impl Into<String>) -> impl IntoResponse { 89 Json(Self { status: status.into() }) 90 } 91} 92 93#[derive(Debug, Serialize)] 94#[serde(rename_all = "camelCase")] 95pub struct DidDocumentResponse { 96 pub did_document: serde_json::Value, 97} 98 99impl DidDocumentResponse { 100 pub fn new(did_document: serde_json::Value) -> impl IntoResponse { 101 Json(Self { did_document }) 102 } 103} 104 105#[derive(Debug, Serialize)] 106pub struct OptionsResponse<T: Serialize> { 107 pub options: T, 108} 109 110impl<T: Serialize> OptionsResponse<T> { 111 pub fn new(options: T) -> Json<Self> { 112 Json(Self { options }) 113 } 114}