39 lines
1.5 KiB
Go
39 lines
1.5 KiB
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
)
|
|
|
|
// AdminApplicationSettings returns the application-wide automation settings.
|
|
func (c *Client) AdminApplicationSettings(ctx context.Context) (ApplicationSettings, *Response, error) {
|
|
var envelope struct {
|
|
Settings ApplicationSettings `json:"settings"`
|
|
}
|
|
response, err := c.do(ctx, http.MethodGet, "v1/admin/application-settings", nil, &envelope)
|
|
return envelope.Settings, response, err
|
|
}
|
|
|
|
// UpdateAdminApplicationSettings changes application-wide automation settings.
|
|
func (c *Client) UpdateAdminApplicationSettings(ctx context.Context, input ApplicationSettingsInput) (ApplicationSettings, *Response, error) {
|
|
var envelope struct {
|
|
Settings ApplicationSettings `json:"settings"`
|
|
}
|
|
response, err := c.do(ctx, http.MethodPatch, "v1/admin/application-settings", input, &envelope)
|
|
return envelope.Settings, response, err
|
|
}
|
|
|
|
// AdminEnvironment returns the API's masked effective environment configuration.
|
|
func (c *Client) AdminEnvironment(ctx context.Context) ([]EnvironmentVariable, *Response, error) {
|
|
var envelope struct {
|
|
Variables []EnvironmentVariable `json:"variables"`
|
|
}
|
|
response, err := c.do(ctx, http.MethodGet, "v1/admin/environment", nil, &envelope)
|
|
return envelope.Variables, response, err
|
|
}
|
|
|
|
// SendAdminTestMail asks the API to send a configuration test email.
|
|
func (c *Client) SendAdminTestMail(ctx context.Context, recipient string) (*Response, error) {
|
|
return c.do(ctx, http.MethodPost, "v1/admin/test-mail", map[string]string{"email": recipient}, nil)
|
|
}
|