Browse Source

delete from the cataolg takes a query parameter rather than a path parmaeter - aligninging with other apis

Mark deVilliers 2 years ago
parent
commit
c85a930b23

+ 2 - 2
client/metadata/README.md

@@ -6,7 +6,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
6 6
 
7 7
 - API version: 
8 8
 - Package version: 1.0.0
9
-- Build date: 2017-08-14T18:22:59.713+01:00
9
+- Build date: 2017-08-15T10:02:08.317+01:00
10 10
 - Build package: class io.swagger.codegen.languages.GoClientCodegen
11 11
 
12 12
 ## Installation
@@ -25,7 +25,7 @@ Class | Method | HTTP request | Description
25 25
 *MetadataApi* | [**CatalogItem**](docs/MetadataApi.md#catalogitem) | **Put** /catalog/items/{location-uid} | catalog an item for discovery e.g. what and where
26 26
 *MetadataApi* | [**MoveLocation**](docs/MetadataApi.md#movelocation) | **Patch** /catalog/announce/{location-uid} | change a node's location - keeping the same location-uid
27 27
 *MetadataApi* | [**RegisterLocation**](docs/MetadataApi.md#registerlocation) | **Put** /catalog/announce | register a node's location
28
-*MetadataApi* | [**RemoveFromCatalog**](docs/MetadataApi.md#removefromcatalog) | **Delete** /catalog/items/{catalog-uid} | delete an item from the catalog
28
+*MetadataApi* | [**RemoveFromCatalog**](docs/MetadataApi.md#removefromcatalog) | **Delete** /catalog/items/ | delete an item from the catalog
29 29
 
30 30
 
31 31
 ## Documentation For Models

+ 3 - 3
client/metadata/api_catalog_item.go

@@ -20,11 +20,11 @@ package swagger
20 20
 
21 21
 type ApiCatalogItem struct {
22 22
 
23
-	// path of the data item
24
-	Subject string `json:"Subject,omitempty"`
25
-
26 23
 	Sample string `json:"sample,omitempty"`
27 24
 
25
+	// path of the data item
26
+	Subject string `json:"subject,omitempty"`
27
+
28 28
 	// a collection of tags probably belonging to an ontology
29 29
 	Tags []string `json:"tags,omitempty"`
30 30
 }

+ 3 - 3
client/metadata/api_catalog_request.go

@@ -20,11 +20,11 @@ package swagger
20 20
 
21 21
 type ApiCatalogRequest struct {
22 22
 
23
-	// path of the data item
24
-	Subject string `json:"Subject,omitempty"`
25
-
26 23
 	Sample string `json:"sample,omitempty"`
27 24
 
25
+	// path of the data item
26
+	Subject string `json:"subject,omitempty"`
27
+
28 28
 	// a collection of tags probably belonging to an ontology
29 29
 	Tags []string `json:"tags,omitempty"`
30 30
 }

+ 3 - 3
client/metadata/api_item_with_location.go

@@ -20,14 +20,14 @@ package swagger
20 20
 
21 21
 type ApiItemWithLocation struct {
22 22
 
23
-	// path of the data item
24
-	Subject string `json:"Subject,omitempty"`
25
-
26 23
 	// location for the catalogued piece of data
27 24
 	Location ApiLocation `json:"location,omitempty"`
28 25
 
29 26
 	Sample string `json:"sample,omitempty"`
30 27
 
28
+	// path of the data item
29
+	Subject string `json:"subject,omitempty"`
30
+
31 31
 	// a collection of tags probably belonging to an ontology
32 32
 	Tags []string `json:"tags,omitempty"`
33 33
 }

+ 1 - 1
client/metadata/docs/ApiCatalogItem.md

@@ -3,8 +3,8 @@
3 3
 ## Properties
4 4
 Name | Type | Description | Notes
5 5
 ------------ | ------------- | ------------- | -------------
6
-**Subject** | **string** | path of the data item | [default to null]
7 6
 **Sample** | **string** |  | [default to null]
7
+**Subject** | **string** | path of the data item | [default to null]
8 8
 **Tags** | **[]string** | a collection of tags probably belonging to an ontology | [default to null]
9 9
 
10 10
 [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

+ 1 - 1
client/metadata/docs/ApiCatalogRequest.md

@@ -3,8 +3,8 @@
3 3
 ## Properties
4 4
 Name | Type | Description | Notes
5 5
 ------------ | ------------- | ------------- | -------------
6
-**Subject** | **string** | path of the data item | [default to null]
7 6
 **Sample** | **string** |  | [default to null]
7
+**Subject** | **string** | path of the data item | [default to null]
8 8
 **Tags** | **[]string** | a collection of tags probably belonging to an ontology | [default to null]
9 9
 
10 10
 [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

+ 1 - 1
client/metadata/docs/ApiItemWithLocation.md

@@ -3,9 +3,9 @@
3 3
 ## Properties
4 4
 Name | Type | Description | Notes
5 5
 ------------ | ------------- | ------------- | -------------
6
-**Subject** | **string** | path of the data item | [default to null]
7 6
 **Location** | [**ApiLocation**](api.Location.md) | location for the catalogued piece of data | [default to null]
8 7
 **Sample** | **string** |  | [default to null]
8
+**Subject** | **string** | path of the data item | [default to null]
9 9
 **Tags** | **[]string** | a collection of tags probably belonging to an ontology | [default to null]
10 10
 
11 11
 [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

+ 3 - 3
client/metadata/docs/MetadataApi.md

@@ -8,7 +8,7 @@ Method | HTTP request | Description
8 8
 [**CatalogItem**](MetadataApi.md#CatalogItem) | **Put** /catalog/items/{location-uid} | catalog an item for discovery e.g. what and where
9 9
 [**MoveLocation**](MetadataApi.md#MoveLocation) | **Patch** /catalog/announce/{location-uid} | change a node's location - keeping the same location-uid
10 10
 [**RegisterLocation**](MetadataApi.md#RegisterLocation) | **Put** /catalog/announce | register a node's location
11
-[**RemoveFromCatalog**](MetadataApi.md#RemoveFromCatalog) | **Delete** /catalog/items/{catalog-uid} | delete an item from the catalog
11
+[**RemoveFromCatalog**](MetadataApi.md#RemoveFromCatalog) | **Delete** /catalog/items/ | delete an item from the catalog
12 12
 
13 13
 
14 14
 # **AllItems**
@@ -127,7 +127,7 @@ No authorization required
127 127
 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
128 128
 
129 129
 # **RemoveFromCatalog**
130
-> RemoveFromCatalog($catalogUid)
130
+> RemoveFromCatalog($subject)
131 131
 
132 132
 delete an item from the catalog
133 133
 
@@ -138,7 +138,7 @@ delete an item from the catalog
138 138
 
139 139
 Name | Type | Description  | Notes
140 140
 ------------- | ------------- | ------------- | -------------
141
- **catalogUid** | **string**| identifier for a cataloged item | 
141
+ **subject** | **string**| 'subject' of the item to delete | [optional] 
142 142
 
143 143
 ### Return type
144 144
 

+ 5 - 5
client/metadata/metadata_api.go

@@ -273,15 +273,14 @@ func (a MetadataApi) RegisterLocation(body ApiLocationRequest) (*ApiLocation, *A
273 273
  * delete an item from the catalog
274 274
  * delete an item from the catalog
275 275
  *
276
- * @param catalogUid identifier for a cataloged item
276
+ * @param subject 'subject' of the item to delete
277 277
  * @return void
278 278
  */
279
-func (a MetadataApi) RemoveFromCatalog(catalogUid string) (*APIResponse, error) {
279
+func (a MetadataApi) RemoveFromCatalog(subject string) (*APIResponse, error) {
280 280
 
281 281
 	var httpMethod = "Delete"
282 282
 	// create path and map variables
283
-	path := a.Configuration.BasePath + "/catalog/items/{catalog-uid}"
284
-	path = strings.Replace(path, "{"+"catalog-uid"+"}", fmt.Sprintf("%v", catalogUid), -1)
283
+	path := a.Configuration.BasePath + "/catalog/items/"
285 284
 
286 285
 
287 286
 	headerParams := make(map[string]string)
@@ -294,7 +293,8 @@ func (a MetadataApi) RemoveFromCatalog(catalogUid string) (*APIResponse, error)
294 293
 	for key := range a.Configuration.DefaultHeader {
295 294
 		headerParams[key] = a.Configuration.DefaultHeader[key]
296 295
 	}
297
-
296
+		queryParams.Add("subject", a.Configuration.APIClient.ParameterToString(subject, ""))
297
+	
298 298
 
299 299
 	// to determine the Content-Type header
300 300
 	localVarHttpContentTypes := []string{ "application/json",  }

+ 4 - 5
metadata/api/catalog.go

@@ -69,7 +69,6 @@ func (e catalogResource) WebService() *restful.WebService {
69 69
 		Consumes(restful.MIME_JSON).
70 70
 		Produces(restful.MIME_JSON)
71 71
 
72
-	catalogUIDParameter := ws.PathParameter("catalog-uid", "identifier for a cataloged item").DataType("string")
73 72
 	locationUIDParameter := ws.PathParameter("location-uid", "identifier for a location").DataType("string")
74 73
 
75 74
 	tags := []string{"metadata"}
@@ -105,11 +104,11 @@ func (e catalogResource) WebService() *restful.WebService {
105 104
 		Returns(http.StatusInternalServerError, "something went wrong", ErrorResponse{}))
106 105
 
107 106
 	// delete an item from the catalog
108
-	ws.Route(ws.DELETE("/items/{catalog-uid}").To(e.removeFromCatalog).
107
+	ws.Route(ws.DELETE("/items/").To(e.removeFromCatalog).
108
+		Param(ws.QueryParameter("subject", "'subject' of the item to delete").DataType("string")).
109 109
 		Doc("delete an item from the catalog").
110 110
 		Metadata(restfulspec.KeyOpenAPITags, tags).
111
-		Returns(http.StatusOK, "OK", nil).
112
-		Param(catalogUIDParameter))
111
+		Returns(http.StatusOK, "OK", nil))
113 112
 
114 113
 	// get all items - simple search
115 114
 	ws.Route(ws.GET("/items/").To(e.allItems).
@@ -218,7 +217,7 @@ func (e catalogResource) catalogItem(request *restful.Request, response *restful
218 217
 }
219 218
 
220 219
 func (e catalogResource) removeFromCatalog(request *restful.Request, response *restful.Response) {
221
-	uid := request.PathParameter("catalog-uid")
220
+	uid := request.QueryParameter("subject")
222 221
 	e.store.Items.Delete(uid)
223 222
 }
224 223