mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
ccd270a9fb
* feat: initial commit to export grpc entities * feat: grpc requests and protofiles in v4 export format * test(export): add grpc requests and protofiles in export tests * test(models): add isProtoFile tests
29 lines
950 B
JavaScript
29 lines
950 B
JavaScript
// @flow
|
|
import * as models from '../index';
|
|
import { isGrpcRequest, isGrpcRequestId } from './is-model';
|
|
import type { GrpcRequest } from '../grpc-request';
|
|
|
|
export function getById(requestId: string): Promise<Request | GrpcRequest | null> {
|
|
return isGrpcRequestId(requestId)
|
|
? models.grpcRequest.getById(requestId)
|
|
: models.request.getById(requestId);
|
|
}
|
|
|
|
export function remove<T>(request: T): Promise<void> {
|
|
return isGrpcRequest(request)
|
|
? models.grpcRequest.remove(request)
|
|
: models.request.remove(request);
|
|
}
|
|
|
|
export function update<T>(request: T, patch: $Shape<T> = {}): Promise<T> {
|
|
return isGrpcRequest(request)
|
|
? models.grpcRequest.update(request, patch)
|
|
: models.request.update(request, patch);
|
|
}
|
|
|
|
export function duplicate<T>(request: T, patch: $Shape<T> = {}): Promise<T> {
|
|
return isGrpcRequest(request)
|
|
? models.grpcRequest.duplicate(request, patch)
|
|
: models.request.duplicate(request, patch);
|
|
}
|