Skip to content

Commit 7f35542

Browse files
authored
Merge pull request #16 from fullcontact/badge
badge: fc module
2 parents fd2b50f + 7fa2a06 commit 7f35542

File tree

2 files changed

+109
-55
lines changed

2 files changed

+109
-55
lines changed

.github/workflows/go.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ jobs:
2222
go-version: '1.20'
2323

2424
- name: Build
25-
run: go build -v ./...
25+
working-directory: fc
26+
run: go build -v .
2627

2728
- name: Test
28-
run: go test -v ./...
29+
working-directory: fc
30+
run: go test -v .

fc/fullcontact.go

Lines changed: 105 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package fullcontact
33
import (
44
"bytes"
55
"encoding/json"
6+
"io"
67
"io/ioutil"
78
"net/http"
89
"time"
@@ -141,8 +142,11 @@ func sendToChannel(ch chan *APIResponse, response *http.Response, url string, er
141142
return
142143
}
143144

144-
/* FullContact V3 Person Enrich API, takes an PersonRequest and returns a channel of type APIResponse.
145-
Request is converted to JSON and sends a Asynchronous request */
145+
/*
146+
FullContact V3 Person Enrich API, takes an PersonRequest and returns a channel of type APIResponse.
147+
148+
Request is converted to JSON and sends a Asynchronous request
149+
*/
146150
func (fcClient *fullContactClient) PersonEnrich(personRequest *PersonRequest) chan *APIResponse {
147151
ch := make(chan *APIResponse)
148152

@@ -166,8 +170,11 @@ func (fcClient *fullContactClient) PersonEnrich(personRequest *PersonRequest) ch
166170
return ch
167171
}
168172

169-
/* FullContact V3 Company Enrich API, takes an CompanyRequest and returns a channel of type APIResponse.
170-
Request is converted to JSON and sends a Asynchronous request */
173+
/*
174+
FullContact V3 Company Enrich API, takes an CompanyRequest and returns a channel of type APIResponse.
175+
176+
Request is converted to JSON and sends a Asynchronous request
177+
*/
171178
func (fcClient *fullContactClient) CompanyEnrich(companyRequest *CompanyRequest) chan *APIResponse {
172179
ch := make(chan *APIResponse)
173180
if companyRequest == nil {
@@ -190,9 +197,12 @@ func (fcClient *fullContactClient) CompanyEnrich(companyRequest *CompanyRequest)
190197
return ch
191198
}
192199

193-
/* Resolve
200+
/*
201+
Resolve
202+
194203
FullContact Resolve API - IdentityMap, takes an ResolveRequest and returns a channel of type APIResponse.
195-
Request is converted to JSON and sends a Asynchronous request */
204+
Request is converted to JSON and sends a Asynchronous request
205+
*/
196206
func (fcClient *fullContactClient) IdentityMap(resolveRequest *ResolveRequest) chan *APIResponse {
197207
ch := make(chan *APIResponse)
198208
if resolveRequest == nil {
@@ -207,9 +217,12 @@ func (fcClient *fullContactClient) IdentityMap(resolveRequest *ResolveRequest) c
207217
return fcClient.resolveRequest(ch, resolveRequest, identityMapUrl)
208218
}
209219

210-
/* Resolve
220+
/*
221+
Resolve
222+
211223
FullContact Resolve API - IdentityResolve, takes an ResolveRequest and returns a channel of type APIResponse.
212-
Request is converted to JSON and sends a Asynchronous request */
224+
Request is converted to JSON and sends a Asynchronous request
225+
*/
213226
func (fcClient *fullContactClient) IdentityResolve(resolveRequest *ResolveRequest) chan *APIResponse {
214227
ch := make(chan *APIResponse)
215228
if resolveRequest == nil {
@@ -224,9 +237,12 @@ func (fcClient *fullContactClient) IdentityResolve(resolveRequest *ResolveReques
224237
return fcClient.resolveRequest(ch, resolveRequest, identityResolveUrl)
225238
}
226239

227-
/* Resolve
240+
/*
241+
Resolve
242+
228243
FullContact Resolve API - IdentityMapResolve, takes an ResolveRequest and returns a channel of type APIResponse.
229-
Request is converted to JSON and sends a Asynchronous request */
244+
Request is converted to JSON and sends a Asynchronous request
245+
*/
230246
func (fcClient *fullContactClient) IdentityMapResolve(resolveRequest *ResolveRequest) chan *APIResponse {
231247
ch := make(chan *APIResponse)
232248
if resolveRequest == nil {
@@ -241,9 +257,12 @@ func (fcClient *fullContactClient) IdentityMapResolve(resolveRequest *ResolveReq
241257
return fcClient.resolveRequest(ch, resolveRequest, identityMapResolveUrl)
242258
}
243259

244-
/* Resolve
260+
/*
261+
Resolve
262+
245263
FullContact Resolve API - IdentityResolve with Tags in response, takes an ResolveRequest and returns a channel of type APIResponse.
246-
Request is converted to JSON and sends a Asynchronous request */
264+
Request is converted to JSON and sends a Asynchronous request
265+
*/
247266
func (fcClient *fullContactClient) IdentityResolveWithTags(resolveRequest *ResolveRequest) chan *APIResponse {
248267
ch := make(chan *APIResponse)
249268
if resolveRequest == nil {
@@ -258,9 +277,12 @@ func (fcClient *fullContactClient) IdentityResolveWithTags(resolveRequest *Resol
258277
return fcClient.resolveRequest(ch, resolveRequest, identityResolveWithTagsUrl)
259278
}
260279

261-
/* Resolve
280+
/*
281+
Resolve
282+
262283
FullContact Resolve API - IdentityDelete, takes an ResolveRequest and returns a channel of type APIResponse.
263-
Request is converted to JSON and sends a Asynchronous request */
284+
Request is converted to JSON and sends a Asynchronous request
285+
*/
264286
func (fcClient *fullContactClient) IdentityDelete(resolveRequest *ResolveRequest) chan *APIResponse {
265287
ch := make(chan *APIResponse)
266288
if resolveRequest == nil {
@@ -286,8 +308,11 @@ func (fcClient *fullContactClient) resolveRequest(ch chan *APIResponse, resolveR
286308
return ch
287309
}
288310

289-
/* FullContact API for adding/creating tags for any recordId in your PIC, takes a TagsRequest and returns a channel of type APIResponse.
290-
Request is converted to JSON and sends a Asynchronous request */
311+
/*
312+
FullContact API for adding/creating tags for any recordId in your PIC, takes a TagsRequest and returns a channel of type APIResponse.
313+
314+
Request is converted to JSON and sends a Asynchronous request
315+
*/
291316
func (fcClient *fullContactClient) TagsCreate(tagsRequest *TagsRequest) chan *APIResponse {
292317
ch := make(chan *APIResponse)
293318
if tagsRequest == nil {
@@ -305,8 +330,11 @@ func (fcClient *fullContactClient) TagsCreate(tagsRequest *TagsRequest) chan *AP
305330
return ch
306331
}
307332

308-
/* FullContact API for getting all tags for any recordId in your PIC, takes a 'recordId' and returns a channel of type APIResponse.
309-
Request is converted to JSON and sends a Asynchronous request */
333+
/*
334+
FullContact API for getting all tags for any recordId in your PIC, takes a 'recordId' and returns a channel of type APIResponse.
335+
336+
Request is converted to JSON and sends a Asynchronous request
337+
*/
310338
func (fcClient *fullContactClient) TagsGet(recordId string) chan *APIResponse {
311339
ch := make(chan *APIResponse)
312340
if !isPopulated(recordId) {
@@ -320,8 +348,11 @@ func (fcClient *fullContactClient) TagsGet(recordId string) chan *APIResponse {
320348
return ch
321349
}
322350

323-
/* FullContact API for deleting any tag(s) for any recordId in your PIC, takes a TagsRequest and returns a channel of type APIResponse.
324-
Request is converted to JSON and sends a Asynchronous request */
351+
/*
352+
FullContact API for deleting any tag(s) for any recordId in your PIC, takes a TagsRequest and returns a channel of type APIResponse.
353+
354+
Request is converted to JSON and sends a Asynchronous request
355+
*/
325356
func (fcClient *fullContactClient) TagsDelete(tagsRequest *TagsRequest) chan *APIResponse {
326357
ch := make(chan *APIResponse)
327358
if tagsRequest == nil {
@@ -339,8 +370,11 @@ func (fcClient *fullContactClient) TagsDelete(tagsRequest *TagsRequest) chan *AP
339370
return ch
340371
}
341372

342-
/* FullContact API for creating Audience based on tags from your PIC, takes a AudienceRequest and returns a channel of type APIResponse.
343-
Request is converted to JSON and sends a Asynchronous request */
373+
/*
374+
FullContact API for creating Audience based on tags from your PIC, takes a AudienceRequest and returns a channel of type APIResponse.
375+
376+
Request is converted to JSON and sends a Asynchronous request
377+
*/
344378
func (fcClient *fullContactClient) AudienceCreate(audienceRequest *AudienceRequest) chan *APIResponse {
345379
ch := make(chan *APIResponse)
346380
if audienceRequest == nil {
@@ -358,8 +392,11 @@ func (fcClient *fullContactClient) AudienceCreate(audienceRequest *AudienceReque
358392
return ch
359393
}
360394

361-
/* FullContact API for downloading Audience created using 'AudienceCreate', takes a requestId and returns a channel of type APIResponse.
362-
Request is converted to JSON and sends a Asynchronous request */
395+
/*
396+
FullContact API for downloading Audience created using 'AudienceCreate', takes a requestId and returns a channel of type APIResponse.
397+
398+
Request is converted to JSON and sends a Asynchronous request
399+
*/
363400
func (fcClient *fullContactClient) AudienceDownload(requestId string) chan *APIResponse {
364401
ch := make(chan *APIResponse)
365402
if !isPopulated(requestId) {
@@ -373,9 +410,12 @@ func (fcClient *fullContactClient) AudienceDownload(requestId string) chan *APIR
373410
return ch
374411
}
375412

376-
/* Permission
413+
/*
414+
Permission
415+
377416
FullContact Permission API - PermissionCreate, takes an PermissionRequest and returns a channel of type APIResponse.
378-
Request is converted to JSON and sends a Asynchronous request */
417+
Request is converted to JSON and sends a Asynchronous request
418+
*/
379419
func (fcClient *fullContactClient) PermissionCreate(permissionRequest *PermissionRequest) chan *APIResponse {
380420
ch := make(chan *APIResponse)
381421
if permissionRequest == nil {
@@ -398,26 +438,38 @@ func (fcClient *fullContactClient) PermissionCreate(permissionRequest *Permissio
398438
return ch
399439
}
400440

401-
/* FullContact Permission API - PermissionDelete, takes an PermissionRequest and returns a channel of type APIResponse.
402-
Request is converted to JSON and sends a Asynchronous request */
441+
/*
442+
FullContact Permission API - PermissionDelete, takes an PermissionRequest and returns a channel of type APIResponse.
443+
444+
Request is converted to JSON and sends a Asynchronous request
445+
*/
403446
func (fcClient *fullContactClient) PermissionDelete(multifieldRequest *MultifieldRequest) chan *APIResponse {
404447
return fcClient.validateAndSendMultiFieldRequestAsync(permissionDeleteUrl, multifieldRequest)
405448
}
406449

407-
/* FullContact Permission API - PermissionFind, takes an PermissionRequest and returns a channel of type APIResponse.
408-
Request is converted to JSON and sends a Asynchronous request */
450+
/*
451+
FullContact Permission API - PermissionFind, takes an PermissionRequest and returns a channel of type APIResponse.
452+
453+
Request is converted to JSON and sends a Asynchronous request
454+
*/
409455
func (fcClient *fullContactClient) PermissionFind(multifieldRequest *MultifieldRequest) chan *APIResponse {
410456
return fcClient.validateAndSendMultiFieldRequestAsync(permissionFindUrl, multifieldRequest)
411457
}
412458

413-
/* FullContact Permission API - PermissionCurrent, takes an PermissionRequest and returns a channel of type APIResponse.
414-
Request is converted to JSON and sends a Asynchronous request */
459+
/*
460+
FullContact Permission API - PermissionCurrent, takes an PermissionRequest and returns a channel of type APIResponse.
461+
462+
Request is converted to JSON and sends a Asynchronous request
463+
*/
415464
func (fcClient *fullContactClient) PermissionCurrent(multifieldRequest *MultifieldRequest) chan *APIResponse {
416465
return fcClient.validateAndSendMultiFieldRequestAsync(permissionCurrentUrl, multifieldRequest)
417466
}
418467

419-
/* FullContact Permission API - PermissionVerify, takes an PermissionRequest and returns a channel of type APIResponse.
420-
Request is converted to JSON and sends a Asynchronous request */
468+
/*
469+
FullContact Permission API - PermissionVerify, takes an PermissionRequest and returns a channel of type APIResponse.
470+
471+
Request is converted to JSON and sends a Asynchronous request
472+
*/
421473
func (fcClient *fullContactClient) PermissionVerify(permissionRequest *PermissionRequest) chan *APIResponse {
422474
ch := make(chan *APIResponse)
423475
if permissionRequest == nil {
@@ -471,11 +523,11 @@ func (fcClient *fullContactClient) VerifyActivity(multifieldRequest *MultifieldR
471523
}
472524

473525
/*
474-
This function will perform the `MultifieldRequest` validations and if
475-
there are no errors then it'll be marshalled and a `MultifieldRequest` will be
476-
made to the specified `url`
526+
This function will perform the `MultifieldRequest` validations and if
527+
there are no errors then it'll be marshalled and a `MultifieldRequest` will be
528+
made to the specified `url`
477529
478-
Returns a channel frm which the request response can be obtained
530+
Returns a channel frm which the request response can be obtained
479531
*/
480532
func (fcClient *fullContactClient) validateAndSendMultiFieldRequestAsync(url string, multifieldRequest *MultifieldRequest) chan *APIResponse {
481533
ch := make(chan *APIResponse)
@@ -531,7 +583,7 @@ func setCompanyResponse(apiResponse *APIResponse) {
531583

532584
// Reset the buffer so that it can be re-read by the caller.
533585
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
534-
586+
535587
if err != nil {
536588
apiResponse.Err = err
537589
return
@@ -556,7 +608,7 @@ func setResolveResponse(apiResponse *APIResponse) {
556608

557609
// Reset the buffer so that it can be re-read by the caller.
558610
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
559-
611+
560612
if err != nil {
561613
apiResponse.Err = err
562614
return
@@ -581,7 +633,7 @@ func setResolveResponseWithTags(apiResponse *APIResponse) {
581633

582634
// Reset the buffer so that it can be re-read by the caller.
583635
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
584-
636+
585637
if err != nil {
586638
apiResponse.Err = err
587639
return
@@ -606,7 +658,7 @@ func setTagsResponse(apiResponse *APIResponse) {
606658

607659
// Reset the buffer so that it can be re-read by the caller.
608660
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
609-
661+
610662
if err != nil {
611663
apiResponse.Err = err
612664
return
@@ -632,7 +684,7 @@ func setAudienceResponse(apiResponse *APIResponse) {
632684

633685
// Reset the buffer so that it can be re-read by the caller.
634686
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
635-
687+
636688
if err != nil {
637689
apiResponse.Err = err
638690
return
@@ -656,12 +708,12 @@ func setAudienceResponse(apiResponse *APIResponse) {
656708
}
657709

658710
func setPermissionCreateResponse(apiResponse *APIResponse) {
659-
_, err := ioutil.ReadAll(apiResponse.RawHttpResponse.Body)
711+
bodyBytes, err := ioutil.ReadAll(apiResponse.RawHttpResponse.Body)
660712
defer apiResponse.RawHttpResponse.Body.Close()
661713

662714
// Reset the buffer so that it can be re-read by the caller.
663715
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
664-
716+
665717
if err != nil {
666718
apiResponse.Err = err
667719
return
@@ -672,12 +724,12 @@ func setPermissionCreateResponse(apiResponse *APIResponse) {
672724
}
673725

674726
func setPermissionDeleteResponse(apiResponse *APIResponse) {
675-
_, err := ioutil.ReadAll(apiResponse.RawHttpResponse.Body)
727+
bodyBytes, err := ioutil.ReadAll(apiResponse.RawHttpResponse.Body)
676728
defer apiResponse.RawHttpResponse.Body.Close()
677729

678730
// Reset the buffer so that it can be re-read by the caller.
679731
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
680-
732+
681733
if err != nil {
682734
apiResponse.Err = err
683735
return
@@ -693,7 +745,7 @@ func setPermissionFindResponse(apiResponse *APIResponse) {
693745

694746
// Reset the buffer so that it can be re-read by the caller.
695747
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
696-
748+
697749
if err != nil {
698750
apiResponse.Err = err
699751
return
@@ -718,7 +770,7 @@ func setPermissionVerifyResponse(apiResponse *APIResponse) {
718770

719771
// Reset the buffer so that it can be re-read by the caller.
720772
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
721-
773+
722774
if err != nil {
723775
apiResponse.Err = err
724776
return
@@ -743,7 +795,7 @@ func setPermissionCurrentResponse(apiResponse *APIResponse) {
743795

744796
// Reset the buffer so that it can be re-read by the caller.
745797
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
746-
798+
747799
if err != nil {
748800
apiResponse.Err = err
749801
return
@@ -768,7 +820,7 @@ func setVerfiySignalsResponse(apiResponse *APIResponse) {
768820

769821
// Reset the buffer so that it can be re-read by the caller.
770822
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
771-
823+
772824
if err != nil {
773825
apiResponse.Err = err
774826
return
@@ -793,7 +845,7 @@ func setVerfiyMatchResponse(apiResponse *APIResponse) {
793845

794846
// Reset the buffer so that it can be re-read by the caller.
795847
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
796-
848+
797849
if err != nil {
798850
apiResponse.Err = err
799851
return
@@ -818,7 +870,7 @@ func setVerfiyActivityResponse(apiResponse *APIResponse) {
818870

819871
// Reset the buffer so that it can be re-read by the caller.
820872
apiResponse.RawHttpResponse.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
821-
873+
822874
if err != nil {
823875
apiResponse.Err = err
824876
return

0 commit comments

Comments
 (0)