Skip to main content

gitpoulpi_hosting/trello/
spec.rs

1//! The Trello family spec: a card's reference is already its short URL.
2
3use crate::spec::FamilySpec;
4use gitpoulpi_config::ApiFamily;
5
6pub static SPEC: FamilySpec = FamilySpec {
7    // `reference` is the card's `shortUrl` (`https://trello.com/c/AbCd1234`);
8    // a bare short link is expanded against the web root.
9    issue_web_url: |base, _project, reference| {
10        let reference = reference.trim();
11        if reference.is_empty() {
12            None
13        } else if reference.starts_with("http://") || reference.starts_with("https://") {
14            Some(reference.to_string())
15        } else {
16            Some(format!("{}/c/{reference}", base.trim_end_matches('/')))
17        }
18    },
19    ..FamilySpec::none(ApiFamily::Trello, "TR", '#')
20};