{"id":18251775,"url":"https://github.com/hiroakis/esa-go","last_synced_at":"2025-04-04T16:32:43.722Z","repository":{"id":57508650,"uuid":"50170982","full_name":"hiroakis/esa-go","owner":"hiroakis","description":"esa client library for API v1 written in golang","archived":false,"fork":false,"pushed_at":"2019-08-15T09:23:01.000Z","size":19,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-19T05:56:39.960Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hiroakis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-22T09:19:41.000Z","updated_at":"2024-06-19T05:56:39.961Z","dependencies_parsed_at":"2022-09-13T08:20:48.866Z","dependency_job_id":null,"html_url":"https://github.com/hiroakis/esa-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiroakis%2Fesa-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiroakis%2Fesa-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiroakis%2Fesa-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiroakis%2Fesa-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hiroakis","download_url":"https://codeload.github.com/hiroakis/esa-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223150760,"owners_count":17095957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T09:48:27.857Z","updated_at":"2024-11-05T09:48:28.932Z","avatar_url":"https://github.com/hiroakis.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esa-go\n\nesa API v1 client written in go.\n\n## Installation\n\n```\ngo get github.com/hiroakis/esa-go\n```\n\n## Basic Usage\n\n```\nimport (\n    \"encoding/json\"\n    \"fmt\"\n    esa \"github.com/hiroakis/esa-go\"\n    \"github.com/hiroakis/esa-go/request\"\n)\n\nfunc main() {\n    // Initializing client\n    c := esa.NewEsaClient(\"API_KEY\", \"TEAM_NAME\")\n\n    // get all posts\n    posts, err := c.GetPosts()\n    if err != nil {\n            fmt.Println(err)\n    }\n    fmt.Println(posts)\n\n    // print specified field\n    fmt.Println(posts.Posts[0].Name)\n\n    // print with json string\n    postsJson, _ := json.Marshal(posts)\n    fmt.Println(string(postsJson))\n\n    // Pagenation\n    c.SetPage(1)\n    posts, err = c.GetPosts()\n    if err != nil {\n            fmt.Println(err)\n    }\n    fmt.Println(posts)\n\n    // Query\n    c.SetQuery(\"category:memo\")\n    posts, err = c.GetPosts()\n    if err != nil {\n            fmt.Println(err)\n    }\n    fmt.Println(posts)\n}\n```\n\n## Examples\n\n```\n    // teams\n    teams, err := c.GetTeams()\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(teams)\n\n    // team\n    c.SetTeam(\"TEAM_NAME\")\n    team, err := c.GetTeam()\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(team)\n\n    // stats\n    stats, err := c.GetStats()\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(stats)\n\n    // members\n    members, err := c.GetMembers()\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(members)\n\n    // post\n    post, err := c.GetPost(1)\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(post)\n\n    // posts\n    posts, err := c.GetPosts()\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(posts)\n\n    // posts\n    c.SetQuery(\"category:memo\")\n    posts, err := c.GetPosts()\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(posts)\n\n    // create new post\n    reqPost :=\n        request.Post{\n            Name:     \"hi!\",\n            BodyMd:   \"hello\",\n            Category: \"Users/hiroakis/memo\",\n        }\n\n    createdPost, err := c.CreatePost(reqPost)\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(createdPost)\n\n    // create new post use template\n    reqPost :=\n        request.Post{\n            TemplatePostId: 123,\n        }\n\n    createdPost, err := c.CreatePost(reqPost)\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(createdPost)\n\n    // update post\n    reqPost :=\n        request.Post{\n            Name:     \"hi!\",\n            BodyMd:   \"おは\",\n            Category: \"Users/hiroakis/memo\",\n        }\n\n    updatedPost, err := c.UpdatePost(549, reqPost)\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(updatedPost)\n\n    // delete post\n    deletedPost, err := c.DeletePost(549)\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(deletedPost)\n\n    // comments\n    comments, err := c.GetComments(543)\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(comments)\n\n    // comment\n    comment, err := c.GetComment(80737)\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(comment)\n\n    // create comment\n    reqComment := request.Comment{\n        BodyMd: \"comment!\",\n    }\n    createdComment, err := c.CreateComment(543, reqComment)\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(createdComment)\n\n    // update comment\n    reqComment = request.Comment{\n        BodyMd: \"comment!!!!\",\n    }\n    updatedComment, err := c.UpdateComment(80737, reqComment)\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(updatedComment)\n\n    deletedComment, err := c.DeleteComment(80737)\n    if err != nil {\n        fmt.Println(err)\n    }\n    fmt.Println(deletedComment)\n```\n\n## Tests\n\n```\ngo test -v\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiroakis%2Fesa-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiroakis%2Fesa-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiroakis%2Fesa-go/lists"}