Skip to content

Commit

Permalink
Release v0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed May 7, 2024
1 parent 710d61d commit 347fd0e
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 144 deletions.
7 changes: 7 additions & 0 deletions connection/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@ func (c *Client) Retrieve(ctx context.Context, id string) (*hookdeckgosdk.Connec
return apiError
}
return value
case 410:
value := new(hookdeckgosdk.GoneError)
value.APIError = apiError
if err := decoder.Decode(value); err != nil {
return apiError
}
return value
}
return apiError
}
Expand Down
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", "v0.2.0")
headers.Set("X-Fern-SDK-Version", "v0.2.1")
return headers
}
7 changes: 7 additions & 0 deletions destination/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ func (c *Client) Retrieve(ctx context.Context, id string) (*hookdeckgosdk.Destin
return apiError
}
return value
case 410:
value := new(hookdeckgosdk.GoneError)
value.APIError = apiError
if err := decoder.Decode(value); err != nil {
return apiError
}
return value
}
return apiError
}
Expand Down
27 changes: 27 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
core "github.com/hookdeck/hookdeck-go-sdk/core"
)

// Bad Request
type BadRequestError struct {
*core.APIError
Body *ApiErrorResponse
Expand All @@ -30,6 +31,31 @@ func (b *BadRequestError) Unwrap() error {
return b.APIError
}

// Gone
type GoneError struct {
*core.APIError
Body *ApiErrorResponse
}

func (g *GoneError) UnmarshalJSON(data []byte) error {
var body *ApiErrorResponse
if err := json.Unmarshal(data, &body); err != nil {
return err
}
g.StatusCode = 410
g.Body = body
return nil
}

func (g *GoneError) MarshalJSON() ([]byte, error) {
return json.Marshal(g.Body)
}

func (g *GoneError) Unwrap() error {
return g.APIError
}

// Not Found
type NotFoundError struct {
*core.APIError
Body *ApiErrorResponse
Expand All @@ -53,6 +79,7 @@ func (n *NotFoundError) Unwrap() error {
return n.APIError
}

// Unprocessable Entity
type UnprocessableEntityError struct {
*core.APIError
Body *ApiErrorResponse
Expand Down
7 changes: 7 additions & 0 deletions source/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ func (c *Client) Retrieve(ctx context.Context, id string, request *hookdeckgosdk
return apiError
}
return value
case 410:
value := new(hookdeckgosdk.GoneError)
value.APIError = apiError
if err := decoder.Decode(value); err != nil {
return apiError
}
return value
}
return apiError
}
Expand Down
Loading

0 comments on commit 347fd0e

Please sign in to comment.