diff --git a/http.go b/http.go index f393a9b..a3d8411 100644 --- a/http.go +++ b/http.go @@ -73,6 +73,10 @@ var InsightsBaseUrl = "https://insights.twilio.com" const InsightsVersion = "v1" +// Service Resource +const ServiceResourceBaseUrl = "https://messaging.twilio.com" +const ServiceResourceVersion = "v1" + type Client struct { *restclient.Client Monitor *Client @@ -85,6 +89,7 @@ type Client struct { Video *Client TaskRouter *Client Insights *Client + Resource *Client // FullPath takes a path part (e.g. "Messages") and // returns the full API path, including the version (e.g. @@ -144,6 +149,9 @@ type Client struct { // NewInsightsClient initializes these services VoiceInsights func(sid string) *VoiceInsightsService + + // NewServiceResourceClient initializes these services + ServiceResources *ServiceResourceService } const defaultTimeout = 30*time.Second + 500*time.Millisecond @@ -350,6 +358,21 @@ func NewVideoClient(accountSid string, authToken string, httpClient *http.Client return c } +// NewServiceResourceClient returns a new Client to use the Service Resource API +// +//https://www.twilio.com/docs/sms/services/api#messaging-services-resource +func NewServiceResourceClient(accountSid string, authToken string, httpClient *http.Client) *Client { + c := newNewClient(accountSid, authToken, ServiceResourceBaseUrl, httpClient) + c.APIVersion = ServiceResourceVersion + c.ServiceResources = &ServiceResourceService{ + MessagingService: &MessagingService{c}, + PhoneNumbers: &PhoneNumberService{c}, + AlphaSenders: &AlphaSenderService{c}, + ShortCodes: &ShortCodeService{c}, + } + return c +} + // NewClient creates a Client for interacting with the Twilio API. This is the // main entrypoint for API interactions; view the methods on the subresources // for more information. @@ -378,6 +401,7 @@ func NewClient(accountSid string, authToken string, httpClient *http.Client) *Cl c.Video = NewVideoClient(accountSid, authToken, httpClient) c.TaskRouter = NewTaskRouterClient(accountSid, authToken, httpClient) c.Insights = NewInsightsClient(accountSid, authToken, httpClient) + c.Resource = NewServiceResourceClient(accountSid, authToken, httpClient) c.Accounts = &AccountService{client: c} c.Applications = &ApplicationService{client: c} @@ -425,7 +449,6 @@ func NewClient(accountSid string, authToken string, httpClient *http.Client) *Cl client: c, }, } - return c } diff --git a/responses_test.go b/responses_test.go index c6776b9..01b812b 100644 --- a/responses_test.go +++ b/responses_test.go @@ -10,7 +10,14 @@ import ( // the envClient is configured to use an Account Sid and Auth Token set in the // environment. all non-short tests should use the envClient -var envClient = NewClient(os.Getenv("TWILIO_ACCOUNT_SID"), os.Getenv("TWILIO_AUTH_TOKEN"), nil) +var envClient *Client + +func init() { + if os.Getenv("TWILIO_ACCOUNT_SID") == "" { + os.Stderr.WriteString("warning: no TWILIO_ACCOUNT_SID configured, HTTP tests will probably fail...\n\n") + } + envClient = NewClient(os.Getenv("TWILIO_ACCOUNT_SID"), os.Getenv("TWILIO_AUTH_TOKEN"), nil) +} type Server struct { s *httptest.Server @@ -66,6 +73,7 @@ func getServer(response []byte) (*Client, *Server) { client.Video.Base = s.URL client.TaskRouter.Base = s.URL client.Insights.Base = s.URL + client.Resource.Base = s.URL return client, s } @@ -81,6 +89,7 @@ func getServerCode(response []byte, code int) (*Client, *Server) { client.Lookup.Base = s.URL client.Video.Base = s.URL client.TaskRouter.Base = s.URL + client.Resource.Base = s.URL return client, s } diff --git a/service_resource.go b/service_resource.go new file mode 100644 index 0000000..b7e4a2c --- /dev/null +++ b/service_resource.go @@ -0,0 +1,364 @@ +package twilio + +import ( + "context" + "fmt" + "net/url" +) + +const ( + messagingServicePathPart = "Services" + phoneNumberServicePathTemplate = messagingServicePathPart + "/%s/PhoneNumbers" + alphaSenderServicePathTemplate = messagingServicePathPart + "/%s/AlphaSenders" + shortCodeServicePathTemplate = messagingServicePathPart + "/%s/ShortCodes" +) + +type ServiceResourceService struct { + *MessagingService + PhoneNumbers *PhoneNumberService + ShortCodes *ShortCodeService + AlphaSenders *AlphaSenderService +} + +type MessagingService struct { + client *Client +} + +type PhoneNumberService struct { + client *Client +} + +type ShortCodeService struct { + client *Client +} + +type AlphaSenderService struct { + client *Client +} + +type MessagingResourceLinks struct { + PhoneNumbers string `json:"phone_numbers"` + ShortCodes string `json:"short_codes"` + AlphaSenders string `json:"alpha_senders"` + Messages string `json:"messages"` + Broadcasts string `json:"broadcasts"` +} + +type MessagingResource struct { + AccountSid string `json:"account_sid"` + Sid string `json:"sid"` + DateCreated TwilioTime `json:"date_created"` + DateUpdated TwilioTime `json:"date_updated"` + FriendlyName string `json:"friendly_name"` + InboundRequestURL string `json:"inbound_request_url"` + InboundMethod string `json:"inbound_method"` + FallbackURL string `json:"fallback_url"` + FallbackMethod string `json:"fallback_method"` + StatusCallback string `json:"status_callback"` + StickySender bool `json:"sticky_sender"` + SmartEncoding bool `json:"smart_encoding"` + MMSConverter bool `json:"mms_converter"` + FallbackToLongCode bool `json:"fallback_to_long_code"` + ScanMessageContent string `json:"scan_message_content"` + AreaCodeGeomatch bool `json:"area_code_geomatch"` + ValidityPeriod int `json:"validity_period"` + SynchronousValidation bool `json:"synchronous_validation"` + Links *MessagingResourceLinks `json:"links"` + URL string `json:"url"` +} + +type MessagingResourcePage struct { + Meta Meta `json:"meta"` + MessagingResource []*MessagingResource `json:"services"` +} + +// Create a service resource +// +// https://www.twilio.com/docs/sms/services/api#create-a-service-resource +func (s *MessagingService) Create(ctx context.Context, data url.Values) (*MessagingResource, error) { + mr := new(MessagingResource) + err := s.client.CreateResource(ctx, messagingServicePathPart, data, mr) + return mr, err +} + +// Get a service resource +// +// https://www.twilio.com/docs/sms/services/api#fetch-a-service-resource +func (s *MessagingService) Get(ctx context.Context, sid string) (*MessagingResource, error) { + mr := new(MessagingResource) + err := s.client.GetResource(ctx, messagingServicePathPart, sid, mr) + return mr, err +} + +// Update a service resource +// +// https://www.twilio.com/docs/sms/services/api#update-a-service-resource +func (s *MessagingService) Update(ctx context.Context, sid string, data url.Values) (*MessagingResource, error) { + mr := new(MessagingResource) + err := s.client.UpdateResource(ctx, messagingServicePathPart, sid, data, mr) + return mr, err +} + +// Delete a service resource +// +// https://www.twilio.com/docs/sms/services/api#delete-a-service-resource +func (s *MessagingService) Delete(ctx context.Context, sid string, data url.Values) error { + return s.client.DeleteResource(ctx, messagingServicePathPart, sid) +} + +// GetPage retrieves an MessagingResourcePage, filtered by the given data. +func (s *MessagingService) GetPage(ctx context.Context, data url.Values) (*MessagingResourcePage, error) { + iter := s.GetPageIterator(data) + return iter.Next(ctx) +} + +type MessagingServiceIterator struct { + p *PageIterator +} + +// GetPageIterator returns an iterator which can be used to retrieve pages. +func (s *MessagingService) GetPageIterator(data url.Values) *MessagingServiceIterator { + iter := NewPageIterator(s.client, data, messagingServicePathPart) + return &MessagingServiceIterator{ + p: iter, + } +} + +// Next returns the next page of resources. If there are no more resources, +// NoMoreResults is returned. +func (c *MessagingServiceIterator) Next(ctx context.Context) (*MessagingResourcePage, error) { + cp := new(MessagingResourcePage) + err := c.p.Next(ctx, cp) + if err != nil { + return nil, err + } + c.p.SetNextPageURI(cp.Meta.NextPageURL) + return cp, nil +} + +type PhoneNumberResource struct { + Sid string `json:"sid"` + AccountSid string `json:"account_sid"` + ServiceSid string `json:"service_sid"` + DateCreated TwilioTime `json:"date_created"` + DateUpdated TwilioTime `json:"date_updated"` + PhoneNumber PhoneNumber `json:"phone_number"` + CountryCode string `json:"country_code"` + Capabilities []string `json:"capabilities"` + URL string `json:"url"` +} + +type PhoneNumberResourcePage struct { + Meta Meta `json:"meta"` + PhoneNumbers []*PhoneNumberResource `json:"phone_numbers"` +} + +// Create a phone number resource for messaging service +// +// https://www.twilio.com/docs/sms/services/api/phonenumber-resource#create-a-phonenumber-resource +func (s *PhoneNumberService) Create(ctx context.Context, serviceSID string, data url.Values) (*PhoneNumberResource, error) { + pnr := new(PhoneNumberResource) + pathPart := fmt.Sprintf(phoneNumberServicePathTemplate, serviceSID) + err := s.client.CreateResource(ctx, pathPart, data, pnr) + return pnr, err +} + +// Get a phone number resource for messaging service +// +// https://www.twilio.com/docs/sms/services/api/phonenumber-resource#fetch-a-phonenumber-resource +func (s *PhoneNumberService) Get(ctx context.Context, serviceSID, sid string) (*PhoneNumberResource, error) { + pnr := new(PhoneNumberResource) + pathPart := fmt.Sprintf(phoneNumberServicePathTemplate, serviceSID) + err := s.client.GetResource(ctx, pathPart, sid, pnr) + return pnr, err +} + +// Delete a phone number resource from messaging service +// +// https://www.twilio.com/docs/sms/services/api/phonenumber-resource#delete-a-phonenumber-resource +func (s *PhoneNumberService) Delete(ctx context.Context, serviceSID, sid string, data url.Values) error { + pathPart := fmt.Sprintf(phoneNumberServicePathTemplate, serviceSID) + return s.client.DeleteResource(ctx, pathPart, sid) +} + +// GetPage retrieves an PhoneNumberResourcePage for given messaging service, filtered by the given data. +func (s *PhoneNumberService) GetPage(ctx context.Context, serviceSID string, data url.Values) (*PhoneNumberResourcePage, error) { + iter := s.GetPageIterator(serviceSID, data) + return iter.Next(ctx) +} + +type PhoneNumberIterator struct { + p *PageIterator +} + +// GetPageIterator returns an iterator which can be used to retrieve pages. +func (s *PhoneNumberService) GetPageIterator(serviceSID string, data url.Values) *PhoneNumberIterator { + pathPart := fmt.Sprintf(phoneNumberServicePathTemplate, serviceSID) + iter := NewPageIterator(s.client, data, pathPart) + return &PhoneNumberIterator{ + p: iter, + } +} + +// Next returns the next page of resources. If there are no more resources, +// NoMoreResults is returned. +func (c *PhoneNumberIterator) Next(ctx context.Context) (*PhoneNumberResourcePage, error) { + cp := new(PhoneNumberResourcePage) + err := c.p.Next(ctx, cp) + if err != nil { + return nil, err + } + c.p.SetNextPageURI(cp.Meta.NextPageURL) + return cp, nil +} + +type AlphaSenderResource struct { + Sid string `json:"sid"` + AccountSid string `json:"account_sid"` + ServiceSid string `json:"service_sid"` + DateCreated TwilioTime `json:"date_created"` + DateUpdated TwilioTime `json:"date_updated"` + AlphaSender string `json:"alpha_sender"` + Capabilities []string `json:"capabilities"` + URL string `json:"url"` +} + +type AlphaSenderResourcePage struct { + Meta Meta `json:"meta"` + AlphaSenders []*AlphaSenderResource `json:"alpha_senders"` +} + +// Create an alpha sender resource for messaging service +// +// https://www.twilio.com/docs/sms/services/api/alphasender-resource#create-an-alphasender-resource +func (s *AlphaSenderService) Create(ctx context.Context, serviceSID string, data url.Values) (*AlphaSenderResource, error) { + asr := new(AlphaSenderResource) + pathPart := fmt.Sprintf(alphaSenderServicePathTemplate, serviceSID) + err := s.client.CreateResource(ctx, pathPart, data, asr) + return asr, err +} + +// Get a alpha sender resource for messaging service +// +// https://www.twilio.com/docs/sms/services/api/alphasender-resource#fetch-an-alphasender-resource +func (s *AlphaSenderService) Get(ctx context.Context, serviceSID, sid string) (*AlphaSenderResource, error) { + asr := new(AlphaSenderResource) + pathPart := fmt.Sprintf(alphaSenderServicePathTemplate, serviceSID) + err := s.client.GetResource(ctx, pathPart, sid, asr) + return asr, err +} + +// Delete a alpha sender resource from messaging service +// +// https://www.twilio.com/docs/sms/services/api/alphasender-resource#delete-an-alphasender-resource +func (s *AlphaSenderService) Delete(ctx context.Context, serviceSID, sid string, data url.Values) error { + pathPart := fmt.Sprintf(alphaSenderServicePathTemplate, serviceSID) + return s.client.DeleteResource(ctx, pathPart, sid) +} + +// GetPage retrieves an AlphaSenderResourcePage for given messaging service, filtered by the given data. +func (s *AlphaSenderService) GetPage(ctx context.Context, serviceSID string, data url.Values) (*AlphaSenderResourcePage, error) { + iter := s.GetPageIterator(serviceSID, data) + return iter.Next(ctx) +} + +type AlphaSenderIterator struct { + p *PageIterator +} + +// GetPageIterator returns an iterator which can be used to retrieve pages. +func (s *AlphaSenderService) GetPageIterator(serviceSID string, data url.Values) *AlphaSenderIterator { + pathPart := fmt.Sprintf(alphaSenderServicePathTemplate, serviceSID) + iter := NewPageIterator(s.client, data, pathPart) + return &AlphaSenderIterator{ + p: iter, + } +} + +// Next returns the next page of resources. If there are no more resources, +// NoMoreResults is returned. +func (c *AlphaSenderIterator) Next(ctx context.Context) (*AlphaSenderResourcePage, error) { + cp := new(AlphaSenderResourcePage) + err := c.p.Next(ctx, cp) + if err != nil { + return nil, err + } + c.p.SetNextPageURI(cp.Meta.NextPageURL) + return cp, nil +} + +type ShortCodeResource struct { + Sid string `json:"sid"` + AccountSid string `json:"account_sid"` + ServiceSid string `json:"service_sid"` + DateCreated TwilioTime `json:"date_created"` + DateUpdated TwilioTime `json:"date_updated"` + ShortCode string `json:"short_code"` + CountryCode string `json:"country_code"` + Capabilities []string `json:"capabilities"` + URL string `json:"url"` +} + +type ShortCodeResourcePage struct { + Meta Meta `json:"meta"` + ShortCodes []*ShortCodeResource `json:"short_codes"` +} + +// Create a short code resource for messaging service +// +// https://www.twilio.com/docs/sms/services/api/shortcode-resource#create-a-shortcode-resource +func (s *ShortCodeService) Create(ctx context.Context, serviceSID string, data url.Values) (*ShortCodeResource, error) { + scr := new(ShortCodeResource) + pathPart := fmt.Sprintf(shortCodeServicePathTemplate, serviceSID) + err := s.client.CreateResource(ctx, pathPart, data, scr) + return scr, err +} + +// Get a short code resource for messaging service +// +// https://www.twilio.com/docs/sms/services/api/shortcode-resource#fetch-a-shortcode-resource +func (s *ShortCodeService) Get(ctx context.Context, serviceSID, sid string) (*ShortCodeResource, error) { + scr := new(ShortCodeResource) + pathPart := fmt.Sprintf(shortCodeServicePathTemplate, serviceSID) + err := s.client.GetResource(ctx, pathPart, sid, scr) + return scr, err +} + +// Delete a short code resource from messaging service +// +// https://www.twilio.com/docs/sms/services/api/shortcode-resource#delete-a-shortcode-resource +func (s *ShortCodeService) Delete(ctx context.Context, serviceSID, sid string, data url.Values) error { + pathPart := fmt.Sprintf(shortCodeServicePathTemplate, serviceSID) + return s.client.DeleteResource(ctx, pathPart, sid) +} + +// GetPage retrieves an ShortCodeResourcePage for given messaging service, filtered by the given data. +func (s *ShortCodeService) GetPage(ctx context.Context, serviceSID string, data url.Values) (*ShortCodeResourcePage, error) { + iter := s.GetPageIterator(serviceSID, data) + return iter.Next(ctx) +} + +type ShortCodeIterator struct { + p *PageIterator +} + +// GetPageIterator returns an iterator which can be used to retrieve pages. +func (s *ShortCodeService) GetPageIterator(serviceSID string, data url.Values) *ShortCodeIterator { + pathPart := fmt.Sprintf(shortCodeServicePathTemplate, serviceSID) + iter := NewPageIterator(s.client, data, pathPart) + return &ShortCodeIterator{ + p: iter, + } +} + +// Next returns the next page of resources. If there are no more resources, +// NoMoreResults is returned. +func (c *ShortCodeIterator) Next(ctx context.Context) (*ShortCodeResourcePage, error) { + cp := new(ShortCodeResourcePage) + err := c.p.Next(ctx, cp) + if err != nil { + return nil, err + } + c.p.SetNextPageURI(cp.Meta.NextPageURL) + return cp, nil +} diff --git a/service_resource_test.go b/service_resource_test.go new file mode 100644 index 0000000..06085ad --- /dev/null +++ b/service_resource_test.go @@ -0,0 +1,140 @@ +package twilio + +import ( + "context" + "testing" +) + +func TestFetchMessagingResource(t *testing.T) { + t.Parallel() + client, server := getServer(messagingResourceResponse) + defer server.Close() + msr, err := client.Resource.ServiceResources.Get(context.Background(), "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + if err != nil { + t.Fatal(err) + } + if msr.Sid != "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" { + t.Errorf("messaging resource: got sid %q, want %q", msr.Sid, "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + } +} + +func TestFetchPhoneNumberResource(t *testing.T) { + t.Parallel() + client, server := getServer(phoneNumberResourceResponse) + defer server.Close() + pnr, err := client.Resource.ServiceResources.PhoneNumbers.Get(context.Background(), "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + if err != nil { + t.Fatal(err) + } + if pnr.ServiceSid != "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" { + t.Errorf("messaging resource: got sid %q, want %q", pnr.ServiceSid, "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + } + if pnr.Sid != "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" { + t.Errorf("phone number resource: got sid %q, want %q", pnr.Sid, "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + } +} + +func TestFetchAlphaSenderResource(t *testing.T) { + t.Parallel() + client, server := getServer(alphaSenderResourceResponse) + defer server.Close() + asr, err := client.Resource.ServiceResources.AlphaSenders.Get(context.Background(), "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + if err != nil { + t.Fatal(err) + } + if asr.ServiceSid != "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" { + t.Errorf("messaging resource: got sid %q, want %q", asr.ServiceSid, "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + } + if asr.Sid != "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" { + t.Errorf("alpha sender resource: got sid %q, want %q", asr.Sid, "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + } +} + +func TestFetchShortCodeResource(t *testing.T) { + t.Parallel() + client, server := getServer(shortCodeResourceResponse) + defer server.Close() + asr, err := client.Resource.ServiceResources.ShortCodes.Get(context.Background(), "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + if err != nil { + t.Fatal(err) + } + if asr.ServiceSid != "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" { + t.Errorf("messaging resource: got sid %q, want %q", asr.ServiceSid, "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + } + if asr.Sid != "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" { + t.Errorf("short code resource: got sid %q, want %q", asr.Sid, "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + } +} + + +var messagingResourceResponse = []byte(` +{ + "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "date_created": "2015-07-30T20:12:31Z", + "date_updated": "2015-07-30T20:12:33Z", + "friendly_name": "My Service!", + "inbound_request_url": "https://www.example.com/", + "inbound_method": "POST", + "fallback_url": "https://www.example.com", + "fallback_method": "GET", + "status_callback": "https://www.example.com", + "sticky_sender": true, + "smart_encoding": false, + "mms_converter": true, + "fallback_to_long_code": true, + "scan_message_content": "inherit", + "area_code_geomatch": true, + "validity_period": 600, + "synchronous_validation": true, + "links": { + "phone_numbers": "https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/PhoneNumbers", + "short_codes": "https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ShortCodes", + "alpha_senders": "https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AlphaSenders", + "messages": "https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages", + "broadcasts": "https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Broadcasts" + }, + "url": "https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" +} +`) + +var phoneNumberResourceResponse = []byte(` +{ + "sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "date_created": "2015-07-30T20:12:31Z", + "date_updated": "2015-07-30T20:12:33Z", + "phone_number": "+987654321", + "country_code": "US", + "capabilities": [], + "url": "https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/PhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" +} +`) + +var alphaSenderResourceResponse = []byte(` +{ + "sid": "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "date_created": "2015-07-30T20:12:31Z", + "date_updated": "2015-07-30T20:12:33Z", + "alpha_sender": "My company", + "capabilities": [], + "url": "https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AlphaSenders/AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" +} +`) + +var shortCodeResourceResponse = []byte(` +{ + "sid": "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "date_created": "2015-07-30T20:12:31Z", + "date_updated": "2015-07-30T20:12:33Z", + "short_code": "12345", + "country_code": "US", + "capabilities": [], + "url": "https://messaging.twilio.com/v1/Services/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ShortCodes/SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" +} +`)