Created
February 22, 2017 20:58
-
-
Save zet4/1feba59445839427eba3c2b5f891a8a3 to your computer and use it in GitHub Desktop.
Goms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main // import "go.zeta.pm/goms" | |
import ( | |
"github.com/pressly/chi" | |
) | |
func main() { | |
root := chi.NewRouter() | |
root.Route("api", func(r chi.Router) { | |
r.Route("v3", func(r chi.Router) { | |
// Get statistics | |
r.Get("/enterprise/stats/:type", nil) | |
r.Route("/user", func(r chi.Router) { | |
// Get the authenticated user | |
r.Get("/", nil) | |
// Update the authenticated user | |
r.Patch("/", nil) | |
}) | |
r.Route("/users", func(r chi.Router) { | |
// Get all users | |
r.Get("/", nil) | |
r.Route("/:username", func(r chi.Router) { | |
// Get a single user | |
r.Get("/", nil) | |
// List public gists for the specified user | |
r.Get("/gists", nil) | |
r.Route("/site_admin", func(r chi.Router) { | |
// Promote an ordinary user to a site administrator | |
r.Put("/", nil) | |
// Demote a site administrator to an ordinary user | |
r.Delete("/", nil) | |
}) | |
r.Route("/suspended", func(r chi.Router) { | |
// Suspend a user | |
r.Put("/", nil) | |
// Unsuspend a user | |
r.Delete("/", nil) | |
}) | |
}) | |
}) | |
r.Route("/gists", func(r chi.Router) { | |
// List the authenticated user's gists or if called anonymously, this will return all public gists | |
r.Get("/", nil) | |
// Create a gist | |
r.Post("/", nil) | |
// List the authenticated user's starred gists | |
r.Get("/starred", nil) | |
r.Route("/:gistid", func(r chi.Router) { | |
// Get a single gist | |
r.Get("/", nil) | |
// Edit a gist | |
r.Patch("/", nil) | |
// Delete a gist | |
r.Delete("/", nil) | |
// Get a specific revision of a gist | |
r.Get("/:sha", nil) | |
// List gist commits | |
r.Get("/commits", nil) | |
r.Route("/star", func(r chi.Router) { | |
// Check if a gist is starred | |
r.Get("/", nil) | |
// Star a gist | |
r.Put("/", nil) | |
// Unstar a gist | |
r.Delete("/", nil) | |
}) | |
r.Route("/forks", func(r chi.Router) { | |
// Fork a gist | |
r.Post("/", nil) | |
// List gist forks | |
r.Get("/", nil) | |
}) | |
r.Route("/comments", func(r chi.Router) { | |
// List comments on a gist | |
r.Get("/", nil) | |
// Create a comment | |
r.Post("/", nil) | |
r.Route("/:commentid", func(r chi.Router) { | |
// Get a single comment | |
r.Get("/", nil) | |
// Edit a comment | |
r.Patch("/", nil) | |
// Delete a comment | |
r.Delete("/", nil) | |
}) | |
}) | |
}) | |
}) | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment