ouid

package
v0.0.0-...-3653921 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2016 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ContentType string = "Content-Type"

ContentType ...

View Source
const DefaultURL = "http://www.reso.org/ouid/"

DefaultURL is the advertised endpoint for RESO ouid service

Variables

View Source
var DefaultReEncodeReader = ReEncodeReader

DefaultReEncodeReader allows overriding the re-encoding operation

View Source
var DefaultXMLDecoder = CreateXMLDecoder

DefaultXMLDecoder the variable used to set a selected charset

Functions

func CreateXMLDecoder

func CreateXMLDecoder(input io.Reader, strict bool) *xml.Decoder

CreateXMLDecoder decodes xml using the given the header if needed

func Process

func Process(ctx context.Context, requester Requester, each EachOrg) error

Process all requested Orgnizations

func ReEncodeReader

func ReEncodeReader(input io.ReadCloser, contentType string) io.ReadCloser

ReEncodeReader re-encodes a reader based on the http content type provided

Types

type Config

type Config struct {
	HTTP     *http.Client
	Endpoint string
	Decoder  func(io.Reader, bool) *xml.Decoder
}

Config is the request configuration

func (*Config) Request

func (cfg *Config) Request(scoper Scoper) Requester

Request requests all Organizations from the endpoint

type EachOrg

type EachOrg func(Organization, error) error

EachOrg is a callback for each found ouid.Organization with the option to return any errors

type Location

type Location struct {
	Address string `xml:"address,omitempty" json:"address,omitempty"`
	City    string `xml:"city,omitempty" json:"city,omitempty"`
	State   string `xml:"state,omitempty" json:"state,omitempty"`
	Zip     string `xml:"zip,omitempty" json:"zip,omitempty"`
}

Location is where its located

type Organization

type Organization struct {
	Name     string    `xml:"name" json:"name"`
	OuID     string    `xml:"ouid" json:"ouid"`
	Active   bool      `xml:"active" json"active"` // TODO need to marshal to int
	Notes    string    `xml:"notes,omitempty" json:"notes,omitempty"`
	Location *Location `xml:"location,omitempty" json:"location,omitempty"`
}

Organization defines the basic identity of a RESO organization

type Organizations

type Organizations struct {
	XMLName      xml.Name       `xml:"organizations,omitempty"`
	Organization []Organization `xml:"organization" json:"organization"`
}

Organizations is a simple wrapper for collecting Organizations

func (Organizations) Len

func (o Organizations) Len() int

func (Organizations) Less

func (o Organizations) Less(i, j int) bool

func (Organizations) Swap

func (o Organizations) Swap(i, j int)

type Requester

type Requester func(context.Context) (io.ReadCloser, error)

Requester provides a common func for extracting Organizations

type Scoper

type Scoper func(url.Values) error

Scoper limits the scope of the Requester

func All

func All() Scoper

All requests all organizations

func And

func And(scopes ...Scoper) Scoper

And will apply multple scope limiting operations

func ByActive

func ByActive(active bool) Scoper

ByActive searches for active or inactive organizations. Example: Active: http://www.reso.org/ouid/?active=1

func ByAssocToMLS

func ByAssocToMLS(assoc2mls string) Scoper

ByAssocToMLS searches by association to an MLS organization. Example: http://www.reso.org/ouid/?assoc2mls=M00000001 Example: http://www.reso.org/ouid/?assoc2mls=M00000002

func ByCity

func ByCity(city string) Scoper

ByCity searches by an organization’s city Example: http://www.reso.org/ouid/?city=dallas

func ByName

func ByName(part string) Scoper

ByName searches by an organization’s name or a portion of the name Example: http://www.reso.org/ouid/?org=mlslistings

func ByOuID

func ByOuID(ouid string) Scoper

ByOuID searches by Organizational Unique ID. / Example: http://www.reso.org/ouid/?ouid=A00000007

func ByState

func ByState(state string) Scoper

ByState searches by an organization’s state Example: http://www.reso.org/ouid/?state=AR

func ByZip

func ByZip(zip string) Scoper

ByZip searches by an organization’s zip Example: http://www.reso.org/ouid/?zip=90210

Jump to

Keyboard shortcuts

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