We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
You can continue the conversation there. Go to discussion →
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
I don't see any example on documentation to convert the response body to type T. I just need the response body as Array<Jobs> instead string.
T
Array<Jobs>
I tried this
const response: Array<Jobs> = await this._agentyApi(url, { method: "GET" });
and this
const response: = await this._agentyApi<Array<Jobs>>(url, { method: "GET" });
But none of these supported
Here is full code
import got, { GotOptions } from "got"; import { Jobs } from "../models/jobs"; export class ApiService { _agentyApi: got.GotInstance; constructor() { this._agentyApi = got.extend({ baseUrl: process.env.API_URL, throwHttpErrors: false, json: true, headers: { "Content-Type": "application/json;charset=UTF-8", }, }); } async getJobsAsync(): Promise<Array<Jobs>> { const url = "/queue"; const response = await this._agentyApi<Array<Jobs>>(url, { method: "GET" }); return response } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I don't see any example on documentation to convert the response body to type
T
. I just need the response body asArray<Jobs>
instead string.I tried this
and this
But none of these supported
Here is full code
Checklist
The text was updated successfully, but these errors were encountered: