Skip to content

Commit

Permalink
Minor changes to keep code consistent within the package
Browse files Browse the repository at this point in the history
  • Loading branch information
svanharmelen committed Oct 6, 2024
1 parent 8082427 commit 8ac0c82
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
25 changes: 12 additions & 13 deletions pages.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions pages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
},
},
}
Expand Down

0 comments on commit 8ac0c82

Please sign in to comment.