Skip to main content
Version: Go

SDK Installation & Setup

This guide will walk you through the process of installing the Glide SDK and making your first API call to leverage our telecom-powered security features.

Prerequisites

  • Completed the Registration process and obtained your API credentials.

Overview

The Glide SDK provides a seamless interface to interact with Open Gateway services, allowing you to integrate advanced telecom-based security features into your applications. Our SDK supports multiple programming languages to fit your development needs.

Step 1: Set Up Your Project

First, let's create a new project directory and initialize it:

mkdir glide-demo
cd glide-demo
go mod init glide-demo

Step 2: Install the Glide SDK Dependency

Next, you need to install the Glide SDK to the newly created project.

go get github.com/GlideApis/sdk-go

Optional: Step 3: Setup Environment Variables

As a best practice, you should store your credentials in environment variables instead of entering them directly into the SDK constructor.

To do this, create a new file called .env in the root of your project and add the following:

GLIDE_CLIENT_ID=<your-api-key>
GLIDE_CLIENT_SECRET=<your-api-secret>
GLIDE_REDIRECT_URI=<your-redirect-uri>
GLIDE_AUTH_BASE_URL=https://auth.glide.com
GLIDE_API_BASE_URL=https://api.glide.com

If you prefer to set the environment values in the terminal you can run:

For Unix-based systems (Linux/macOS):
export GLIDE_CLIENT_ID=<your-api-key>
export GLIDE_CLIENT_SECRET=<your-api-secret>
export GLIDE_REDIRECT_URI=<your-redirect-uri>
export GLIDE_AUTH_BASE_URL=<glide-auth-url>
export GLIDE_API_BASE_URL=<glide-api-url>
For Windows Command Prompt:
set GLIDE_CLIENT_ID=<your-api-key>
set GLIDE_CLIENT_SECRET=<your-api-secret>
set GLIDE_REDIRECT_URI=<your-redirect-uri>
set GLIDE_AUTH_BASE_URL=<glide-auth-url>
set GLIDE_API_BASE_URL=<glide-api-url>
info

The SDK will automatically pick up these environment variables when you initialize it.

Step 4: Make Your First API Call

Now that you have installed the SDK and set up your environment variables, you can make your first API call.

Create a new file called main.go in your project directory and add the following code:

package main

import (
"fmt"
"log"
"os"
"github.com/GlideApis/sdk-go/pkg/glide"
"github.com/GlideApis/sdk-go/pkg/types"
)

func SetupGlideSettings() types.GlideSdkSettings {
if os.Getenv("GLIDE_CLIENT_ID") == "" {
log.Fatal("GLIDE_CLIENT_ID environment variable is not set")
}
if os.Getenv("GLIDE_CLIENT_SECRET") == "" {
log.Fatal("GLIDE_CLIENT_SECRET environment variable is not set")
}
if os.Getenv("GLIDE_REDIRECT_URI") == "" {
log.Fatal("GLIDE_REDIRECT_URI environment variable is not set")
}
if os.Getenv("GLIDE_AUTH_BASE_URL") == "" {
log.Fatal("GLIDE_AUTH_BASE_URL environment variable is not set")
}
if os.Getenv("GLIDE_API_BASE_URL") == "" {
log.Fatal("GLIDE_API_BASE_URL environment variable is not set")
}
if os.Getenv("REPORT_METRIC_URL") == "" {
fmt.Println("REPORT_METRIC_URL environment variable is not set")
}
return types.GlideSdkSettings{
ClientID: os.Getenv("GLIDE_CLIENT_ID"),
ClientSecret: os.Getenv("GLIDE_CLIENT_SECRET"),
RedirectURI: os.Getenv("GLIDE_REDIRECT_URI"),
Internal: types.InternalSettings{
AuthBaseURL: os.Getenv("GLIDE_AUTH_BASE_URL"),
APIBaseURL: os.Getenv("GLIDE_API_BASE_URL"),
},
}
}

func main() {
fmt.Println("Starting Glide SDK Example...")

// Set up Glide SDK settings
settings := SetupGlideSettings()

// Initialize Glide client
glideClient, err := glide.NewGlideClient(settings)
if err != nil {
log.Fatalf("Failed to create Glide client: %v", err)
}

// MagicAuth Service Example
magicAuthResponse := glideClient.MagicAuth.GetHello()
fmt.Printf("MagicAuth Response: %s\n", magicAuthResponse)

// TelcoFinder Service Example
telcoFinderResponse := glideClient.TelcoFinder.GetHello()
fmt.Printf("TelcoFinder Response: %s\n", telcoFinderResponse)

// SimSwap Service Example
simSwapResponse := glideClient.SimSwap.GetHello()
fmt.Printf("SimSwap Response: %s\n", simSwapResponse)

// NumberVerify Service Example
numberVerifyResponse := glideClient.NumberVerify.GetHello()
fmt.Printf("NumberVerify Response: %s\n", numberVerifyResponse)
}
  • SetupGlideSettings: This function checks for the required environment variables and initializes the GlideSdkSettings struct.
  • Main Function: Initializes the Glide client and demonstrates how to call different services provided by the SDK.

To make sure it is working nice you can run:

go run main.go

You should see output similar to:

Starting Glide SDK Example...
MagicAuth Response: Hello from MagicAuth Service
TelcoFinder Response: Hello from TelcoFinder Service
SimSwap Response: Hello from SimSwap Service
NumberVerify Response: Hello from NumberVerify Service

Next Steps

Now that you've made your first API call, you can explore other features and services provided by the Glide SDK. Refer to the API Documentation for detailed information on available methods and their usage.