Skip to content

Commit e4a1fae

Browse files
authored
refactor!: cleaned up redundant response interfaces (#22)
1 parent f7413f8 commit e4a1fae

File tree

1 file changed

+7
-27
lines changed

1 file changed

+7
-27
lines changed

lib/restli-client.ts

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,13 @@ export interface LIBatchGetResponse extends AxiosResponse {
193193
};
194194
}
195195

196-
export interface LIGetAllResponse extends AxiosResponse {
196+
export interface LICollectionResponse extends AxiosResponse {
197197
data: {
198-
/** List of entities */
198+
/** List of entities returned in the response. */
199199
elements: RestliEntity[];
200200
paging?: PagingObject;
201+
/** Optional response metadata. */
202+
metadata?: any;
201203
};
202204
}
203205

@@ -222,20 +224,6 @@ export interface LIBatchCreateResponse extends AxiosResponse {
222224

223225
export interface LIPartialUpdateResponse extends AxiosResponse {}
224226

225-
export interface LIBatchPartialUpdateResponse extends AxiosResponse {
226-
data: {
227-
/** A map of entities and their corresponding response status. */
228-
results: Record<
229-
EncodedEntityId,
230-
{
231-
status: number;
232-
}
233-
>;
234-
/** A map where the keys are the encoded entity ids that failed to be updated, and the values include the error response. */
235-
errors: Record<EncodedEntityId, any>;
236-
};
237-
}
238-
239227
export interface LIUpdateResponse extends AxiosResponse {}
240228

241229
export interface LIBatchUpdateResponse extends AxiosResponse {
@@ -268,14 +256,6 @@ export interface LIBatchDeleteResponse extends AxiosResponse {
268256
};
269257
}
270258

271-
export interface LIFinderResponse extends AxiosResponse {
272-
data: {
273-
/** An array of entities found based on the search criteria */
274-
elements: RestliEntity[];
275-
paging?: PagingObject;
276-
};
277-
}
278-
279259
export interface LIBatchFinderResponse extends AxiosResponse {
280260
data: {
281261
/** An array of finder search results in the same order as the array of search criteria provided to the batch finder. */
@@ -449,7 +429,7 @@ export class RestliClient {
449429
queryParams = {},
450430
versionString = null,
451431
additionalConfig = {}
452-
}: LIGetAllRequestOptions): Promise<LIGetAllResponse> {
432+
}: LIGetAllRequestOptions): Promise<LICollectionResponse> {
453433
const urlPath = buildRestliUrl(resourcePath, pathKeys, versionString);
454434
const encodedQueryParamString = encodeQueryParamsForGetRequests(queryParams);
455435

@@ -497,7 +477,7 @@ export class RestliClient {
497477
versionString = null,
498478
accessToken,
499479
additionalConfig = {}
500-
}: LIFinderRequestOptions): Promise<LIFinderResponse> {
480+
}: LIFinderRequestOptions): Promise<LICollectionResponse> {
501481
const urlPath = buildRestliUrl(resourcePath, pathKeys, versionString);
502482
const encodedQueryParamString = encodeQueryParamsForGetRequests({
503483
q: finderName,
@@ -793,7 +773,7 @@ export class RestliClient {
793773
versionString = null,
794774
accessToken,
795775
additionalConfig = {}
796-
}: LIBatchPartialUpdateRequestOptions): Promise<LIBatchPartialUpdateResponse> {
776+
}: LIBatchPartialUpdateRequestOptions): Promise<LIBatchUpdateResponse> {
797777
const urlPath = buildRestliUrl(resourcePath, pathKeys, versionString);
798778

799779
if (patchSetObjects) {

0 commit comments

Comments
 (0)