This repository was archived by the owner on Dec 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobject.go
More file actions
47 lines (41 loc) · 1.44 KB
/
object.go
File metadata and controls
47 lines (41 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// object
package rets
import (
"fmt"
"github.com/mlapping/rets/results"
"strconv"
)
// GetObject?Resource=Property&Type=Thumbnail&ID=20141106154635467418000000:0&Location=0
type ObjectQuery struct {
Resource string
Id string // this is value associated with the KeyField property which is set at the resource-level
Type string
Index string // [0-9]+|* , * meaning all
Location int // 0 for picture download, 1 for link (if you're using flexmls)
}
//Location:http://cdn.photos.flexmls.com/knx/20141106174321256467000000-t.jpg
//MIME-Version:1.0
//Object-ID:1
//Preferred:1
//RETS-Version:RETS/1.5
//Server:Apache-Coyote/1.1
//Set-Cookie:JSESSIONID=CC297D51FEF893664506CE5A20101C6D; Path=/rets2_1
// GetObject?Resource=Property&Type=Thumbnail&ID=20141106154635467418000000:0&Location=0&Format=STANDARD-XML
func (sess *Session) Object(query *ObjectQuery, addtlParams map[string]string) ([]results.ObjectResult, error) {
queryString := map[string]string{
"Resource": query.Resource,
"Type": query.Type,
"ID": fmt.Sprintf("%s:%s", query.Id, query.Index),
"Location": strconv.Itoa(query.Location),
}
// check for multipart results
if query.Index == "*" {
// fire off the query
multipartObjects, err := sess.getMultipartResults("Search", "GET", sess.Capabilities.GetObjectUrl(), queryString)
if err != nil {
return nil, err
}
return multipartObjects, nil
}
return nil, fmt.Errorf("Not implemented, sorry :(")
}