ghnc

package module
v0.0.0-...-b824824 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2018 License: MIT Imports: 8 Imported by: 0

README

ghnc (GitHub Name Checker)

GoDoc

A GitHub username checking library for Go.

Installation

go get github.com/Andoryuuta/ghnc

Usage

package main

import (
	"fmt"

	"github.com/Andoryuuta/ghnc"
)

func main() {
	username := "Andoryuuta"

	// Get the client
	client, err := ghnc.GetGHClient()
	if err != nil {
		panic(err)
	}

	// Check if the username is available
	available, reason, err := client.UsernameAvailable(username)
	if err != nil {
		panic(err)
	}

	fmt.Printf("Username %s available: %v (reason: %v)", username, available, reason)
}

Documentation

Index

Constants

View Source
const (
	SIGNUP_URL        = "https://github.com/join?source=login"
	NAMECHECK_API_URL = "https://github.com/signup_check/username"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GHClient

type GHClient struct {
	HttpClient *http.Client
	AuthToken  string
}

func GetGHClient

func GetGHClient() (*GHClient, error)

GetGHClient gets the required cookies and authenticy token and returns a GHClient.

func (*GHClient) UsernameAvailable

func (g *GHClient) UsernameAvailable(username string) (available bool, reason string, err error)

UsernameAvailable checks if a username is available.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL