-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfe6895
commit 5850246
Showing
2 changed files
with
33 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/ONSdigital/dp-api-clients-go/v2/nlp/berlin" | ||
) | ||
|
||
func main() { | ||
|
||
// Initialize the Berlin API client | ||
client := berlin.New("http://localhost:28900") | ||
|
||
// Create an Options struct and set a query parameter 'q' | ||
// you can also use url.Values directly into the Options | ||
options := berlin.OptInit() | ||
fmt.Println(options) | ||
|
||
options.Q("dentists in london with something") | ||
fmt.Println(options) | ||
|
||
// Get Berlin results using the created client and custom options | ||
results, err := client.GetBerlin(context.TODO(), options) | ||
fmt.Println(err) | ||
fmt.Println(results.Matches) | ||
fmt.Println(results.Matches[0].Scores.Score) | ||
fmt.Println(results.Matches[0].Scores.Offset) | ||
fmt.Println(results.Matches[0].Loc.Codes) | ||
fmt.Println(results.Matches[0].Loc.Encoding) | ||
fmt.Println(results.Matches[0].Loc.ID) | ||
fmt.Println(results.Query) | ||
} |