2014-03-30 22:44:26 +00:00
|
|
|
/*
|
Rename import paths from camlistore.org to perkeep.org.
Part of the project renaming, issue #981.
After this, users will need to mv their $GOPATH/src/camlistore.org to
$GOPATH/src/perkeep.org. Sorry.
This doesn't yet rename the tools like camlistored, camput, camget,
camtool, etc.
Also, this only moves the lru package to internal. More will move to
internal later.
Also, this doesn't yet remove the "/pkg/" directory. That'll likely
happen later.
This updates some docs, but not all.
devcam test now passes again, even with Go 1.10 (which requires vet
checks are clean too). So a bunch of vet tests are fixed in this CL
too, and a bunch of other broken tests are now fixed (introduced from
the past week of merging the CL backlog).
Change-Id: If580db1691b5b99f8ed6195070789b1f44877dd4
2018-01-01 22:41:41 +00:00
|
|
|
Copyright 2014 The Perkeep Authors
|
2014-03-30 22:44:26 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Types for Foursquare's JSON API.
|
|
|
|
|
|
|
|
package foursquare
|
|
|
|
|
|
|
|
type user struct {
|
|
|
|
Id string
|
|
|
|
FirstName string
|
|
|
|
LastName string
|
2016-04-30 14:52:43 +00:00
|
|
|
Photo photoItem
|
2014-03-30 22:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type userInfo struct {
|
|
|
|
Response struct {
|
|
|
|
User user
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type checkinsList struct {
|
|
|
|
Response struct {
|
|
|
|
Checkins struct {
|
|
|
|
Items []*checkinItem
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type checkinItem struct {
|
2014-07-12 15:27:09 +00:00
|
|
|
Id string
|
|
|
|
CreatedAt int64 // unix time in seconds from 4sq
|
|
|
|
TimeZoneOffset int // offset in minutes. positive is east.
|
|
|
|
Shout string // "Message from check-in, if present and visible to the acting user."
|
|
|
|
Venue venueItem
|
2016-04-30 02:35:59 +00:00
|
|
|
With []*user // list of friends checked in together
|
2014-03-30 22:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type venueItem struct {
|
|
|
|
Id string // eg 42474900f964a52087201fe3 from 4sq
|
|
|
|
Name string
|
|
|
|
Location *venueLocationItem
|
|
|
|
Categories []*venueCategory
|
|
|
|
}
|
|
|
|
|
2014-04-06 07:56:32 +00:00
|
|
|
type photosList struct {
|
|
|
|
Response struct {
|
|
|
|
Photos struct {
|
|
|
|
Items []*photoItem
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type photoItem struct {
|
|
|
|
Id string
|
|
|
|
Prefix string
|
|
|
|
Suffix string
|
|
|
|
Width int
|
|
|
|
Height int
|
|
|
|
}
|
|
|
|
|
2014-03-30 22:44:26 +00:00
|
|
|
func (vi *venueItem) primaryCategory() *venueCategory {
|
|
|
|
for _, c := range vi.Categories {
|
|
|
|
if c.Primary {
|
|
|
|
return c
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (vi *venueItem) icon() string {
|
|
|
|
c := vi.primaryCategory()
|
|
|
|
if c == nil || c.Icon == nil || c.Icon.Prefix == "" {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return c.Icon.Prefix + "bg_88" + c.Icon.Suffix
|
|
|
|
}
|
|
|
|
|
2016-04-30 14:52:43 +00:00
|
|
|
func (user *user) icon() string {
|
|
|
|
if user.Photo.Prefix == "" || user.Photo.Suffix == "" {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return user.Photo.Prefix + "500x500" + user.Photo.Suffix
|
|
|
|
}
|
|
|
|
|
2014-03-30 22:44:26 +00:00
|
|
|
type venueLocationItem struct {
|
|
|
|
Address string
|
|
|
|
City string
|
|
|
|
PostalCode string
|
|
|
|
State string
|
|
|
|
Country string // 4sq provides "US"
|
|
|
|
Lat float64
|
|
|
|
Lng float64
|
|
|
|
}
|
|
|
|
|
|
|
|
type venueCategory struct {
|
|
|
|
Primary bool
|
|
|
|
Name string
|
|
|
|
Icon *categoryIcon
|
|
|
|
}
|
|
|
|
|
|
|
|
type categoryIcon struct {
|
|
|
|
Prefix string
|
|
|
|
Suffix string
|
|
|
|
}
|