diff --git a/pkg/core/ssl-applicator/acme-dns01/providers/35cn/internal/client.go b/pkg/core/ssl-applicator/acme-dns01/providers/35cn/internal/client.go index f6f29258..8fd42feb 100644 --- a/pkg/core/ssl-applicator/acme-dns01/providers/35cn/internal/client.go +++ b/pkg/core/ssl-applicator/acme-dns01/providers/35cn/internal/client.go @@ -15,7 +15,7 @@ import ( "strings" "time" - querystring "github.com/google/go-querystring/query" + qs "github.com/google/go-querystring/query" "golang.org/x/text/encoding" "golang.org/x/text/encoding/simplifiedchinese" "golang.org/x/text/transform" @@ -75,7 +75,7 @@ type DnsRecordID struct { } func (c *DnsClient) AddRecord(ctx context.Context, record DnsRecord) (int, error) { - values, err := querystring.Values(record) + values, err := qs.Values(record) if err != nil { return 0, err } diff --git a/pkg/sdk3rd/baishan/api_get_domain_config.go b/pkg/sdk3rd/baishan/api_get_domain_config.go index bbaae26d..acd8daef 100644 --- a/pkg/sdk3rd/baishan/api_get_domain_config.go +++ b/pkg/sdk3rd/baishan/api_get_domain_config.go @@ -6,8 +6,8 @@ import ( ) type GetDomainConfigRequest struct { - Domains *string `json:"domains,omitempty"` - Config *[]string `json:"config,omitempty"` + Domains *string `json:"domains,omitempty" url:"domains,omitempty"` + Config *[]string `json:"config,omitempty" url:"config,omitempty"` } type GetDomainConfigResponse struct { diff --git a/pkg/sdk3rd/baishan/api_get_domain_list.go b/pkg/sdk3rd/baishan/api_get_domain_list.go index f4c5166b..a18731c9 100644 --- a/pkg/sdk3rd/baishan/api_get_domain_list.go +++ b/pkg/sdk3rd/baishan/api_get_domain_list.go @@ -3,14 +3,15 @@ package baishan import ( "context" "encoding/json" - "fmt" "net/http" + + qs "github.com/google/go-querystring/query" ) type GetDomainListRequest struct { - PageNumber *int32 `json:"page_number,omitempty"` - PageSize *int32 `json:"page_size,omitempty"` - DomainStatus *string `json:"domain_status,omitempty"` + PageNumber *int32 `json:"page_number,omitempty" url:"page_number,omitempty"` + PageSize *int32 `json:"page_size,omitempty" url:"page_size,omitempty"` + DomainStatus *string `json:"domain_status,omitempty" url:"domain_status,omitempty"` } type GetDomainListResponse struct { @@ -33,16 +34,12 @@ func (c *Client) GetDomainListWithContext(ctx context.Context, req *GetDomainLis if err != nil { return nil, err } else { - if req.PageNumber != nil { - httpreq.SetQueryParam("page_number", fmt.Sprintf("%d", *req.PageNumber)) - } - if req.PageSize != nil { - httpreq.SetQueryParam("page_number", fmt.Sprintf("%d", *req.PageSize)) - } - if req.DomainStatus != nil { - httpreq.SetQueryParam("domain_status", *req.DomainStatus) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/ao/api_list_certs.go b/pkg/sdk3rd/ctyun/ao/api_list_certs.go index a77cd377..031765fa 100644 --- a/pkg/sdk3rd/ctyun/ao/api_list_certs.go +++ b/pkg/sdk3rd/ctyun/ao/api_list_certs.go @@ -3,13 +3,14 @@ package ao import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type ListCertsRequest struct { - Page *int32 `json:"page,omitempty"` - PerPage *int32 `json:"per_page,omitempty"` - UsageMode *int32 `json:"usage_mode,omitempty"` + Page *int32 `json:"page,omitempty" url:"page,omitempty"` + PerPage *int32 `json:"per_page,omitempty" url:"per_page,omitempty"` + UsageMode *int32 `json:"usage_mode,omitempty" url:"usage_mode,omitempty"` } type ListCertsResponse struct { @@ -33,16 +34,12 @@ func (c *Client) ListCertsWithContext(ctx context.Context, req *ListCertsRequest if err != nil { return nil, err } else { - if req.Page != nil { - httpreq.SetQueryParam("page", strconv.Itoa(int(*req.Page))) - } - if req.PerPage != nil { - httpreq.SetQueryParam("per_page", strconv.Itoa(int(*req.PerPage))) - } - if req.UsageMode != nil { - httpreq.SetQueryParam("usage_mode", strconv.Itoa(int(*req.UsageMode))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/ao/api_query_cert.go b/pkg/sdk3rd/ctyun/ao/api_query_cert.go index 3493cdbe..b2d39e4e 100644 --- a/pkg/sdk3rd/ctyun/ao/api_query_cert.go +++ b/pkg/sdk3rd/ctyun/ao/api_query_cert.go @@ -3,13 +3,14 @@ package ao import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryCertRequest struct { - Id *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - UsageMode *int32 `json:"usage_mode,omitempty"` + Id *int64 `json:"id,omitempty" url:"id,omitempty"` + Name *string `json:"name,omitempty" url:"name,omitempty"` + UsageMode *int32 `json:"usage_mode,omitempty" url:"usage_mode,omitempty"` } type QueryCertResponse struct { @@ -29,16 +30,12 @@ func (c *Client) QueryCertWithContext(ctx context.Context, req *QueryCertRequest if err != nil { return nil, err } else { - if req.Id != nil { - httpreq.SetQueryParam("id", strconv.Itoa(int(*req.Id))) - } - if req.Name != nil { - httpreq.SetQueryParam("name", *req.Name) - } - if req.UsageMode != nil { - httpreq.SetQueryParam("usage_mode", strconv.Itoa(int(*req.UsageMode))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/ao/api_query_domains.go b/pkg/sdk3rd/ctyun/ao/api_query_domains.go index 96f947df..6b435cf2 100644 --- a/pkg/sdk3rd/ctyun/ao/api_query_domains.go +++ b/pkg/sdk3rd/ctyun/ao/api_query_domains.go @@ -3,16 +3,17 @@ package ao import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryDomainsRequest struct { - Page *int32 `json:"page,omitempty"` - PageSize *int32 `json:"page_size,omitempty"` - Domain *string `json:"domain,omitempty"` - ProductCode *string `json:"product_code,omitempty"` - Status *int32 `json:"status,omitempty"` - AreaScope *int32 `json:"area_scope,omitempty"` + Page *int32 `json:"page,omitempty" url:"page,omitempty"` + PageSize *int32 `json:"page_size,omitempty" url:"page_size,omitempty"` + Domain *string `json:"domain,omitempty" url:"domain,omitempty"` + ProductCode *string `json:"product_code,omitempty" url:"product_code,omitempty"` + Status *int32 `json:"status,omitempty" url:"status,omitempty"` + AreaScope *int32 `json:"area_scope,omitempty" url:"area_scope,omitempty"` } type QueryDomainsResponse struct { @@ -36,25 +37,12 @@ func (c *Client) QueryDomainsWithContext(ctx context.Context, req *QueryDomainsR if err != nil { return nil, err } else { - if req.Page != nil { - httpreq.SetQueryParam("page", strconv.Itoa(int(*req.Page))) - } - if req.PageSize != nil { - httpreq.SetQueryParam("page_size", strconv.Itoa(int(*req.PageSize))) - } - if req.Domain != nil { - httpreq.SetQueryParam("domain", *req.Domain) - } - if req.ProductCode != nil { - httpreq.SetQueryParam("product_code", *req.ProductCode) - } - if req.Status != nil { - httpreq.SetQueryParam("status", strconv.Itoa(int(*req.Status))) - } - if req.AreaScope != nil { - httpreq.SetQueryParam("area_scope", strconv.Itoa(int(*req.AreaScope))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/cdn/api_query_cert_detail.go b/pkg/sdk3rd/ctyun/cdn/api_query_cert_detail.go index a2998ea4..fb11c459 100644 --- a/pkg/sdk3rd/ctyun/cdn/api_query_cert_detail.go +++ b/pkg/sdk3rd/ctyun/cdn/api_query_cert_detail.go @@ -3,13 +3,14 @@ package cdn import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryCertDetailRequest struct { - Id *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - UsageMode *int32 `json:"usage_mode,omitempty"` + Id *int64 `json:"id,omitempty" url:"id,omitempty"` + Name *string `json:"name,omitempty" url:"name,omitempty"` + UsageMode *int32 `json:"usage_mode,omitempty" url:"usage_mode,omitempty"` } type QueryCertDetailResponse struct { @@ -29,16 +30,12 @@ func (c *Client) QueryCertDetailWithContext(ctx context.Context, req *QueryCertD if err != nil { return nil, err } else { - if req.Id != nil { - httpreq.SetQueryParam("id", strconv.Itoa(int(*req.Id))) - } - if req.Name != nil { - httpreq.SetQueryParam("name", *req.Name) - } - if req.UsageMode != nil { - httpreq.SetQueryParam("usage_mode", strconv.Itoa(int(*req.UsageMode))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/cdn/api_query_cert_list.go b/pkg/sdk3rd/ctyun/cdn/api_query_cert_list.go index 3c09696d..fea5a417 100644 --- a/pkg/sdk3rd/ctyun/cdn/api_query_cert_list.go +++ b/pkg/sdk3rd/ctyun/cdn/api_query_cert_list.go @@ -3,13 +3,14 @@ package cdn import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryCertListRequest struct { - Page *int32 `json:"page,omitempty"` - PerPage *int32 `json:"per_page,omitempty"` - UsageMode *int32 `json:"usage_mode,omitempty"` + Page *int32 `json:"page,omitempty" url:"page,omitempty"` + PerPage *int32 `json:"per_page,omitempty" url:"per_page,omitempty"` + UsageMode *int32 `json:"usage_mode,omitempty" url:"usage_mode,omitempty"` } type QueryCertListResponse struct { @@ -33,16 +34,12 @@ func (c *Client) QueryCertListWithContext(ctx context.Context, req *QueryCertLis if err != nil { return nil, err } else { - if req.Page != nil { - httpreq.SetQueryParam("page", strconv.Itoa(int(*req.Page))) - } - if req.PerPage != nil { - httpreq.SetQueryParam("per_page", strconv.Itoa(int(*req.PerPage))) - } - if req.UsageMode != nil { - httpreq.SetQueryParam("usage_mode", strconv.Itoa(int(*req.UsageMode))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/cdn/api_query_domain_detail.go b/pkg/sdk3rd/ctyun/cdn/api_query_domain_detail.go index b2de1273..bde67fbb 100644 --- a/pkg/sdk3rd/ctyun/cdn/api_query_domain_detail.go +++ b/pkg/sdk3rd/ctyun/cdn/api_query_domain_detail.go @@ -3,12 +3,14 @@ package cdn import ( "context" "net/http" + + qs "github.com/google/go-querystring/query" ) type QueryDomainDetailRequest struct { - Domain *string `json:"domain,omitempty"` - ProductCode *string `json:"product_code,omitempty"` - FunctionNames *string `json:"function_names,omitempty"` + Domain *string `json:"domain,omitempty" url:"domain,omitempty"` + ProductCode *string `json:"product_code,omitempty" url:"product_code,omitempty"` + FunctionNames *string `json:"function_names,omitempty" url:"function_names,omitempty"` } type QueryDomainDetailResponse struct { @@ -26,16 +28,12 @@ func (c *Client) QueryDomainDetailWithContext(ctx context.Context, req *QueryDom if err != nil { return nil, err } else { - if req.Domain != nil { - httpreq.SetQueryParam("domain", *req.Domain) - } - if req.ProductCode != nil { - httpreq.SetQueryParam("product_code", *req.ProductCode) - } - if req.FunctionNames != nil { - httpreq.SetQueryParam("function_names", *req.FunctionNames) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/cdn/api_query_domain_list.go b/pkg/sdk3rd/ctyun/cdn/api_query_domain_list.go index d2a316e9..4966cd85 100644 --- a/pkg/sdk3rd/ctyun/cdn/api_query_domain_list.go +++ b/pkg/sdk3rd/ctyun/cdn/api_query_domain_list.go @@ -3,16 +3,17 @@ package cdn import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryDomainListRequest struct { - Page *int32 `json:"page,omitempty"` - PageSize *int32 `json:"page_size,omitempty"` - Domain *string `json:"domain,omitempty"` - ProductCode *string `json:"product_code,omitempty"` - Status *int32 `json:"status,omitempty"` - AreaScope *int32 `json:"area_scope,omitempty"` + Page *int32 `json:"page,omitempty" url:"page,omitempty"` + PageSize *int32 `json:"page_size,omitempty" url:"page_size,omitempty"` + Domain *string `json:"domain,omitempty" url:"domain,omitempty"` + ProductCode *string `json:"product_code,omitempty" url:"product_code,omitempty"` + Status *int32 `json:"status,omitempty" url:"status,omitempty"` + AreaScope *int32 `json:"area_scope,omitempty" url:"area_scope,omitempty"` } type QueryDomainListResponse struct { @@ -36,25 +37,12 @@ func (c *Client) QueryDomainListWithContext(ctx context.Context, req *QueryDomai if err != nil { return nil, err } else { - if req.Page != nil { - httpreq.SetQueryParam("page", strconv.Itoa(int(*req.Page))) - } - if req.PageSize != nil { - httpreq.SetQueryParam("page_size", strconv.Itoa(int(*req.PageSize))) - } - if req.Domain != nil { - httpreq.SetQueryParam("domain", *req.Domain) - } - if req.ProductCode != nil { - httpreq.SetQueryParam("product_code", *req.ProductCode) - } - if req.Status != nil { - httpreq.SetQueryParam("status", strconv.Itoa(int(*req.Status))) - } - if req.AreaScope != nil { - httpreq.SetQueryParam("area_scope", strconv.Itoa(int(*req.AreaScope))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/dns/api_query_record_list.go b/pkg/sdk3rd/ctyun/dns/api_query_record_list.go index cac3a6e3..0c58f5e9 100644 --- a/pkg/sdk3rd/ctyun/dns/api_query_record_list.go +++ b/pkg/sdk3rd/ctyun/dns/api_query_record_list.go @@ -3,16 +3,17 @@ package dns import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryRecordListRequest struct { - Domain *string `json:"domain,omitempty"` - Host *string `json:"host,omitempty"` - Type *string `json:"type,omitempty"` - LineCode *string `json:"lineCode,omitempty"` - Value *string `json:"value,omitempty"` - State *int32 `json:"state,omitempty"` + Domain *string `json:"domain,omitempty" url:"domain,omitempty"` + Host *string `json:"host,omitempty" url:"host,omitempty"` + Type *string `json:"type,omitempty" url:"type,omitempty"` + LineCode *string `json:"lineCode,omitempty" url:"lineCode,omitempty"` + Value *string `json:"value,omitempty" url:"value,omitempty"` + State *int32 `json:"state,omitempty" url:"state,omitempty"` } type QueryRecordListResponse struct { @@ -32,26 +33,12 @@ func (c *Client) QueryRecordListWithContext(ctx context.Context, req *QueryRecor if err != nil { return nil, err } else { - if req.Domain != nil { - httpreq.SetQueryParam("domain", *req.Domain) - } - if req.Host != nil { - httpreq.SetQueryParam("host", *req.Host) - } - if req.Type != nil { - httpreq.SetQueryParam("type", *req.Type) - } - if req.LineCode != nil { - httpreq.SetQueryParam("lineCode", *req.LineCode) - } - if req.Value != nil { - httpreq.SetQueryParam("value", *req.Value) - } - if req.State != nil { - httpreq.SetQueryParam("state", strconv.Itoa(int(*req.State))) + values, err := qs.Values(req) + if err != nil { + return nil, err } - httpreq.SetBody(req) + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/elb/api_list_certificates.go b/pkg/sdk3rd/ctyun/elb/api_list_certificates.go index e7256126..a7893fa7 100644 --- a/pkg/sdk3rd/ctyun/elb/api_list_certificates.go +++ b/pkg/sdk3rd/ctyun/elb/api_list_certificates.go @@ -3,14 +3,16 @@ package elb import ( "context" "net/http" + + qs "github.com/google/go-querystring/query" ) type ListCertificatesRequest struct { - ClientToken *string `json:"clientToken,omitempty"` - RegionID *string `json:"regionID,omitempty"` - IDs *string `json:"IDs,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` + ClientToken *string `json:"clientToken,omitempty" url:"clientToken,omitempty"` + RegionID *string `json:"regionID,omitempty" url:"regionID,omitempty"` + IDs *string `json:"IDs,omitempty" url:"IDs,omitempty"` + Name *string `json:"name,omitempty" url:"name,omitempty"` + Type *string `json:"type,omitempty" url:"type,omitempty"` } type ListCertificatesResponse struct { @@ -28,22 +30,12 @@ func (c *Client) ListCertificatesWithContext(ctx context.Context, req *ListCerti if err != nil { return nil, err } else { - if req.ClientToken != nil { - httpreq.SetQueryParam("clientToken", *req.ClientToken) - } - if req.RegionID != nil { - httpreq.SetQueryParam("regionID", *req.RegionID) - } - if req.IDs != nil { - httpreq.SetQueryParam("IDs", *req.IDs) - } - if req.Name != nil { - httpreq.SetQueryParam("name", *req.Name) - } - if req.Type != nil { - httpreq.SetQueryParam("type", *req.Type) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/elb/api_list_listeners.go b/pkg/sdk3rd/ctyun/elb/api_list_listeners.go index 9de6b0ce..524cde98 100644 --- a/pkg/sdk3rd/ctyun/elb/api_list_listeners.go +++ b/pkg/sdk3rd/ctyun/elb/api_list_listeners.go @@ -3,16 +3,18 @@ package elb import ( "context" "net/http" + + qs "github.com/google/go-querystring/query" ) type ListListenersRequest struct { - ClientToken *string `json:"clientToken,omitempty"` - RegionID *string `json:"regionID,omitempty"` - ProjectID *string `json:"projectID,omitempty"` - IDs *string `json:"IDs,omitempty"` - Name *string `json:"name,omitempty"` - LoadBalancerID *string `json:"loadBalancerID,omitempty"` - AccessControlID *string `json:"accessControlID,omitempty"` + ClientToken *string `json:"clientToken,omitempty" url:"clientToken,omitempty"` + RegionID *string `json:"regionID,omitempty" url:"regionID,omitempty"` + ProjectID *string `json:"projectID,omitempty" url:"projectID,omitempty"` + IDs *string `json:"IDs,omitempty" url:"IDs,omitempty"` + Name *string `json:"name,omitempty" url:"name,omitempty"` + LoadBalancerID *string `json:"loadBalancerID,omitempty" url:"loadBalancerID,omitempty"` + AccessControlID *string `json:"accessControlID,omitempty" url:"accessControlID,omitempty"` } type ListListenersResponse struct { @@ -30,28 +32,12 @@ func (c *Client) ListListenersWithContext(ctx context.Context, req *ListListener if err != nil { return nil, err } else { - if req.ClientToken != nil { - httpreq.SetQueryParam("clientToken", *req.ClientToken) - } - if req.RegionID != nil { - httpreq.SetQueryParam("regionID", *req.RegionID) - } - if req.ProjectID != nil { - httpreq.SetQueryParam("projectID", *req.ProjectID) - } - if req.IDs != nil { - httpreq.SetQueryParam("IDs", *req.IDs) - } - if req.Name != nil { - httpreq.SetQueryParam("name", *req.Name) - } - if req.LoadBalancerID != nil { - httpreq.SetQueryParam("loadBalancerID", *req.LoadBalancerID) - } - if req.LoadBalancerID != nil { - httpreq.SetQueryParam("accessControlID", *req.AccessControlID) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/elb/api_show_listener.go b/pkg/sdk3rd/ctyun/elb/api_show_listener.go index 2d1ad02f..2e916476 100644 --- a/pkg/sdk3rd/ctyun/elb/api_show_listener.go +++ b/pkg/sdk3rd/ctyun/elb/api_show_listener.go @@ -3,12 +3,14 @@ package elb import ( "context" "net/http" + + qs "github.com/google/go-querystring/query" ) type ShowListenerRequest struct { - ClientToken *string `json:"clientToken,omitempty"` - RegionID *string `json:"regionID,omitempty"` - ListenerID *string `json:"listenerID,omitempty"` + ClientToken *string `json:"clientToken,omitempty" url:"clientToken,omitempty"` + RegionID *string `json:"regionID,omitempty" url:"regionID,omitempty"` + ListenerID *string `json:"listenerID,omitempty" url:"listenerID,omitempty"` } type ShowListenerResponse struct { @@ -26,16 +28,12 @@ func (c *Client) ShowListenerWithContext(ctx context.Context, req *ShowListenerR if err != nil { return nil, err } else { - if req.ClientToken != nil { - httpreq.SetQueryParam("clientToken", *req.ClientToken) - } - if req.RegionID != nil { - httpreq.SetQueryParam("regionID", *req.RegionID) - } - if req.ListenerID != nil { - httpreq.SetQueryParam("listenerID", *req.ListenerID) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/icdn/api_query_cert_detail.go b/pkg/sdk3rd/ctyun/icdn/api_query_cert_detail.go index 75beca46..e952df03 100644 --- a/pkg/sdk3rd/ctyun/icdn/api_query_cert_detail.go +++ b/pkg/sdk3rd/ctyun/icdn/api_query_cert_detail.go @@ -3,13 +3,14 @@ package icdn import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryCertDetailRequest struct { - Id *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - UsageMode *int32 `json:"usage_mode,omitempty"` + Id *int64 `json:"id,omitempty" url:"id,omitempty"` + Name *string `json:"name,omitempty" url:"name,omitempty"` + UsageMode *int32 `json:"usage_mode,omitempty" url:"usage_mode,omitempty"` } type QueryCertDetailResponse struct { @@ -29,16 +30,12 @@ func (c *Client) QueryCertDetailWithContext(ctx context.Context, req *QueryCertD if err != nil { return nil, err } else { - if req.Id != nil { - httpreq.SetQueryParam("id", strconv.Itoa(int(*req.Id))) - } - if req.Name != nil { - httpreq.SetQueryParam("name", *req.Name) - } - if req.UsageMode != nil { - httpreq.SetQueryParam("usage_mode", strconv.Itoa(int(*req.UsageMode))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/icdn/api_query_cert_list.go b/pkg/sdk3rd/ctyun/icdn/api_query_cert_list.go index 806a77fe..f7eeee37 100644 --- a/pkg/sdk3rd/ctyun/icdn/api_query_cert_list.go +++ b/pkg/sdk3rd/ctyun/icdn/api_query_cert_list.go @@ -3,13 +3,14 @@ package icdn import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryCertListRequest struct { - Page *int32 `json:"page,omitempty"` - PerPage *int32 `json:"per_page,omitempty"` - UsageMode *int32 `json:"usage_mode,omitempty"` + Page *int32 `json:"page,omitempty" url:"page,omitempty"` + PerPage *int32 `json:"per_page,omitempty" url:"per_page,omitempty"` + UsageMode *int32 `json:"usage_mode,omitempty" url:"usage_mode,omitempty"` } type QueryCertListResponse struct { @@ -33,16 +34,12 @@ func (c *Client) QueryCertListWithContext(ctx context.Context, req *QueryCertLis if err != nil { return nil, err } else { - if req.Page != nil { - httpreq.SetQueryParam("page", strconv.Itoa(int(*req.Page))) - } - if req.PerPage != nil { - httpreq.SetQueryParam("per_page", strconv.Itoa(int(*req.PerPage))) - } - if req.UsageMode != nil { - httpreq.SetQueryParam("usage_mode", strconv.Itoa(int(*req.UsageMode))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/icdn/api_query_domain_detail.go b/pkg/sdk3rd/ctyun/icdn/api_query_domain_detail.go index bf735c2a..9166ef5b 100644 --- a/pkg/sdk3rd/ctyun/icdn/api_query_domain_detail.go +++ b/pkg/sdk3rd/ctyun/icdn/api_query_domain_detail.go @@ -3,12 +3,14 @@ package icdn import ( "context" "net/http" + + qs "github.com/google/go-querystring/query" ) type QueryDomainDetailRequest struct { - Domain *string `json:"domain,omitempty"` - ProductCode *string `json:"product_code,omitempty"` - FunctionNames *string `json:"function_names,omitempty"` + Domain *string `json:"domain,omitempty" url:"domain,omitempty"` + ProductCode *string `json:"product_code,omitempty" url:"product_code,omitempty"` + FunctionNames *string `json:"function_names,omitempty" url:"function_names,omitempty"` } type QueryDomainDetailResponse struct { @@ -26,16 +28,12 @@ func (c *Client) QueryDomainDetailWithContext(ctx context.Context, req *QueryDom if err != nil { return nil, err } else { - if req.Domain != nil { - httpreq.SetQueryParam("domain", *req.Domain) - } - if req.ProductCode != nil { - httpreq.SetQueryParam("product_code", *req.ProductCode) - } - if req.FunctionNames != nil { - httpreq.SetQueryParam("function_names", *req.FunctionNames) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/icdn/api_query_domain_list.go b/pkg/sdk3rd/ctyun/icdn/api_query_domain_list.go index 318fea11..5a83e0ec 100644 --- a/pkg/sdk3rd/ctyun/icdn/api_query_domain_list.go +++ b/pkg/sdk3rd/ctyun/icdn/api_query_domain_list.go @@ -3,16 +3,17 @@ package icdn import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryDomainListRequest struct { - Page *int32 `json:"page,omitempty"` - PageSize *int32 `json:"page_size,omitempty"` - Domain *string `json:"domain,omitempty"` - ProductCode *string `json:"product_code,omitempty"` - Status *int32 `json:"status,omitempty"` - AreaScope *int32 `json:"area_scope,omitempty"` + Page *int32 `json:"page,omitempty" url:"page,omitempty"` + PageSize *int32 `json:"page_size,omitempty" url:"page_size,omitempty"` + Domain *string `json:"domain,omitempty" url:"domain,omitempty"` + ProductCode *string `json:"product_code,omitempty" url:"product_code,omitempty"` + Status *int32 `json:"status,omitempty" url:"status,omitempty"` + AreaScope *int32 `json:"area_scope,omitempty" url:"area_scope,omitempty"` } type QueryDomainListResponse struct { @@ -36,25 +37,12 @@ func (c *Client) QueryDomainListWithContext(ctx context.Context, req *QueryDomai if err != nil { return nil, err } else { - if req.Page != nil { - httpreq.SetQueryParam("page", strconv.Itoa(int(*req.Page))) - } - if req.PageSize != nil { - httpreq.SetQueryParam("page_size", strconv.Itoa(int(*req.PageSize))) - } - if req.Domain != nil { - httpreq.SetQueryParam("domain", *req.Domain) - } - if req.ProductCode != nil { - httpreq.SetQueryParam("product_code", *req.ProductCode) - } - if req.Status != nil { - httpreq.SetQueryParam("status", strconv.Itoa(int(*req.Status))) - } - if req.AreaScope != nil { - httpreq.SetQueryParam("area_scope", strconv.Itoa(int(*req.AreaScope))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/lvdn/api_query_cert_detail.go b/pkg/sdk3rd/ctyun/lvdn/api_query_cert_detail.go index f3427ad4..03baef0a 100644 --- a/pkg/sdk3rd/ctyun/lvdn/api_query_cert_detail.go +++ b/pkg/sdk3rd/ctyun/lvdn/api_query_cert_detail.go @@ -3,13 +3,14 @@ package lvdn import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryCertDetailRequest struct { - Id *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - UsageMode *int32 `json:"usage_mode,omitempty"` + Id *int64 `json:"id,omitempty" url:"id,omitempty"` + Name *string `json:"name,omitempty" url:"name,omitempty"` + UsageMode *int32 `json:"usage_mode,omitempty" url:"usage_mode,omitempty"` } type QueryCertDetailResponse struct { @@ -29,16 +30,12 @@ func (c *Client) QueryCertDetailWithContext(ctx context.Context, req *QueryCertD if err != nil { return nil, err } else { - if req.Id != nil { - httpreq.SetQueryParam("id", strconv.Itoa(int(*req.Id))) - } - if req.Name != nil { - httpreq.SetQueryParam("name", *req.Name) - } - if req.UsageMode != nil { - httpreq.SetQueryParam("usage_mode", strconv.Itoa(int(*req.UsageMode))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/lvdn/api_query_cert_list.go b/pkg/sdk3rd/ctyun/lvdn/api_query_cert_list.go index d7fb5ebd..0d3fc760 100644 --- a/pkg/sdk3rd/ctyun/lvdn/api_query_cert_list.go +++ b/pkg/sdk3rd/ctyun/lvdn/api_query_cert_list.go @@ -3,13 +3,14 @@ package lvdn import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryCertListRequest struct { - Page *int32 `json:"page,omitempty"` - PerPage *int32 `json:"per_page,omitempty"` - UsageMode *int32 `json:"usage_mode,omitempty"` + Page *int32 `json:"page,omitempty" url:"page,omitempty"` + PerPage *int32 `json:"per_page,omitempty" url:"per_page,omitempty"` + UsageMode *int32 `json:"usage_mode,omitempty" url:"usage_mode,omitempty"` } type QueryCertListResponse struct { @@ -33,16 +34,12 @@ func (c *Client) QueryCertListWithContext(ctx context.Context, req *QueryCertLis if err != nil { return nil, err } else { - if req.Page != nil { - httpreq.SetQueryParam("page", strconv.Itoa(int(*req.Page))) - } - if req.PerPage != nil { - httpreq.SetQueryParam("per_page", strconv.Itoa(int(*req.PerPage))) - } - if req.UsageMode != nil { - httpreq.SetQueryParam("usage_mode", strconv.Itoa(int(*req.UsageMode))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/lvdn/api_query_domain_detail.go b/pkg/sdk3rd/ctyun/lvdn/api_query_domain_detail.go index 18883481..95ce16f1 100644 --- a/pkg/sdk3rd/ctyun/lvdn/api_query_domain_detail.go +++ b/pkg/sdk3rd/ctyun/lvdn/api_query_domain_detail.go @@ -3,11 +3,13 @@ package lvdn import ( "context" "net/http" + + qs "github.com/google/go-querystring/query" ) type QueryDomainDetailRequest struct { - Domain *string `json:"domain,omitempty"` - ProductCode *string `json:"product_code,omitempty"` + Domain *string `json:"domain,omitempty" url:"domain,omitempty"` + ProductCode *string `json:"product_code,omitempty" url:"product_code,omitempty"` } type QueryDomainDetailResponse struct { @@ -25,13 +27,12 @@ func (c *Client) QueryDomainDetailWithContext(ctx context.Context, req *QueryDom if err != nil { return nil, err } else { - if req.Domain != nil { - httpreq.SetQueryParam("domain", *req.Domain) - } - if req.ProductCode != nil { - httpreq.SetQueryParam("product_code", *req.ProductCode) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/ctyun/lvdn/api_query_domain_list.go b/pkg/sdk3rd/ctyun/lvdn/api_query_domain_list.go index 14f669b0..d7db91c5 100644 --- a/pkg/sdk3rd/ctyun/lvdn/api_query_domain_list.go +++ b/pkg/sdk3rd/ctyun/lvdn/api_query_domain_list.go @@ -3,16 +3,17 @@ package lvdn import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type QueryDomainListRequest struct { - Page *int32 `json:"page,omitempty"` - PageSize *int32 `json:"page_size,omitempty"` - Domain *string `json:"domain,omitempty"` - ProductCode *string `json:"product_code,omitempty"` - Status *int32 `json:"status,omitempty"` - AreaScope *int32 `json:"area_scope,omitempty"` + Page *int32 `json:"page,omitempty" url:"page,omitempty"` + PageSize *int32 `json:"page_size,omitempty" url:"page_size,omitempty"` + Domain *string `json:"domain,omitempty" url:"domain,omitempty"` + ProductCode *string `json:"product_code,omitempty" url:"product_code,omitempty"` + Status *int32 `json:"status,omitempty" url:"status,omitempty"` + AreaScope *int32 `json:"area_scope,omitempty" url:"area_scope,omitempty"` } type QueryDomainListResponse struct { @@ -36,25 +37,12 @@ func (c *Client) QueryDomainListWithContext(ctx context.Context, req *QueryDomai if err != nil { return nil, err } else { - if req.Page != nil { - httpreq.SetQueryParam("page", strconv.Itoa(int(*req.Page))) - } - if req.PageSize != nil { - httpreq.SetQueryParam("page_size", strconv.Itoa(int(*req.PageSize))) - } - if req.Domain != nil { - httpreq.SetQueryParam("domain", *req.Domain) - } - if req.ProductCode != nil { - httpreq.SetQueryParam("product_code", *req.ProductCode) - } - if req.Status != nil { - httpreq.SetQueryParam("status", strconv.Itoa(int(*req.Status))) - } - if req.AreaScope != nil { - httpreq.SetQueryParam("area_scope", strconv.Itoa(int(*req.AreaScope))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/dnsla/api_list_domains.go b/pkg/sdk3rd/dnsla/api_list_domains.go index d7972e98..41b8404e 100644 --- a/pkg/sdk3rd/dnsla/api_list_domains.go +++ b/pkg/sdk3rd/dnsla/api_list_domains.go @@ -3,13 +3,14 @@ package dnsla import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type ListDomainsRequest struct { - GroupId *string `json:"groupId,omitempty"` - PageIndex *int32 `json:"pageIndex,omitempty"` - PageSize *int32 `json:"pageSize,omitempty"` + GroupId *string `json:"groupId,omitempty" url:"groupId,omitempty"` + PageIndex *int32 `json:"pageIndex,omitempty" url:"pageIndex,omitempty"` + PageSize *int32 `json:"pageSize,omitempty" url:"pageSize,omitempty"` } type ListDomainsResponse struct { @@ -29,16 +30,12 @@ func (c *Client) ListDomainsWithContext(ctx context.Context, req *ListDomainsReq if err != nil { return nil, err } else { - if req.GroupId != nil { - httpreq.SetQueryParam("groupId", *req.GroupId) - } - if req.PageIndex != nil { - httpreq.SetQueryParam("pageIndex", strconv.Itoa(int(*req.PageIndex))) - } - if req.PageSize != nil { - httpreq.SetQueryParam("pageSize", strconv.Itoa(int(*req.PageSize))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/dnsla/api_list_records.go b/pkg/sdk3rd/dnsla/api_list_records.go index 4e77cc2f..0fd331b4 100644 --- a/pkg/sdk3rd/dnsla/api_list_records.go +++ b/pkg/sdk3rd/dnsla/api_list_records.go @@ -3,18 +3,19 @@ package dnsla import ( "context" "net/http" - "strconv" + + qs "github.com/google/go-querystring/query" ) type ListRecordsRequest struct { - DomainId *string `json:"domainId,omitempty"` - GroupId *string `json:"groupId,omitempty"` - LineId *string `json:"lineId,omitempty"` - Type *int32 `json:"type,omitempty"` - Host *string `json:"host,omitempty"` - Data *string `json:"data,omitempty"` - PageIndex *int32 `json:"pageIndex,omitempty"` - PageSize *int32 `json:"pageSize,omitempty"` + DomainId *string `json:"domainId,omitempty" url:"domainId,omitempty"` + GroupId *string `json:"groupId,omitempty" url:"groupId,omitempty"` + LineId *string `json:"lineId,omitempty" url:"lineId,omitempty"` + Type *int32 `json:"type,omitempty" url:"type,omitempty"` + Host *string `json:"host,omitempty" url:"host,omitempty"` + Data *string `json:"data,omitempty" url:"data,omitempty"` + PageIndex *int32 `json:"pageIndex,omitempty" url:"pageIndex,omitempty"` + PageSize *int32 `json:"pageSize,omitempty" url:"pageSize,omitempty"` } type ListRecordsResponse struct { @@ -34,31 +35,12 @@ func (c *Client) ListRecordsWithContext(ctx context.Context, req *ListRecordsReq if err != nil { return nil, err } else { - if req.DomainId != nil { - httpreq.SetQueryParam("domainId", *req.DomainId) - } - if req.GroupId != nil { - httpreq.SetQueryParam("groupId", *req.GroupId) - } - if req.LineId != nil { - httpreq.SetQueryParam("lineId", *req.LineId) - } - if req.Type != nil { - httpreq.SetQueryParam("type", strconv.Itoa(int(*req.Type))) - } - if req.Host != nil { - httpreq.SetQueryParam("host", *req.Host) - } - if req.Data != nil { - httpreq.SetQueryParam("data", *req.Data) - } - if req.PageIndex != nil { - httpreq.SetQueryParam("pageIndex", strconv.Itoa(int(*req.PageIndex))) - } - if req.PageSize != nil { - httpreq.SetQueryParam("pageSize", strconv.Itoa(int(*req.PageSize))) + values, err := qs.Values(req) + if err != nil { + return nil, err } + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/pkg/sdk3rd/upyun/console/api_get_buckets.go b/pkg/sdk3rd/upyun/console/api_get_buckets.go index 8ddccc80..de55b07e 100644 --- a/pkg/sdk3rd/upyun/console/api_get_buckets.go +++ b/pkg/sdk3rd/upyun/console/api_get_buckets.go @@ -2,20 +2,21 @@ package console import ( "context" - "fmt" "net/http" + + qs "github.com/google/go-querystring/query" ) type GetBucketsRequest struct { - BucketName string `json:"status"` - BusinessType string `json:"business_type"` - Type string `json:"type"` - Status string `json:"state"` - Tag string `json:"tag"` - IsSecurityCDN bool `json:"security_cdn"` - WithDomains bool `json:"with_domains"` - Page int32 `json:"page"` - PerPage int32 `json:"perPage"` + BucketName string `json:"status" url:"bucket_name"` + BusinessType string `json:"business_type" url:"business_type"` + Type string `json:"type" url:"type"` + Status string `json:"state" url:"state"` + Tag string `json:"tag" url:"tag"` + IsSecurityCDN bool `json:"security_cdn" url:"security_cdn"` + WithDomains bool `json:"with_domains" url:"with_domains"` + Page int32 `json:"page" url:"page"` + PerPage int32 `json:"perPage" url:"perPage"` } type GetBucketsResponse struct { @@ -64,15 +65,12 @@ func (c *Client) GetBucketsWithContext(ctx context.Context, req *GetBucketsReque if err != nil { return nil, err } else { - httpreq.SetQueryParam("bucket_name", req.BucketName) - httpreq.SetQueryParam("business_type", req.BusinessType) - httpreq.SetQueryParam("type", req.Type) - httpreq.SetQueryParam("state", req.Status) - httpreq.SetQueryParam("tag", req.Tag) - httpreq.SetQueryParam("security_cdn", fmt.Sprintf("%v", req.IsSecurityCDN)) - httpreq.SetQueryParam("with_domains", fmt.Sprintf("%v", req.WithDomains)) - httpreq.SetQueryParam("page", fmt.Sprintf("%d", req.Page)) - httpreq.SetQueryParam("perPage", fmt.Sprintf("%d", req.PerPage)) + values, err := qs.Values(req) + if err != nil { + return nil, err + } + + httpreq.SetQueryParamsFromValues(values) httpreq.SetContext(ctx) } diff --git a/ui/src/pages/settings/SettingsAccount.tsx b/ui/src/pages/settings/SettingsAccount.tsx index 0555a38e..40d3f584 100644 --- a/ui/src/pages/settings/SettingsAccount.tsx +++ b/ui/src/pages/settings/SettingsAccount.tsx @@ -108,10 +108,11 @@ const SettingsAccountUsername = ({ className, style }: { className?: string; sty
{t("settings.account.username.tips")}
- +
{getAuthStore().record?.email} - - +
+ + )}