[Feature Reqest] Add `body` params for API calls
I'd love to find a way to populate the body of requests too for each endpoint in the routes directory. The way this would look would be by modifying the empty "body": {} to something like this:
"body": {
"mimeType": "application/json",
"text": "{\n\t\"ignored\": false\n}"
},
Here would be an example of the full object for one of the calls.
{
"parentId": "__FLD_2__",
"_id": "__REQ_17__",
"_type": "request",
"name": "Set a thread subscription",
"description": "This lets you subscribe or unsubscribe from a conversation.\n\nhttps://developer.github.com/v3/activity/notifications/#set-a-thread-subscription",
"headers": [],
"authentication": {
"token": "{{ github_token }}",
"type": "bearer"
},
"method": "PUT",
"url": "{{ github_api_root }}/notifications/threads/{{ thread_id }}/subscription",
"body": {
"mimeType": "application/json",
"text": "{\n\t\"ignored\": false\n}"
},
"parameters": []
},
I spent about 30 minutes doing this by hand and it was not a fun process. We may want to consider programmatically getting this information in there somehow (I'm sure some fancy sed/awk can help).
Then I realized you used the Octokit Routes so I think we would need to update something in Index.js to pull the body tag out instead of just populating it with an empty body as we do here
This would be a great addition.
The change to include a body would go here, approximately:
https://github.com/swinton/github-rest-apis-for-insomnia/blob/31387a1ebefde9897175494b1bed7ffcb6cf7bec/index.js#L64
However, I don't think @octokit/routes includes the request bodies, so this would be quite difficult to implement.
#7 should be easier @IAmHughes, since params are defined in @octokit/routes.
I was just going to say that may be the better route, closing in favor of #7 so we can leverage the params:
This might be worth revisiting now that @octokit/routes supports the OpenAPI spec, which specifies a requestBody object.
Here's an example requestBody, for the POST /app/installations/:installation_id/access_tokens route, note there is an example property that we could use:
{
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"repository_ids": {
"type": "array",
"description": "The `id`s of the repositories that the installation token can access. Providing repository `id`s restricts the access of an installation token to specific repositories. You can use the \"[List repositories](https://developer.github.com/v3/apps/installations/#list-repositories)\" endpoint to get the `id` of all repositories that an installation can access. For example, you can select specific repositories when creating an installation token to restrict the number of repositories that can be cloned using the token.",
"items": {
"type": "integer"
}
},
"permissions": {
"type": "object",
"description": "The permissions granted to the access token. The permissions object includes the permission names and their access type. For a complete list of permissions and allowable values, see \"[GitHub App permissions](https://developer.github.com/apps/building-github-apps/creating-github-apps-using-url-parameters/#github-app-permissions).\"",
"properties": {}
}
}
},
"example": {
"repository_ids": [
1296269
],
"permissions": {
"issues": "write",
"contents": "read"
}
}
}
}
}