Skip to content
This repository was archived by the owner on Feb 7, 2020. It is now read-only.

Commit d17a7dc

Browse files
committed
refactor: update JSDoc to document TypeScript type arguments
See https://www.typescriptlang.org/docs/handbook/generics.html for more info
1 parent 1ea9dae commit d17a7dc

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

projects/ngx-simple-http/src/lib/simple-http.service.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import { Observable } from 'rxjs';
77
export class SimpleHttpService {
88
constructor(private http: HttpClient) { }
99
/**
10-
* Generates the query parameters to be used for a HTTP DELETE request
10+
* Constructs and sends a HTTP DELETE request
1111
* @param apiEndpoint The API endpoint
1212
* @param apiParams Parameters to append to the API endpoint
1313
* @param apiHeaders HTTP headers to append to the request
14+
* @template P A TypeScript interface to type the HTTP request's parameters to
15+
* @template R A TypeScript interface to type the HTTP request's response to
1416
* @return A `HttpClient` instance
1517
*/
1618
createHttpDelete<P extends any, R extends any>(apiEndpoint: string, apiParams: P, apiHeaders: HttpHeaders = null): Observable<R> {
@@ -38,10 +40,12 @@ export class SimpleHttpService {
3840
}
3941
}
4042
/**
41-
* Generates the query parameters to be used for a HTTP GET request
43+
* Constructs and sends a HTTP GET request
4244
* @param apiEndpoint The API endpoint
4345
* @param apiParams Parameters to append to the API endpoint
4446
* @param apiHeaders HTTP headers to append to the request
47+
* @template P A TypeScript interface to type the HTTP request's parameters to
48+
* @template R A TypeScript interface to type the HTTP request's response to
4549
* @return A `HttpClient` instance
4650
*/
4751
createHttpGet<P extends any, R extends any>(apiEndpoint: string, apiParams: P, apiHeaders: HttpHeaders = null): Observable<R> {
@@ -69,11 +73,14 @@ export class SimpleHttpService {
6973
}
7074
}
7175
/**
72-
* Generates the query parameters to be used with the API endpoint
76+
* Constructs and sends a HTTP POST request
7377
* @param apiEndpoint The API endpoint
7478
* @param apiParams Parameters to append to the API endpoint
7579
* @param apiBody The request body
7680
* @param apiHeaders HTTP headers to append to the request
81+
* @template B A TypeScript interface to type the HTTP request's body to
82+
* @template P A TypeScript interface to type the HTTP request's parameters to
83+
* @template R A TypeScript interface to type the HTTP request's response to
7784
* @return A `HttpClient` instance
7885
*/
7986
createHttpPost<
@@ -126,11 +133,14 @@ export class SimpleHttpService {
126133
}
127134
}
128135
/**
129-
* Generates the query parameters to be used with the API endpoint
136+
* Constructs and sends a HTTP PUT request
130137
* @param apiEndpoint The API endpoint
131138
* @param apiParams Parameters to append to the API endpoint
132139
* @param apiBody The request body
133140
* @param apiHeaders HTTP headers to append to the request
141+
* @template B A TypeScript interface to type the HTTP request's body to
142+
* @template P A TypeScript interface to type the HTTP request's parameters to
143+
* @template R A TypeScript interface to type the HTTP request's response to
134144
* @return A `HttpClient` instance
135145
*/
136146
createHttpPut<

0 commit comments

Comments
 (0)