From 8ac0c82d26dec0922d8c3b5115df2f99f5f1f5f0 Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Sun, 6 Oct 2024 13:43:26 +0200 Subject: [PATCH] Minor changes to keep code consistent within the package --- pages.go | 25 ++++++++++++------------- pages_test.go | 8 ++++---- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/pages.go b/pages.go index 606baf623..81be8ba6f 100644 --- a/pages.go +++ b/pages.go @@ -26,24 +26,24 @@ type PagesService struct { client *Client } -// PagesDeployment represents a Pages deployment. +// Pages represents the Pages of a project. // // GitLab API docs: https://docs.gitlab.com/ee/api/pages.html -type PagesDeployment struct { - CreatedAt *time.Time `json:"created_at"` - URL string `json:"url"` - PathPrefix *string `json:"path_prefix"` - RootDirectory *string `json:"root_directory"` +type Pages struct { + URL string `json:"url"` + IsUniqueDomainEnabled bool `json:"is_unique_domain_enabled"` + ForceHTTPS bool `json:"force_https"` + Deployments []*PagesDeployment `json:"deployments"` } -// Pages represents the Pages of a project. +// PagesDeployment represents a Pages deployment. // // GitLab API docs: https://docs.gitlab.com/ee/api/pages.html -type Pages struct { - URL string `json:"url"` - IsUniqueDomainEnabled bool `json:"is_unique_domain_enabled"` - ForceHTTPS bool `json:"force_https"` - Deployments []PagesDeployment `json:"deployments"` +type PagesDeployment struct { + CreatedAt time.Time `json:"created_at"` + URL string `json:"url"` + PathPrefix string `json:"path_prefix"` + RootDirectory string `json:"root_directory"` } // UnpublishPages unpublished pages. The user must have admin privileges. @@ -75,7 +75,6 @@ func (s *PagesService) GetPages(gid interface{}, options ...RequestOptionFunc) ( if err != nil { return nil, nil, err } - u := fmt.Sprintf("projects/%s/pages", PathEscape(project)) req, err := s.client.NewRequest(http.MethodGet, u, nil, options) diff --git a/pages_test.go b/pages_test.go index 395ef2c6a..0168253c3 100644 --- a/pages_test.go +++ b/pages_test.go @@ -63,12 +63,12 @@ func TestGetPages(t *testing.T) { URL: "https://ssl.domain.example", IsUniqueDomainEnabled: false, ForceHTTPS: false, - Deployments: []PagesDeployment{ + Deployments: []*PagesDeployment{ { - CreatedAt: Ptr(time.Date(2021, time.April, 27, 21, 27, 38, 584000000, time.UTC)), + CreatedAt: time.Date(2021, time.April, 27, 21, 27, 38, 584000000, time.UTC), URL: "https://ssl.domain.example/", - PathPrefix: Ptr(""), - RootDirectory: nil, + PathPrefix: "", + RootDirectory: "", }, }, }