This Api is meant for 3rd party integrations
- In order to successfully build and run your SDK files, you are required to have the following setup in your system:
- Go (Visit https://golang.org/doc/install for more details on how to install Go)
- Java VM Version 8 or later
- Eclipse 4.6 (Neon) or later (http://www.eclipse.org/neon/)
- GoClipse setup within above installed Eclipse (Follow the instructions at this link to setup GoClipse)
- Ensure that
GOPATH
environment variable is set in the system variables. If not, set it to your workspace directory where you will be adding your Go projects. - The generated code uses unirest-go http library. Therefore, you will need internet access to resolve this dependency. If Go is properly installed and configured, run the following command to pull the dependency:
go get github.com/apimatic/unirest-go
This will install unirest-go in the GOPATH
you specified in the system variables.
Now follow the steps mentioned below to build your SDK:
- Open eclipse in the Go language perspective and click on the
Import
option inFile
menu.
- Select
General -> Existing Projects into Workspace
option from the tree list.
- In
Select root directory
, provide path to the unzipped archive for the generated code. Once the path is set and the Project becomes visible underProjects
clickFinish
- The Go library will be imported and its files will be visible in the Project Explorer
The following section explains how to use the CynsmsapiLib library in a new project.
Create a new project in Eclipse by File
-> New
-> Go Project
Name the Project as Test
and click Finish
Create a new directory in the src
directory of this project
Name it test.com
Now create a new file inside src/test.com
Name it testsdk.go
In this Go file, you can start adding code to initialize the client library. Sample code to initialize the client library and using its methods is given in the subsequent sections.
You need to import your generated library in this project in order to make use of its functions. In order to import the library, you can add its path in the GOPATH
for this project. Follow the below steps:
Right click on the project name and click on Properties
Choose Go Compiler
from the side menu. Check Use project specific settings
and uncheck Use same value as the GOPATH environment variable.
. By default, the GOPATH value from the environment variables will be visible in Eclipse GOPATH
. Do not remove this as this points to the unirest dependency.
Append the library path to this GOPATH
Once the path is appended, click on OK
Right click on the project name and click on Build Project
If the build is successful, right click on your Go file and click on Run As
-> Go Application
Factory for the API
interface can be accessed from the package api_pkg.
aPI := api_pkg.NewAPI()
TODO: Add a method description
func (me *API_IMPL) CreateSendSMS(
apiKey string,
to string,
sms string,
from string)(string,error)
Parameter | Tags | Description |
---|---|---|
apiKey | Required DefaultValue |
set your API_KEY from http://sms.cynojine.com/sms-api/info (user panel) |
to | Required DefaultValue |
the number we are sending to - Any phone number |
sms | Required |
SMS Body |
from | Required |
Change the from number below. It can be a valid phone number or a String |
apiKey := "xxxxxxxxxxxxx"
to := "260986"
sms := "sms"
from := "from"
var result string
result,_ = aPI.CreateSendSMS(apiKey, to, sms, from)
Checking SMS Balance
func (me *API_IMPL) GetBALANCECHECK(input *GetBALANCECHECKInput, queryParameters map[string]interface{})(,error)
Parameter | Tags | Description |
---|---|---|
apiKey | Required |
Get your account balance |
response | Required DefaultValue |
Json Responce |
queryParameters | Optional |
Additional optional query parameters are supported by this method |
collect := new (api_pkg.GetBALANCECHECKInput)
apiKey := "api_key"
collect.ApiKey = apiKey
response := "json"
collect.Response = response
// key-value map for optional query parameters
queryParams := map[string]interface{}{"key" : "value"}
var result
result,_ = aPI.GetBALANCECHECK(collect, queryParams, )