2024-06-22 01:16:24 +01:00
|
|
|
// SPDX-FileCopyrightText: 2024 Dan Anglin <d.n.i.anglin@gmail.com>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2024-06-18 19:58:59 +01:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/model"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (g *Client) GetMediaAttachment(mediaAttachmentID string) (model.Attachment, error) {
|
|
|
|
url := g.Authentication.Instance + "/api/v1/media/" + mediaAttachmentID
|
|
|
|
|
|
|
|
var attachment model.Attachment
|
|
|
|
|
|
|
|
if err := g.sendRequest(http.MethodGet, url, nil, &attachment); err != nil {
|
|
|
|
return model.Attachment{}, fmt.Errorf("received an error after sending the request to get the media attachment: %w", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return attachment, nil
|
|
|
|
}
|