BlueGit

ict rusty-teams

Files

rusty-teams / crates / chatsvc / src / pins / mod.rs

mod.rs

Initial commit
metis Daniel Däschle · pushed by metis · 7 weeks ago
06e0ae51 History
mod.rs 1016 B Download Raw
1mod channels;
2mod chats;
3mod folders;
4mod state;
5mod teams;
6mod transport;
7
8use session::Session;
9
10pub use folders::{Folder, FolderKind, Folders};
11pub use state::{PinnedChannels, PinnedChats};
12pub use teams::{ChannelLayout, TeamLayout};
13pub use transport::{CSA_RESOURCE, CSA_SCOPE, CsaTransport, SessionTransport};
14
15pub const DEFAULT_REGION: &str = "emea";
16
17pub struct Pins<T: CsaTransport = SessionTransport> {
18 transport: T,
19 base_url: String,
20}
21
22impl Pins<SessionTransport> {
23 pub fn new(session: &Session) -> Self {
24 Self::with_region(session, DEFAULT_REGION)
25 }
26
27 pub fn with_region(session: &Session, region: &str) -> Self {
28 Pins::with_transport(SessionTransport::new(session), region)
29 }
30}
31
32impl<T: CsaTransport> Pins<T> {
33 pub fn with_transport(transport: T, region: &str) -> Self {
34 Pins {
35 transport,
36 base_url: format!(
37 "https://teams.cloud.microsoft/api/csa/{region}/api/v1/teams/users/me"
38 ),
39 }
40 }
41}