IsExcludedFromCampaigns field not declared in ressources.Contact struct
mderoulou opened this issue · 1 comments
mderoulou commented
Here are my imports :
import (
"fmt"
"anotherRepository/config"
mailjet "github.com/mailjet/mailjet-apiv3-go"
"github.com/mailjet/mailjet-apiv3-go/resources"
)
And there my code :
func ExcludeContact(id int64) bool {
mailjetClient := mailjet.NewMailjetClient(config.Config("MJ_APIKEY_PUBLIC"), config.Config("MJ_APIKEY_PRIVATE"))
mr := &mailjet.Request{
Resource: "contact",
ID: id,
}
fmr := &mailjet.FullRequest{
Info: mr,
Payload: &resources.Contact{
IsExcludedFromCampaigns: "true",
},
}
err := mailjetClient.Put(fmr)
if err != nil {
fmt.Println(err)
return false
}
return true
}
And when I launch my go project, it throws me an error :
src\utils\contact\contact.go:47:4: unknown field 'IsExcludedFromCampaigns' in struct literal of type resources.Contact
src\utils\contact\contact.go:50:27: not enough arguments in call to mailjetClient.Put
have (*mailjet.FullRequest)
want (*mailjet.FullRequest, []string, ...mailjet.RequestOptions)
And wrote all code from this example: https://dev.mailjet.com/email/guides/contact-management/#manage-your-exclusion-list
Did I miss something or something's missing in module declarations ?
teros0 commented
Hey!
Can you try using versioned paths?
Get package:
go get github.com/mailjet/mailjet-apiv3-go/v4
And then import mailjet packages:
// Import the Mailjet wrapper
import (
"github.com/mailjet/mailjet-apiv3-go/v4"
"github.com/mailjet/mailjet-apiv3-go/v4/resources"
)