2024-02-27 20:05:03 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/model"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (g *Client) GetInstance() (model.InstanceV2, error) {
|
|
|
|
path := "/api/v2/instance"
|
|
|
|
url := g.Authentication.Instance + path
|
|
|
|
|
|
|
|
var instance model.InstanceV2
|
|
|
|
|
2024-08-02 08:15:15 +01:00
|
|
|
params := requestParameters{
|
|
|
|
httpMethod: http.MethodGet,
|
|
|
|
url: url,
|
|
|
|
requestBody: nil,
|
|
|
|
contentType: "",
|
|
|
|
output: &instance,
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := g.sendRequest(params); err != nil {
|
2024-06-02 11:35:43 +01:00
|
|
|
return model.InstanceV2{}, fmt.Errorf("received an error after sending the request to get the instance details: %w", err)
|
2024-02-27 20:05:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return instance, nil
|
|
|
|
}
|