mirror of
https://github.com/certimate-go/certimate.git
synced 2026-06-22 21:05:48 +08:00
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package onepanel
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
type WebsiteHttpsGetResponse struct {
|
|
apiResponseBase
|
|
|
|
Data *struct {
|
|
Enable bool `json:"enable"`
|
|
WebsiteSSLID int64 `json:"websiteSSLId"`
|
|
HttpConfig string `json:"httpConfig"`
|
|
SSLProtocol []string `json:"SSLProtocol"`
|
|
Algorithm string `json:"algorithm"`
|
|
Hsts bool `json:"hsts"`
|
|
} `json:"data,omitempty"`
|
|
}
|
|
|
|
func (c *Client) WebsiteHttpsGet(websiteId int64) (*WebsiteHttpsGetResponse, error) {
|
|
return c.WebsiteHttpsGetWithContext(context.Background(), websiteId)
|
|
}
|
|
|
|
func (c *Client) WebsiteHttpsGetWithContext(ctx context.Context, websiteId int64) (*WebsiteHttpsGetResponse, error) {
|
|
if websiteId == 0 {
|
|
return nil, fmt.Errorf("sdkerr: unset websiteId")
|
|
}
|
|
|
|
httpreq, err := c.newRequest(http.MethodGet, fmt.Sprintf("/websites/%d/https", websiteId))
|
|
if err != nil {
|
|
return nil, err
|
|
} else {
|
|
httpreq.SetContext(ctx)
|
|
}
|
|
|
|
result := &WebsiteHttpsGetResponse{}
|
|
if _, err := c.doRequestWithResult(httpreq, result); err != nil {
|
|
return result, err
|
|
}
|
|
|
|
return result, nil
|
|
}
|