Documentation ¶
Index ¶
- Constants
- Variables
- func CreateXMLDecoder(input io.Reader, strict bool) *xml.Decoder
- func Process(ctx context.Context, requester Requester, each EachOrg) error
- func ReEncodeReader(input io.ReadCloser, contentType string) io.ReadCloser
- type Config
- type EachOrg
- type Location
- type Organization
- type Organizations
- type Requester
- type Scoper
Constants ¶
const ContentType string = "Content-Type"
ContentType ...
const DefaultURL = "http://www.reso.org/ouid/"
DefaultURL is the advertised endpoint for RESO ouid service
Variables ¶
var DefaultReEncodeReader = ReEncodeReader
DefaultReEncodeReader allows overriding the re-encoding operation
var DefaultXMLDecoder = CreateXMLDecoder
DefaultXMLDecoder the variable used to set a selected charset
Functions ¶
func CreateXMLDecoder ¶
CreateXMLDecoder decodes xml using the given the header if needed
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 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 ¶
Scoper limits the scope of the Requester
func ByActive ¶
ByActive searches for active or inactive organizations. Example: Active: http://www.reso.org/ouid/?active=1
func ByAssocToMLS ¶
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 ¶
ByCity searches by an organization’s city Example: http://www.reso.org/ouid/?city=dallas
func ByName ¶
ByName searches by an organization’s name or a portion of the name Example: http://www.reso.org/ouid/?org=mlslistings
func ByOuID ¶
ByOuID searches by Organizational Unique ID. / Example: http://www.reso.org/ouid/?ouid=A00000007
func ByState ¶
ByState searches by an organization’s state Example: http://www.reso.org/ouid/?state=AR
func ByZip ¶
ByZip searches by an organization’s zip Example: http://www.reso.org/ouid/?zip=90210