yapla

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2021 License: MIT Imports: 7 Imported by: 0

README

go-yapla

Go Report Card Go Reference Go coverage Apache V2 License

Support Yapla API 2.0
Official documentation available here

Getting Started

Dependencies

No extra dependency are needed

Go mod

To get a specific release version use @<tag> in your go get command.

go get git.iglou.eu/Production/go-yapla@v0.0.1

Or @latest to get the latest repository change

go get git.iglou.eu/Production/go-yapla@latest

Quick Example

This example shows a complete working Go file which will login a member and showing their information map

package main

import (
	"fmt"
	"log"

	"git.iglou.eu/Production/go-yapla"
)

func main() {
    // Create a new required instance
    //
    // Need to provide a valid Yapla API Key 
    //
    // You can overwrite default configuration
    // For this provide an extra argument like
    // yapla.Config{...}
	y, err := yapla.NewSession("HP1ST252NFKX6Z6RVJ4RKEU23WS2QXSTQHTVYA1JAFWYX306")
	if err != nil {
		log.Fatalln(err)
	}

    // Login a Yapla member of your organisation
    // Need "only" user email and user password
    //
    // Return a struct with the API reply state and data on map format
    //
    // LoginContact() function is also avilable
	yRep, err := y.LoginMember("moncompte@macompagnie.com", "monp4ssW0R4!")
	if err != nil {
		log.Fatalln(err)
	}

	fmt.Println(yRep.Data)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	Config Config
	// contains filtered or unexported fields
}

func NewSession

func NewSession(apiKey string, config ...Config) (*Api, error)

func (*Api) LoginContact

func (api *Api) LoginContact(login, password string) (Reply, error)

func (*Api) LoginMember

func (api *Api) LoginMember(login, password string) (Reply, error)

type Config

type Config struct {
	URL     string
	Timeout time.Duration
}

type Reply

type Reply struct {
	Result bool                   `json:"result"`
	Data   map[string]interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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