Skip to content

Commit

Permalink
fix: use requestBody instead of resource (#1149)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed May 8, 2018
1 parent f9c9c3a commit 9afb5b5
Show file tree
Hide file tree
Showing 197 changed files with 7,241 additions and 3,630 deletions.
11 changes: 6 additions & 5 deletions README.md
Expand Up @@ -266,12 +266,12 @@ See the [Options section][options] for more information.

### Specifying request body

The body of the request is specified in the `resource` parameter object of the request. The resource/body is specified as a JavaScript object with key/value pairs. For example, this sample creates a watcher that posts notifications to a Google Cloud Pub/Sub topic when emails are sent to a gmail account:
The body of the request is specified in the `requestBody` parameter object of the request. The body is specified as a JavaScript object with key/value pairs. For example, this sample creates a watcher that posts notifications to a Google Cloud Pub/Sub topic when emails are sent to a gmail account:

```js
const res = await gmail.users.watch({
userId: 'me',
resource: {
requestBody: {
// Replace with `projects/${PROJECT_ID}/topics/${TOPIC_NAME}`
topicName: `projects/el-gato/topics/gmail`
}
Expand All @@ -280,7 +280,7 @@ console.log(res.data);
```

### Media uploads
This client supports multipart media uploads. The resource parameters are specified in the `resource` parameter object, and the media itself is specified in the `media.body` parameter with mime-type specified in `media.mimeType`.
This client supports multipart media uploads. The resource parameters are specified in the `requestBody` parameter object, and the media itself is specified in the `media.body` parameter with mime-type specified in `media.mimeType`.

This example uploads a plain text file to Google Drive with the title "Test" and contents "Hello World".

Expand All @@ -291,7 +291,7 @@ const drive = google.drive({
});

const res = await drive.files.create({
resource: {
requestBody: {
name: 'Test',
mimeType: 'text/plain'
},
Expand All @@ -314,7 +314,7 @@ const drive = google.drive({

async function main() {
const res = await drive.files.create({
resource: {
requestBody: {
name: 'testimage.png',
mimeType: 'image/png'
},
Expand Down Expand Up @@ -487,6 +487,7 @@ We love contributions! Before submitting a Pull Request, it's always good to sta
* Ask your development related questions on [Stackoverflow][stackoverflow].
* If you've found an bug/issue, please [file it on GitHub][bugs].


[snyk-image]: https://snyk.io/test/github/google/google-api-nodejs-client/badge.svg
[snyk-url]: https://snyk.io/test/github/google/google-api-nodejs-client
[david-image]: https://david-dm.org/google/google-api-nodejs-client.svg
Expand Down

0 comments on commit 9afb5b5

Please sign in to comment.