@@ -83,33 +83,36 @@ export class HttpService {
8383 * @param method - HTTP method
8484 * @param path - API path after /v0/
8585 * @param body - Optional request body
86- * @param query - Optional query params
86+ * @param options - Optional parameters for selecting records.
8787 * @returns Promise<T>
8888 */
8989 private _request < T > (
9090 method : 'GET' | 'POST' | 'PATCH' | 'DELETE' ,
9191 path : string ,
9292 body ?: unknown ,
93- query ?: Record < string , any >
93+ options ?: SelectOptions
9494 ) : Promise < T > {
9595 return new Promise < T > ( ( resolve , reject ) => {
9696 const baseUrl = 'https://api.airtable.com/v0/' ;
9797 const url = new URL ( baseUrl + path ) ;
98- if ( query && method === 'GET' ) {
99- Object . entries ( query ) . forEach ( ( [ k , v ] ) => {
98+
99+ if ( options && method === 'GET' ) {
100+ Object . entries ( options ) . forEach ( ( [ k , v ] ) => {
100101 if ( v !== undefined && v !== null ) url . searchParams . append ( k , String ( v ) ) ;
101102 } ) ;
102103 }
104+
103105 const headers : Record < string , string > = {
104106 Authorization : this . getToken ( ) ,
105107 'Content-Type' : 'application/json' ,
106108 } ;
107- const options = {
109+
110+ const reqOptions = {
108111 method,
109112 headers,
110113 } ;
111114
112- const req = httpsRequest ( url , options , ( res ) => {
115+ const req = httpsRequest ( url , reqOptions , ( res ) => {
113116 let data = '' ;
114117 res . on ( 'data' , ( chunk ) => ( data += chunk ) ) ;
115118 res . on ( 'end' , ( ) => {
0 commit comments