github.com/twilio/twilio-go@v1.20.1/client/jwt/chat_grant.go (about) 1 package jwt 2 3 import "fmt" 4 5 type ChatGrant struct { 6 ServiceSid string `json:"service_sid"` 7 EndpointID string `json:"endpoint_id"` 8 DeploymentRoleSid string `json:"deployment_role_sid"` 9 PushCredentialSid string `json:"push_credential_sid"` 10 } 11 12 func (chatGrant *ChatGrant) Key() string { 13 return "chat" 14 } 15 16 func (chatGrant *ChatGrant) ToPayload() map[string]interface{} { 17 grant := make(map[string]interface{}) 18 if chatGrant.ServiceSid != "" { 19 grant["service_sid"] = chatGrant.ServiceSid 20 } 21 if chatGrant.EndpointID != "" { 22 grant["endpoint_id"] = chatGrant.EndpointID 23 } 24 if chatGrant.DeploymentRoleSid != "" { 25 grant["deployment_role_sid"] = chatGrant.DeploymentRoleSid 26 } 27 if chatGrant.PushCredentialSid != "" { 28 grant["push_credential_sid"] = chatGrant.PushCredentialSid 29 } 30 31 return grant 32 } 33 34 func (chatGrant *ChatGrant) ToString() string { 35 return fmt.Sprintf("<%s %s>", "ChatGrant", chatGrant.ToPayload()) 36 }