Permalink
Browse files

Added api function to support simple endpoints

  • Loading branch information...
1 parent be60afb commit e9a668e58e120746c81d90e252e0480f214f04f5 @ardan-bkennedy ardan-bkennedy committed Nov 11, 2013
Showing with 8 additions and 0 deletions.
  1. +8 −0 api/api.go
View
8 api/api.go
@@ -52,6 +52,14 @@ func Action(cs config.Settings, prefix string, suffix ...string) *URL {
return u
}
+func ActionEndpoint(cs config.Settings, endpoint string) *URL {
+ u := &URL{Settings: cs, URL: url.URL{}}
+ u.URL.Scheme = cs.Scheme
+ u.URL.Host = fmt.Sprintf("%s:%d", url.QueryEscape(cs.Host), cs.Port)
+ u.URL.Path = fmt.Sprintf("/%s/projects/%s/%s", cs.ApiVersion, cs.ProjectId, endpoint)
+ return u
+}
+
func VersionAction(cs config.Settings) *URL {
u := &URL{Settings: cs, URL: url.URL{Scheme: cs.Scheme}}
u.URL.Host = fmt.Sprintf("%s:%d", url.QueryEscape(cs.Host), cs.Port)

0 comments on commit e9a668e

Please sign in to comment.