forked from azer/go-flickr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
url.go
31 lines (27 loc) · 747 Bytes
/
url.go
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
package flickr
import (
"fmt"
)
var URL_KEYS = map[string]string{
"square": "s",
"largeSquare": "q",
"thumbnail": "t",
"small": "m",
"small320": "n",
"medium": "",
"medium640": "z",
"medium800": "c",
"large": "b",
"large1600": "h",
"large2048": "k",
}
func GenerateURLs(id string, farm int, secret, server, format string) map[string]string {
result := map[string]string{}
for name, letter := range URL_KEYS {
result[name] = GenerateURL(letter, id, farm, secret, server, format)
}
return result
}
func GenerateURL(key, id string, farm int, secret, server, format string) string {
return fmt.Sprintf("https://farm%d.staticflickr.com/%s/%s_%s_%s.%s", farm, server, id, secret, key, format)
}