Loading acorn-cli/src/commands/gather/mod.rs +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ pub async fn run( // let langs = gitlab::languages().await?; // dbg!(langs); // gitlab_merge_request_note_example().await; gitlab_example().await; // gitlab_example().await; // orcid_example().await; // ror_example().await; Ok(()) Loading acorn-lib/assets/constants/application.json +18 −16 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ ] }, { "name": "github", "name": "github::api", "domain": "api.github.com", "resources": [ { Loading @@ -39,8 +39,20 @@ ] }, { "name": "gitlab", "domain": "code.ornl.gov", "name": "github::org", "domain": "raw.githubusercontent.com", "root": "github-linguist/linguist", "resources": [ { "name": "languages", "method": "get", "template": "{{ base }}/refs/heads/main/lib/linguist/languages.yml" } ] }, { "name": "gitlab::api", "domain": "gitlab.com", "root": "api/v4", "resources": [ { Loading Loading @@ -106,24 +118,14 @@ ] }, { "name": "languages::gitlab", "name": "gitlab::org", "domain": "gitlab.com", "root": "gitlab-org/gitlab", "resources": [ { "name": "languages", "method": "get", "template": "{{ base }}/gitlab-org/gitlab/-/raw/master/vendor/languages.yml" } ] }, { "name": "languages::github", "domain": "raw.githubusercontent.com", "resources": [ { "name": "languages", "method": "get", "template": "{{ base }}/github-linguist/linguist/refs/heads/main/lib/linguist/languages.yml" "template": "{{ base }}/-/raw/master/vendor/languages.yml" } ] }, Loading acorn-lib/src/io/api/github.rs +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ impl TreeEntry { } /// Fetch repository tree blob paths for a GitHub repository and branch pub(crate) async fn tree_paths(host: impl Into<String>, path: impl Into<String>, branch: impl Into<String>) -> ApiResult<Vec<String>> { let endpoint = match Endpoint::from_template("github").map(|e| e.with_domain(host)) { let endpoint = match Endpoint::from_template("github::api").map(|e| e.with_domain(host)) { | Ok(endpoint) => endpoint, | Err(why) => return Err(why), }; Loading acorn-lib/src/io/api/gitlab.rs +6 −6 Original line number Diff line number Diff line Loading @@ -767,7 +767,7 @@ pub async fn groups(options: Options) -> ApiResult<GroupsResponse> { let Options { token, identifier, domain, .. } = options; match Endpoint::from_template("gitlab").map(|e| e.with_domain(&domain)) { match Endpoint::from_template("gitlab::api").map(|e| e.with_domain(&domain)) { | Ok(endpoint) => { let params = vec![ param!(Header, "PRIVATE-TOKEN", &token), Loading @@ -783,7 +783,7 @@ pub async fn groups(options: Options) -> ApiResult<GroupsResponse> { } /// Download programming language metadata from GitLab linguist source file pub async fn languages() -> ApiResult<ProgrammingLanguagesResponse> { let names = ["languages::gitlab", "languages::github"]; let names = ["gitlab::org", "github::org"]; let action = "languages"; async fn fetch(name: &str, action: &str) -> ApiResult<ProgrammingLanguagesResponse> { match INCLUDED_ENDPOINTS.find_by_name(name) { Loading Loading @@ -821,7 +821,7 @@ pub async fn merge_request_note(options: Options) -> ApiResult<MergeRequestNoteR body, domain, } = options; match Endpoint::from_template("gitlab").map(|e| e.with_domain(&domain)) { match Endpoint::from_template("gitlab::api").map(|e| e.with_domain(&domain)) { | Ok(endpoint) => { let body = body.unwrap_or_default(); let params = vec![ Loading @@ -842,7 +842,7 @@ pub async fn runner(options: Options) -> ApiResult<RunnerDetails> { let Options { token, identifier, domain, .. } = options; match Endpoint::from_template("gitlab").map(|e| e.with_domain(&domain)) { match Endpoint::from_template("gitlab::api").map(|e| e.with_domain(&domain)) { | Ok(endpoint) => { let params = vec![ param!(Header, "PRIVATE-TOKEN", &token), Loading @@ -858,7 +858,7 @@ pub async fn runner(options: Options) -> ApiResult<RunnerDetails> { pub async fn runners(options: Options) -> ApiResult<RunnersResponse> { let action = "runners"; let Options { token, domain, .. } = options; match Endpoint::from_template("gitlab").map(|e| e.with_domain(&domain)) { match Endpoint::from_template("gitlab::api").map(|e| e.with_domain(&domain)) { | Ok(endpoint) => { let params = vec![param!(Header, "PRIVATE-TOKEN", &token)]; let response = endpoint.invoke_with::<PaginationField, EmptyField>(action, Some(params)).await; Loading @@ -875,7 +875,7 @@ pub(crate) async fn tree_paths( directory: impl Into<String>, page: u32, ) -> ApiResult<Vec<String>> { match Endpoint::from_template("gitlab").map(|e| e.with_domain(host.into())) { match Endpoint::from_template("gitlab::api").map(|e| e.with_domain(host.into())) { | Ok(endpoint) => { let params = vec![ param!(TemplateValue, "identifier", &identifier.into()), Loading Loading
acorn-cli/src/commands/gather/mod.rs +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ pub async fn run( // let langs = gitlab::languages().await?; // dbg!(langs); // gitlab_merge_request_note_example().await; gitlab_example().await; // gitlab_example().await; // orcid_example().await; // ror_example().await; Ok(()) Loading
acorn-lib/assets/constants/application.json +18 −16 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ ] }, { "name": "github", "name": "github::api", "domain": "api.github.com", "resources": [ { Loading @@ -39,8 +39,20 @@ ] }, { "name": "gitlab", "domain": "code.ornl.gov", "name": "github::org", "domain": "raw.githubusercontent.com", "root": "github-linguist/linguist", "resources": [ { "name": "languages", "method": "get", "template": "{{ base }}/refs/heads/main/lib/linguist/languages.yml" } ] }, { "name": "gitlab::api", "domain": "gitlab.com", "root": "api/v4", "resources": [ { Loading Loading @@ -106,24 +118,14 @@ ] }, { "name": "languages::gitlab", "name": "gitlab::org", "domain": "gitlab.com", "root": "gitlab-org/gitlab", "resources": [ { "name": "languages", "method": "get", "template": "{{ base }}/gitlab-org/gitlab/-/raw/master/vendor/languages.yml" } ] }, { "name": "languages::github", "domain": "raw.githubusercontent.com", "resources": [ { "name": "languages", "method": "get", "template": "{{ base }}/github-linguist/linguist/refs/heads/main/lib/linguist/languages.yml" "template": "{{ base }}/-/raw/master/vendor/languages.yml" } ] }, Loading
acorn-lib/src/io/api/github.rs +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ impl TreeEntry { } /// Fetch repository tree blob paths for a GitHub repository and branch pub(crate) async fn tree_paths(host: impl Into<String>, path: impl Into<String>, branch: impl Into<String>) -> ApiResult<Vec<String>> { let endpoint = match Endpoint::from_template("github").map(|e| e.with_domain(host)) { let endpoint = match Endpoint::from_template("github::api").map(|e| e.with_domain(host)) { | Ok(endpoint) => endpoint, | Err(why) => return Err(why), }; Loading
acorn-lib/src/io/api/gitlab.rs +6 −6 Original line number Diff line number Diff line Loading @@ -767,7 +767,7 @@ pub async fn groups(options: Options) -> ApiResult<GroupsResponse> { let Options { token, identifier, domain, .. } = options; match Endpoint::from_template("gitlab").map(|e| e.with_domain(&domain)) { match Endpoint::from_template("gitlab::api").map(|e| e.with_domain(&domain)) { | Ok(endpoint) => { let params = vec![ param!(Header, "PRIVATE-TOKEN", &token), Loading @@ -783,7 +783,7 @@ pub async fn groups(options: Options) -> ApiResult<GroupsResponse> { } /// Download programming language metadata from GitLab linguist source file pub async fn languages() -> ApiResult<ProgrammingLanguagesResponse> { let names = ["languages::gitlab", "languages::github"]; let names = ["gitlab::org", "github::org"]; let action = "languages"; async fn fetch(name: &str, action: &str) -> ApiResult<ProgrammingLanguagesResponse> { match INCLUDED_ENDPOINTS.find_by_name(name) { Loading Loading @@ -821,7 +821,7 @@ pub async fn merge_request_note(options: Options) -> ApiResult<MergeRequestNoteR body, domain, } = options; match Endpoint::from_template("gitlab").map(|e| e.with_domain(&domain)) { match Endpoint::from_template("gitlab::api").map(|e| e.with_domain(&domain)) { | Ok(endpoint) => { let body = body.unwrap_or_default(); let params = vec![ Loading @@ -842,7 +842,7 @@ pub async fn runner(options: Options) -> ApiResult<RunnerDetails> { let Options { token, identifier, domain, .. } = options; match Endpoint::from_template("gitlab").map(|e| e.with_domain(&domain)) { match Endpoint::from_template("gitlab::api").map(|e| e.with_domain(&domain)) { | Ok(endpoint) => { let params = vec![ param!(Header, "PRIVATE-TOKEN", &token), Loading @@ -858,7 +858,7 @@ pub async fn runner(options: Options) -> ApiResult<RunnerDetails> { pub async fn runners(options: Options) -> ApiResult<RunnersResponse> { let action = "runners"; let Options { token, domain, .. } = options; match Endpoint::from_template("gitlab").map(|e| e.with_domain(&domain)) { match Endpoint::from_template("gitlab::api").map(|e| e.with_domain(&domain)) { | Ok(endpoint) => { let params = vec![param!(Header, "PRIVATE-TOKEN", &token)]; let response = endpoint.invoke_with::<PaginationField, EmptyField>(action, Some(params)).await; Loading @@ -875,7 +875,7 @@ pub(crate) async fn tree_paths( directory: impl Into<String>, page: u32, ) -> ApiResult<Vec<String>> { match Endpoint::from_template("gitlab").map(|e| e.with_domain(host.into())) { match Endpoint::from_template("gitlab::api").map(|e| e.with_domain(host.into())) { | Ok(endpoint) => { let params = vec![ param!(TemplateValue, "identifier", &identifier.into()), Loading