Documentation ¶
Index ¶
- Constants
- Variables
- func ChangePassword(requester Requester, url string) error
- func CreateXMLDecoder(input io.Reader, strict bool) *xml.Decoder
- func Get(ctx context.Context, requester Requester, r GetRequest) error
- func GetObjects(ctx context.Context, requester Requester, r GetObjectRequest) (*http.Response, error)
- func MetadataResponse(ctx context.Context, requester Requester, r MetadataRequest) (*http.Response, error)
- func MetadataStream(resp *http.Response, err error) (io.ReadCloser, error)
- func OptionalIntValue(values url.Values) func(string, int)
- func OptionalStringValue(values url.Values) func(string, string)
- func PostObject(ctx context.Context, requester Requester, url string) error
- func PrepGetObjects(r GetObjectRequest) (*http.Request, error)
- func PrepGetPayloadList(r PayloadListRequest) (*http.Request, error)
- func PrepMetadataRequest(r MetadataRequest) (*http.Request, error)
- func PrepSearchRequest(r SearchRequest) (*http.Request, error)
- func ReEncodeReader(input io.ReadCloser, contentType string) io.ReadCloser
- func SearchResponse(ctx context.Context, requester Requester, r SearchRequest) (*http.Response, error)
- func SearchStream(resp *http.Response, err error) (io.ReadCloser, error)
- func Update(ctx context.Context, requester Requester, url string) error
- type CapabilityURLs
- type CompactData
- type CompactEntry
- type CompactMSystem
- type CompactMetadata
- type CompactRow
- type CompactSearchResult
- type CompactSystem
- type Delimiter
- type DelimiterTag
- type Digest
- type EachPayload
- type EachRow
- type GetObjectParams
- type GetObjectRequest
- type GetObjectResponse
- type GetObjectResult
- type GetRequest
- type Indexer
- type LoginRequest
- type LogoutRequest
- type LogoutResponse
- type MetadataParams
- type MetadataRequest
- type Object
- type PayloadList
- type PayloadListRequest
- type RequestIDer
- type Requester
- type Response
- type ResponseTag
- type Row
- type SearchParams
- type SearchRequest
- type StandardXMLSearchResult
- type UserAgentAuthentication
- type WWWAuthTransport
Constants ¶
const ( UserAgent string = "User-Agent" Accept string = "Accept" ContentType string = "Content-Type" WWWAuth string = "Www-Authenticate" WWWAuthResp string = "Authorization" )
standard http header names
const ( RETSVersion string = "RETS-Version" RETSSessionID string = "RETS-Session-ID" RETSRequestID string = "RETS-Request-ID" RETSUAAuth string = "RETS-UA-Authorization" )
rets http header names
const ( // XMLElemRETS tag for RETS responses XMLElemRETS = "RETS" // XMLElemRETSStatus tag for RETS responses XMLElemRETSStatus = "RETS-STATUS" )
const ( // CountNone dont include a count CountNone = iota // CountIncluded include a count after the data CountIncluded = iota // CountOnly returns only the count CountOnly = iota )
Count is the type of serverside count response that should be included
const ( // StandardNames requests normalized naming StandardNames = iota // SystemNames (the default) requests whatever field names are used by the server SystemNames = iota )
const ( StatusOK = 0 StatusSystemError = 10000 StatusZeroBalance = 20003 StatusBrokerCodeRequired = 20012 StatusBrokerCodeInvalid = 20013 StatusMultipleLogins = 20022 StatusServerLoginError = 20036 StatusClientAuthFailed = 20037 StatusUserAgentAuthRequired = 20041 StatusServerTemporarilyDisabled = 20050 StatusInsecurePassword = 20140 StatusRepeatPassword = 20141 StatusInvalidEncryptedUsername = 20142 StatusUnknownQueryField = 20200 StatusNoRecords = 20201 StatusInvalidSelect = 20202 StatusSearchError = 20203 StatusInvalidQuerySyntax = 20206 StatusMaxRecordsExceeded = 20208 StatusTimeout = 20209 StatusTooManyOutstandingQueries = 20210 StatusQueryTooComplex = 20211 StatusInvalidKeyRequest = 20212 // deprecated StatusInvalidKey = 20213 // deprecated StatusInvalidParameter = 20301 StatusSaveError = 20302 StatusUpdateError = 20303 StatusWarningResponse2 = 20311 StatusWarningResponse0 = 20312 StatusInvalidResource = 20400 StatusInvalidType = 20401 StatusInvalidIdentifier = 20402 StatusObjectNotFound = 20403 StatusUnsupportedMimeType = 20406 StatusResourceUnvailable = 20408 StatusRequestTooLarge = 20410 StatusExecutionTimeout = 20411 StatusTooManyOutstandingRequests = 20412 StatusMiscGetObjectError = 20413 StatusUnknwownMetadataResource = 20500 StatusUnknownMetadataType = 20501 StatusUnknownMetadataIdentifier = 20502 StatusNoMetadataFound = 20503 StatusUnsupportedMetadataMimeType = 20506 StatusMetadataResourceUnvailable = 20508 StatusMetadataRequestTooLarge = 20510 StatusMetadataExecutionTimeout = 20511 StatusTooManyOutstandingMetadataRequests = 20512 StatusMiscMetadataError = 20513 StatusNotLoggedIn = 20701 StatusMiscLogoutError = 20702 )
const CompactDefaultDelim = "\t"
CompactDefaultDelim is the default field delimiter for COMPACT data
const CompactMetadataDelim = "\t"
CompactMetadataDelim is the only delimiter option for compact metadata
const (
DefaultHTTPMethod = "GET"
)
const DefaultTimeout int = 300000
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 ChangePassword ¶
ChangePassword ....
func CreateXMLDecoder ¶
CreateXMLDecoder decodes xml using the given the header if needed
func Get ¶
func Get(ctx context.Context, requester Requester, r GetRequest) error
Get gets an arbitrary file from the server or performs an arbitrary action, specified by URI
func GetObjects ¶
func GetObjects(ctx context.Context, requester Requester, r GetObjectRequest) (*http.Response, error)
GetObjects sends the GetObject request
func MetadataResponse ¶
func MetadataResponse(ctx context.Context, requester Requester, r MetadataRequest) (*http.Response, error)
MetadataResponse processes the request... TODO may no longer be necessary
func MetadataStream ¶
MetadataStream encodes the http response stream for us
func OptionalIntValue ¶
OptionalIntValue ...
func OptionalStringValue ¶
OptionalStringValue ...
func PostObject ¶
PostObject ...
func PrepGetObjects ¶
func PrepGetObjects(r GetObjectRequest) (*http.Request, error)
PrepGetObjects creates an http.Request from a GetObjectRequest
func PrepGetPayloadList ¶
func PrepGetPayloadList(r PayloadListRequest) (*http.Request, error)
PrepGetPayloadList creates an http.Request from a PayloadListRequest
func PrepMetadataRequest ¶
func PrepMetadataRequest(r MetadataRequest) (*http.Request, error)
PrepMetadataRequest creates an http.Request from a MetadataRequest
func PrepSearchRequest ¶
func PrepSearchRequest(r SearchRequest) (*http.Request, error)
PrepSearchRequest creates an http.Request from a SearchRequest
func ReEncodeReader ¶
func ReEncodeReader(input io.ReadCloser, contentType string) io.ReadCloser
ReEncodeReader re-encodes a reader based on the http content type provided
func SearchResponse ¶
func SearchResponse(ctx context.Context, requester Requester, r SearchRequest) (*http.Response, error)
SearchResponse returns the raw stream from the RETS server response
func SearchStream ¶
SearchStream wraps the body with proper content decoding given the content type or char encoding
Types ¶
type CapabilityURLs ¶
type CapabilityURLs struct { Response Response MemberName, User, Broker, MetadataVersion, MinMetadataVersion string OfficeList []string TimeoutSeconds int64 // X-urls AdditionalURLs map[string]string // urls for web calls Action, ChangePassword, GetMetadata, GetObject, Login, LoginComplete, Logout, Search, Update, PostObject, GetPayloadList string }
CapabilityURLs ...
func Login ¶
func Login(ctx context.Context, requester Requester, r LoginRequest) (*CapabilityURLs, error)
Login ...
type CompactData ¶
type CompactData struct { Element string Delimiter string Attr map[string]string // parse these values out with decode CompactDelimiter Delimiter `xml:"DELIMITER"` CompactColumns CompactRow `xml:"COLUMNS"` CompactRows []CompactRow `xml:"DATA"` }
CompactData is the common compact decoded structure
func NewCompactData ¶
func NewCompactData(start xml.StartElement, decoder *xml.Decoder, delim string) (CompactData, error)
NewCompactData parses a CompactData from a start element. If delim is explicitly passed, it will override the DELIMITER element value, which defaults to \t. Pass empty string to automatically parse DELIMITER value or fallback to default of \t.
func (CompactData) Columns ¶
func (cd CompactData) Columns() Row
Columns parses the compact values for the cols
func (CompactData) Entries ¶
func (cd CompactData) Entries() []CompactEntry
Entries turns all rows into maps
func (CompactData) Rows ¶
func (cd CompactData) Rows(each func(i int, row Row))
Rows provides callback to access each row
type CompactEntry ¶
CompactEntry ...
type CompactMSystem ¶
type CompactMSystem struct { Version string `xml:"Version,attr"` Date string `xml:"Date,attr"` Comments string `xml:"COMMENTS"` System CompactSystem `xml:"SYSTEM"` }
CompactMSystem ...
type CompactMetadata ¶
type CompactMetadata struct { Response Response MSystem CompactMSystem Elements map[string][]CompactData }
CompactMetadata ...
func GetCompactMetadata ¶
func GetCompactMetadata(ctx context.Context, requester Requester, r MetadataRequest) (*CompactMetadata, error)
GetCompactMetadata ...
func ParseMetadataCompactResult ¶
func ParseMetadataCompactResult(body io.ReadCloser) (*CompactMetadata, error)
ParseMetadataCompactResult ...
type CompactSearchResult ¶
type CompactSearchResult struct { Response Response Count int Delimiter string Columns Row BytesReceived int64 // contains filtered or unexported fields }
CompactSearchResult provides processing given the components from the search
func NewCompactSearchResult ¶
func NewCompactSearchResult(body io.ReadCloser) (*CompactSearchResult, error)
NewCompactSearchResult _always_ close this
func SearchCompact ¶
func SearchCompact(ctx context.Context, requester Requester, r SearchRequest) (*CompactSearchResult, error)
SearchCompact wraps up most of the intermediate steps
type CompactSystem ¶
type CompactSystem struct { ID string `xml:"SystemID,attr"` Description string `xml:"SystemDescription,attr"` TimeZoneOffset string `xml:",attr,omitempty"` MetadataID string `xml:",attr,omitempty"` }
CompactSystem ...
type Delimiter ¶
type Delimiter struct {
Value string `xml:"value,attr"`
}
Delimiter is the optional <DELIMITER value="2C"/> element
type DelimiterTag ¶
type DelimiterTag xml.StartElement
DelimiterTag holds the separator for compact data
type Digest ¶
type Digest struct { Realm string Nonce string Algorithm string Opaque string Qop string NonceCount int // contains filtered or unexported fields }
Digest http://en.wikipedia.org/wiki/Digest_access_authentication
func (*Digest) CreateDigestResponse ¶
CreateDigestResponse ...
type GetObjectParams ¶
type GetObjectParams struct { Resource, Type, UID, ID string /** 5.4.2 listing data to be embedded in the response */ ObjectData []string /* 5.4.1 */ Location int }
GetObjectParams holds the parameters for GetObject requests
type GetObjectRequest ¶
type GetObjectRequest struct { /* 5.3 */ URL, HTTPMethod string HTTPFormEncodedValues bool // POST style http params GetObjectParams }
GetObjectRequest ...
type GetObjectResponse ¶
GetObjectResponse is the response holder for processing GetObject requests
func (*GetObjectResponse) ForEach ¶
func (r *GetObjectResponse) ForEach(ctx context.Context, result GetObjectResult) error
ForEach ...
type GetObjectResult ¶
GetObjectResult is the callback walking func for retrieving objets
type LogoutResponse ¶
type LogoutResponse struct { ReplyCode int ReplyText string ConnectTime uint64 Billing string SignOffMessage string }
LogoutResponse ...
func Logout ¶
func Logout(ctx context.Context, requester Requester, r LogoutRequest) (*LogoutResponse, error)
Logout ...
type MetadataParams ¶
type MetadataParams struct {
Format, MType, ID string
}
MetadataParams for the request
type MetadataRequest ¶
type MetadataRequest struct { // RETS request options URL, HTTPMethod string HTTPFormEncodedValues bool // POST style http params MetadataParams }
MetadataRequest ...
type Object ¶
type Object struct { // ContentID required ContentID, ContentType string // ObjectID 5.5.2 this is probably a bad idea, though its solid with the spec ObjectID int // optional-ish _must_ return if the request used this field UID string /** optional */ Description, SubDescription, Location string /* 5.6.7 - because why would you want to use standard http errors when we can reinvent! */ RetsError bool RetsMessage *Response /* 5.6.3 */ Preferred bool /* 5.6.5 */ ObjectData map[string]string /** it may be wiser to convert this to a readcloser with a content-length */ Blob []byte }
Object provides the photo extraction core for RETS section 5.5
func NewObjectFromStream ¶
func NewObjectFromStream(header textproto.MIMEHeader, body io.ReadCloser) (*Object, error)
NewObjectFromStream ...
type PayloadList ¶
type PayloadList struct { Response Response // contains filtered or unexported fields }
PayloadList ...
func GetPayloadList ¶
func GetPayloadList(ctx context.Context, requester Requester, r PayloadListRequest) (PayloadList, error)
GetPayloadList ...
func NewPayloadList ¶
func NewPayloadList(body io.ReadCloser) (PayloadList, error)
NewPayloadList parse a stream and reads PayloadLists
type PayloadListRequest ¶
type PayloadListRequest struct {
URL, HTTPMethod, ID string
}
PayloadListRequest ...
type RequestIDer ¶
RequestIDer allows functions to be provided to generate request ids
func CreateRETSVersioner ¶
func CreateRETSVersioner(version string) RequestIDer
CreateRETSVersioner provides a hook to get a RETS Version from a request
func CreateSessionIDer ¶
func CreateSessionIDer(jar http.CookieJar) RequestIDer
CreateSessionIDer provides a default implement for extracting the session from a cookie jar
type Requester ¶
Requester implmenters should not assume any order of ops
func DefaultSession ¶
func DefaultSession(user, pwd, userAgent, userAgentPw, retsVersion string, transport http.RoundTripper) (Requester, error)
DefaultSession configures the default rets session
type ResponseTag ¶
type ResponseTag xml.StartElement
ResponseTag holds the separator for compact data
type SearchParams ¶
type SearchParams struct { SearchType, Class string // Residential Format, Select string // Payload should not be used with the format,select pair Payload string //The Client may request a specific XML format for the return set. // Query should be in the format specified by QueryType Query, QueryType string // DMQL2 is the standard option // RestrictedIndicator is the symbol to be used for fields that are blanked serverside (e.g. ####) RestrictedIndicator string StandardNames int // (0|1|) Count int // (|0|1|2) Limit int // <0 => "NONE" // Offset is properly started at 1, or left blank and assumed to have been 1 Offset int }
SearchParams is the configuration for creating a SearchReqeust
type SearchRequest ¶
type SearchRequest struct { URL, HTTPMethod string HTTPFormEncodedValues bool // POST style http params PathEscape bool // url.PathEscape instead of url.Encode SearchParams }
SearchRequest holds the information needed to send a RETS request
type StandardXMLSearchResult ¶
type StandardXMLSearchResult struct { Response Response // contains filtered or unexported fields }
StandardXMLSearchResult ...
func NewStandardXMLSearchResult ¶
func NewStandardXMLSearchResult(body io.ReadCloser) (*StandardXMLSearchResult, error)
NewStandardXMLSearchResult returns an XML search result handler to listen to elements
func StandardXMLSearch ¶
func StandardXMLSearch(ctx context.Context, requester Requester, r SearchRequest) (*StandardXMLSearchResult, error)
StandardXMLSearch if you set the wrong request Format you will get nothing back
func (*StandardXMLSearchResult) Close ¶
func (c *StandardXMLSearchResult) Close() error
Close closesthe connection
type UserAgentAuthentication ¶
type UserAgentAuthentication struct { Requester Requester UserAgent, UserAgentPassword string // usually a constant, but a func hook just in case it changes mid-session GetRETSVersion RequestIDer // go create one if you want, sadist CreateRequestID RequestIDer // extracts from a cookie, but that cookie isnt guaranteed to be in the req that we receive GetSessionID RequestIDer }
UserAgentAuthentication ... RETS 1.8 - 3.10 Computing the RETS-UA-Authorization Value
type WWWAuthTransport ¶
type WWWAuthTransport struct { Requester Requester Username, Password string // contains filtered or unexported fields }
WWWAuthTransport manages rfc2617 authentication