func Handler() *mux.Router { m := router.API() m.Get(router.Service).Handler(handler(serveService)) m.Get(router.Services).Handler(handler(serveServices)) m.Get(router.CreateService).Handler(handler(serveCreateService)) m.Get(router.Project).Handler(handler(serveProject)) m.Get(router.CreateProject).Handler(handler(serveCreateProject)) m.Get(router.UpdateProject).Handler(handler(serveUpdateProject)) m.Get(router.RunProjectCommand).Handler(handler(serveProjectCommand)) return m }
func NewClient(httpClient *http.Client) *Client { if httpClient == nil { httpClient = http.DefaultClient } c := &Client{ BaseURL: &url.URL{Scheme: "http", Host: "mew.hackedu.us:4000", Path: "/api/"}, UserAgent: userAgent, httpClient: httpClient, } c.Projects = &projectsService{c} c.Services = &servicesService{c} return c } var apiRouter = router.API() func (c *Client) url(apiRouteName string, routeVars map[string]string, opt interface{}) (*url.URL, error) { route := apiRouter.Get(apiRouteName) if route == nil { return nil, fmt.Errorf("no API route named %q", apiRouteName) } routeVarsList := make([]string, 2*len(routeVars)) i := 0 for name, val := range routeVars { routeVarsList[i*2] = name routeVarsList[i*2+1] = val } url, err := route.URL(routeVarsList...) if err != nil {