go-reloadly

command module
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2021 License: MIT Imports: 1 Imported by: 0

README

reloadly

Work in progress.

Usage

Getting Started
svc := reloadly.New()
svc.Auth(id, secret)

operator := svc.OperatorsAutoDetect("+34987467293", "ES")

Also, for sandbox usage, you have:

svc := reloadly.New()
svc.Sandbox()

// now all calls use the sandbox base url
svc.Auth(id, secret)
operator := svc.OperatorsAutoDetect("+34987467293", "ES")

Or you can create the Service type directly.

Making requests
req := &TopupRequest{
    RecipientPhone: &RecipientPhone{operator.Country.IsoName, "+9187654467"},
    OperatorID: operator.OperatorID,
	Amount: amount,
}

respV := new(TopupResponse)
httpResponse, err := svc.Request("POST", "/topups", req, respV)

// respV will have the marshalled json response
// err will be an APIError, if we get a json error response, or
// an error created directly from the http library or marshaling
Convenience Methods

Some convenience methods for simple tasks:

svc.Topup("+3441983489", operator, 10)
Topups using suggested amounts

This is useful...

Documentation

Overview

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL