Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Commit

Permalink
Release v0.0.32
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Sep 4, 2023
1 parent 6931cb7 commit 545bc11
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 225 deletions.
6 changes: 3 additions & 3 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestNewClient(t *testing.T) {

t.Run("base url", func(t *testing.T) {
c := NewClient(
ClientWithBaseURL("test.co"),
WithBaseURL("test.co"),
)
assert.Equal(t, "test.co", c.baseURL)
assert.Equal(t, http.DefaultClient, c.httpClient)
Expand All @@ -28,7 +28,7 @@ func TestNewClient(t *testing.T) {
Timeout: 5 * time.Second,
}
c := NewClient(
ClientWithHTTPClient(httpClient),
WithHTTPClient(httpClient),
)
assert.Empty(t, c.baseURL)
assert.Equal(t, httpClient, c.httpClient)
Expand All @@ -38,7 +38,7 @@ func TestNewClient(t *testing.T) {
header := make(http.Header)
header.Set("X-API-Tenancy", "test")
c := NewClient(
ClientWithHTTPHeader(header),
WithHTTPHeader(header),
)
assert.Empty(t, c.baseURL)
assert.Equal(t, http.DefaultClient, c.httpClient)
Expand Down
16 changes: 8 additions & 8 deletions client/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@ import (
http "net/http"
)

// ClientWithBaseURL sets the client's base URL, overriding the
// WithBaseURL sets the client's base URL, overriding the
// default environment, if any.
func ClientWithBaseURL(baseURL string) core.ClientOption {
func WithBaseURL(baseURL string) core.ClientOption {
return func(opts *core.ClientOptions) {
opts.BaseURL = baseURL
}
}

// ClientWithHTTPClient uses the given HTTPClient to issue all HTTP requests.
func ClientWithHTTPClient(httpClient core.HTTPClient) core.ClientOption {
// WithHTTPClient uses the given HTTPClient to issue all HTTP requests.
func WithHTTPClient(httpClient core.HTTPClient) core.ClientOption {
return func(opts *core.ClientOptions) {
opts.HTTPClient = httpClient
}
}

// ClientWithHTTPHeader adds the given http.Header to all requests
// WithHTTPHeader adds the given http.Header to all requests
// issued by the client.
func ClientWithHTTPHeader(httpHeader http.Header) core.ClientOption {
func WithHTTPHeader(httpHeader http.Header) core.ClientOption {
return func(opts *core.ClientOptions) {
// Clone the headers so they can't be modified after the option call.
opts.HTTPHeader = httpHeader.Clone()
}
}

// ClientWithAuthToken sets the 'Authorization: Bearer <token>' header on every request.
func ClientWithAuthToken(token string) core.ClientOption {
// WithAuthToken sets the 'Authorization: Bearer <token>' header on every request.
func WithAuthToken(token string) core.ClientOption {
return func(opts *core.ClientOptions) {
opts.Token = token
}
Expand Down
8 changes: 4 additions & 4 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type ConnectionCreateRequest struct {
Destination *core.Optional[ConnectionCreateRequestDestination] `json:"destination,omitempty"`
// Source input object
Source *core.Optional[ConnectionCreateRequestSource] `json:"source,omitempty"`
Rules []*Rule `json:"rules,omitempty"`
Rules *core.Optional[[]*Rule] `json:"rules,omitempty"`
}

type ConnectionListRequest struct {
Expand All @@ -43,8 +43,8 @@ type ConnectionUpdateRequest struct {
// <span style="white-space: nowrap">`<= 155 characters`</span>
Name *core.Optional[string] `json:"name,omitempty"`
// Description for the connection
Description *core.Optional[string] `json:"description,omitempty"`
Rules []*Rule `json:"rules,omitempty"`
Description *core.Optional[string] `json:"description,omitempty"`
Rules *core.Optional[[]*Rule] `json:"rules,omitempty"`
}

type ConnectionUpsertRequest struct {
Expand All @@ -60,5 +60,5 @@ type ConnectionUpsertRequest struct {
Destination *core.Optional[ConnectionUpsertRequestDestination] `json:"destination,omitempty"`
// Source input object
Source *core.Optional[ConnectionUpsertRequestSource] `json:"source,omitempty"`
Rules []*Rule `json:"rules,omitempty"`
Rules *core.Optional[[]*Rule] `json:"rules,omitempty"`
}
2 changes: 1 addition & 1 deletion core/client_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ func (c *ClientOptions) cloneHeader() http.Header {
headers := c.HTTPHeader.Clone()
headers.Set("X-Fern-Language", "Go")
headers.Set("X-Fern-SDK-Name", "github.com/hookdeck/hookdeck-go-sdk")
headers.Set("X-Fern-SDK-Version", "0.0.30")
headers.Set("X-Fern-SDK-Version", "0.0.32")
return headers
}
4 changes: 2 additions & 2 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func DoRequest(
client HTTPClient,
url string,
method string,
request any,
response any,
request interface{},
response interface{},
responseIsOptional bool,
endpointHeaders http.Header,
errorDecoder ErrorDecoder,
Expand Down
2 changes: 1 addition & 1 deletion environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package api

// Environments defines all of the API environments.
// These values can be used with the ClientWithBaseURL
// These values can be used with the WithBaseURL
// ClientOption to override the client's default environment,
// if any.
var Environments = struct {
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/hookdeck/hookdeck-go-sdk

go 1.19
go 1.18

require github.com/stretchr/testify v1.8.4
require github.com/stretchr/testify v1.7.0

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
13 changes: 7 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type NotificationUpdateRequest struct {
// Enable or disable webhook notifications on the workspace
Enabled *core.Optional[bool] `json:"enabled,omitempty"`
// List of topics to send notifications for
Topics []TopicsValue `json:"topics,omitempty"`
Topics *core.Optional[[]TopicsValue] `json:"topics,omitempty"`
// The Hookdeck Source to send the webhook to
SourceId *core.Optional[string] `json:"source_id,omitempty"`
}
8 changes: 4 additions & 4 deletions transformation.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type TransformationCreateRequest struct {
// JavaScript code to be executed as string
Code string `json:"code"`
// Key-value environment variables to be passed to the transformation
Env map[string]*TransformationCreateRequestEnvValue `json:"env,omitempty"`
Env *core.Optional[map[string]string] `json:"env,omitempty"`
}

type TransformationListRequest struct {
Expand All @@ -40,7 +40,7 @@ type TransformationListExecutionRequest struct {

type TransformationRunRequest struct {
// Key-value environment variables to be passed to the transformation
Env *core.Optional[TransformationRunRequestEnv] `json:"env,omitempty"`
Env *core.Optional[map[string]string] `json:"env,omitempty"`
// ID of the connection to use for the execution `context`
WebhookId *core.Optional[string] `json:"webhook_id,omitempty"`
// JavaScript code to be executed
Expand All @@ -58,7 +58,7 @@ type TransformationUpdateRequest struct {
// JavaScript code to be executed
Code *core.Optional[string] `json:"code,omitempty"`
// Key-value environment variables to be passed to the transformation
Env map[string]*TransformationUpdateRequestEnvValue `json:"env,omitempty"`
Env *core.Optional[map[string]string] `json:"env,omitempty"`
}

type TransformationUpsertRequest struct {
Expand All @@ -67,5 +67,5 @@ type TransformationUpsertRequest struct {
// JavaScript code to be executed as string
Code string `json:"code"`
// Key-value environment variables to be passed to the transformation
Env map[string]*TransformationUpsertRequestEnvValue `json:"env,omitempty"`
Env *core.Optional[map[string]string] `json:"env,omitempty"`
}
Loading

0 comments on commit 545bc11

Please sign in to comment.