Skip to content

Commit daa0fb0

Browse files
committed
feat: rearrange http client method params
1 parent 0d44681 commit daa0fb0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tailflow/laravel-orion",
3-
"version": "3.1.0",
3+
"version": "3.2.0",
44
"description": "Typescript SDK for Laravel Orion",
55
"keywords": [
66
"laravel orion",

src/httpClient.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export class HttpClient {
1515
public async request<Response extends Record<string, unknown>>(
1616
url: string,
1717
method: HttpMethod,
18-
params: Record<string, unknown> | null = {},
19-
data: Record<string, unknown> = {}
18+
params?: Record<string, unknown> | null,
19+
data?: Record<string, unknown>
2020
): Promise<AxiosResponse<Response>> {
2121
const config: AxiosRequestConfig = Object.assign(Orion.getHttpClientConfig(), {
2222
baseURL: this.baseUrl,
@@ -36,25 +36,25 @@ export class HttpClient {
3636
return this.client.request<Response>(config);
3737
}
3838

39-
public async get<Response extends Record<string, unknown>>(url: string, params: Record<string, unknown>): Promise<AxiosResponse<Response>> {
39+
public async get<Response extends Record<string, unknown>>(url: string, params?: Record<string, unknown>): Promise<AxiosResponse<Response>> {
4040
return this.request<Response>(
4141
url, HttpMethod.GET, params
4242
)
4343
}
4444

45-
public async post<Response extends Record<string, unknown>>(url: string, params: Record<string, unknown>, data: Record<string, unknown>): Promise<AxiosResponse<Response>> {
45+
public async post<Response extends Record<string, unknown>>(url: string, data: Record<string, unknown>, params?: Record<string, unknown>,): Promise<AxiosResponse<Response>> {
4646
return this.request<Response>(
4747
url, HttpMethod.POST, params, data
4848
)
4949
}
5050

51-
public async patch<Response extends Record<string, unknown>>(url: string, params: Record<string, unknown>, data: Record<string, unknown>): Promise<AxiosResponse<Response>> {
51+
public async patch<Response extends Record<string, unknown>>(url: string, data: Record<string, unknown>, params?: Record<string, unknown>, ): Promise<AxiosResponse<Response>> {
5252
return this.request<Response>(
5353
url, HttpMethod.PATCH, params, data
5454
)
5555
}
5656

57-
public async delete<Response extends Record<string, unknown>>(url: string, params: Record<string, unknown>): Promise<AxiosResponse<Response>> {
57+
public async delete<Response extends Record<string, unknown>>(url: string, params?: Record<string, unknown>): Promise<AxiosResponse<Response>> {
5858
return this.request<Response>(
5959
url, HttpMethod.DELETE, params
6060
)

0 commit comments

Comments
 (0)