Categorygithub.com/rizalgowandy/synapse-go
modulepackage
0.4.0
Repository: https://github.com/rizalgowandy/synapse-go.git
Documentation: pkg.go.dev

# README

Go Doc Release Go Report Card Build Status Sourcegraph

logo

Getting Started

Every request to the Synapse API must be authenticated with a client id and secret key. You can get this information after creating a Synapse account.

Installation

go get -v github.com/rizalgowandy/synapse-go

Quick Start

package main

import (
	"context"
	"log"

	"github.com/rizalgowandy/synapse-go"
	"github.com/rizalgowandy/synapse-go/pkg/api"
	"github.com/rizalgowandy/synapse-go/pkg/entity"
	"github.com/rizalgowandy/synapse-go/pkg/enum"
)

func main() {
	client, err := synapse.NewClient(&api.Config{
		ID:               "REPLACE_WITH_YOUR_API_CLIENT_ID",
		Key:              "REPLACE_WITH_YOUR_API_CLIENT_SECRET",
		Timeout:          0,    // Default: 1 min.
		RetryCount:       0,    // Default: 0 = disable.
		RetryMaxWaitTime: 0,    // Default: 2 secs.
		Debug:            true, // Turn on development for easier debugging.
	})
	if err != nil {
		log.Fatal(err)
	}

	// Generate refresh token.
	resp, err := client.GenerateRefreshToken(
		context.Background(),
		&entity.GenerateRefreshTokenReq{
			UserID:        "REPLACE_WITH_USER_ID",
			UserIPAddress: "REPLACE_WITH_USER_IP_ADDRESS",
			Email:         "REPLACE_WITH_USER_EMAIL",
			Password:      "REPLACE_WITH_USER_PASSWORD",
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("%+v", resp)
}

For more example check here.

Supported API

Version: 2023-03-08

# Packages

No description provided by the author
No description provided by the author

# Functions

NewClient creates a client to interact with Synapse API.

# Structs

Client is the main client to interact with Synapse API.