Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT]: Discriminate types based on media type #582

Open
1 task done
wolfy1339 opened this issue May 13, 2023 · 1 comment
Open
1 task done

[FEAT]: Discriminate types based on media type #582

wolfy1339 opened this issue May 13, 2023 · 1 comment
Labels
hacktoberfest Issues for participation in Hacktoberfest Status: Up for grabs Issues that are ready to be worked on by anyone Type: Feature New feature or request
Projects

Comments

@wolfy1339
Copy link
Member

Describe the need

Currently when specifying a media type format in the request options, the types always return the response for application/json

It would be nice if the returned types could be discriminated with the specified media type

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@wolfy1339 wolfy1339 added Type: Feature New feature or request Status: Triage This is being looked at and prioritized labels May 13, 2023
@ghost ghost added this to Features in JS May 13, 2023
@wolfy1339 wolfy1339 added Priority: Normal and removed Status: Triage This is being looked at and prioritized labels May 13, 2023
@wolfy1339
Copy link
Member Author

Here is an example snippet demonstrating the issue:

/** @type {import('@octokit/types').OctokitResponse<import('@octokit/openapi-types').components["schemas"]["content-tree"]>} */
// @ts-ignore Overriding the type of the response for the correct type with the `object` media type
const { data } = await octokit.request(
    'GET /repos/{owner}/{repo}/contents/{path}',
    {
      owner,
      repo,
      path: PATH,
      mediaType: {
        format: 'object'
      }
    }
);

@kfcampbell kfcampbell added the Status: Up for grabs Issues that are ready to be worked on by anyone label May 15, 2023
@nickfloyd nickfloyd added the hacktoberfest Issues for participation in Hacktoberfest label Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Issues for participation in Hacktoberfest Status: Up for grabs Issues that are ready to be worked on by anyone Type: Feature New feature or request
Projects
Status: 🔥 Backlog
JS
  
Features
Development

No branches or pull requests

3 participants