Skip to content
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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

YReshetko
Copy link

Hello @kevinburke

We would like to have messaging service support in the framework
https://www.twilio.com/docs/sms/services/api

@kevinburke
Copy link
Owner

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
Copy link
Owner

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?

t.Parallel()
client, server := getServer(messagingResourceResponse)
defer server.Close()
msr, err := client.Resource.ServiceResourceService.Fetch(context.Background(), "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
Copy link
Owner

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?

Copy link
Author

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?

// 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) {
Copy link
Owner

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().

// 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) {
Copy link
Owner

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.

AlphaSenders []*AlphaSenderResource `json:"alpha_senders"`
}

// Create a alpha sender resource for messaging service
Copy link
Owner

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},
Copy link
Owner

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
Copy link
Owner

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!

@YReshetko
Copy link
Author

Hi @kevinburke
Thank you for review.

I've updated the PR according to your comments apart from Messaging Service client name Resource could you have a look at my comment and advise appropriate name, please?

@yinzara
Copy link

yinzara commented Aug 20, 2020

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.

@kevinburke
Copy link
Owner

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.

@yinzara
Copy link

yinzara commented Aug 20, 2020

Just out of curiosity, have you ever approached Twilio developer evangelists about them providing you with official support?

@kevinburke
Copy link
Owner

Yes, we chat about it every six months or so, they haven't expressed any interest in doing it.

Kevin

@tmc
Copy link

tmc commented Feb 12, 2021

@YReshetko can you resolve the conflicts here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants