Skip to content

Commit

Permalink
Add Updated Title Roles to Autocomplete (#44)
Browse files Browse the repository at this point in the history
* Add support for updated_title_roles

* add test

* updates
  • Loading branch information
vvillait88 authored Dec 17, 2024
1 parent 31fedac commit cc96214
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Add Headline to Person Schema
- Update Readme

## [3.4.0] - 2024-11-28

- Add Support for Class and Updated Title Roles in Autocomplete
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<img src="https://img.shields.io/badge/repo%20status-Active-limegreen" alt="Repo Status">
</a>&nbsp;
<a href="https://pkg.go.dev/github.com/peopledatalabs/peopledatalabs-go">
<img src="https://img.shields.io/github/go-mod/go-version/peopledatalabs/peopledatalabs-go" alt="Go 3.3.0" />
<img src="https://img.shields.io/github/go-mod/go-version/peopledatalabs/peopledatalabs-go" alt="Go 3.4.0" />
</a>&nbsp;
<a href="https://github.com/peopledatalabs/peopledatalabs-go/actions/workflows/test.yaml">
<img src="https://github.com/peopledatalabs/peopledatalabs-go/actions/workflows/test.yaml/badge.svg" alt="Tests Status" />
Expand Down
17 changes: 17 additions & 0 deletions api/autocomplete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,20 @@ func TestAutocomplete(t *testing.T) {
assert.Equal(t, resp.Status, http.StatusOK)
assert.Equal(t, resp.Data[0].Name, "stanford university")
}

func TestAutocompleteClass(t *testing.T) {
// setup
auto := Autocomplete{Client: NewClient(os.Getenv("PDL_API_KEY"), "1.0.0")}

// test
params := model.AutocompleteParams{
BaseParams: model.BaseParams{Pretty: true, Size: 10, UpdatedTitleRoles: true},
AutocompleteBaseParams: model.AutocompleteBaseParams{Field: "class", Text: "sale"},
}
resp, err := auto.Autocomplete(context.Background(), params)

// assertions
assert.NoError(t, err)
assert.Equal(t, resp.Status, http.StatusOK)
assert.Equal(t, resp.Data[0].Name, "sales_and_marketing")
}
1 change: 1 addition & 0 deletions model/autocomplete.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type AutocompleteResult struct {
type AutocompleteType string

const (
AutocompleteTypeClass AutocompleteType = "class" // Job title classes
AutocompleteTypeCompany AutocompleteType = "company" // Company names
AutocompleteTypeCountry AutocompleteType = "country" // Country names
AutocompleteTypeIndustry AutocompleteType = "industry" // Industries
Expand Down
2 changes: 1 addition & 1 deletion pld.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/peopledatalabs/peopledatalabs-go/v3/api"
)

const Version = "3.3.0"
const Version = "3.4.0"

type pld struct {
Person api.Person
Expand Down

0 comments on commit cc96214

Please sign in to comment.