Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/smspartnerfr/sms-api-go

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/smspartnerfr/sms-api-go

  • v0.0.0-20230515084058-79426aab2d2b
  • Source
  • Go
  • Socket score

Version published
Created
Source

SMS Partner

Summary

SMSPartner API client in Go

Requirements:

To use client v1, you'll need to set the environment variable

  • SMSPARTNER_API_KEY

Installation

$ go get -u -v github.com/hoflish/smspartner-go

Documentation

API Documentation (fr)

Usage

Sample usage: You can see file example_test.go

With default client

  • Check credits
import (
	"fmt"
	"log"
	"net/http"

	"github.com/hoflish/smspartner-go/v1"
)

  client, err := smspartner.NewClient(&http.Client{})
	if err != nil {
		log.Fatal(err)
	}

	credits, err := client.CheckCredits()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("Credits: %#v\n", credits)

With custom client

import (
	"fmt"
	"log"
	"net"
	"net/http"
	"time"

	"github.com/hoflish/smspartner-go/v1"
)


  var tr = &http.Transport{
		Dial: (&net.Dialer{
			Timeout:   10 * time.Second,
			KeepAlive: 10 * time.Second,
		}).Dial,
		TLSHandshakeTimeout: 10 * time.Second,
		// ...
	}
	var client = &http.Client{
		Transport: tr,
	}
	spClient, err := smspartner.NewClient(client)
	if err != nil {
		log.Fatal(err)
	}

	credits, err := spClient.CheckCredits()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("Credits: %#v\n", credits)

Test

Run all tests:

go test ./...

Run tests for one package:

go test ./v1

Run a single test:

go test ./v1 -run TestCredits

FAQs

Package last updated on 15 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc