Updates API calls adding slashes where really needed.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>
constructor(serverApi: AxiosInstance, resourceType: string, actions: ApiActions) {
this.serverApi = serverApi;
- this.resourceType = '/' + resourceType + '/';
+ this.resourceType = '/' + resourceType;
this.actions = actions;
}
delete(uuid: string): Promise<T> {
return CommonService.defaultResponse(
this.serverApi
- .delete(this.resourceType + uuid),
+ .delete(this.resourceType + '/' + uuid),
this.actions
);
}
get(uuid: string) {
return CommonService.defaultResponse(
this.serverApi
- .get<T>(this.resourceType + uuid),
+ .get<T>(this.resourceType + '/' + uuid),
this.actions
);
}
update(uuid: string, data: Partial<T>) {
return CommonService.defaultResponse(
this.serverApi
- .put<T>(this.resourceType + uuid, data && CommonService.mapKeys(_.snakeCase)(data)),
+ .put<T>(this.resourceType + '/' + uuid, data && CommonService.mapKeys(_.snakeCase)(data)),
this.actions
);
}
trash(uuid: string): Promise<T> {
return CommonResourceService.defaultResponse(
this.serverApi
- .post(this.resourceType + `${uuid}/trash`),
+ .post(this.resourceType + `/${uuid}/trash`),
this.actions
);
}
};
return CommonResourceService.defaultResponse(
this.serverApi
- .post(this.resourceType + `${uuid}/untrash`, {
+ .post(this.resourceType + `/${uuid}/untrash`, {
params: CommonResourceService.mapKeys(_.snakeCase)(params)
}),
this.actions
filters: filters ? `[${filters}]` : undefined,
order: order ? order : undefined
};
-
- const pathUrl = uuid ? `${uuid}/contents` : 'contents';
+ const pathUrl = uuid ? `/${uuid}/contents` : '/contents';
const cfg: AxiosRequestConfig = { params: CommonResourceService.mapKeys(_.snakeCase)(params) };
if (session) {
shared(params: SharedArguments = {}): Promise<ListResults<GroupContentsResource>> {
return CommonResourceService.defaultResponse(
this.serverApi
- .get(this.resourceType + 'shared', { params }),
+ .get(this.resourceType + '/shared', { params }),
this.actions
);
}
activate(uuid: string) {
return CommonResourceService.defaultResponse(
this.serverApi
- .post(this.resourceType + `${uuid}/activate`),
+ .post(this.resourceType + `/${uuid}/activate`),
this.actions
);
}
unsetup(uuid: string) {
return CommonResourceService.defaultResponse(
this.serverApi
- .post(this.resourceType + uuid + '/unsetup'),
+ .post(this.resourceType + `/${uuid}/unsetup`),
this.actions
);
}