ucare/
project.rs

1//! Holds all primitives and logic around the project resource.
2
3use std::fmt::Debug;
4
5use reqwest::Method;
6use serde::Deserialize;
7
8use crate::ucare::{rest::Client, Result};
9
10/// Service is used to make calls to webhook API.
11pub struct Service<'a> {
12    client: &'a Client,
13}
14
15/// creates an instance of the webhook service
16pub fn new_svc(client: &Client) -> Service {
17    Service { client }
18}
19
20impl Service<'_> {
21    /// Getting info about account project.
22    pub fn info(&self) -> Result<Info> {
23        self.client
24            .call::<String, String, Info>(Method::GET, format!("/project/"), None, None)
25    }
26}
27
28/// Account project information
29#[derive(Debug, Deserialize)]
30pub struct Info {
31    /// Project login name.
32    pub name: String,
33    /// Project public key.
34    pub pub_key: String,
35    /// Project collaborators.
36    pub collaborators: Option<Vec<Collaborator>>,
37}
38
39/// Collaborator information
40#[derive(Debug, Deserialize)]
41pub struct Collaborator {
42    /// Collaborator email.
43    pub email: String,
44    /// Collaborator name.
45    pub name: String,
46}