Skip to content

wong2/batchexecute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

batchexecute

TypeScript package to ease interactions with Google's batchexecute batch RPC system. It assists in preparing requests for it and decoding responses returned from it. Ported from pybatchexecute.

Usage

import { preparedBatchExecute, parseBatchExecuteResponse } from 'batchexecute'

// prepare a request
const encoded = preparedBatchExecute({
  host: 'example.com',
  app: 'example',
  rpcs: [
    { id: 'rpc1id', args: ['some', 'args'] },
    { id: 'rpc2id', args: ['some', 'args'] },
  ]
})

// make the request
const resp = await fetch(encoded.url, {
  method: 'POST',
  headers: encoded.headers,
  body: encoded.body,
})

const raw = await resp.text()

// parse the response
const results = parseBatchExecuteResponse(raw)

About

TypeScript package to ease interactions with Google's batchexecute batch RPC system

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published