[go: up one dir, main page]

Skip to content

sue445/go-doorkeeper

Repository files navigation

go-doorkeeper

Doorkeeper API client for Go

Latest Version Build Status Maintainability Coverage Status GoDoc Go Report Card

Example

package main

import (
	"github.com/sue445/go-doorkeeper"
	"os"
)

func main() {
	accessToken := os.Getenv("DOORKEEPER_ACCESS_TOKEN")
	if accessToken == "" {
		panic("DOORKEEPER_ACCESS_TOKEN is required")
	}

	client := doorkeeper.NewClient(accessToken)

	// List all featured events
	events, rateLimit, err := client.GetEvents(&doorkeeper.GetEventsParams{})
	// more options
	events, rateLimit, err := client.GetEvents(&doorkeeper.GetEventsParams{Query: "golang", Sort: doorkeeper.SortByPublishedAt()})

	// List a community's events
	groupName := "trbmeetup"
	events, rateLimit, err := client.GetGroupEvents(groupName, &doorkeeper.GetEventsParams{})

	// Show a specific event
	eventID := 28319
	event, rateLimit, err := client.GetEvent(eventID)
	// or
	event, rateLimit, err := client.GetEvent(eventID, doorkeeper.WithLocale("en"))

	// Show a specific group
	groupName := "trbmeetup"
	group, rateLimit, err := client.GetGroup(groupName)
	// or
	group, rateLimit, err := client.GetGroup(groupName, doorkeeper.WithLocale("en"))
}

Reference

https://godoc.org/github.com/sue445/go-doorkeeper