edgeservpos

package module
v0.0.0-...-f1bb141 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 5 Imported by: 0

README

go-edgeservpos

CI codecov Go Reference

A Go client library for the EdgeServ POS API. Provides programmatic access to restaurant point-of-sale data including customer management.

Installation

go get github.com/jeffresc/go-edgeservpos

Usage

package main

import (
	"fmt"
	"log"

	edgeservpos "github.com/jeffresc/go-edgeservpos"
)

func main() {
	client := edgeservpos.NewClient(
		"https://api.example.com", // API host
		"RESTAURANT_CODE",         // Restaurant code
		"CLIENT_ID",               // OAuth client ID
		"CLIENT_SECRET",           // OAuth client secret
		"USERNAME",                // Username
		"PASSWORD",                // Password
	)

	customers, err := client.ListCustomers()
	if err != nil {
		log.Fatal(err)
	}

	for _, c := range customers {
		fmt.Printf("%s %s (%s)\n", c.FirstName, c.LastName, c.EmailAddress)
	}
}

API

Client

NewClient(host, restaurantCode, clientID, clientSecret, username, password string) *Client — Creates a new API client.

Methods
Method Description
GetOAuthToken() (string, error) Retrieves an OAuth bearer token.
ListCustomers() ([]Customer, error) Retrieves all customers for the restaurant. Handles token management automatically.
Types
  • CustomerServerID, FirstName, LastName, EmailAddress, Point, PhoneNumbers, LastVisitDate, Addresses
  • AddressAddress, Address2, City, State, ZipCode

Testing

go test -race ./...

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Address  string `json:"address"`
	Address2 string `json:"address2"`
	City     string `json:"city"`
	State    string `json:"state"`
	ZipCode  string `json:"zipCode"`
}

Address represents a customer's address

type Client

type Client struct {
	Host           string
	RestaurantCode string
	ClientID       string
	ClientSecret   string
	Username       string
	Password       string
	HTTPClient     *http.Client
}

Client represents an EdgeServPOS API client

func NewClient

func NewClient(host, restaurantCode, clientID, clientSecret, username, password string) *Client

NewClient creates a new EdgeServPOS API client

func (*Client) GetOAuthToken

func (c *Client) GetOAuthToken() (string, error)

GetOAuthToken retrieves an OAuth token for the client

func (*Client) ListCustomers

func (c *Client) ListCustomers() ([]Customer, error)

ListCustomers retrieves all customers for the restaurant with automatic token management

type Customer

type Customer struct {
	ServerID      int       `json:"serverId"`
	FirstName     string    `json:"firstName"`
	LastName      string    `json:"lastName"`
	EmailAddress  string    `json:"emailAddress"`
	Point         int       `json:"point"`
	PhoneNumbers  []string  `json:"phoneNumbers"`
	LastVisitDate int64     `json:"lastVisitDate"`
	Addresses     []Address `json:"addresses"`
}

Customer represents each customer in the response array

type OAuthResponse

type OAuthResponse struct {
	Value string `json:"value"`
}

OAuthResponse represents the expected JSON response from the OAuth token endpoint

Jump to

Keyboard shortcuts

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