Skip to content

Commit

Permalink
Merge pull request #7 from Find-AI/release-please--branches--main--ch…
Browse files Browse the repository at this point in the history
…anges--next

release: 0.1.0-alpha.2
  • Loading branch information
philipithomas authored Sep 26, 2024
2 parents 72dd13a + f36413b commit f00c647
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 8 deletions.
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.1.0-alpha.1"
".": "0.1.0-alpha.2"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 6
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/find-ai%2Ffind-ai-f45934597cf41099fa75c9b28ddb560d912602d210d2411f861dd6973b6fd8d4.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/find-ai%2Ffind-ai-bf9b5b8a950e0a79b0bf1911bf01feb5a3575113be8f5d24f7b487351f3470c5.yml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.2 (2024-09-26)

Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/Find-AI/find-ai-go/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)

### Features

* **api:** manual updates updated ([#6](https://github.com/Find-AI/find-ai-go/issues/6)) ([fa7e2ad](https://github.com/Find-AI/find-ai-go/commit/fa7e2ad99741119fa3e867084220299659312bab))

## 0.1.0-alpha.1 (2024-09-25)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/Find-AI/find-ai-go/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/Find-AI/[email protected].1'
go get -u 'github.com/Find-AI/[email protected].2'
```

<!-- x-release-please-end -->
Expand All @@ -44,10 +44,13 @@ import (
"context"

"github.com/Find-AI/find-ai-go"
"github.com/Find-AI/find-ai-go/option"
)

func main() {
client := findai.NewClient()
client := findai.NewClient(
option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("FIND_AI_API_KEY")
)
searchGetResponses, err := client.Searches.Get(context.TODO(), "id")
if err != nil {
panic(err.Error())
Expand Down
10 changes: 7 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package findai
import (
"context"
"net/http"
"os"

"github.com/Find-AI/find-ai-go/internal/requestconfig"
"github.com/Find-AI/find-ai-go/option"
Expand All @@ -21,11 +22,14 @@ type Client struct {
}

// NewClient generates a new client with the default option read from the
// environment (). The option passed in as arguments are applied after these
// default arguments, and all option will be passed down to the services and
// requests that this client makes.
// environment (FIND_AI_API_KEY). The option passed in as arguments are applied
// after these default arguments, and all option will be passed down to the
// services and requests that this client makes.
func NewClient(opts ...option.RequestOption) (r *Client) {
defaults := []option.RequestOption{option.WithEnvironmentProduction()}
if o, ok := os.LookupEnv("FIND_AI_API_KEY"); ok {
defaults = append(defaults, option.WithAPIKey(o))
}
opts = append(defaults, opts...)

r = &Client{Options: opts}
Expand Down
2 changes: 2 additions & 0 deletions companyenrichmentenrich_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestCompanyEnrichmentEnrichNewWithOptionalParams(t *testing.T) {
}
client := findai.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.CompanyEnrichment.Enrich.New(context.TODO(), findai.CompanyEnrichmentEnrichNewParams{
Domain: findai.F("domain"),
Expand All @@ -46,6 +47,7 @@ func TestCompanyEnrichmentEnrichGet(t *testing.T) {
}
client := findai.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.CompanyEnrichment.Enrich.Get(context.TODO(), "token")
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions internal/requestconfig/requestconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ type RequestConfig struct {
BaseURL *url.URL
HTTPClient *http.Client
Middlewares []middleware
APIKey string
// If ResponseBodyInto not nil, then we will attempt to deserialize into
// ResponseBodyInto. If Destination is a []byte, then it will return the body as
// is.
Expand Down Expand Up @@ -480,6 +481,7 @@ func (cfg *RequestConfig) Clone(ctx context.Context) *RequestConfig {
BaseURL: cfg.BaseURL,
HTTPClient: cfg.HTTPClient,
Middlewares: cfg.Middlewares,
APIKey: cfg.APIKey,
}

return new
Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "0.1.0-alpha.1" // x-release-please-version
const PackageVersion = "0.1.0-alpha.2" // x-release-please-version
8 changes: 8 additions & 0 deletions option/requestoption.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,11 @@ func WithRequestTimeout(dur time.Duration) RequestOption {
func WithEnvironmentProduction() RequestOption {
return WithBaseURL("https://usefind.ai/found/")
}

// WithAPIKey returns a RequestOption that sets the client setting "api_key".
func WithAPIKey(value string) RequestOption {
return func(r *requestconfig.RequestConfig) error {
r.APIKey = value
return r.Apply(WithHeader("Authorization", r.APIKey))
}
}
2 changes: 2 additions & 0 deletions peopleenrichmentenrich_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestPeopleEnrichmentEnrichNewWithOptionalParams(t *testing.T) {
}
client := findai.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.PeopleEnrichment.Enrich.New(context.TODO(), findai.PeopleEnrichmentEnrichNewParams{
Email: findai.F("email"),
Expand All @@ -46,6 +47,7 @@ func TestPeopleEnrichmentEnrichGet(t *testing.T) {
}
client := findai.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.PeopleEnrichment.Enrich.Get(context.TODO(), "token")
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestSearchNewWithOptionalParams(t *testing.T) {
}
client := findai.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.Searches.New(context.TODO(), findai.SearchNewParams{
MaxMatches: findai.F(0.000000),
Expand All @@ -49,6 +50,7 @@ func TestSearchGet(t *testing.T) {
}
client := findai.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.Searches.Get(context.TODO(), "id")
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions usage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func TestUsage(t *testing.T) {
}
client := findai.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.Searches.Get(context.TODO(), "id")
if err != nil {
Expand Down

0 comments on commit f00c647

Please sign in to comment.