Skip to content

Commit

Permalink
Merge pull request #728 from google/dvanderb-update-batch-docs
Browse files Browse the repository at this point in the history
Update batch documentation
  • Loading branch information
dvanderb committed Apr 6, 2021
2 parents 2370756 + 52fa020 commit e296cd6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 149 deletions.
23 changes: 11 additions & 12 deletions docs/batch.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ The JavaScript client library supports batching HTTP requests to make multiple A
The JavaScript client library defines an object called `Batch`. You can start by instantiating this object:

```js
var batch = gapi.client.newBatch();
const batch = gapi.client.newBatch();
```

## Adding requests to the batch

Use the `Batch` object's [`add`](reference.md#----gapiclientbatchaddrequestopt_params--) method to add individual HTTP requests. The `add` method supports one optional parameter:
Use the `Batch` object's [`add`](reference.md#----gapiclientbatchaddrequestopt_params--) method to add individual HTTP requests. Only requests created via [discovery](discovery.md) should be added to a batch. The `add` method supports one optional parameter:

<table>
<colgroup>
Expand Down Expand Up @@ -49,19 +49,18 @@ Use the `Batch` object's [`add`](reference.md#----gapiclientbatchaddrequestopt_p
Example:

```js
var searchRequest = function(name) {
return gapi.client.request({
'path': 'plus/v1/people',
'params': {'query': name}
});
};
var searchAlvin = searchRequest('Alvin');
var searchSimon = searchRequest('Simon');
const getMe = gapi.client.people.people.get({
'resourceName': 'people/me'
});

const getYou = gapi.client.people.people.get({
'resourceName': 'people/you'
});

// Adding just the request
batch.add(searchAlvin);
batch.add(getMe);
// Adding the request with an ID
batch.add(searchSimon, {'id': 'searchSimon'});
batch.add(getYou, {'id': 'getYou'});
```

## Executing a batch
Expand Down
137 changes: 0 additions & 137 deletions samples/httpBatch.html

This file was deleted.

1 comment on commit e296cd6

@jhoneDoe993
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Credit card need

Please sign in to comment.