Skip to content

Commit

Permalink
Revert "feat(payload): add user_id to payload" (#4)
Browse files Browse the repository at this point in the history
Signed-off-by: Niladri Halder <[email protected]>
  • Loading branch information
niladrih authored Nov 9, 2023
1 parent 2277f89 commit ecc4269
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 14 deletions.
1 change: 0 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func (c *MeasurementClient) Send(event *event.OpenebsEvent) error {
dataPayload, err := payload.NewPayload(
payload.WithClientId(client.clientId),
payload.WithOpenebsEvent(event),
payload.WithUserId(client.clientId),
)

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func main() {
client, err := gaClient.NewMeasurementClient(
gaClient.WithApiSecret("NguBiGh6QeOdeG3zJswggQ"),
gaClient.WithMeasurementId("G-TZGP46618W"),
gaClient.WithClientId("uniqueClientId-000000001"),
gaClient.WithClientId("uniqueUserId-000000001"),
)
if err != nil {
panic(err)
Expand Down
12 changes: 0 additions & 12 deletions payload/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ type PayloadOption func(*Payload) error
type Payload struct {
ClientId string `json:"client_id"`
Events []ApiEvent `json:"events"`
UserId string `json:"user_id"`
}

type ApiEvent struct {
Expand Down Expand Up @@ -44,17 +43,6 @@ func WithClientId(clientId string) PayloadOption {
}
}

func WithUserId(userId string) PayloadOption {
return func(p *Payload) error {
if len(userId) == 0 {
return errors.Errorf("failed to set Payload userId: id is an empty string")
}

p.UserId = userId
return nil
}
}

func WithOpenebsEvent(event *event.OpenebsEvent) PayloadOption {
return func(p *Payload) error {
p.Events = append(p.Events, ApiEvent{
Expand Down

0 comments on commit ecc4269

Please sign in to comment.