diff --git a/src/builder/batch.ts b/src/builder/batch.ts new file mode 100644 index 0000000..1de65bb --- /dev/null +++ b/src/builder/batch.ts @@ -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 + +export interface JsonBatchRequest { + id: string; + method: JsonBatchMethod; + url: string; + atomicityGroup?: string; + dependsOn?: string[]; + headers?: JsonBatchHeaders; + body?: T; +} + diff --git a/src/builder/index.ts b/src/builder/index.ts index 57d6092..7271967 100644 --- a/src/builder/index.ts +++ b/src/builder/index.ts @@ -1,3 +1,6 @@ +import { createRequireFromPath } from 'module'; + export * from './filter'; export * from './param'; export * from './types'; +export * from './batch';