-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from KareHero/visitor-identification
Visitor Identification module added.
- Loading branch information
Showing
5 changed files
with
57 additions
and
4 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,18 @@ | ||
package hubspot | ||
|
||
const ( | ||
visitorIdentificationBasePath = "/conversations/v3/visitor-identification" | ||
) | ||
|
||
type Conversation struct { | ||
VisitorIdentification VisitorIdentificationService | ||
} | ||
|
||
func newConversation(c *Client) *Conversation { | ||
return &Conversation{ | ||
VisitorIdentification: &VisitorIdentificationServiceOp{ | ||
client: c, | ||
basePath: visitorIdentificationBasePath, | ||
}, | ||
} | ||
} |
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,31 @@ | ||
package hubspot | ||
|
||
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 | ||
basePath string | ||
} | ||
|
||
var _ VisitorIdentificationService = (*VisitorIdentificationServiceOp)(nil) | ||
|
||
func (s *VisitorIdentificationServiceOp) GenerateIdentificationToken(option IdentificationTokenRequest) (*IdentificationTokenResponse, error) { | ||
response := &IdentificationTokenResponse{} | ||
path := s.basePath + "/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