forked from saintpete/twilio-go
-
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
Open
YReshetko
wants to merge
10
commits into
kevinburke:master
Choose a base branch
from
YReshetko:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+531
−5
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dadf399
Adding service resource
df45025
Update messaging service path part
e03bbb1
Fix geomatch type for messsaging service
a87a69d
Add phone number and alpha sender resources
3ec0116
Add short code service for messaging services
f0cdecf
Adding service resource test
4c38729
Clean up gitignore
e6378a8
Self review change
b127557
Fix test flags initialization order
6d50341
Messaging service code review update
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,10 @@ var TaskRouterBaseUrl = "https://taskrouter.twilio.com" | |
|
||
const TaskRouterVersion = "v1" | ||
|
||
// Service Resource | ||
const ServiceResourceBaseUrl = "https://messaging.twilio.com" | ||
const ServiceResourceVersion = "v1" | ||
|
||
type Client struct { | ||
*rest.Client | ||
Monitor *Client | ||
|
@@ -78,6 +82,7 @@ type Client struct { | |
Verify *Client | ||
Video *Client | ||
TaskRouter *Client | ||
Resource *Client | ||
|
||
// FullPath takes a path part (e.g. "Messages") and | ||
// returns the full API path, including the version (e.g. | ||
|
@@ -134,6 +139,8 @@ type Client struct { | |
|
||
// NewTaskRouterClient initializes these services | ||
Workspace func(sid string) *WorkspaceService | ||
|
||
ServiceResourceService *ServiceResourceService | ||
} | ||
|
||
const defaultTimeout = 30*time.Second + 500*time.Millisecond | ||
|
@@ -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 | ||
func NewServiceResource(accountSid string, authToken string, httpClient *http.Client) *Client { | ||
c := newNewClient(accountSid, authToken, ServiceResourceBaseUrl, httpClient) | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Generally these are plural elsewhere in the API... PhoneNumbers, AlphaSenders, ShortCodes. |
||
AlphaSender: &AlphaSenderService{c}, | ||
ShortCode: &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. | ||
|
@@ -345,6 +365,7 @@ func NewClient(accountSid string, authToken string, httpClient *http.Client) *Cl | |
c.Verify = NewVerifyClient(accountSid, authToken, httpClient) | ||
c.Video = NewVideoClient(accountSid, authToken, httpClient) | ||
c.TaskRouter = NewTaskRouterClient(accountSid, authToken, httpClient) | ||
c.Resource = NewServiceResource(accountSid, authToken, httpClient) | ||
|
||
c.Accounts = &AccountService{client: c} | ||
c.Applications = &ApplicationService{client: c} | ||
|
@@ -392,7 +413,6 @@ func NewClient(accountSid string, authToken string, httpClient *http.Client) *Cl | |
client: c, | ||
}, | ||
} | ||
|
||
return c | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?