Documentation
¶
Overview ¶
Package vali provides a client interface to CIVL's Open Validation Server. See http://vali.fai-civl.org/webservice.html.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client is a validator service client.
func (*Client) ValidateIGC ¶
func (s *Client) ValidateIGC(ctx context.Context, filename string, igcFile io.Reader) (Status, *Response, error)
ValidateIGC validates igcFile.
Example ¶
package main
import (
"context"
"fmt"
"os"
"github.com/twpayne/go-vali"
)
func main() {
filename := "testdata/2006-06-10-XXX-3XI-01.IGC"
igcFile, err := os.Open(filename)
if err != nil {
fmt.Println(err)
return
}
defer igcFile.Close()
ctx := context.Background()
if status, _, err := vali.NewClient().ValidateIGC(ctx, filename, igcFile); status == vali.StatusValid {
fmt.Println("OK")
} else {
fmt.Println(err)
}
}
Output: OK
type ClientOption ¶
type ClientOption func(*Client)
An ClientOption is an option for configuring a Client.
func WithEndpoint ¶
func WithEndpoint(endpoint string) ClientOption
WithEndpoint sets the HTTP endpoint.
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient sets the http.WithHTTPClient.
type Response ¶
type Response struct {
Result string `json:"result"`
Status string `json:"status"`
Msg string `json:"msg"`
IGC string `json:"igc"`
Ref string `json:"ref"`
Server string `json:"server"`
}
A Response represents a response from the server.
type ServerError ¶
A ServerError represents a server error.
func (*ServerError) Error ¶
func (se *ServerError) Error() string
Click to show internal directories.
Click to hide internal directories.