/codeforces_api

Connect with the codeforces api. Also supports authenticated requests.

Primary LanguageGoMIT LicenseMIT

Codeforces

Unit tests Go Reference codecov

Implements all the methods mentioned in the codeforces api. Creating a client is really simple, all you have to do is:

package main

import (
	"fmt"
	"os"

	"github.com/michelececcacci/codeforces"
)

func main() {
	key := os.Getenv("CF_API_KEY")
	secret := os.Getenv("CF_API_SECRET")
	c := codeforces.NewClient(key, secret)
	resp, err := c.User.Friends(false)
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println(resp)
	}
}

You can also leave the key and secret parameters empty, but you wont be able to access methods that require authentication such as c.Client.Friends(). For examples refer to the examples folder