Skip to content

Commit

Permalink
feat: type for batch request for odata 4.01
Browse files Browse the repository at this point in the history
  • Loading branch information
Soontao committed Aug 9, 2020
1 parent ba538c1 commit 88e5bf2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/builder/batch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// https://docs.oasis-open.org/odata/odata-json-format/v4.01/odata-json-format-v4.01.html#_Toc38457781
// support json format for batch request

export interface JsonBatchBundle {
requests: JsonBatchRequest[];
}

export type JsonBatchMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'

export type JsonBatchHeaders = Record<string, string>

export interface JsonBatchRequest<T = any> {
id: string;
method: JsonBatchMethod;
url: string;
atomicityGroup?: string;
dependsOn?: string[];
headers?: JsonBatchHeaders;
body?: T;
}

3 changes: 3 additions & 0 deletions src/builder/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { createRequireFromPath } from 'module';

export * from './filter';
export * from './param';
export * from './types';
export * from './batch';

0 comments on commit 88e5bf2

Please sign in to comment.