Loading group_hooks.go +4 −4 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ func (s *GroupsService) TriggerTestGroupHook(pid any, hook int64, trigger GroupH func (s *GroupsService) SetGroupCustomHeader(gid any, hook int64, key string, opt *SetHookCustomHeaderOptions, options ...RequestOptionFunc) (*Response, error) { _, resp, err := do[none](s.client, withMethod(http.MethodPut), withPath("groups/%s/hooks/%d/custom_headers/%s", GroupID{gid}, hook, key), withPath("groups/%s/hooks/%d/custom_headers/%s", GroupID{gid}, hook, NoEscape{key}), withAPIOpts(opt), withRequestOpts(options...), ) Loading @@ -252,7 +252,7 @@ func (s *GroupsService) SetGroupCustomHeader(gid any, hook int64, key string, op func (s *GroupsService) DeleteGroupCustomHeader(gid any, hook int64, key string, options ...RequestOptionFunc) (*Response, error) { _, resp, err := do[none](s.client, withMethod(http.MethodDelete), withPath("groups/%s/hooks/%d/custom_headers/%s", GroupID{gid}, hook, key), withPath("groups/%s/hooks/%d/custom_headers/%s", GroupID{gid}, hook, NoEscape{key}), withRequestOpts(options...), ) return resp, err Loading @@ -274,7 +274,7 @@ type SetHookURLVariableOptions struct { func (s *GroupsService) SetGroupHookURLVariable(gid any, hook int64, key string, opt *SetHookURLVariableOptions, options ...RequestOptionFunc) (*Response, error) { _, resp, err := do[none](s.client, withMethod(http.MethodPut), withPath("groups/%s/hooks/%d/url_variables/%s", GroupID{gid}, hook, key), withPath("groups/%s/hooks/%d/url_variables/%s", GroupID{gid}, hook, NoEscape{key}), withAPIOpts(opt), withRequestOpts(options...), ) Loading @@ -288,7 +288,7 @@ func (s *GroupsService) SetGroupHookURLVariable(gid any, hook int64, key string, func (s *GroupsService) DeleteGroupHookURLVariable(gid any, hook int64, key string, options ...RequestOptionFunc) (*Response, error) { _, resp, err := do[none](s.client, withMethod(http.MethodDelete), withPath("groups/%s/hooks/%d/url_variables/%s", GroupID{gid}, hook, key), withPath("groups/%s/hooks/%d/url_variables/%s", GroupID{gid}, hook, NoEscape{key}), withRequestOpts(options...), ) return resp, err Loading group_hooks_test.go +12 −8 Original line number Diff line number Diff line Loading @@ -491,8 +491,9 @@ func TestSetGroupWebhookHeader(t *testing.T) { var bodyJSON map[string]any // Removed most of the arguments to keep test slim mux.HandleFunc("/api/v4/groups/1/hooks/1/custom_headers/Authorization", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/api/v4/groups/1/hooks/1/custom_headers/Authorization.Header", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodPut) testURL(t, r, r.Pattern) w.WriteHeader(http.StatusNoContent) // validate that the `value` body is sent properly Loading @@ -505,7 +506,7 @@ func TestSetGroupWebhookHeader(t *testing.T) { fmt.Fprint(w, ``) }) req, err := client.Groups.SetGroupCustomHeader(1, 1, "Authorization", &SetHookCustomHeaderOptions{Value: Ptr("testValue")}) req, err := client.Groups.SetGroupCustomHeader(1, 1, "Authorization.Header", &SetHookCustomHeaderOptions{Value: Ptr("testValue")}) require.NoError(t, err) assert.Equal(t, "testValue", bodyJSON["value"]) Loading @@ -515,11 +516,12 @@ func TestSetGroupWebhookHeader(t *testing.T) { func TestDeleteGroupCustomHeader(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/hooks/1/custom_headers/Authorization", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/api/v4/groups/1/hooks/1/custom_headers/Authorization.Header", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodDelete) testURL(t, r, r.Pattern) }) resp, err := client.Groups.DeleteGroupCustomHeader(1, 1, "Authorization") resp, err := client.Groups.DeleteGroupCustomHeader(1, 1, "Authorization.Header") require.NoError(t, err) require.NotNil(t, resp) } Loading @@ -527,11 +529,12 @@ func TestDeleteGroupCustomHeader(t *testing.T) { func TestSetGroupHookURLVariable(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/hooks/1/url_variables/KEY", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/api/v4/groups/1/hooks/1/url_variables/KEY.NAME", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodPut) testURL(t, r, r.Pattern) }) resp, err := client.Groups.SetGroupHookURLVariable(1, 1, "KEY", &SetHookURLVariableOptions{Value: Ptr("VALUE")}) resp, err := client.Groups.SetGroupHookURLVariable(1, 1, "KEY.NAME", &SetHookURLVariableOptions{Value: Ptr("VALUE")}) require.NoError(t, err) require.NotNil(t, resp) } Loading @@ -539,11 +542,12 @@ func TestSetGroupHookURLVariable(t *testing.T) { func TestDeleteGroupHookURLVariable(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/hooks/1/url_variables/KEY", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/api/v4/groups/1/hooks/1/url_variables/KEY.NAME", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodDelete) testURL(t, r, r.Pattern) }) resp, err := client.Groups.DeleteGroupHookURLVariable(1, 1, "KEY") resp, err := client.Groups.DeleteGroupHookURLVariable(1, 1, "KEY.NAME") require.NoError(t, err) require.NotNil(t, resp) } license_templates.go +1 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ type GetLicenseTemplateOptions struct { // https://docs.gitlab.com/api/templates/licenses/#single-license-template func (s *LicenseTemplatesService) GetLicenseTemplate(template string, opt *GetLicenseTemplateOptions, options ...RequestOptionFunc) (*LicenseTemplate, *Response, error) { return do[*LicenseTemplate](s.client, withPath("templates/licenses/%s", template), withPath("templates/licenses/%s", NoEscape{template}), withAPIOpts(opt), withRequestOpts(options...), ) Loading license_templates_test.go +1 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ func TestLicenseTemplatesService_GetLicenseTemplate(t *testing.T) { mux.HandleFunc("/api/v4/templates/licenses/apache-2.0", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) testURL(t, r, r.Pattern) fmt.Fprintf(w, ` { "key": "apache-2.0", Loading pipeline_schedules.go +2 −2 Original line number Diff line number Diff line Loading @@ -265,7 +265,7 @@ type EditPipelineScheduleVariableOptions struct { func (s *PipelineSchedulesService) EditPipelineScheduleVariable(pid any, schedule int64, key string, opt *EditPipelineScheduleVariableOptions, options ...RequestOptionFunc) (*PipelineVariable, *Response, error) { return do[*PipelineVariable](s.client, withMethod(http.MethodPut), withPath("projects/%s/pipeline_schedules/%d/variables/%s", ProjectID{pid}, schedule, key), withPath("projects/%s/pipeline_schedules/%d/variables/%s", ProjectID{pid}, schedule, NoEscape{key}), withAPIOpts(opt), withRequestOpts(options...), ) Loading @@ -278,7 +278,7 @@ func (s *PipelineSchedulesService) EditPipelineScheduleVariable(pid any, schedul func (s *PipelineSchedulesService) DeletePipelineScheduleVariable(pid any, schedule int64, key string, options ...RequestOptionFunc) (*PipelineVariable, *Response, error) { return do[*PipelineVariable](s.client, withMethod(http.MethodDelete), withPath("projects/%s/pipeline_schedules/%d/variables/%s", ProjectID{pid}, schedule, key), withPath("projects/%s/pipeline_schedules/%d/variables/%s", ProjectID{pid}, schedule, NoEscape{key}), withRequestOpts(options...), ) } Loading
group_hooks.go +4 −4 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ func (s *GroupsService) TriggerTestGroupHook(pid any, hook int64, trigger GroupH func (s *GroupsService) SetGroupCustomHeader(gid any, hook int64, key string, opt *SetHookCustomHeaderOptions, options ...RequestOptionFunc) (*Response, error) { _, resp, err := do[none](s.client, withMethod(http.MethodPut), withPath("groups/%s/hooks/%d/custom_headers/%s", GroupID{gid}, hook, key), withPath("groups/%s/hooks/%d/custom_headers/%s", GroupID{gid}, hook, NoEscape{key}), withAPIOpts(opt), withRequestOpts(options...), ) Loading @@ -252,7 +252,7 @@ func (s *GroupsService) SetGroupCustomHeader(gid any, hook int64, key string, op func (s *GroupsService) DeleteGroupCustomHeader(gid any, hook int64, key string, options ...RequestOptionFunc) (*Response, error) { _, resp, err := do[none](s.client, withMethod(http.MethodDelete), withPath("groups/%s/hooks/%d/custom_headers/%s", GroupID{gid}, hook, key), withPath("groups/%s/hooks/%d/custom_headers/%s", GroupID{gid}, hook, NoEscape{key}), withRequestOpts(options...), ) return resp, err Loading @@ -274,7 +274,7 @@ type SetHookURLVariableOptions struct { func (s *GroupsService) SetGroupHookURLVariable(gid any, hook int64, key string, opt *SetHookURLVariableOptions, options ...RequestOptionFunc) (*Response, error) { _, resp, err := do[none](s.client, withMethod(http.MethodPut), withPath("groups/%s/hooks/%d/url_variables/%s", GroupID{gid}, hook, key), withPath("groups/%s/hooks/%d/url_variables/%s", GroupID{gid}, hook, NoEscape{key}), withAPIOpts(opt), withRequestOpts(options...), ) Loading @@ -288,7 +288,7 @@ func (s *GroupsService) SetGroupHookURLVariable(gid any, hook int64, key string, func (s *GroupsService) DeleteGroupHookURLVariable(gid any, hook int64, key string, options ...RequestOptionFunc) (*Response, error) { _, resp, err := do[none](s.client, withMethod(http.MethodDelete), withPath("groups/%s/hooks/%d/url_variables/%s", GroupID{gid}, hook, key), withPath("groups/%s/hooks/%d/url_variables/%s", GroupID{gid}, hook, NoEscape{key}), withRequestOpts(options...), ) return resp, err Loading
group_hooks_test.go +12 −8 Original line number Diff line number Diff line Loading @@ -491,8 +491,9 @@ func TestSetGroupWebhookHeader(t *testing.T) { var bodyJSON map[string]any // Removed most of the arguments to keep test slim mux.HandleFunc("/api/v4/groups/1/hooks/1/custom_headers/Authorization", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/api/v4/groups/1/hooks/1/custom_headers/Authorization.Header", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodPut) testURL(t, r, r.Pattern) w.WriteHeader(http.StatusNoContent) // validate that the `value` body is sent properly Loading @@ -505,7 +506,7 @@ func TestSetGroupWebhookHeader(t *testing.T) { fmt.Fprint(w, ``) }) req, err := client.Groups.SetGroupCustomHeader(1, 1, "Authorization", &SetHookCustomHeaderOptions{Value: Ptr("testValue")}) req, err := client.Groups.SetGroupCustomHeader(1, 1, "Authorization.Header", &SetHookCustomHeaderOptions{Value: Ptr("testValue")}) require.NoError(t, err) assert.Equal(t, "testValue", bodyJSON["value"]) Loading @@ -515,11 +516,12 @@ func TestSetGroupWebhookHeader(t *testing.T) { func TestDeleteGroupCustomHeader(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/hooks/1/custom_headers/Authorization", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/api/v4/groups/1/hooks/1/custom_headers/Authorization.Header", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodDelete) testURL(t, r, r.Pattern) }) resp, err := client.Groups.DeleteGroupCustomHeader(1, 1, "Authorization") resp, err := client.Groups.DeleteGroupCustomHeader(1, 1, "Authorization.Header") require.NoError(t, err) require.NotNil(t, resp) } Loading @@ -527,11 +529,12 @@ func TestDeleteGroupCustomHeader(t *testing.T) { func TestSetGroupHookURLVariable(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/hooks/1/url_variables/KEY", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/api/v4/groups/1/hooks/1/url_variables/KEY.NAME", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodPut) testURL(t, r, r.Pattern) }) resp, err := client.Groups.SetGroupHookURLVariable(1, 1, "KEY", &SetHookURLVariableOptions{Value: Ptr("VALUE")}) resp, err := client.Groups.SetGroupHookURLVariable(1, 1, "KEY.NAME", &SetHookURLVariableOptions{Value: Ptr("VALUE")}) require.NoError(t, err) require.NotNil(t, resp) } Loading @@ -539,11 +542,12 @@ func TestSetGroupHookURLVariable(t *testing.T) { func TestDeleteGroupHookURLVariable(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/hooks/1/url_variables/KEY", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/api/v4/groups/1/hooks/1/url_variables/KEY.NAME", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodDelete) testURL(t, r, r.Pattern) }) resp, err := client.Groups.DeleteGroupHookURLVariable(1, 1, "KEY") resp, err := client.Groups.DeleteGroupHookURLVariable(1, 1, "KEY.NAME") require.NoError(t, err) require.NotNil(t, resp) }
license_templates.go +1 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ type GetLicenseTemplateOptions struct { // https://docs.gitlab.com/api/templates/licenses/#single-license-template func (s *LicenseTemplatesService) GetLicenseTemplate(template string, opt *GetLicenseTemplateOptions, options ...RequestOptionFunc) (*LicenseTemplate, *Response, error) { return do[*LicenseTemplate](s.client, withPath("templates/licenses/%s", template), withPath("templates/licenses/%s", NoEscape{template}), withAPIOpts(opt), withRequestOpts(options...), ) Loading
license_templates_test.go +1 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ func TestLicenseTemplatesService_GetLicenseTemplate(t *testing.T) { mux.HandleFunc("/api/v4/templates/licenses/apache-2.0", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) testURL(t, r, r.Pattern) fmt.Fprintf(w, ` { "key": "apache-2.0", Loading
pipeline_schedules.go +2 −2 Original line number Diff line number Diff line Loading @@ -265,7 +265,7 @@ type EditPipelineScheduleVariableOptions struct { func (s *PipelineSchedulesService) EditPipelineScheduleVariable(pid any, schedule int64, key string, opt *EditPipelineScheduleVariableOptions, options ...RequestOptionFunc) (*PipelineVariable, *Response, error) { return do[*PipelineVariable](s.client, withMethod(http.MethodPut), withPath("projects/%s/pipeline_schedules/%d/variables/%s", ProjectID{pid}, schedule, key), withPath("projects/%s/pipeline_schedules/%d/variables/%s", ProjectID{pid}, schedule, NoEscape{key}), withAPIOpts(opt), withRequestOpts(options...), ) Loading @@ -278,7 +278,7 @@ func (s *PipelineSchedulesService) EditPipelineScheduleVariable(pid any, schedul func (s *PipelineSchedulesService) DeletePipelineScheduleVariable(pid any, schedule int64, key string, options ...RequestOptionFunc) (*PipelineVariable, *Response, error) { return do[*PipelineVariable](s.client, withMethod(http.MethodDelete), withPath("projects/%s/pipeline_schedules/%d/variables/%s", ProjectID{pid}, schedule, key), withPath("projects/%s/pipeline_schedules/%d/variables/%s", ProjectID{pid}, schedule, NoEscape{key}), withRequestOpts(options...), ) }