Skip to content

SUP2Ak/github-stats-api-go

Repository files navigation

GitHub Stats API Go

🇬🇧 | 🇫🇷

GitHub Stats API Go GitHub CI

Overview

github-stats-api-go is a Go-based API that retrieves statistics from GitHub for a specified user. It provides information such as the number of followers, repositories, stars, and organizations associated with the user.

Features

  • Retrieve user statistics from GitHub
  • Includes options for fetching stars, followers, following, repositories, and organizations
  • Simple HTTP/HTTPS server to handle requests

Installation

To use this API, you need to have Go installed on your machine. You can install it from the official Go website.

  1. Initialize a new Go module:
go mod init your_project_name
  1. Install the module using go get:
go get github.com/SUP2Ak/github-stats-api-go
  1. Create a new Go file (e.g., main.go) and import the module:
package main
import (
    "log"
    "time"
    githubstats "github.com/sup2ak/github-stats-api-go"
)

func main() {
    // Configuration
    config := githubstats.Config{
        Token: "your_github_token",
        IP:    "0.0.0.0",
        Port:  "8080",
        Scheme: "http", // or "https" null value is "http"
        Path:  "/stats",
        RateLimit: 10,
        CacheDuration: 1 * time.Hour,
        // and more...
    }
    // Create an instance of GStats
    stats := githubstats.GStats{}
    // Connect to the GitHub API
    err := stats.Connect(config)
    if err != nil {
        log.Fatalf("Connection error: %v", err)
    }
}
  1. Run the program:
go run main.go

Example Request

To get statistics for the user sup2ak, you can make a GET request:

curl "http://localhost:8080/stats?username=sup2ak"

License

This project is licensed under the GPL-3.0 License.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages