1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
use crate::dtos::AccountDTO;
use nettu_scheduler_domain::Account;
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AccountResponse {
pub account: AccountDTO,
}
impl AccountResponse {
pub fn new(account: Account) -> Self {
Self {
account: AccountDTO::new(&account),
}
}
}
pub mod create_account {
use super::*;
#[derive(Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RequestBody {
pub code: String,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct APIResponse {
pub account: AccountDTO,
pub secret_api_key: String,
}
impl APIResponse {
pub fn new(account: Account) -> Self {
Self {
account: AccountDTO::new(&account),
secret_api_key: account.secret_api_key,
}
}
}
}
pub mod get_account {
use super::*;
pub type APIResponse = AccountResponse;
}
pub mod set_account_pub_key {
use super::*;
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RequestBody {
pub public_jwt_key: Option<String>,
}
pub type APIResponse = AccountResponse;
}
pub mod set_account_webhook {
use super::*;
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RequestBody {
pub webhook_url: String,
}
pub type APIResponse = AccountResponse;
}
pub mod delete_account_webhook {
use super::*;
pub type APIResponse = AccountResponse;
}
pub mod add_account_integration {
use nettu_scheduler_domain::IntegrationProvider;
use super::*;
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RequestBody {
pub client_id: String,
pub client_secret: String,
pub redirect_uri: String,
pub provider: IntegrationProvider,
}
pub type APIResponse = String;
}
pub mod remove_account_integration {
use super::*;
use nettu_scheduler_domain::IntegrationProvider;
#[derive(Debug, Deserialize, Serialize)]
pub struct PathParams {
pub provider: IntegrationProvider,
}
pub type APIResponse = String;
}