Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.16.0 #133

Merged
merged 11 commits into from
Apr 1, 2024
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.15.0"
".": "0.16.0"
}
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 0.16.0 (2024-03-29)

Full Changelog: [v0.15.0...v0.16.0](https://github.com/Finch-API/finch-api-go/compare/v0.15.0...v0.16.0)

### Features

* add IsKnown method to enums ([#135](https://github.com/Finch-API/finch-api-go/issues/135)) ([a12efdc](https://github.com/Finch-API/finch-api-go/commit/a12efdce5d7ac1c4486cccfee5c2b83ed99fa279))
* **client:** implement raw requests methods on client ([#139](https://github.com/Finch-API/finch-api-go/issues/139)) ([0469fdc](https://github.com/Finch-API/finch-api-go/commit/0469fdcad5e8323a6d61419f5190624160f29318))


### Chores

* **internal:** move pagination types to pagination package ([#140](https://github.com/Finch-API/finch-api-go/issues/140)) ([b4172a5](https://github.com/Finch-API/finch-api-go/commit/b4172a582939c4b111bbc947b8fd228fa6763ef6))
* **internal:** update generated pragma comment ([#134](https://github.com/Finch-API/finch-api-go/issues/134)) ([5acbf83](https://github.com/Finch-API/finch-api-go/commit/5acbf8307554cc006f6a6cd6c6bdf9c2de039eae))
* revert temporary commit ([4acd051](https://github.com/Finch-API/finch-api-go/commit/4acd051a9bbc90843d33bc7f99c5035670f6573a))
* temporary commit ([46f8947](https://github.com/Finch-API/finch-api-go/commit/46f8947f7277ba5c50e91a87c485078ed32235e3))


### Documentation

* fix typo in CONTRIBUTING.md ([#132](https://github.com/Finch-API/finch-api-go/issues/132)) ([dd445c7](https://github.com/Finch-API/finch-api-go/commit/dd445c72799beab386d9e5e5055381ea0bcfa184))
* fix typo in docstring for Null() ([#138](https://github.com/Finch-API/finch-api-go/issues/138)) ([da24dc4](https://github.com/Finch-API/finch-api-go/commit/da24dc425772a4ba905931de5bc231d8e90665fa))
* **readme:** consistent use of sentence case in headings ([#136](https://github.com/Finch-API/finch-api-go/issues/136)) ([2c2438f](https://github.com/Finch-API/finch-api-go/commit/2c2438ffd87570117e560da4dd4410c5c1cccc5b))
* **readme:** document file uploads ([#137](https://github.com/Finch-API/finch-api-go/issues/137)) ([4fea46d](https://github.com/Finch-API/finch-api-go/commit/4fea46dd3dd728c5ef594a3af2faeea248d3cbbf))

## 0.15.0 (2024-03-13)

Full Changelog: [v0.14.3...v0.15.0](https://github.com/Finch-API/finch-api-go/compare/v0.14.3...v0.15.0)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Most tests require you to [set up a mock server](https://github.com/stoplightio/

```bash
# you will need npm installed
npx prism path/to/your/openapi.yml
npx prism mock path/to/your/openapi.yml
```

```bash
Expand Down
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/Finch-API/finch-api-go@v0.15.0'
go get -u 'github.com/Finch-API/finch-api-go@v0.16.0'
```

<!-- x-release-please-end -->
Expand Down Expand Up @@ -59,7 +59,7 @@ func main() {

```

### Request Fields
### Request fields

All request parameters are wrapped in a generic `Field` type,
which we use to distinguish zero values from null or omitted fields.
Expand Down Expand Up @@ -89,7 +89,7 @@ params := FooParams{
}
```

### Response Objects
### Response objects

All fields in response structs are value types (not pointers or wrappers).

Expand Down Expand Up @@ -230,6 +230,19 @@ client.HRIS.Directory.List(
)
```

### File uploads

Request parameters that correspond to file uploads in multipart requests are typed as
`param.Field[io.Reader]`. The contents of the `io.Reader` will by default be sent as a multipart form
part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing `Name() string` or `ContentType()
string` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a
file returned by `os.Open` will be sent with the file name on disk.

We also provide a helper `finchgo.FileParam(reader io.Reader, filename string, contentType string)`
which can be used to wrap any `io.Reader` with the appropriate file name and content type.

## Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
Expand Down Expand Up @@ -289,7 +302,7 @@ You may also replace the default `http.Client` with
accepted (this overwrites any previous client) and receives requests after any
middleware has been applied.

## Semantic Versioning
## Semantic versioning

This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

Expand Down
48 changes: 26 additions & 22 deletions accesstoken.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package finchgo

import (
"bytes"
"context"
"errors"
"net/http"
Expand Down Expand Up @@ -36,29 +37,32 @@ func NewAccessTokenService(opts ...option.RequestOption) (r *AccessTokenService)
func (r *AccessTokenService) New(ctx context.Context, body AccessTokenNewParams, opts ...option.RequestOption) (res *CreateAccessTokenResponse, err error) {
opts = append(r.Options[:], opts...)

opts = append(opts[:], func(rc *requestconfig.RequestConfig) error {
bodyClientID := gjson.Get(string(rc.Buffer), "client_id")
if !bodyClientID.Exists() {
if rc.ClientID == "" {
return errors.New("client_id must be provided as an argument or with the FINCH_CLIENT_ID environment variable")
opts = append(opts[:], func(rc *requestconfig.RequestConfig) (err error) {
if body, ok := rc.Body.(*bytes.Buffer); ok {
b := body.Bytes()[:]

bodyClientID := gjson.GetBytes(b, "client_id")
if !bodyClientID.Exists() {
if rc.ClientID == "" {
return errors.New("client_id must be provided as an argument or with the FINCH_CLIENT_ID environment variable")
}
b, err = sjson.SetBytes(b, "client_id", rc.ClientID)
if err != nil {
return err
}
rc.Body = bytes.NewBuffer(b)
}
updatedBody, err := sjson.Set(string(rc.Buffer), "client_id", rc.ClientID)
if err != nil {
return err
bodyClientSecret := gjson.GetBytes(b, "client_secret")
if !bodyClientSecret.Exists() {
if rc.ClientSecret == "" {
return errors.New("client_secret must be provided as an argument or with the FINCH_CLIENT_SECRET environment variable")
}
b, err = sjson.SetBytes(b, "client_secret", rc.ClientSecret)
if err != nil {
return err
}
rc.Body = bytes.NewBuffer(b)
}
rc.Buffer = []byte(updatedBody)
}

bodyClientSecret := gjson.Get(string(rc.Buffer), "client_secret")
if !bodyClientSecret.Exists() {
if rc.ClientSecret == "" {
return errors.New("client_secret must be provided as an argument or with the FINCH_CLIENT_SECRET environment variable")
}
updatedBody, err := sjson.Set(string(rc.Buffer), "client_secret", rc.ClientSecret)
if err != nil {
return err
}
rc.Buffer = []byte(updatedBody)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion accesstoken_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package finchgo_test

Expand Down
18 changes: 17 additions & 1 deletion account.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package finchgo

Expand Down Expand Up @@ -175,6 +175,14 @@ const (
IntrospectionClientTypeSandbox IntrospectionClientType = "sandbox"
)

func (r IntrospectionClientType) IsKnown() bool {
switch r {
case IntrospectionClientTypeProduction, IntrospectionClientTypeDevelopment, IntrospectionClientTypeSandbox:
return true
}
return false
}

// The type of the connection associated with the token.
//
// `provider` - connection to an external provider
Expand All @@ -186,3 +194,11 @@ const (
IntrospectionConnectionTypeProvider IntrospectionConnectionType = "provider"
IntrospectionConnectionTypeFinch IntrospectionConnectionType = "finch"
)

func (r IntrospectionConnectionType) IsKnown() bool {
switch r {
case IntrospectionConnectionTypeProvider, IntrospectionConnectionTypeFinch:
return true
}
return false
}
2 changes: 1 addition & 1 deletion account_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package finchgo_test

Expand Down
2 changes: 1 addition & 1 deletion aliases.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package finchgo

Expand Down
Loading
Loading