package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Tags.Create(ctx, operations.CreateTagTagsRequestBody{
Data: &operations.CreateTagTagsData{
Type: operations.CreateTagTagsTypeTags.ToPointer(),
Attributes: &operations.CreateTagTagsAttributes{
Name: latitudeshgosdk.Pointer("Tag Name"),
Description: latitudeshgosdk.Pointer("Tag Description"),
Color: latitudeshgosdk.Pointer("#bebebe"),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.CustomTag != nil {
// handle response
}
}{
"data": {
"id": "tag_Rz8Ka32gLoUAZJYxkMrxiR8j9Ppa",
"type": "tags",
"attributes": {
"name": "Tag Name",
"slug": "tag-name",
"description": "Tag Description",
"color": "#bebebe",
"team": {
"id": "team_P5gz2MnmXoT4JXGwobmvf8bVoV3",
"name": "628 Team",
"slug": "628-team",
"description": "628 Team",
"address": "300 Jacqueline Village, Lake Shaunmouth, NH 56746",
"status": "verified",
"currency": {
"id": "cur_AW6Q2D9lqKLpr",
"code": "BRL",
"name": "Brazilian Real",
"currency_id": null
}
}
}
}
}Create a Tag in the team.
package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Tags.Create(ctx, operations.CreateTagTagsRequestBody{
Data: &operations.CreateTagTagsData{
Type: operations.CreateTagTagsTypeTags.ToPointer(),
Attributes: &operations.CreateTagTagsAttributes{
Name: latitudeshgosdk.Pointer("Tag Name"),
Description: latitudeshgosdk.Pointer("Tag Description"),
Color: latitudeshgosdk.Pointer("#bebebe"),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.CustomTag != nil {
// handle response
}
}{
"data": {
"id": "tag_Rz8Ka32gLoUAZJYxkMrxiR8j9Ppa",
"type": "tags",
"attributes": {
"name": "Tag Name",
"slug": "tag-name",
"description": "Tag Description",
"color": "#bebebe",
"team": {
"id": "team_P5gz2MnmXoT4JXGwobmvf8bVoV3",
"name": "628 Team",
"slug": "628-team",
"description": "628 Team",
"address": "300 Jacqueline Village, Lake Shaunmouth, NH 56746",
"status": "verified",
"currency": {
"id": "cur_AW6Q2D9lqKLpr",
"code": "BRL",
"name": "Brazilian Real",
"currency_id": null
}
}
}
}
}Was this page helpful?