coderwall

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

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

Go to latest
Published: Aug 15, 2013 License: MIT Imports: 4 Imported by: 0

README

Coderwall

Coderwall API client for go.

Installation

go get github.com/pilu/coderwall-go

Usage

package main

import (
  "github.com/pilu/coderwall-go"
  "fmt"
  "flag"
  "os"
)

func usage() {
  fmt.Fprintf(os.Stderr, "usage: coderwall USERNAME\n")
  flag.PrintDefaults()
  os.Exit(1)
}

func main() {
  flag.Usage = usage
  flag.Parse()

  args := flag.Args()
  if len(args) < 1 {
    usage()
    os.Exit(1);
  }
  client := coderwall.NewClient()
  profile, err := client.GetProfile(args[0])
  if err != nil {
    fmt.Println(err)
    os.Exit(1)
  }
  fmt.Printf("%s, %s (%s) - %d endorsement\n\n", profile.Username, profile.Name, profile.Location, profile.Endorsements)
  fmt.Printf("Badges (%d):\n\n", len(profile.Badges))
  for _, badge := range(profile.Badges) {
    fmt.Printf("\t%s\n\t\t%s\n\n", badge.Name, badge.Description)
  }
}

Documentation

Overview

A client for the Coderwall API (http://coderwall.com/api).

Usage example:

package main

import (
  "github.com/pilu/coderwall-go"
  "fmt"
  "flag"
  "os"
)

func usage() {
  fmt.Fprintf(os.Stderr, "usage: coderwall USERNAME\n")
  flag.PrintDefaults()
  os.Exit(1)
}

func main() {
  flag.Usage = usage
  flag.Parse()

  args := flag.Args()
  if len(args) < 1 {
    usage()
    os.Exit(1);
  }
  client := coderwall.NewClient()
  profile, err := client.GetProfile(args[0])
  if err != nil {
    fmt.Println(err)
    os.Exit(1)
  }
  fmt.Printf("%s, %s (%s) - %d endorsement\n\n", profile.Username, profile.Name, profile.Location, profile.Endorsements)
  fmt.Printf("Badges (%d):\n\n", len(profile.Badges))
  for _, badge := range(profile.Badges) {
    fmt.Printf("\t%s\n\t\t%s\n\n", badge.Name, badge.Description)
  }
}

Index

Constants

View Source
const BaseUrl = "http://coderwall.com"

Variables

This section is empty.

Functions

func NewClient

func NewClient() client

Types

type HttpClient

type HttpClient interface {
	Get(string) (resp *http.Response, err error)
}

type Profile

type Profile struct {
	Username     string
	Name         string
	Location     string
	Endorsements int
	Team         string
	Accounts     map[string]string
	Badges       []struct {
		Name        string
		Description string
		Created     string
		Badge       string
	}
}

Jump to

Keyboard shortcuts

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