Skip to content

Commit 9deea3e

Browse files
committed
Move SvixHttpClient to internal package
This is done in preparation for the new internal API client
1 parent d4d7da2 commit 9deea3e

26 files changed

+308
-380
lines changed

Diff for: go/application.go

+15-14
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ package svix
44
import (
55
"context"
66

7+
"github.com/svix/svix-webhooks/go/internal"
78
"github.com/svix/svix-webhooks/go/models"
89
)
910

1011
type Application struct {
11-
client *SvixHttpClient
12+
client *internal.SvixHttpClient
1213
}
1314

14-
func newApplication(client *SvixHttpClient) *Application {
15+
func newApplication(client *internal.SvixHttpClient) *Application {
1516
return &Application{
1617
client: client,
1718
}
@@ -39,14 +40,14 @@ func (application *Application) List(
3940
queryMap := map[string]string{}
4041
var err error
4142
if o != nil {
42-
serializeParamToMap("limit", o.Limit, queryMap, &err)
43-
serializeParamToMap("iterator", o.Iterator, queryMap, &err)
44-
serializeParamToMap("order", o.Order, queryMap, &err)
43+
internal.SerializeParamToMap("limit", o.Limit, queryMap, &err)
44+
internal.SerializeParamToMap("iterator", o.Iterator, queryMap, &err)
45+
internal.SerializeParamToMap("order", o.Order, queryMap, &err)
4546
if err != nil {
4647
return nil, err
4748
}
4849
}
49-
return executeRequest[any, models.ListResponseApplicationOut](
50+
return internal.ExecuteRequest[any, models.ListResponseApplicationOut](
5051
ctx,
5152
application.client,
5253
"GET",
@@ -70,12 +71,12 @@ func (application *Application) Create(
7071
headerMap := map[string]string{}
7172
var err error
7273
if o != nil {
73-
serializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
74+
internal.SerializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
7475
if err != nil {
7576
return nil, err
7677
}
7778
}
78-
return executeRequest[models.ApplicationIn, models.ApplicationOut](
79+
return internal.ExecuteRequest[models.ApplicationIn, models.ApplicationOut](
7980
ctx,
8081
application.client,
8182
"POST",
@@ -100,13 +101,13 @@ func (application *Application) GetOrCreate(
100101

101102
var err error
102103
if o != nil {
103-
serializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
104+
internal.SerializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
104105
if err != nil {
105106
return nil, err
106107
}
107108
}
108109

109-
return executeRequest[models.ApplicationIn, models.ApplicationOut](
110+
return internal.ExecuteRequest[models.ApplicationIn, models.ApplicationOut](
110111
ctx,
111112
application.client,
112113
"POST",
@@ -126,7 +127,7 @@ func (application *Application) Get(
126127
pathMap := map[string]string{
127128
"app_id": appId,
128129
}
129-
return executeRequest[any, models.ApplicationOut](
130+
return internal.ExecuteRequest[any, models.ApplicationOut](
130131
ctx,
131132
application.client,
132133
"GET",
@@ -147,7 +148,7 @@ func (application *Application) Update(
147148
pathMap := map[string]string{
148149
"app_id": appId,
149150
}
150-
return executeRequest[models.ApplicationIn, models.ApplicationOut](
151+
return internal.ExecuteRequest[models.ApplicationIn, models.ApplicationOut](
151152
ctx,
152153
application.client,
153154
"PUT",
@@ -167,7 +168,7 @@ func (application *Application) Delete(
167168
pathMap := map[string]string{
168169
"app_id": appId,
169170
}
170-
_, err := executeRequest[any, any](
171+
_, err := internal.ExecuteRequest[any, any](
171172
ctx,
172173
application.client,
173174
"DELETE",
@@ -189,7 +190,7 @@ func (application *Application) Patch(
189190
pathMap := map[string]string{
190191
"app_id": appId,
191192
}
192-
return executeRequest[models.ApplicationPatch, models.ApplicationOut](
193+
return internal.ExecuteRequest[models.ApplicationPatch, models.ApplicationOut](
193194
ctx,
194195
application.client,
195196
"PATCH",

Diff for: go/authentication.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ package svix
44
import (
55
"context"
66

7+
"github.com/svix/svix-webhooks/go/internal"
78
"github.com/svix/svix-webhooks/go/models"
89
)
910

1011
type Authentication struct {
11-
client *SvixHttpClient
12+
client *internal.SvixHttpClient
1213
}
1314

14-
func newAuthentication(client *SvixHttpClient) *Authentication {
15+
func newAuthentication(client *internal.SvixHttpClient) *Authentication {
1516
return &Authentication{
1617
client: client,
1718
}
@@ -42,12 +43,12 @@ func (authentication *Authentication) AppPortalAccess(
4243
headerMap := map[string]string{}
4344
var err error
4445
if o != nil {
45-
serializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
46+
internal.SerializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
4647
if err != nil {
4748
return nil, err
4849
}
4950
}
50-
return executeRequest[models.AppPortalAccessIn, models.AppPortalAccessOut](
51+
return internal.ExecuteRequest[models.AppPortalAccessIn, models.AppPortalAccessOut](
5152
ctx,
5253
authentication.client,
5354
"POST",
@@ -72,12 +73,12 @@ func (authentication *Authentication) ExpireAll(
7273
headerMap := map[string]string{}
7374
var err error
7475
if o != nil {
75-
serializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
76+
internal.SerializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
7677
if err != nil {
7778
return err
7879
}
7980
}
80-
_, err = executeRequest[models.ApplicationTokenExpireIn, any](
81+
_, err = internal.ExecuteRequest[models.ApplicationTokenExpireIn, any](
8182
ctx,
8283
authentication.client,
8384
"POST",
@@ -102,12 +103,12 @@ func (authentication *Authentication) DashboardAccess(
102103
headerMap := map[string]string{}
103104
var err error
104105
if o != nil {
105-
serializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
106+
internal.SerializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
106107
if err != nil {
107108
return nil, err
108109
}
109110
}
110-
return executeRequest[any, models.DashboardAccessOut](
111+
return internal.ExecuteRequest[any, models.DashboardAccessOut](
111112
ctx,
112113
authentication.client,
113114
"POST",
@@ -129,12 +130,12 @@ func (authentication *Authentication) Logout(
129130
headerMap := map[string]string{}
130131
var err error
131132
if o != nil {
132-
serializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
133+
internal.SerializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
133134
if err != nil {
134135
return err
135136
}
136137
}
137-
_, err = executeRequest[any, any](
138+
_, err = internal.ExecuteRequest[any, any](
138139
ctx,
139140
authentication.client,
140141
"POST",

Diff for: go/background_task.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ package svix
44
import (
55
"context"
66

7+
"github.com/svix/svix-webhooks/go/internal"
78
"github.com/svix/svix-webhooks/go/models"
89
)
910

1011
type BackgroundTask struct {
11-
client *SvixHttpClient
12+
client *internal.SvixHttpClient
1213
}
1314

14-
func newBackgroundTask(client *SvixHttpClient) *BackgroundTask {
15+
func newBackgroundTask(client *internal.SvixHttpClient) *BackgroundTask {
1516
return &BackgroundTask{
1617
client: client,
1718
}
@@ -41,16 +42,16 @@ func (backgroundTask *BackgroundTask) List(
4142
queryMap := map[string]string{}
4243
var err error
4344
if o != nil {
44-
serializeParamToMap("status", o.Status, queryMap, &err)
45-
serializeParamToMap("task", o.Task, queryMap, &err)
46-
serializeParamToMap("limit", o.Limit, queryMap, &err)
47-
serializeParamToMap("iterator", o.Iterator, queryMap, &err)
48-
serializeParamToMap("order", o.Order, queryMap, &err)
45+
internal.SerializeParamToMap("status", o.Status, queryMap, &err)
46+
internal.SerializeParamToMap("task", o.Task, queryMap, &err)
47+
internal.SerializeParamToMap("limit", o.Limit, queryMap, &err)
48+
internal.SerializeParamToMap("iterator", o.Iterator, queryMap, &err)
49+
internal.SerializeParamToMap("order", o.Order, queryMap, &err)
4950
if err != nil {
5051
return nil, err
5152
}
5253
}
53-
return executeRequest[any, models.ListResponseBackgroundTaskOut](
54+
return internal.ExecuteRequest[any, models.ListResponseBackgroundTaskOut](
5455
ctx,
5556
backgroundTask.client,
5657
"GET",
@@ -70,7 +71,7 @@ func (backgroundTask *BackgroundTask) Get(
7071
pathMap := map[string]string{
7172
"task_id": taskId,
7273
}
73-
return executeRequest[any, models.BackgroundTaskOut](
74+
return internal.ExecuteRequest[any, models.BackgroundTaskOut](
7475
ctx,
7576
backgroundTask.client,
7677
"GET",

0 commit comments

Comments
 (0)