@@ -44,6 +44,9 @@ type Projects interface {
44
44
45
45
// AddTagBindings adds or modifies the value of existing tag binding keys for a project.
46
46
AddTagBindings (ctx context.Context , projectID string , options ProjectAddTagBindingsOptions ) ([]* TagBinding , error )
47
+
48
+ // DeleteAllTagBindings removes all existing tag bindings for a project.
49
+ DeleteAllTagBindings (ctx context.Context , projectID string ) error
47
50
}
48
51
49
52
// projects implements Projects
@@ -326,6 +329,30 @@ func (s *projects) Delete(ctx context.Context, projectID string) error {
326
329
return req .Do (ctx , nil )
327
330
}
328
331
332
+ // Delete all tag bindings associated with a project.
333
+ func (s * projects ) DeleteAllTagBindings (ctx context.Context , projectID string ) error {
334
+ if ! validStringID (& projectID ) {
335
+ return ErrInvalidProjectID
336
+ }
337
+
338
+ type aliasOpts struct {
339
+ Type string `jsonapi:"primary,projects"`
340
+ TagBindings []* TagBinding `jsonapi:"relation,tag-bindings"`
341
+ }
342
+
343
+ opts := & aliasOpts {
344
+ TagBindings : []* TagBinding {},
345
+ }
346
+
347
+ u := fmt .Sprintf ("projects/%s" , url .PathEscape (projectID ))
348
+ req , err := s .client .NewRequest ("PATCH" , u , opts )
349
+ if err != nil {
350
+ return err
351
+ }
352
+
353
+ return req .Do (ctx , nil )
354
+ }
355
+
329
356
func (o ProjectCreateOptions ) valid () error {
330
357
if ! validString (& o .Name ) {
331
358
return ErrRequiredName
0 commit comments