-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conversation visitor identification code refactored & all test cases …
…failure issue resolved.
- Loading branch information
Showing
7 changed files
with
56 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package hubspot | ||
|
||
type Conversation struct { | ||
VisitorIdentification VisitorIdentificationService | ||
IdentificationTokenRequest IdentificationTokenRequest | ||
} | ||
|
||
func newConversation(c *Client) *Conversation { | ||
return &Conversation{ | ||
VisitorIdentification: &VisitorIdentificationServiceOp{ | ||
client: c, | ||
}, | ||
} | ||
} |
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,34 @@ | ||
package hubspot | ||
|
||
const ( | ||
visitorIdentificationBasePath = "/conversations/v3/visitor-identification" | ||
) | ||
|
||
type IdentificationTokenResponse struct { | ||
Token string `json:"token"` | ||
} | ||
|
||
type IdentificationTokenRequest struct { | ||
FirstName string `json:"firstname"` | ||
LastName string `json:"lastname"` | ||
Email string `json:"email"` | ||
} | ||
|
||
type VisitorIdentificationService interface { | ||
GenerateIdentificationToken(option IdentificationTokenRequest) (*IdentificationTokenResponse, error) | ||
} | ||
|
||
type VisitorIdentificationServiceOp struct { | ||
client *Client | ||
} | ||
|
||
var _ VisitorIdentificationService = (*VisitorIdentificationServiceOp)(nil) | ||
|
||
func (s *VisitorIdentificationServiceOp) GenerateIdentificationToken(option IdentificationTokenRequest) (*IdentificationTokenResponse, error) { | ||
response := &IdentificationTokenResponse{} | ||
path := visitorIdentificationBasePath + "/tokens/create" | ||
if err := s.client.Post(path, option, response); err != nil { | ||
return nil, err | ||
} | ||
return response, nil | ||
} |
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.