api

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

README

go-flysfo-api

Go package for accessing the developers.flysfo.com API.

Documentation

Documentation is incomplete at this time.

Design

The core of this package's approach to the ExecuteMethod method (which is attached to the api.Client struct) whose signature looks like this:

ExecuteMethod(context.Context, string, *url.Values) (io.ReadSeekCloser, error)

This package only defines a handful of Go types or structs (often incomplete) mapping to individual API responses. So far these are all specific to operations that have been SFO Museum in nature.

In time there may be others, along with helper methods for unmarshaling API responses in to typed responses but the baseline for all operations will remain: Query paramters (url.Values) sent over HTTP returning an io.ReadSeekCloser instance that is inspected and validated according to the needs and uses of the tools using the FlySFO API.

Tools

api
$> ./bin/api -h
Execute a method against the developers.flysfo.com API.
Usage:
	 ./bin/api [options]
Valid options are:
  -apikey string
    	A valid developers.flysfo.com API key encoded as a gocloud.dev/runtimevar URI. Supported schemes are: constant://, file://
  -method string
    	The relative URL of the method to be executed.
  -param value
    	Zero or more query parameters to append to the method being executed.

For example:

$>./bin/api -apikey 'constant://?val={APIKEY}' -method /offerings/facilities/terminals/ | json_pp | less

[
   {
      "airport" : {
         "airport_code" : "SFO",
         "airport_id" : 1876,
         "airport_location_id" : 1876,
         "airport_name" : "San Francisco International Airport",
         "customs_type" : 1,
         "iata_code" : "SFO",
         "icao_code" : "KSFO",
         "in_service" : false,
         "source" : 4,
         "utc_offset" : "-7.00"
      },
      "concourse" : [
         {
            "concourse_id" : 2,
            "concourse_location" : {
      ... and so on
   }
]

See also

Documentation

Overview

Package api provides methods for accessing the developers.flysfo.com API.

Index

Constants

View Source
const V1 string = "https://api.flysfo.com/sfo/v1.0"

V1 is the root URL endpoint for version one of the FlySFO API.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

type Client is a struct for performing requests to the FlySFO API.

func NewClient

func NewClient(ctx context.Context, apikey string) (*Client, error)

func NewClientWithEndpoint

func NewClientWithEndpoint(ctx context.Context, endpoint string, apikey string) (*Client, error)

func (*Client) ExecuteMethod

func (cl *Client) ExecuteMethod(ctx context.Context, uri string, params *url.Values) (io.ReadSeekCloser, error)

Directories

Path Synopsis
cmd
api

Jump to

Keyboard shortcuts

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