mirror of
https://github.com/kovetskiy/mark.git
synced 2026-05-02 13:22:40 +00:00
feat: enhance Confluence link generation by utilizing base URL from API response
Signed-off-by: Nikolai Emil Damm <ndam@tv2.dk>
This commit is contained in:
committed by
Manuel Rüger
parent
bb4d4e2dab
commit
a334c1c1cc
@@ -61,6 +61,7 @@ type PageInfo struct {
|
||||
|
||||
Links struct {
|
||||
Full string `json:"webui"`
|
||||
Base string `json:"-"` // Not from JSON; populated from response _links.base
|
||||
} `json:"_links"`
|
||||
}
|
||||
|
||||
@@ -193,6 +194,9 @@ func (api *API) FindPage(
|
||||
) (*PageInfo, error) {
|
||||
result := struct {
|
||||
Results []PageInfo `json:"results"`
|
||||
Links struct {
|
||||
Base string `json:"base"`
|
||||
} `json:"_links"`
|
||||
}{}
|
||||
|
||||
payload := map[string]string{
|
||||
@@ -222,7 +226,13 @@ func (api *API) FindPage(
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return &result.Results[0], nil
|
||||
page := &result.Results[0]
|
||||
// Populate the base URL from the response _links.base
|
||||
if result.Links.Base != "" {
|
||||
page.Links.Base = result.Links.Base
|
||||
}
|
||||
|
||||
return page, nil
|
||||
}
|
||||
|
||||
func (api *API) CreateAttachment(
|
||||
|
||||
Reference in New Issue
Block a user