How to choose only required fields from a returned json object and to store it in the predefined RestultObject

60 views Asked by At

I am using octokit in my typescript project. when I do octokit.request(any_endpoint), it is returning the object of OctokitResponse and it has some fields that are unnecessary for me, but i have to store it in any type. Like when I retrieve all the repos and I just want repo name from the response. How to do that.
I want some similar thing to dotnet efcore select() method to select required data only. I dont know is there the pojo classes octokit is offering to store the result.

        let res: OctokitResponse<any> = await octokit.request('GET /orgs/{org}/repos', {
                org: configData.organizationName,
                type: 'all',
                headers: {
                    'X-GitHub-Api-Version': '2022-11-28'
                },
                per_page: perPage,
                page: page
            });

I want some custom type to use instead any. Let me know it Octokit is offering pojo classes to store the response directly writing instead on any.
basically I want to remove responsetype as any.
Thank you.

0

There are 0 answers