bugyoclient

package module
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: MIT Imports: 9 Imported by: 2

README

bugyo-client-go

Bugyo Cloud Punchmark Client for go

Bugyo CLI Installation

Windows

  • Install with PowerShell
iwr https://github.com/tomtwinkle/bugyo-client-go/releases/download/v0.0.10/bugyoclient_windows_amd64.zip -OutFile bugyoclient.zip && Expand-Archive -Path bugyoclient.zip && rm bugyoclient.zip
cd bugyoclient
.\bugyoclient.exe help

How to use Bugyo CLI

  • 出勤
.\bugyoclient.exe punchmark --type in
or 
.\bugyoclient.exe pm -t in
  • 退出
.\bugyoclient.exe punchmark --type out
or 
.\bugyoclient.exe pm -t out
  • 外出
.\bugyoclient.exe punchmark --type go
or 
.\bugyoclient.exe pm -t go
  • 再入
.\bugyoclient.exe punchmark --type return
or 
.\bugyoclient.exe pm -t return

How to use client

go get github.com/tomtwinkle/bugyo-client-go
package main

import (
	"github.com/tomtwinkle/bugyo-client-go"
	"log"
)

func main() {
	config := &bugyoclient.BugyoConfig{
		TenantCode: "<Your Tenant Code>",
		OBCiD: "<Your OBCID>",
		Password: "<Your Password>",
    }
	client, err := bugyoclient.NewClient(config)
	if err != nil {
		log.Fatal(err)
	}
	if err := client.Login(); err != nil {
		log.Fatal(err)
	}
	if err := client.Punchmark(bugyoclient.ClockTypeClockIn); err != nil {
		log.Fatal(err)
	}
}

How to develop

  • download go modules
go mod download

How to run test

  • create .env file
TENANTCODE=<You Tenant code>
OBCID=<You OBCID>
PASSWORD=<You Password>
  • go test login
go test -v ./client/login_test.go

Documentation

Index

Constants

View Source
const (
	ClockTypeClockIn  = ClockType("ClockIn")
	ClockTypeClockOut = ClockType("ClockOut")
	ClockTypeGoOut    = ClockType("GoOut")
	ClockTypeReturned = ClockType("Returned")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BugyoClient

type BugyoClient interface {
	Login() error
	IsLoggedIn() bool
	Punchmark(clockType ClockType) error
}

func NewClient

func NewClient(config *BugyoConfig, opts ...Options) (BugyoClient, error)

type BugyoConfig

type BugyoConfig struct {
	TenantCode string
	OBCiD      string
	Password   string
}

type ClockType

type ClockType string

type Options

type Options func(*options)

func WithDebug

func WithDebug() Options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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