{"id":15788067,"url":"https://github.com/keinos/go-gisty","last_synced_at":"2025-05-07T05:47:24.753Z","repository":{"id":102704531,"uuid":"554582429","full_name":"KEINOS/go-gisty","owner":"KEINOS","description":"GitHub Gist managing package for Go. It can retrieve the stargazers (number of stars) of a gist as well.","archived":false,"fork":false,"pushed_at":"2025-05-05T20:03:01.000Z","size":2643,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-05T21:23:16.737Z","etag":null,"topics":["gist","gists","go","go-library","go-module","go-package","golang","stargazers"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KEINOS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-20T03:32:05.000Z","updated_at":"2025-05-05T20:03:08.000Z","dependencies_parsed_at":"2023-11-26T21:21:49.769Z","dependency_job_id":"125f92e0-b7b3-4f41-bfe8-643b45dcc678","html_url":"https://github.com/KEINOS/go-gisty","commit_stats":{"total_commits":136,"total_committers":2,"mean_commits":68.0,"dds":"0.18382352941176472","last_synced_commit":"b67982bdd2eff9f064566746ce627a4e603fc407"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KEINOS%2Fgo-gisty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KEINOS%2Fgo-gisty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KEINOS%2Fgo-gisty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KEINOS%2Fgo-gisty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KEINOS","download_url":"https://codeload.github.com/KEINOS/go-gisty/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252823685,"owners_count":21809707,"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":["gist","gists","go","go-library","go-module","go-package","golang","stargazers"],"created_at":"2024-10-04T21:40:47.389Z","updated_at":"2025-05-07T05:47:24.673Z","avatar_url":"https://github.com/KEINOS.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![go1.23+](https://img.shields.io/badge/Go-1.23+-blue?logo=go)](https://github.com/KEINOS/go-gisty/blob/main/.github/workflows/unit-tests.yml#L81 \"Supported versions\")\n[![Go Reference](https://pkg.go.dev/badge/github.com/KEINOS/go-gisty.svg)](https://pkg.go.dev/github.com/KEINOS/go-gisty/gisty)\n# go-gisty\n\n`go-gisty` is a simple and easy-to-use **Go package for managing [GitHub Gists](https://docs.github.com/en/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists#about-gists)**.\nIt can retrieve the stargazers (number of stars) of a gist as well.\n\n## Usage\n\n```go\ngo get \"github.com/KEINOS/go-gisty\"\n```\n\n```go\n// This package requires a GitHub Personal Access Token (with gist scope)\n// to be set in the GITHUB_TOKEN/GH_TOKEN environment variable.\nimport \"github.com/KEINOS/go-gisty/gisty\"\n```\n\n- [x] CRUD\n  - [x] `Gisty.Create()` ..... Create a new gist with specified files to GitHub.\n  - [x] `Gisty.Read()` ....... Get a content of a gist from GitHub.\n  - [x] `Gisty.Update()` ..... Syncs the local changes to the gist on GitHub.\n  - [x] `Gisty.Delete()` ..... Delete a specified gist from GitHub.\n- [x] `Gisty.Clone()` ........ Clone a specified gist in GitHub to local.\n- [x] `Gisty.List()` ......... Get the list of gists in the GitHub account.\n- [x] `Gisty.Stargazer()` .... Get number of stars of a specified gist in GitHub.\n- [x] `Gisty.Comments()` ..... Get comments of a specified gist in GitHub.\n\n\u003e __Note__ : This package is a wrapper of the [`gist` subcommand](https://github.com/cli/cli/tree/trunk/pkg/cmd/gist) from the [GitHub CLI](https://docs.github.com/en/github-cli/github-cli/about-github-cli). It is intended to provide a **similar functionality as the `gh gist` command in your Go applications**.\n\u003e\n\u003e Conversely, if you just **want to create a single command that perform gist operations**, then it is recommended to create an alias for the `gh gist` command in your shell configuration, instead of re-inventing the wheel like I did. Also, **if you are a vim user and want to handle gist through vim**, you should consider using the [vim-gist](https://github.com/mattn/vim-gist) plugin.\n\n```go\nfunc Example() {\n  // Create a new Gisty instance.\n  obj := gisty.NewGisty()\n\n  // The below line is equivalent to:\n  //   gh gist list --public --limit 10\n  args := gisty.ListArgs{\n    Limit:      10,\n    OnlyPublic: true,  // If both OnlyPublic and OnlySecret are true,\n    OnlySecret: false, // OnlySecret is prior.\n  }\n\n  items, err := obj.List(args)\n  if err != nil {\n    log.Fatal(err)\n  }\n\n  // Print the fields of the first item\n  firstItem := items[0]\n\n  fmt.Println(\"GistID:\", firstItem.GistID)\n  fmt.Println(\"Description:\", firstItem.Description)\n  fmt.Println(\"Number of files:\", firstItem.Files)\n  fmt.Println(\"Is public gist:\", firstItem.IsPublic)\n  fmt.Println(\"Updated at:\", firstItem.UpdatedAt.String())\n  // Output:\n  // GistID: e915aa8c01dd438e3ffd79b05f15a4ff\n  // Description: Title of gist item 1\n  // Number of files: 1\n  // Is public gist: true\n  // Updated at: 2022-04-18 03:04:38 +0000 UTC\n}\n```\n\n```go\nfunc main() {\n  // Default gist ID if not specified.\n  gistID := \"5b10b34f87955dfc86d310cd623a61d1\"\n\n  if len(os.Args) \u003e 1 {\n    gistID = gisty.SanitizeGistID(os.Args[1])\n  }\n\n  // Instantiate a new Gisty object.\n  obj := gisty.NewGisty()\n\n  // Get the number of stars of the gist.\n  count, err := obj.Stargazer(gistID)\n  if err != nil {\n    log.Fatal(err)\n  }\n\n  fmt.Printf(\"ID: %s, STARS: %v\\n\", gistID, count)\n}\n```\n\n- View more examples @ pkg.go.dev\n  - [function/method](https://pkg.go.dev/github.com/KEINOS/go-gisty/gisty#pkg-examples)\n  - [application](https://pkg.go.dev/github.com/KEINOS/go-gisty/_examples)\n\n## Contribute\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/KEINOS/go-gisty.svg)](https://pkg.go.dev/github.com/KEINOS/go-gisty)\n[![go1.18+](https://img.shields.io/badge/Go-1.18+-blue?logo=go)](https://github.com/KEINOS/go-gisty/blob/main/.github/workflows/unit-tests.yml#L81 \"Supported versions\")\n\n- Branch to PR:\n  - `main`\n    - Any PRs for the betterment of the package is welcome.\n    - Please draft a PR before you start implementing the feature. So the others can comment on the idea or avoid duplication of work.\n- Issues/bug reports:\n  - [![Opened Issues](https://img.shields.io/github/issues/KEINOS/go-gisty?color=lightblue\u0026logo=github)](https://github.com/KEINOS/go-gisty/issues \"opened issues\")\n  - [GitHub Issues](https://github.com/KEINOS/go-gisty/issues)\n    - Reproducible sample code is required to help us to fix the issue.\n- Help wanted:\n  - [GitHub Issues](https://github.com/KEINOS/go-gisty/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)\n\n### Statuses\n\n[![UnitTests](https://github.com/KEINOS/go-gisty/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/KEINOS/go-gisty/actions/workflows/unit-tests.yml \"Unit tests on various Go versions. From Go 1.18 to the latest.\")\n[![PlatformTests](https://github.com/KEINOS/go-gisty/actions/workflows/platform-tests.yml/badge.svg)](https://github.com/KEINOS/go-gisty/actions/workflows/platform-tests.yml \"Unit tests on various platforms. Such as Linux, macOS and Windows.\")\n[![GolangCI](https://github.com/KEINOS/go-gisty/actions/workflows/golangci-lint.yml/badge.svg)](https://github.com/KEINOS/go-gisty/actions/workflows/golangci-lint.yml \"Lint and static analysis via golangci-lint.\")\n\n[![CodeQL-Analysis](https://github.com/KEINOS/go-gisty/actions/workflows/codeQL-analysis.yml/badge.svg)](https://github.com/KEINOS/go-gisty/actions/workflows/codeQL-analysis.yml \"Vulnerability scan using CodeQL.\")\n[![Vulnerability](https://github.com/KEINOS/go-gisty/actions/workflows/vulnerability.yml/badge.svg)](https://github.com/KEINOS/go-gisty/actions/workflows/vulnerability.yml \"Vulnerability scan using govulncheck.\")\n[![codecov](https://codecov.io/gh/KEINOS/go-gisty/branch/main/graph/badge.svg?token=JVY7WUeUFz)](https://codecov.io/gh/KEINOS/go-gisty \"Code coverage\")\n[![Go Report Card](https://goreportcard.com/badge/github.com/KEINOS/go-gisty)](https://goreportcard.com/report/github.com/KEINOS/go-gisty \"Code quality\")\n\n## TODOs\n\n- [x] ~~Retrieve comments in a gist~~ [[#2](https://github.com/KEINOS/go-gisty/issues/2)]\n- [ ] Simple method to fetch a file in a gist [[#3](https://github.com/KEINOS/go-gisty/issues/3)]\n\n## License\n\n- [MIT License](https://github.com/KEINOS/go-gisty/blob/main/LICENSE).\n  - Copyright (c) 2021-2022 [The go-gisty contributors](https://github.com/KEINOS/go-gisty/graphs/contributors).\n- With all the respect to [GitHub CLI](https://github.com/cli/cli/blob/trunk/LICENSE) and their [contributors](https://github.com/cli/cli/graphs/contributors).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeinos%2Fgo-gisty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeinos%2Fgo-gisty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeinos%2Fgo-gisty/lists"}