diff --git a/examples/get_address/get_address.go b/examples/get_address/get_address.go new file mode 100644 index 0000000..050fccc --- /dev/null +++ b/examples/get_address/get_address.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + "github.com/joho/godotenv" + "github.com/go-resty/resty/v2" + "os" +) + +func main(){ + godotenv.Load(".env") + apiKey := os.Getenv("API_KEY") + restClient := resty.New() + + rawGetAddressRes, _ := restClient.R(). + Get("https://block.io/api/v2/get_new_address?api_key=" + apiKey) + + fmt.Println("get_new_address response:") + fmt.Print(rawGetAddressRes) +} diff --git a/examples/get_address/go.mod b/examples/get_address/go.mod new file mode 100644 index 0000000..5958878 --- /dev/null +++ b/examples/get_address/go.mod @@ -0,0 +1,8 @@ +module block-io/block_io-go/examples/get_address + +go 1.12 + +require ( + github.com/go-resty/resty/v2 v2.3.0 + github.com/joho/godotenv v1.3.0 +) diff --git a/examples/get_address/go.sum b/examples/get_address/go.sum new file mode 100644 index 0000000..6f208c0 --- /dev/null +++ b/examples/get_address/go.sum @@ -0,0 +1,10 @@ +github.com/go-resty/resty/v2 v2.3.0 h1:JOOeAvjSlapTT92p8xiS19Zxev1neGikoHsXJeOq8So= +github.com/go-resty/resty/v2 v2.3.0/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120 h1:EZ3cVSzKOlJxAd8e8YAJ7no8nNypTxexh/YE/xW3ZEY= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/examples/get_balance/get_balance.go b/examples/get_balance/get_balance.go new file mode 100644 index 0000000..a0d862d --- /dev/null +++ b/examples/get_balance/get_balance.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + "github.com/go-resty/resty/v2" + "github.com/joho/godotenv" + "os" +) + +func main(){ + godotenv.Load(".env") + apiKey := os.Getenv("API_KEY") + address := os.Getenv("ADDRESS") + restClient := resty.New() + + rawGetAddressBalanceRes, _ := restClient.R(). + Get("https://block.io/api/v2/get_address_balance?api_key=" + apiKey + "&address=" + address) + + fmt.Println("get_address_balance response:") + fmt.Print(rawGetAddressBalanceRes) +} diff --git a/examples/get_balance/go.mod b/examples/get_balance/go.mod new file mode 100644 index 0000000..1e1a0c0 --- /dev/null +++ b/examples/get_balance/go.mod @@ -0,0 +1,8 @@ +module block-io/block_io-go/examples/get_balance + +go 1.12 + +require ( + github.com/go-resty/resty/v2 v2.3.0 + github.com/joho/godotenv v1.3.0 +) diff --git a/examples/get_balance/go.sum b/examples/get_balance/go.sum new file mode 100644 index 0000000..6f208c0 --- /dev/null +++ b/examples/get_balance/go.sum @@ -0,0 +1,10 @@ +github.com/go-resty/resty/v2 v2.3.0 h1:JOOeAvjSlapTT92p8xiS19Zxev1neGikoHsXJeOq8So= +github.com/go-resty/resty/v2 v2.3.0/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120 h1:EZ3cVSzKOlJxAd8e8YAJ7no8nNypTxexh/YE/xW3ZEY= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=