From 33dd2a3732bef39e7a6591636ec888a2d3de38f8 Mon Sep 17 00:00:00 2001 From: Scaleway Bot Date: Mon, 30 Oct 2023 16:05:51 +0100 Subject: [PATCH] fix: set default fields for requests with only query params (#1905) --- api/account/v2/account_sdk.go | 10 ++++ api/account/v3/account_sdk.go | 10 ++++ api/billing/v2alpha1/billing_sdk.go | 15 +++++ api/cockpit/v1beta1/cockpit_sdk.go | 65 ++++++++++++++++++++ api/domain/v2beta1/domain_sdk.go | 35 +++++++++++ api/iam/v1alpha1/iam_sdk.go | 85 +++++++++++++++++++++++++++ api/marketplace/v2/marketplace_sdk.go | 25 ++++++++ api/test/v1/test_sdk.go | 5 ++ 8 files changed, 250 insertions(+) diff --git a/api/account/v2/account_sdk.go b/api/account/v2/account_sdk.go index f68f781d1..eb6d38cdd 100644 --- a/api/account/v2/account_sdk.go +++ b/api/account/v2/account_sdk.go @@ -232,6 +232,16 @@ func (s *API) CreateProject(req *CreateProjectRequest, opts ...scw.RequestOption func (s *API) ListProjects(req *ListProjectsRequest, opts ...scw.RequestOption) (*ListProjectsResponse, error) { var err error + if req.OrganizationID == "" { + defaultOrganizationID, _ := s.client.GetDefaultOrganizationID() + req.OrganizationID = defaultOrganizationID + } + + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "organization_id", req.OrganizationID) parameter.AddToQuery(query, "name", req.Name) diff --git a/api/account/v3/account_sdk.go b/api/account/v3/account_sdk.go index f8b681960..6e79fc644 100644 --- a/api/account/v3/account_sdk.go +++ b/api/account/v3/account_sdk.go @@ -230,6 +230,16 @@ func (s *ProjectAPI) CreateProject(req *ProjectAPICreateProjectRequest, opts ... func (s *ProjectAPI) ListProjects(req *ProjectAPIListProjectsRequest, opts ...scw.RequestOption) (*ListProjectsResponse, error) { var err error + if req.OrganizationID == "" { + defaultOrganizationID, _ := s.client.GetDefaultOrganizationID() + req.OrganizationID = defaultOrganizationID + } + + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "organization_id", req.OrganizationID) parameter.AddToQuery(query, "name", req.Name) diff --git a/api/billing/v2alpha1/billing_sdk.go b/api/billing/v2alpha1/billing_sdk.go index dd3d50a48..39cca22e9 100644 --- a/api/billing/v2alpha1/billing_sdk.go +++ b/api/billing/v2alpha1/billing_sdk.go @@ -493,6 +493,11 @@ func NewAPI(client *scw.Client) *API { func (s *API) GetConsumption(req *GetConsumptionRequest, opts ...scw.RequestOption) (*GetConsumptionResponse, error) { var err error + if req.OrganizationID == "" { + defaultOrganizationID, _ := s.client.GetDefaultOrganizationID() + req.OrganizationID = defaultOrganizationID + } + query := url.Values{} parameter.AddToQuery(query, "organization_id", req.OrganizationID) @@ -515,6 +520,11 @@ func (s *API) GetConsumption(req *GetConsumptionRequest, opts ...scw.RequestOpti func (s *API) ListInvoices(req *ListInvoicesRequest, opts ...scw.RequestOption) (*ListInvoicesResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "organization_id", req.OrganizationID) parameter.AddToQuery(query, "started_after", req.StartedAfter) @@ -569,6 +579,11 @@ func (s *API) DownloadInvoice(req *DownloadInvoiceRequest, opts ...scw.RequestOp func (s *API) ListDiscounts(req *ListDiscountsRequest, opts ...scw.RequestOption) (*ListDiscountsResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "order_by", req.OrderBy) parameter.AddToQuery(query, "page", req.Page) diff --git a/api/cockpit/v1beta1/cockpit_sdk.go b/api/cockpit/v1beta1/cockpit_sdk.go index 85aba421e..df7495872 100644 --- a/api/cockpit/v1beta1/cockpit_sdk.go +++ b/api/cockpit/v1beta1/cockpit_sdk.go @@ -963,6 +963,11 @@ func (s *API) ActivateCockpit(req *ActivateCockpitRequest, opts ...scw.RequestOp func (s *API) GetCockpit(req *GetCockpitRequest, opts ...scw.RequestOption) (*Cockpit, error) { var err error + if req.ProjectID == "" { + defaultProjectID, _ := s.client.GetDefaultProjectID() + req.ProjectID = defaultProjectID + } + query := url.Values{} parameter.AddToQuery(query, "project_id", req.ProjectID) @@ -985,6 +990,11 @@ func (s *API) GetCockpit(req *GetCockpitRequest, opts ...scw.RequestOption) (*Co func (s *API) GetCockpitMetrics(req *GetCockpitMetricsRequest, opts ...scw.RequestOption) (*CockpitMetrics, error) { var err error + if req.ProjectID == "" { + defaultProjectID, _ := s.client.GetDefaultProjectID() + req.ProjectID = defaultProjectID + } + query := url.Values{} parameter.AddToQuery(query, "project_id", req.ProjectID) parameter.AddToQuery(query, "start_date", req.StartDate) @@ -1094,6 +1104,16 @@ func (s *API) CreateDatasource(req *CreateDatasourceRequest, opts ...scw.Request func (s *API) ListDatasources(req *ListDatasourcesRequest, opts ...scw.RequestOption) (*ListDatasourcesResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + + if req.ProjectID == "" { + defaultProjectID, _ := s.client.GetDefaultProjectID() + req.ProjectID = defaultProjectID + } + query := url.Values{} parameter.AddToQuery(query, "page", req.Page) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -1152,6 +1172,16 @@ func (s *API) CreateToken(req *CreateTokenRequest, opts ...scw.RequestOption) (* func (s *API) ListTokens(req *ListTokensRequest, opts ...scw.RequestOption) (*ListTokensResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + + if req.ProjectID == "" { + defaultProjectID, _ := s.client.GetDefaultProjectID() + req.ProjectID = defaultProjectID + } + query := url.Values{} parameter.AddToQuery(query, "page", req.Page) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -1247,6 +1277,16 @@ func (s *API) CreateContactPoint(req *CreateContactPointRequest, opts ...scw.Req func (s *API) ListContactPoints(req *ListContactPointsRequest, opts ...scw.RequestOption) (*ListContactPointsResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + + if req.ProjectID == "" { + defaultProjectID, _ := s.client.GetDefaultProjectID() + req.ProjectID = defaultProjectID + } + query := url.Values{} parameter.AddToQuery(query, "page", req.Page) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -1403,6 +1443,16 @@ func (s *API) CreateGrafanaUser(req *CreateGrafanaUserRequest, opts ...scw.Reque func (s *API) ListGrafanaUsers(req *ListGrafanaUsersRequest, opts ...scw.RequestOption) (*ListGrafanaUsersResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + + if req.ProjectID == "" { + defaultProjectID, _ := s.client.GetDefaultProjectID() + req.ProjectID = defaultProjectID + } + query := url.Values{} parameter.AddToQuery(query, "page", req.Page) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -1490,6 +1540,11 @@ func (s *API) ResetGrafanaUserPassword(req *ResetGrafanaUserPasswordRequest, opt func (s *API) ListPlans(req *ListPlansRequest, opts ...scw.RequestOption) (*ListPlansResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "page", req.Page) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -1542,6 +1597,16 @@ func (s *API) SelectPlan(req *SelectPlanRequest, opts ...scw.RequestOption) (*Se func (s *API) ListGrafanaProductDashboards(req *ListGrafanaProductDashboardsRequest, opts ...scw.RequestOption) (*ListGrafanaProductDashboardsResponse, error) { var err error + if req.ProjectID == "" { + defaultProjectID, _ := s.client.GetDefaultProjectID() + req.ProjectID = defaultProjectID + } + + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "project_id", req.ProjectID) parameter.AddToQuery(query, "page", req.Page) diff --git a/api/domain/v2beta1/domain_sdk.go b/api/domain/v2beta1/domain_sdk.go index d01f2383b..bde8b92ff 100644 --- a/api/domain/v2beta1/domain_sdk.go +++ b/api/domain/v2beta1/domain_sdk.go @@ -2827,6 +2827,11 @@ func NewAPI(client *scw.Client) *API { func (s *API) ListDNSZones(req *ListDNSZonesRequest, opts ...scw.RequestOption) (*ListDNSZonesResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "organization_id", req.OrganizationID) parameter.AddToQuery(query, "project_id", req.ProjectID) @@ -3399,6 +3404,11 @@ func (s *API) CreateSSLCertificate(req *CreateSSLCertificateRequest, opts ...scw func (s *API) ListSSLCertificates(req *ListSSLCertificatesRequest, opts ...scw.RequestOption) (*ListSSLCertificatesResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "dns_zone", req.DNSZone) parameter.AddToQuery(query, "page", req.Page) @@ -3501,6 +3511,11 @@ func NewRegistrarAPI(client *scw.Client) *RegistrarAPI { func (s *RegistrarAPI) ListTasks(req *RegistrarAPIListTasksRequest, opts ...scw.RequestOption) (*ListTasksResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "page", req.Page) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -3715,6 +3730,11 @@ func (s *RegistrarAPI) CheckContactsCompatibility(req *RegistrarAPICheckContacts func (s *RegistrarAPI) ListContacts(req *RegistrarAPIListContactsRequest, opts ...scw.RequestOption) (*ListContactsResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "page", req.Page) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -3792,6 +3812,11 @@ func (s *RegistrarAPI) UpdateContact(req *RegistrarAPIUpdateContactRequest, opts func (s *RegistrarAPI) ListDomains(req *RegistrarAPIListDomainsRequest, opts ...scw.RequestOption) (*ListDomainsResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "page", req.Page) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -3822,6 +3847,11 @@ func (s *RegistrarAPI) ListDomains(req *RegistrarAPIListDomainsRequest, opts ... func (s *RegistrarAPI) ListRenewableDomains(req *RegistrarAPIListRenewableDomainsRequest, opts ...scw.RequestOption) (*ListRenewableDomainsResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "page", req.Page) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -4109,6 +4139,11 @@ func (s *RegistrarAPI) SearchAvailableDomains(req *RegistrarAPISearchAvailableDo func (s *RegistrarAPI) ListTlds(req *RegistrarAPIListTldsRequest, opts ...scw.RequestOption) (*ListTldsResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "tlds", req.Tlds) parameter.AddToQuery(query, "page", req.Page) diff --git a/api/iam/v1alpha1/iam_sdk.go b/api/iam/v1alpha1/iam_sdk.go index 417a86017..f4848c042 100644 --- a/api/iam/v1alpha1/iam_sdk.go +++ b/api/iam/v1alpha1/iam_sdk.go @@ -1909,6 +1909,11 @@ func NewAPI(client *scw.Client) *API { func (s *API) ListSSHKeys(req *ListSSHKeysRequest, opts ...scw.RequestOption) (*ListSSHKeysResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "order_by", req.OrderBy) parameter.AddToQuery(query, "page", req.Page) @@ -2038,6 +2043,11 @@ func (s *API) DeleteSSHKey(req *DeleteSSHKeyRequest, opts ...scw.RequestOption) func (s *API) ListUsers(req *ListUsersRequest, opts ...scw.RequestOption) (*ListUsersResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "order_by", req.OrderBy) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -2135,6 +2145,16 @@ func (s *API) CreateUser(req *CreateUserRequest, opts ...scw.RequestOption) (*Us func (s *API) ListApplications(req *ListApplicationsRequest, opts ...scw.RequestOption) (*ListApplicationsResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + + if req.OrganizationID == "" { + defaultOrganizationID, _ := s.client.GetDefaultOrganizationID() + req.OrganizationID = defaultOrganizationID + } + query := url.Values{} parameter.AddToQuery(query, "order_by", req.OrderBy) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -2264,6 +2284,16 @@ func (s *API) DeleteApplication(req *DeleteApplicationRequest, opts ...scw.Reque func (s *API) ListGroups(req *ListGroupsRequest, opts ...scw.RequestOption) (*ListGroupsResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + + if req.OrganizationID == "" { + defaultOrganizationID, _ := s.client.GetDefaultOrganizationID() + req.OrganizationID = defaultOrganizationID + } + query := url.Values{} parameter.AddToQuery(query, "order_by", req.OrderBy) parameter.AddToQuery(query, "page", req.Page) @@ -2502,6 +2532,16 @@ func (s *API) DeleteGroup(req *DeleteGroupRequest, opts ...scw.RequestOption) er func (s *API) ListPolicies(req *ListPoliciesRequest, opts ...scw.RequestOption) (*ListPoliciesResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + + if req.OrganizationID == "" { + defaultOrganizationID, _ := s.client.GetDefaultOrganizationID() + req.OrganizationID = defaultOrganizationID + } + query := url.Values{} parameter.AddToQuery(query, "order_by", req.OrderBy) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -2684,6 +2724,11 @@ func (s *API) SetRules(req *SetRulesRequest, opts ...scw.RequestOption) (*SetRul func (s *API) ListRules(req *ListRulesRequest, opts ...scw.RequestOption) (*ListRulesResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "policy_id", req.PolicyID) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -2708,6 +2753,16 @@ func (s *API) ListRules(req *ListRulesRequest, opts ...scw.RequestOption) (*List func (s *API) ListPermissionSets(req *ListPermissionSetsRequest, opts ...scw.RequestOption) (*ListPermissionSetsResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + + if req.OrganizationID == "" { + defaultOrganizationID, _ := s.client.GetDefaultOrganizationID() + req.OrganizationID = defaultOrganizationID + } + query := url.Values{} parameter.AddToQuery(query, "order_by", req.OrderBy) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -2733,6 +2788,11 @@ func (s *API) ListPermissionSets(req *ListPermissionSetsRequest, opts ...scw.Req func (s *API) ListAPIKeys(req *ListAPIKeysRequest, opts ...scw.RequestOption) (*ListAPIKeysResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "order_by", req.OrderBy) parameter.AddToQuery(query, "page", req.Page) @@ -2858,6 +2918,16 @@ func (s *API) DeleteAPIKey(req *DeleteAPIKeyRequest, opts ...scw.RequestOption) func (s *API) ListQuota(req *ListQuotaRequest, opts ...scw.RequestOption) (*ListQuotaResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + + if req.OrganizationID == "" { + defaultOrganizationID, _ := s.client.GetDefaultOrganizationID() + req.OrganizationID = defaultOrganizationID + } + query := url.Values{} parameter.AddToQuery(query, "order_by", req.OrderBy) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -2914,6 +2984,11 @@ func (s *API) GetQuotum(req *GetQuotumRequest, opts ...scw.RequestOption) (*Quot func (s *API) ListJWTs(req *ListJWTsRequest, opts ...scw.RequestOption) (*ListJWTsResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "order_by", req.OrderBy) parameter.AddToQuery(query, "audience_id", req.AudienceID) @@ -2982,6 +3057,16 @@ func (s *API) DeleteJWT(req *DeleteJWTRequest, opts ...scw.RequestOption) error func (s *API) ListLogs(req *ListLogsRequest, opts ...scw.RequestOption) (*ListLogsResponse, error) { var err error + if req.OrganizationID == "" { + defaultOrganizationID, _ := s.client.GetDefaultOrganizationID() + req.OrganizationID = defaultOrganizationID + } + + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "order_by", req.OrderBy) parameter.AddToQuery(query, "organization_id", req.OrganizationID) diff --git a/api/marketplace/v2/marketplace_sdk.go b/api/marketplace/v2/marketplace_sdk.go index 2a7ffba7c..003547c3a 100644 --- a/api/marketplace/v2/marketplace_sdk.go +++ b/api/marketplace/v2/marketplace_sdk.go @@ -452,6 +452,11 @@ func NewAPI(client *scw.Client) *API { func (s *API) ListImages(req *ListImagesRequest, opts ...scw.RequestOption) (*ListImagesResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "page_size", req.PageSize) parameter.AddToQuery(query, "page", req.Page) @@ -501,6 +506,11 @@ func (s *API) GetImage(req *GetImageRequest, opts ...scw.RequestOption) (*Image, func (s *API) ListVersions(req *ListVersionsRequest, opts ...scw.RequestOption) (*ListVersionsResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "image_id", req.ImageID) parameter.AddToQuery(query, "page_size", req.PageSize) @@ -548,6 +558,16 @@ func (s *API) GetVersion(req *GetVersionRequest, opts ...scw.RequestOption) (*Ve func (s *API) ListLocalImages(req *ListLocalImagesRequest, opts ...scw.RequestOption) (*ListLocalImagesResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + + defaultZone, exist := s.client.GetDefaultZone() + if (req.Zone == nil || *req.Zone == "") && exist { + req.Zone = &defaultZone + } + query := url.Values{} parameter.AddToQuery(query, "page_size", req.PageSize) parameter.AddToQuery(query, "page", req.Page) @@ -599,6 +619,11 @@ func (s *API) GetLocalImage(req *GetLocalImageRequest, opts ...scw.RequestOption func (s *API) ListCategories(req *ListCategoriesRequest, opts ...scw.RequestOption) (*ListCategoriesResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "page_size", req.PageSize) parameter.AddToQuery(query, "page", req.Page) diff --git a/api/test/v1/test_sdk.go b/api/test/v1/test_sdk.go index fae5e1b35..6b9492d0f 100644 --- a/api/test/v1/test_sdk.go +++ b/api/test/v1/test_sdk.go @@ -366,6 +366,11 @@ func (s *API) Register(req *RegisterRequest, opts ...scw.RequestOption) (*Regist func (s *API) ListHumans(req *ListHumansRequest, opts ...scw.RequestOption) (*ListHumansResponse, error) { var err error + defaultPageSize, exist := s.client.GetDefaultPageSize() + if (req.PageSize == nil || *req.PageSize == 0) && exist { + req.PageSize = &defaultPageSize + } + query := url.Values{} parameter.AddToQuery(query, "page", req.Page) parameter.AddToQuery(query, "page_size", req.PageSize)