You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-27Lines changed: 37 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,9 @@ The documentation for the Twilio API can be found [here][apidocs].
11
11
12
12
This library supports the following Go implementations:
13
13
14
-
* 1.14, 1.15, 1.16
14
+
* 1.14
15
+
* 1.15
16
+
* 1.16
15
17
16
18
## Installation
17
19
@@ -32,25 +34,30 @@ The Twilio `Client` needs your Twilio credentials. You should pass these
32
34
directly to the constructor (see the code below).
33
35
34
36
```go
35
-
import"github.com/twilio/twilio-go"
36
-
37
-
accountSID:="ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
38
-
authToken:="YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
37
+
package main
38
+
import"github.com/twilio/twilio-go/twilio"
39
39
40
-
client:= twilio.NewClient(accountSID, authToken)
40
+
funcmain(){
41
+
accountSID:="ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
42
+
authToken:="YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
43
+
client:= twilio.NewClient(accountSID, authToken)
44
+
}
41
45
```
42
46
43
47
We suggest storing your credentials as environment variables and then use it in your code. Why? You'll never have to worry about committing your credentials and accidentally posting them somewhere public.
44
48
45
49
```go
50
+
package main
46
51
import (
47
52
"github.com/twilio/twilio-go/twilio"
48
53
"os"
49
54
)
50
55
51
-
accountSid:= os.Getenv("TWILIO_ACCOUNT_SID")
52
-
authToken:= os.Getenv("TWILIO_AUTH_TOKEN")
53
-
client:= twilio.NewClient(accountSid, authToken)
56
+
funcmain(){
57
+
accountSid:= os.Getenv("TWILIO_ACCOUNT_SID")
58
+
authToken:= os.Getenv("TWILIO_AUTH_TOKEN")
59
+
client:= twilio.NewClient(accountSid, authToken)
60
+
}
54
61
```
55
62
56
63
### Buy a phone number
@@ -67,7 +74,7 @@ import (
67
74
funcmain() {
68
75
accountSid:= os.Getenv("TWILIO_ACCOUNT_SID")
69
76
authToken:= os.Getenv("TWILIO_AUTH_TOKEN")
70
-
phoneNumber:=os.Getenv("TWILIO_PHONE_NUMBER")
77
+
phoneNumber:="AVAILABLE_TWILIO_PHONE_NUMBER"
71
78
72
79
client:= twilio.NewClient(accountSid, authToken)
73
80
@@ -79,7 +86,7 @@ func main() {
79
86
fmt.Println(err.Error())
80
87
err = nil
81
88
} else {
82
-
fmt.Println(resp)
89
+
fmt.Println("Phone Number Status: " + *resp.Status)
For more descriptive exception types, please see the [Twilio documentation](https://www.twilio.com/docs/libraries/go/usage-guide#exceptions).
@@ -206,7 +216,7 @@ go test ./...
206
216
207
217
If you need help installing or using the library, please check the [Twilio Support Help Center](https://support.twilio.com) first, and [file a support ticket](https://twilio.com/help/contact) if you don't find an answer to your question.
208
218
209
-
All the code [here](twilio/rest) was generated by [twilio-oai-generator](https://github.com/twilio/twilio-oai-generator) by leveraging [openapi-generator](https://github.com/OpenAPITools/openapi-generator) and [twilio-oai](https://github.com/twilio/twilio-oai). If you find an issue with the generation or the openapi specs, please go ahead and open an issue or a PR against the relevant repositories.
219
+
All the code [here](twilio/rest) was generated by [twilio-oai-generator](https://github.com/twilio/twilio-oai-generator) by leveraging [openapi-generator](https://github.com/OpenAPITools/openapi-generator) and [twilio-oai](https://github.com/twilio/twilio-oai). If you find an issue with the generation or the openapi specs, please go ahead and open an issue or a PR against the relevant repositories.
0 commit comments