goopla

package
v0.0.0-...-832c62a Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

func DoRequestWithClient

func DoRequestWithClient(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)

func FromEnv

func FromEnv(c *Client) error

func StreamDiscardInitial

func StreamDiscardInitial(c *streamConfig)

Types

type Agent

type Agent struct {
	AgentName     string `xml:"agent_name"`
	AgentID       string `xml:"agent_id"`
	AgentAddress  string `xml:"company_address"`
	AgentPhone    string `xml:"agent_phone"`
	AgentCategory string `xml:"category"`
}

type Client

type Client struct {
	BaseURL     *url.URL
	Credentials Credentials

	Listing *ListingService
	Stream  *StreamService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(credentials Credentials, opts ...Opt) (*Client, error)

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(path string, form url.Values) (*http.Request, error)

type Credentials

type Credentials struct {
	ApiKey string
}

type FloorArea

type FloorArea struct {
	Name  string `xml:"name"`
	Units string `xml:"units"`
	Value string `xml:"value"`
}

type Listing

type Listing struct {
	Agent
	ListingDetails
	RoomDetails
	RentalPrices
}

type ListingDetails

type ListingDetails struct {
	ListingID        string  `xml:"listing_id"`
	ListingURL       XMLURL  `xml:"details_url"`
	ImageURL         XMLURL  `xml:"image_url"`
	Address          string  `xml:"displayable_address"`
	Town             string  `xml:"post_town"`
	PostCode         string  `xml:"outcode"`
	AvailabilityDate XMLDate `xml:"available_from_display"`
	FirstPublished   XMLTime `xml:"first_published_date"`
	LastPublished    XMLTime `xml:"last_published_date"`
	Status           string  `xml:"status"`
	Description      string  `xml:"description"`
	ShortDescription string  `xml:"short_description"`
	PropertyType     string  `xml:"property_type"`
	FloorPlan        XMLURL  `xml:"floor_plan"`
	FurnishedState   string  `xml:"furnished_state"`
	LettingFees      string  `xml:"letting_fees"`
	SharedOccupancy  string  `xml:"rental_prices>shared_occupancy"`
}

type ListingOptions

type ListingOptions struct {
	Area           string
	Order_by       string
	Ordering       string
	Listing_status string
	Include_sold   string
	Include_rented string
	Minimum_price  string
	Maximum_price  string
	Minimum_beds   int
	Maximum_beds   int
	Furnished      string
	Property_type  string
	New_homes      bool
	Chain_free     bool
	Keywords       []string
	Listing_id     string
	Branch_id      string
	Page_number    int
	Page_size      int
	Summarized     string
	// contains filtered or unexported fields
}

type ListingResponse

type ListingResponse struct {
	SearchSettings
	Listings []Listing `xml:"listing"`
}

type ListingService

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

func (*ListingService) Get

type Opt

type Opt func(*Client) error

func WithBaseURL

func WithBaseURL(u string) Opt

type RentalPrices

type RentalPrices struct {
	AccurateAmount string `xml:"rental_prices>accurate"`
	Monthly        int    `xml:"rental_prices>per_month"`
	Weekly         int    `xml:"rental_prices>per_week"`
}

type RoomDetails

type RoomDetails struct {
	Bedrooms  int `xml:"num_bedrooms"`
	Bathrooms int `xml:"num_bathrooms"`
	Floors    int `xml:"num_floors"`
	Recepts   int `xml:"num_recepts"`
	FloorArea `xml:"floor_area"`
}

type SearchBoundingBox

type SearchBoundingBox struct {
	MaxLatitude  string `xml:"bounding_box>latitude_max"`
	MinLatitude  string `xml:"bounding_box>latitude_min"`
	Maxlongitude string `xml:"bounding_box>longitude_max"`
	Minlongitude string `xml:"bounding_box>longitude_min"`
}

type SearchSettings

type SearchSettings struct {
	Area      string `xml:"area_name"`
	Street    string `xml:"street"`
	Town      string `xml:"town"`
	County    string `xml:"county"`
	Country   string `xml:"country"`
	PostCode  string `xml:"postcode"`
	Latitude  string `xml:"latitude"`
	Longitude string `xml:"longitude"`
	SearchBoundingBox
	ListingAmount int `xml:"result_count"`
}

type StreamOpt

type StreamOpt func(*streamConfig)

func StreamInterval

func StreamInterval(i time.Duration) StreamOpt

type StreamService

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

func (*StreamService) Listings

func (s *StreamService) Listings(listingOpts *ListingOptions, streamOpts ...StreamOpt) (<-chan Listing, <-chan error, func())

type XMLDate

type XMLDate struct {
	time.Time
}

func (*XMLDate) UnmarshalXML

func (x *XMLDate) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*XMLDate) UnmarshalXMLAttr

func (x *XMLDate) UnmarshalXMLAttr(attr xml.Attr) error

type XMLTime

type XMLTime struct {
	time.Time
}

func (*XMLTime) UnmarshalXML

func (x *XMLTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*XMLTime) UnmarshalXMLAttr

func (x *XMLTime) UnmarshalXMLAttr(attr xml.Attr) error

type XMLURL

type XMLURL struct {
	url.URL
}

func (*XMLURL) UnmarshalXML

func (u *XMLURL) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*XMLURL) UnmarshalXMLAttr

func (u *XMLURL) UnmarshalXMLAttr(attr xml.Attr) error

Jump to

Keyboard shortcuts

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