In pulls.get, getting error 'mediaType' does not exist in type 'PullsGetParams'
See original GitHub issueBug Report
Current Behavior
When trying to typescript-compile the below code, getting Argument of type '{ owner: string; repo: string; pull_number: any; mediaType: { format: string; }; }' is not assignable to parameter of type 'PullsGetParams'.
import { Application } from 'probot' // eslint-disable-line no-unused-vars
export = (app: Application) => {
app.on('pull_request.opened', async (context) => {
const issue = context.issue()
const pr = await context.github.pulls.get({
owner: issue.owner,
repo: issue.repo,
pull_number: issue.number,
mediaType: {
format: 'diff'
}
})
console.error(pr)
})
}
Expected behavior/code
Should be able to compile and run, according to docs from @octokit/rest
: https://octokit.github.io/rest.js/
Excerpt:
const { data: diff } = await octokit.pulls.get({
owner: "octokit",
repo: "rest.js",
pull_number: 123,
mediaType: {
format: "diff"
}
});
Environment
- Probot version(s): v9.5.0
- Node/npm version: node v10.16.0
- OS: macOS
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Getting not supported media type error - json - Stack Overflow
Change your Content-Type in Postman to application/json . Click on the Headers button to do so. Also you are not producing json in...
Read more >415 Unsupported Media Type - KeyCDN Support
A 415 Unsupported Media Type error occurs when the origin server refuses a particular request since the resource is in a format that...
Read more >APIKit "Unsupported media type" error - MuleSoft Help Center
This type of Error occurs when you define the MediaType or MimeType or Format for you resource to accept application/Json but while calling...
Read more >C# API Media type not supported - Error 1124
Hi Guys, Trying API for first time. I am able to do GET sheet details successfully.
Read more >Web API 415: Unsupported Media Type - Microsoft Q&A
Web API 415: Unsupported Media Type. How can I support two content types for an endpoint - application/x-www-form-urlencoded
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for taking a look! I changed the code to your suggestion:
And I’m getting the following error:
Thank you so much for the quick response and fix!