Skip to content

Commit

Permalink
docs: add new examples methods
Browse files Browse the repository at this point in the history
  • Loading branch information
kenriortega committed Nov 5, 2021
1 parent f44f6d9 commit cc4f9a3
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
13 changes: 12 additions & 1 deletion examples/main.go → examples/info/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,29 @@ import (
"fmt"
"log"
"os"
"runtime"

"github.com/joho/godotenv"
"github.com/kenriortega/qvapay-go"
)

func init() {
err := godotenv.Load()
if err != nil {
log.Fatalf(err.Error())
}
numcpu := runtime.NumCPU()
runtime.GOMAXPROCS(numcpu) // Try to use all available CPUs.
}

func main() {
api := qvapay.NewAPIClient(
os.Getenv("APP_ID"), // app_id
os.Getenv("APP_SECRET"), // secret_id
qvapay.BaseURL, // constants url base https://qvapay.com/api
false, // skip verificationSSL
nil, // custom http.Client
nil, // debug io.Writter (os.Stdout)
os.Stdout, // debug io.Writter (os.Stdout)
)

info, err := api.GetInfo(context.Background())
Expand Down
41 changes: 41 additions & 0 deletions examples/txs/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package main

import (
"context"
"fmt"
"log"
"os"
"runtime"

"github.com/joho/godotenv"
"github.com/kenriortega/qvapay-go"
)

func init() {
err := godotenv.Load()
if err != nil {
log.Fatalf(err.Error())
}
numcpu := runtime.NumCPU()
runtime.GOMAXPROCS(numcpu) // Try to use all available CPUs.
}

func main() {
api := qvapay.NewAPIClient(
os.Getenv("APP_ID"), // app_id
os.Getenv("APP_SECRET"), // secret_id
qvapay.BaseURL, // constants url base https://qvapay.com/api
false, // skip verificationSSL
nil, // custom http.Client
nil, // debug io.Writter (os.Stdout)
)

tx, err := api.GetTransactions(
context.Background(),
qvapay.APIQueryParams{Page: 1},
)
if err != nil {
log.Fatalf(err.Error())
}
fmt.Println(tx)
}

0 comments on commit cc4f9a3

Please sign in to comment.