resourcespace_client/api/
mod.rs1pub mod collection;
2pub mod message;
3pub mod metadata;
4pub mod resource;
5pub mod search;
6pub mod system;
7pub mod user;
8
9use serde::Serialize;
10use serde_with::{StringWithSeparator, formats::CommaSeparator, serde_as};
11use std::fmt::Display;
12
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)]
14#[serde(rename_all = "lowercase")]
15pub enum SortOrder {
16 Asc,
17 Desc,
18}
19
20#[serde_as]
35#[derive(Serialize, Debug, Clone, PartialEq)]
36pub struct List<T: Display>(#[serde_as(as = "StringWithSeparator::<CommaSeparator, T>")] Vec<T>);
37
38impl From<u32> for List<u32> {
40 fn from(val: u32) -> Self {
41 Self(vec![val])
42 }
43}
44impl From<Vec<u32>> for List<u32> {
45 fn from(vals: Vec<u32>) -> Self {
46 Self(vals)
47 }
48}
49impl<const N: usize> From<[u32; N]> for List<u32> {
50 fn from(arr: [u32; N]) -> Self {
51 Self(arr.into_iter().collect())
52 }
53}
54
55impl From<String> for List<String> {
57 fn from(val: String) -> Self {
58 Self(vec![val])
59 }
60}
61impl From<&str> for List<String> {
62 fn from(val: &str) -> Self {
63 Self(vec![val.to_string()])
64 }
65}
66impl From<Vec<String>> for List<String> {
67 fn from(vals: Vec<String>) -> Self {
68 Self(vals)
69 }
70}
71impl From<Vec<&str>> for List<String> {
72 fn from(vals: Vec<&str>) -> Self {
73 Self(vals.into_iter().map(|s| s.to_string()).collect())
74 }
75}
76impl<const N: usize> From<[String; N]> for List<String> {
77 fn from(arr: [String; N]) -> Self {
78 Self(arr.into_iter().collect())
79 }
80}
81impl<const N: usize> From<[&str; N]> for List<String> {
82 fn from(arr: [&str; N]) -> Self {
83 Self(arr.into_iter().map(|s| s.to_string()).collect())
84 }
85}