Skip to content

klev-dev/klev-api-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

klev API client library for Golang

A wrapper around klev API that makes it easier to use it in Golang.

Installation

Installation is as simple as using go get:

go get github.com/klev-dev/klev-api-go

Documentation

You can find documentation at:

Quickstart

See the examples repository for additional examples.

klev hello world

package main

import (
	"context"
	"fmt"
	"os"
	"time"

	klev "github.com/klev-dev/klev-api-go"
)

func main() {
	fmt.Println(hello(context.Background()))
}

func hello(ctx context.Context) error {
	cfg := klev.NewConfig(os.Getenv("KLEV_TOKEN_DEMO"))
	client := klev.New(cfg)

	log, err := client.LogCreate(ctx, klev.LogIn{})
	if err != nil {
		return err
	}

	_, err = client.Post(ctx, log.LogID, time.Time{}, nil, []byte("hello world!"))
	if err != nil {
		return err
	}

	msg, err := client.Get(ctx, log.LogID, 0)
	if err != nil {
		return err
	}
	fmt.Println(string(msg.Value))

	return nil
}

About

A golang api wrapper for klev.dev

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages