Skip to content

Commit 7322151

Browse files
authored
docs: update readme and documentation link (#58)
1 parent 7bdbc7f commit 7322151

File tree

2 files changed

+38
-28
lines changed

2 files changed

+38
-28
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ contact_links:
66
url: https://stackoverflow.com/questions/tagged/twilio-go+or+twilio+go
77
about: Ask questions on Stack Overflow
88
- name: Documentation
9-
url: https://www.twilio.com/docs/libraries/reference/twilio-go
9+
url: https://github.com/twilio/twilio-go#getting-started
1010
about: View Reference Documentation

README.md

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ The documentation for the Twilio API can be found [here][apidocs].
1111

1212
This library supports the following Go implementations:
1313

14-
* 1.14, 1.15, 1.16
14+
* 1.14
15+
* 1.15
16+
* 1.16
1517

1618
## Installation
1719

@@ -32,25 +34,30 @@ The Twilio `Client` needs your Twilio credentials. You should pass these
3234
directly to the constructor (see the code below).
3335

3436
```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"
3939

40-
client := twilio.NewClient(accountSID, authToken)
40+
func main(){
41+
accountSID := "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
42+
authToken := "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
43+
client := twilio.NewClient(accountSID, authToken)
44+
}
4145
```
4246

4347
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.
4448

4549
```go
50+
package main
4651
import (
4752
"github.com/twilio/twilio-go/twilio"
4853
"os"
4954
)
5055

51-
accountSid := os.Getenv("TWILIO_ACCOUNT_SID")
52-
authToken := os.Getenv("TWILIO_AUTH_TOKEN")
53-
client := twilio.NewClient(accountSid, authToken)
56+
func main(){
57+
accountSid := os.Getenv("TWILIO_ACCOUNT_SID")
58+
authToken := os.Getenv("TWILIO_AUTH_TOKEN")
59+
client := twilio.NewClient(accountSid, authToken)
60+
}
5461
```
5562

5663
### Buy a phone number
@@ -67,7 +74,7 @@ import (
6774
func main() {
6875
accountSid := os.Getenv("TWILIO_ACCOUNT_SID")
6976
authToken := os.Getenv("TWILIO_AUTH_TOKEN")
70-
phoneNumber := os.Getenv("TWILIO_PHONE_NUMBER")
77+
phoneNumber := "AVAILABLE_TWILIO_PHONE_NUMBER"
7178

7279
client := twilio.NewClient(accountSid, authToken)
7380

@@ -79,7 +86,7 @@ func main() {
7986
fmt.Println(err.Error())
8087
err = nil
8188
} else {
82-
fmt.Println(resp)
89+
fmt.Println("Phone Number Status: " + *resp.Status)
8390
}
8491
}
8592
```
@@ -115,8 +122,9 @@ func main() {
115122
fmt.Println(err.Error())
116123
err = nil
117124
} else {
118-
fmt.Println(resp)
119-
}
125+
fmt.Println( "Message Status: " + *resp.Status)
126+
fmt.Println( "Message Sid: " + *resp.Sid)
127+
}
120128
}
121129
```
122130

@@ -151,7 +159,9 @@ func main() {
151159
fmt.Println(err.Error())
152160
err = nil
153161
} else {
154-
fmt.Println(resp)
162+
fmt.Println("Call Status: " + *resp.Status)
163+
fmt.Println("Call Sid: " + *resp.Sid)
164+
fmt.Println("Call Direction: " + *resp.Direction)
155165
}
156166
}
157167
```
@@ -168,21 +178,21 @@ import (
168178
)
169179

170180
func main() {
171-
accountSid := os.Getenv("TWILIO_ACCOUNT_SID")
172-
authToken := os.Getenv("TWILIO_AUTH_TOKEN")
173-
phoneNumber := os.Getenv("TWILIO_PHONE_NUMBER")
181+
accountSid := os.Getenv("TWILIO_ACCOUNT_SID")
182+
authToken := os.Getenv("TWILIO_AUTH_TOKEN")
183+
phoneNumber := os.Getenv("TWILIO_PHONE_NUMBER")
174184

175-
client := twilio.NewClient(accountSid, authToken)
185+
client := twilio.NewClient(accountSid, authToken)
176186

177-
params := &openapi.CreateIncomingPhoneNumberParams{}
178-
params.PhoneNumber = &phoneNumber
187+
params := &openapi.CreateIncomingPhoneNumberParams{}
188+
params.PhoneNumber = &phoneNumber
179189

180-
resp, err := client.ApiV2010.CreateIncomingPhoneNumber(accountSid, params)
181-
if err != nil {
182-
twilioError := err.(*error.TwilioRestError)
183-
fmt.Println(twilioError.Error())
184-
}
185-
fmt.Println(resp)
190+
resp, err := client.ApiV2010.CreateIncomingPhoneNumber(accountSid, params)
191+
if err != nil {
192+
twilioError := err.(*error.TwilioRestError)
193+
fmt.Println(twilioError.Error())
194+
}
195+
}
186196
```
187197

188198
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 ./...
206216

207217
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.
208218

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.
210220

211221
[apidocs]: https://www.twilio.com/docs/api
212222
[twiml]: https://www.twilio.com/docs/api/twiml

0 commit comments

Comments
 (0)