From 7ef920817e5dcf7e3f5b444dc0070d9ef10488af Mon Sep 17 00:00:00 2001 From: Timo Furrer Date: Mon, 14 Nov 2022 16:31:19 +0100 Subject: [PATCH] Add `DeleteLicense` API --- license.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/license.go b/license.go index ddec3beac..1c739967a 100644 --- a/license.go +++ b/license.go @@ -17,6 +17,7 @@ package gitlab import ( + "fmt" "net/http" "time" ) @@ -110,3 +111,18 @@ func (s *LicenseService) AddLicense(opt *AddLicenseOptions, options ...RequestOp return l, resp, err } + +// DeleteLicense deletes an existing license. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/license.html#delete-a-license +func (s *LicenseService) DeleteLicense(licenseID int, options ...RequestOptionFunc) (*Response, error) { + u := fmt.Sprintf("license/%d", licenseID) + + req, err := s.client.NewRequest(http.MethodDelete, u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +}