Browse Source

Revert "DeleteCollection: Make params a struct"

This reverts commit 1d34eede72c856b5aa9a31ed4036f42aed3111eb.
Matt Baer 6 months ago
parent
commit
7a2c93ae6d
2 changed files with 4 additions and 12 deletions
  1. 2
    8
      collection.go
  2. 2
    4
      collection_test.go

+ 2
- 8
collection.go View File

@@ -29,12 +29,6 @@ type (
29 29
 		Alias string `json:"alias"`
30 30
 		Title string `json:"title"`
31 31
 	}
32
-
33
-	// DeleteCollectionParams holds the parameters required to delete a
34
-	// collection.
35
-	DeleteCollectionParams struct {
36
-		Alias string `json:"-"`
37
-	}
38 32
 )
39 33
 
40 34
 // CreateCollection creates a new collection, returning a user-friendly error
@@ -146,8 +140,8 @@ func (c *Client) GetUserCollections() (*[]Collection, error) {
146 140
 // anonymous.
147 141
 //
148 142
 // See https://developers.write.as/docs/api/#delete-a-collection.
149
-func (c *Client) DeleteCollection(p *DeleteCollectionParams) error {
150
-	endpoint := "/collections/" + p.Alias
143
+func (c *Client) DeleteCollection(alias string) error {
144
+	endpoint := "/collections/" + alias
151 145
 	env, err := c.delete(endpoint, nil /* data */)
152 146
 	if err != nil {
153 147
 		return err

+ 2
- 4
collection_test.go View File

@@ -71,8 +71,7 @@ func TestCreateAndDeleteCollection(t *testing.T) {
71 71
 		t.Fatalf("Unable to create collection %q: %v", alias, err)
72 72
 	}
73 73
 
74
-	p := &DeleteCollectionParams{Alias: c.Alias}
75
-	if err := wac.DeleteCollection(p); err != nil {
74
+	if err := wac.DeleteCollection(c.Alias); err != nil {
76 75
 		t.Fatalf("Unable to delete collection %q: %v", alias, err)
77 76
 	}
78 77
 }
@@ -82,8 +81,7 @@ func TestDeleteCollectionUnauthenticated(t *testing.T) {
82 81
 
83 82
 	now := time.Now().Unix()
84 83
 	alias := fmt.Sprintf("test-collection-does-not-exist-%v", now)
85
-	p := &DeleteCollectionParams{Alias: alias}
86
-	err := wac.DeleteCollection(p)
84
+	err := wac.DeleteCollection(alias)
87 85
 	if err == nil {
88 86
 		t.Fatalf("Should not be able to delete collection %q unauthenticated.", alias)
89 87
 	}