Skip to content

Commit

Permalink
Merge pull request #9 from fullcontact/aanand4403/sc-146920/verify-ap…
Browse files Browse the repository at this point in the history
…i-client-library-changes

feat: [sc-146920] Verify API Client Library Changes
  • Loading branch information
McManCSU authored Feb 9, 2024
2 parents 2cb79b0 + eb398aa commit fd2b50f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 32 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## FullContact Go Client
[![GoDoc](https://godoc.org/github.com/fullcontact/fullcontact-go/fc?status.svg)](https://godoc.org/github.com/fullcontact/fullcontact-go/fc)

![status](https://github.com/fullcontact/fullcontact-go/actions/workflows/go.yml/badge.svg)

The official [FullContact](https://www.fullcontact.com/) Golang Client Library for the FullContact V3 APIs.

Expand Down Expand Up @@ -636,9 +637,11 @@ Query takes a `MultifieldRequest`
class: `VerifyActivityResponse`. A basic API response with response code as 200 if successful with the following fields

- `Emails`: _float64_
- `Message`: _string_
- `Online`: _float64_
- `Social`: _float64_
- `Employment`: _float64_

The `Message` field will contain the error message if the individual cannot be verified. If person can be identified then, the `Emails` field will contain the verify score.
If person can be identified then, the `Emails`, `Online`, `Social`, `Employment` field will contain the verify score.

```go
multifieldRequest, err := fc.NewMultifieldRequest(
Expand All @@ -660,15 +663,12 @@ class: `VerifyMatchResponse`. A basic API response with response code as 200 if
- `City`: _bool_
- `Region`: _bool_
- `Country`: _bool_
- `Continent`: _bool_
- `PostalCode`: _bool_
- `FamilyName`: _bool_
- `GivenName`: _bool_
- `Phone`: _bool_
- `Email`: _bool_
- `Maid`: _bool_
- `Social`: _bool_
- `NonId`: _bool_
- `Risk`: _float64_

```go
multifieldRequest, err := fc.NewMultifieldRequest(
Expand Down Expand Up @@ -752,4 +752,4 @@ class: `VerifySignalsResponse`. A basic API response with response code as 200 i
if resp.IsSuccessful == true {
fmt.Printf("Verify Signals API Response: %v", resp)
}
```
```
31 changes: 17 additions & 14 deletions fc/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,26 @@ type VerifySignalsResponse struct {
}

type VerifyMatchResponse struct {
City bool `json:"city"`
Region bool `json:"region"`
Country bool `json:"country"`
Continent bool `json:"continent"`
PostalCode bool `json:"postalCode"`
FamilyName bool `json:"familyName"`
GivenName bool `json:"givenName"`
Phone bool `json:"phone"`
Email bool `json:"email"`
Maid bool `json:"maid"`
Social bool `json:"social"`
NonId bool `json:"nonId"`
City string `json:"city"`
Region string `json:"region"`
Country string `json:"country"`
Continent bool `json:"continent"`
PostalCode string `json:"postalCode"`
FamilyName string `json:"familyName"`
GivenName string `json:"givenName"`
Phone string `json:"phone"`
Email string `json:"email"`
Maid bool `json:"maid"`
Social bool `json:"social"`
NonId bool `json:"nonId"`
Risk float64 `json:"risk"`
}

type VerifyActivityResponse struct {
Emails float64 `json:"emails"`
Message string `json:"message"`
Emails float64 `json:"emails"`
Online float64 `json:"online"`
Social float64 `json:"social"`
Employment float64 `json:"employment"`
}

type VerifiedEmail struct {
Expand Down
25 changes: 14 additions & 11 deletions fc/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func TestVerfiyActivity(t *testing.T) {
ch := make(chan *APIResponse)
respJson := "{\"emails\":0.21,\"message\":\"Individual is not currently found within FullContact's Identity Graph\"}"
respJson := "{\"emails\":0.21,\"online\":0.31,\"social\":0.41,\"employment\":0.51}"
fcTestClient, testServer := getTestServerAndClient(verifyActivityUrl, respJson, 200)
defer testServer.Close()
go fcTestClient.do(testServer.URL, nil, ch)
Expand All @@ -22,7 +22,9 @@ func TestVerfiyActivity(t *testing.T) {
assert.True(t, strings.Contains(resp.String(), "RawHttpRespons"))
// Validating Activity Fields
assert.Equal(t, 0.21, response.Emails)
assert.Equal(t, "Individual is not currently found within FullContact's Identity Graph", response.Message)
assert.Equal(t, 0.31, response.Online)
assert.Equal(t, 0.41, response.Social)
assert.Equal(t, 0.51, response.Employment)
}

func TestVerfiyActivityAutoRetry(t *testing.T) {
Expand Down Expand Up @@ -77,7 +79,7 @@ func TestVerfiyActivityStatus403(t *testing.T) {

func TestVerifyMatch(t *testing.T) {
ch := make(chan *APIResponse)
respJson := "{\"city\":true,\"region\":false,\"country\":true,\"continent\":false,\"postalCode\":true,\"familyName\":false,\"givenName\":true,\"phone\":false,\"email\":true,\"maid\":false,\"social\":true,\"nonId\":false}"
respJson := "{\"city\":\"household\",\"region\":\"household\",\"country\":\"household\",\"continent\":false,\"postalCode\":\"household\",\"familyName\":\"household\",\"givenName\":\"unknown\",\"phone\":\"tangled\",\"email\":\"self\",\"maid\":false,\"social\":true,\"nonId\":false,\"risk\":0.78}"
fcTestClient, testServer := getTestServerAndClient(verifyMatchUrl, respJson, 200)
defer testServer.Close()
go fcTestClient.do(testServer.URL, nil, ch)
Expand All @@ -89,18 +91,19 @@ func TestVerifyMatch(t *testing.T) {
assert.Equal(t, "200 OK", resp.Status)
assert.True(t, strings.Contains(resp.String(), "RawHttpRespons"))
// Validating Match Fields
assert.True(t, response.City)
assert.False(t, response.Region)
assert.True(t, response.Country)
assert.Equal(t, "household", response.City)
assert.Equal(t, "household", response.Region)
assert.Equal(t, "household", response.Country)
assert.Equal(t, "household", response.PostalCode)
assert.Equal(t, "household", response.FamilyName)
assert.Equal(t, "unknown", response.GivenName)
assert.Equal(t, "tangled", response.Phone)
assert.Equal(t, "self", response.Email)
assert.False(t, response.Continent)
assert.True(t, response.PostalCode)
assert.False(t, response.FamilyName)
assert.True(t, response.GivenName)
assert.False(t, response.Phone)
assert.True(t, response.Email)
assert.False(t, response.Maid)
assert.True(t, response.Social)
assert.False(t, response.NonId)
assert.Equal(t, 0.78, response.Risk)
}

func TestVerifyMatchAutoRetry(t *testing.T) {
Expand Down

0 comments on commit fd2b50f

Please sign in to comment.