-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Messaging service support #51
base: master
Are you sure you want to change the base?
Conversation
Hi, thanks very much for submitting this, apologies I haven't gotten to this yet. |
http.go
Outdated
@@ -318,6 +325,19 @@ func NewVideoClient(accountSid string, authToken string, httpClient *http.Client | |||
return c | |||
} | |||
|
|||
// NewServiceResource returns a new Client to use Service Resource API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the*
Can you link to documentation here?
service_resource_test.go
Outdated
t.Parallel() | ||
client, server := getServer(messagingResourceResponse) | ||
defer server.Close() | ||
msr, err := client.Resource.ServiceResourceService.Fetch(context.Background(), "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we change this to client.Messaging.ServiceResources.Fetch
or similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately Messaging
field exists in Client
structure, so I changed ServiceResourceService
to just ServiceResources
.
I understand that Resource
name is very generic one but I could not fine suitable name.
Maybe we can use Copilot
name as it is main feature of the Messaging services. What do you think?
service_resource.go
Outdated
// Fetch a service resource | ||
// | ||
// https://www.twilio.com/docs/sms/services/api#fetch-a-service-resource | ||
func (s *MessagingService) Fetch(ctx context.Context, sid string) (*MessagingResource, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be just Get()
.
service_resource.go
Outdated
// Fetch a phone number resource for messaging service | ||
// | ||
// https://www.twilio.com/docs/sms/services/api/phonenumber-resource#fetch-a-phonenumber-resource | ||
func (s *PhoneNumberService) Fetch(ctx context.Context, serviceSID, sid string) (*PhoneNumberResource, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto here, we don't use Fetch() anywhere else in the API.
service_resource.go
Outdated
AlphaSenders []*AlphaSenderResource `json:"alpha_senders"` | ||
} | ||
|
||
// Create a alpha sender resource for messaging service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an alpha*
http.go
Outdated
c.APIVersion = ServiceResourceVersion | ||
c.ServiceResourceService = &ServiceResourceService{ | ||
MessagingService: &MessagingService{c}, | ||
PhoneNumber: &PhoneNumberService{c}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally these are plural elsewhere in the API... PhoneNumbers, AlphaSenders, ShortCodes.
@@ -0,0 +1,140 @@ | |||
package twilio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding tests!
Hi @kevinburke I've updated the PR according to your comments apart from Messaging Service client name |
Could we get this updated to master and something finalized? I really want to use this in a terraform provider and I'm having to use a custom version of everything. |
I'll try to take a look at this, but to be clear, I don't get paid to maintain this project so I review and merge changes when I have time. |
Just out of curiosity, have you ever approached Twilio developer evangelists about them providing you with official support? |
Yes, we chat about it every six months or so, they haven't expressed any interest in doing it. Kevin |
@YReshetko can you resolve the conflicts here? |
Hello @kevinburke
We would like to have messaging service support in the framework
https://www.twilio.com/docs/sms/services/api