mirror of
https://github.com/woodchen-ink/certimate.git
synced 2025-07-18 17:31:55 +08:00
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
package console
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
)
|
|
|
|
type UpdateHttpsCertificateManagerRequest struct {
|
|
CertificateId string `json:"certificate_id"`
|
|
Domain string `json:"domain"`
|
|
Https bool `json:"https"`
|
|
ForceHttps bool `json:"force_https"`
|
|
}
|
|
|
|
type UpdateHttpsCertificateManagerResponse struct {
|
|
apiResponseBase
|
|
|
|
Data *struct {
|
|
apiResponseBaseData
|
|
|
|
Status bool `json:"status"`
|
|
} `json:"data,omitempty"`
|
|
}
|
|
|
|
func (c *Client) UpdateHttpsCertificateManager(req *UpdateHttpsCertificateManagerRequest) (*UpdateHttpsCertificateManagerResponse, error) {
|
|
return c.UpdateHttpsCertificateManagerWithContext(context.Background(), req)
|
|
}
|
|
|
|
func (c *Client) UpdateHttpsCertificateManagerWithContext(ctx context.Context, req *UpdateHttpsCertificateManagerRequest) (*UpdateHttpsCertificateManagerResponse, error) {
|
|
if err := c.ensureCookieExists(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
httpreq, err := c.newRequest(http.MethodPost, "/api/https/certificate/manager")
|
|
if err != nil {
|
|
return nil, err
|
|
} else {
|
|
httpreq.SetBody(req)
|
|
httpreq.SetContext(ctx)
|
|
}
|
|
|
|
result := &UpdateHttpsCertificateManagerResponse{}
|
|
if _, err := c.doRequestWithResult(httpreq, result); err != nil {
|
|
return result, err
|
|
}
|
|
|
|
return result, nil
|
|
}
|