api

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient added in v0.1.0

func NewClient() http.Client

NewClient returns a http.Client

This client has a customized Transport that is a instance of [retryableRoundTripper] struct.

By default - base is http.DefaultTransport - attempts is 3 - waitTime is 2 seconds

Types

type Api

type Api struct {
	// contains filtered or unexported fields
}

Api is a struct that implements ApiCaller

func (*Api) ListGroups added in v0.0.2

func (a *Api) ListGroups() ([]Group, error)

Lists of all groups. Fetch data from {BASE_URL}/groups with api_key as a query parameter.

func (*Api) ListMembers

func (a *Api) ListMembers(gn string) ([]Member, error)

Lists members for a specific group.

type ApiCaller

type ApiCaller interface {
	ListGroups() ([]Group, error)
	ListMembers(gn string) ([]Member, error)
}

Interface for Sakamichi API call.

func New

func New(config util.Config) ApiCaller

New returns a new ApiCaller instance using passed configuration.

type Group added in v0.0.2

type Group struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

Group represents group information.

type ListGroupsResponse added in v0.0.2

type ListGroupsResponse struct {

	// Top layer of json struct in the response body.
	Groups []Group `json:"groups"`
}

Structure reflecting API response results.

type ListMembersResponse

type ListMembersResponse struct {

	// Top layer of json struct in the response body.
	Members []Member `json:"members"`
}

Structure reflecting API response results.

type Member

type Member struct {
	ID         int    `json:"user_id"`
	Name       string `json:"user_name"`
	Birthday   string `json:"birthday"`
	Height     string `json:"height"`
	Blood      string `json:"blood_type"`
	Generation string `json:"generation"`
	BlogURL    string `json:"blog_url"`
	ImgURL     string `json:"img_url"`
}

Group represents member information.

Jump to

Keyboard shortcuts

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