mirror of
https://github.com/woodchen-ink/certimate.git
synced 2025-07-19 01:41:55 +08:00
37 lines
785 B
Go
37 lines
785 B
Go
package dogecloud
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
)
|
|
|
|
type BindCdnCertRequest struct {
|
|
CertId int64 `json:"id"`
|
|
Domain string `json:"domain"`
|
|
}
|
|
|
|
type BindCdnCertResponse struct {
|
|
apiResponseBase
|
|
}
|
|
|
|
func (c *Client) BindCdnCert(req *BindCdnCertRequest) (*BindCdnCertResponse, error) {
|
|
return c.BindCdnCertWithContext(context.Background(), req)
|
|
}
|
|
|
|
func (c *Client) BindCdnCertWithContext(ctx context.Context, req *BindCdnCertRequest) (*BindCdnCertResponse, error) {
|
|
httpreq, err := c.newRequest(http.MethodPost, "/cdn/cert/bind.json")
|
|
if err != nil {
|
|
return nil, err
|
|
} else {
|
|
httpreq.SetBody(req)
|
|
httpreq.SetContext(ctx)
|
|
}
|
|
|
|
result := &BindCdnCertResponse{}
|
|
if _, err := c.doRequestWithResult(httpreq, result); err != nil {
|
|
return result, err
|
|
}
|
|
|
|
return result, nil
|
|
}
|