grp_core/common/orgs/
create.rs1use crate::empty_notes;
2use crate::error::errors::request::Request;
3use crate::platform::Platform;
4use crate::error::structs::Error;
5use crate::config::Config;
6use crate::common::users::structs::User;
7use crate::animation::Animation;
8use crate::specific::{gitea, gitlab};
9
10
11impl Platform {
12 pub async fn create_org<T: Into<String>, A: Animation + ?Sized>(&self,
24 name: T,
25 config: &Config,
26 recursive: bool,
27 animation: &Box<A>
28 ) -> (Vec<User>, Vec<Error>) {
29 let name = name.into();
30 match self {
31 Platform::Github => (
32 vec![],
33 vec![ Request::unsuported(self.name(), "Create orgs", empty_notes!()) ]
34 ),
35 Platform::Codeberg |
36 Platform::Forgejo |
37 Platform::Gitea => {
38 let result = gitea::orgs::create::create(self, &name, config, animation).await;
39 match result {
40 Ok(u) => (vec![u], vec![]),
41 Err(e) => (vec![], vec![e]),
42 }
43 },
44 Platform::Gitlab => gitlab::groups::create::create_group(self, &name, &config, recursive, animation).await
45 }
46 }
47}