Verified Commit 04cc8491 authored by José M. Requena Plens's avatar José M. Requena Plens Committed by GitLab
Browse files

feat(namespaces): add the eight fields the namespace entity sends to Namespace

Changelog: Improvements
parent a0286d44
Loading
Loading
Loading
Loading
+12 −0
Changes for namespaces.go: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@

package gitlab

import (
	"time"
)

var (
	routeNamespaces         = route("namespaces")
	routeNamespacesID       = route("namespaces/%s")
@@ -54,11 +58,19 @@ type Namespace struct {
	AvatarURL                        *string    `json:"avatar_url"`
	WebURL                           string     `json:"web_url"`
	MembersCountWithDescendants      int64      `json:"members_count_with_descendants"`
	RootRepositorySize               int64      `json:"root_repository_size"`
	ProjectsCount                    int64      `json:"projects_count"`
	SharedRunnersMinutesLimit        int64      `json:"shared_runners_minutes_limit"`
	ExtraSharedRunnersMinutesLimit   int64      `json:"extra_shared_runners_minutes_limit"`
	AdditionalPurchasedStorageSize   int64      `json:"additional_purchased_storage_size"`
	AdditionalPurchasedStorageEndsOn *ISOTime   `json:"additional_purchased_storage_ends_on"`
	BillableMembersCount             int64      `json:"billable_members_count"`
	Plan                             string     `json:"plan"`
	TrialEndsOn                      *ISOTime   `json:"trial_ends_on"`
	Trial                            bool       `json:"trial"`
	MaxSeatsUsed                     *int64     `json:"max_seats_used"`
	MaxSeatsUsedChangedAt            *time.Time `json:"max_seats_used_changed_at"`
	EndDate                          *ISOTime   `json:"end_date"`
	SeatsInUse                       *int64     `json:"seats_in_use"`
}

+19 −0
Changes for namespaces_test.go: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import (
	"fmt"
	"net/http"
	"testing"
	"time"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
@@ -186,8 +187,16 @@ func TestGetNamespace(t *testing.T) {
			"avatar_url": null,
			"web_url": "https://gitlab.example.com/groups/group1",
			"members_count_with_descendants": 2,
			"root_repository_size": 100,
			"projects_count": 3,
			"shared_runners_minutes_limit": 133,
			"extra_shared_runners_minutes_limit": 50,
			"additional_purchased_storage_size": 1000,
			"additional_purchased_storage_ends_on": "2022-06-18",
			"billable_members_count": 2,
			"max_seats_used": 0,
			"max_seats_used_changed_at": "2025-05-15T12:00:02.000Z",
			"end_date": "2026-06-18",
			"seats_in_use": 0,
			"plan": "default",
			"trial_ends_on": null,
@@ -198,6 +207,8 @@ func TestGetNamespace(t *testing.T) {
	namespace, _, err := client.Namespaces.GetNamespace(2)
	assert.NoError(t, err)

	storageEndsOn := ISOTime(time.Date(2022, time.June, 18, 0, 0, 0, 0, time.UTC))
	endDate := ISOTime(time.Date(2026, time.June, 18, 0, 0, 0, 0, time.UTC))
	want := &Namespace{
		ID:                               2,
		Name:                             "group1",
@@ -207,8 +218,16 @@ func TestGetNamespace(t *testing.T) {
		AvatarURL:                        nil,
		WebURL:                           "https://gitlab.example.com/groups/group1",
		MembersCountWithDescendants:      2,
		RootRepositorySize:               100,
		ProjectsCount:                    3,
		SharedRunnersMinutesLimit:        133,
		ExtraSharedRunnersMinutesLimit:   50,
		AdditionalPurchasedStorageSize:   1000,
		AdditionalPurchasedStorageEndsOn: &storageEndsOn,
		BillableMembersCount:             2,
		MaxSeatsUsed:                     new(int64(0)),
		MaxSeatsUsedChangedAt:            mustParseTime("2025-05-15T12:00:02.000Z"),
		EndDate:                          &endDate,
		SeatsInUse:                       new(int64(0)),
		Plan:                             "default",
		TrialEndsOn:                      nil,