Skip to content

Commit fee4c3b

Browse files
committed
add documentation
1 parent c92d4cd commit fee4c3b

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ Installation
1818

1919
You can use the different service packages by importing them
2020

21-
`go
22-
import "github.com/kingzbauer/africastalking-go`
21+
```go
22+
import "github.com/kingzbauer/africastalking-go/sms"
23+
```

client/doc.go

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
Package client implements the underlying API calling logic.
3+
4+
Initialize the `Client` and pass it to other API services.
5+
6+
Example:
7+
8+
cli := New(apiKey, username, sandbox)
9+
// You can pass this to the service methods
10+
rep, err := SendMessage(cli, req)
11+
*/
12+
package client

doc.go

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Package africastalking is an unofficial AfricasTalking SDK providing SMS, Voice, Payment, Airtime, USSD API implementations
3+
4+
Currently implemented services
5+
6+
- SMS
7+
*/
8+
package africastalking

sms/doc.go

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Package sms provides SMS sending and fetching API
3+
4+
Example Send SMS:
5+
6+
package main
7+
8+
import (
9+
"fmt"
10+
"os"
11+
12+
"github.com/kingzbauer/africastalking-go/sms"
13+
)
14+
15+
var (
16+
apiKey string = "yourapikey"
17+
username string = "yourusername"
18+
shortCode string = "yourshortcode"
19+
live bool = true
20+
number = "+2547********"
21+
)
22+
23+
func main() {
24+
srv := sms.NewService(apiKey, username, shortCode, live)
25+
rep, err := srv.Send("Test message", []string{number}, shortCode)
26+
27+
if err != nil {
28+
fmt.Printf("Error: %s\n", err)
29+
os.Exit(1)
30+
}
31+
32+
fmt.Printf("Response: %s\n", rep)
33+
}
34+
*/
35+
package sms

0 commit comments

Comments
 (0)