2015-12-07 05:01:03 +01:00
|
|
|
package src
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
func createResourceInfoRequest(c *Client,
|
|
|
|
apiPath string,
|
|
|
|
path string,
|
|
|
|
options ...ResourceInfoRequestOptions) *HTTPRequest {
|
|
|
|
var parameters = make(map[string]interface{})
|
|
|
|
parameters["path"] = path
|
|
|
|
if len(options) > 0 {
|
|
|
|
opt := options[0]
|
|
|
|
if opt.SortMode != nil {
|
|
|
|
parameters["sort"] = opt.SortMode.String()
|
|
|
|
}
|
|
|
|
if opt.Limit != nil {
|
2017-02-25 14:39:16 +01:00
|
|
|
parameters["limit"] = *opt.Limit
|
2015-12-07 05:01:03 +01:00
|
|
|
}
|
|
|
|
if opt.Offset != nil {
|
2017-02-25 14:39:16 +01:00
|
|
|
parameters["offset"] = *opt.Offset
|
2015-12-07 05:01:03 +01:00
|
|
|
}
|
|
|
|
if opt.Fields != nil {
|
|
|
|
parameters["fields"] = strings.Join(opt.Fields, ",")
|
|
|
|
}
|
|
|
|
if opt.PreviewSize != nil {
|
|
|
|
parameters["preview_size"] = opt.PreviewSize.String()
|
|
|
|
}
|
|
|
|
if opt.PreviewCrop != nil {
|
2017-02-25 14:39:16 +01:00
|
|
|
parameters["preview_crop"] = *opt.PreviewCrop
|
2015-12-07 05:01:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return createGetRequest(c, apiPath, parameters)
|
|
|
|
}
|