github.com/twilio/twilio-go@v1.20.1/client/jwt/taskrouter_grant.go (about) 1 package jwt 2 3 import "fmt" 4 5 type TaskRouterGrant struct { 6 WorkspaceSid string `json:"workspace_sid"` 7 WorkerSid string `json:"worker_sid"` 8 Role string `json:"role"` 9 } 10 11 func (taskRouterGrant *TaskRouterGrant) Key() string { 12 return "task_router" 13 } 14 15 func (taskRouterGrant *TaskRouterGrant) ToPayload() map[string]interface{} { 16 grant := make(map[string]interface{}) 17 18 if taskRouterGrant.WorkspaceSid != "" { 19 grant["workspace_sid"] = taskRouterGrant.WorkspaceSid 20 } 21 if taskRouterGrant.WorkerSid != "" { 22 grant["worker_sid"] = taskRouterGrant.WorkerSid 23 } 24 if taskRouterGrant.Role != "" { 25 grant["role"] = taskRouterGrant.Role 26 } 27 28 return grant 29 } 30 31 func (taskRouterGrant *TaskRouterGrant) ToString() string { 32 return fmt.Sprintf("<%s %s>", "TaskRouterGrant", taskRouterGrant.ToPayload()) 33 }