api

package
v0.0.0-...-79bf07c Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizationHeader = "Authorization"
	ContentTypeHeader   = "Content-Type"
)
View Source
const (
	SubmissionBaseUrl string = "api/submission/v1/submissions"
	UserParam         string = "user"
	ChallengeParam    string = "challenge"
)
View Source
const (
	MembersBaseUrl string = "api/auth/v1/users"
	PageParam      string = "page"
	PageSizeParam  string = "pageSize"
)
View Source
const (
	LoginURL string = "api/auth/v1/authenticate"
)
View Source
const (
	ReviewBaseUrl string = "api/review/v1/reviews"
)
View Source
const (
	WhitelistBaseUrl string = "api/auth/v1/whitelist"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	Token string `json:"token"`
}

type Client

type Client struct {
	BaseURL *url.URL

	Token string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(client *http.Client) (*Client, error)

func (*Client) CreateReviews

func (c *Client) CreateReviews(reviews []Review) error

func (*Client) GetAllMembers

func (c *Client) GetAllMembers() ([]MemberInfo, error)

func (*Client) GetMembers

func (c *Client) GetMembers(page int, pageSize int) ([]MemberInfo, error)

func (*Client) GetSubmissions

func (c *Client) GetSubmissions(user string, challenge string) ([]SubmissionInfo, error)

func (*Client) Login

func (c *Client) Login(username string, password string) (string, error)

func (*Client) Request

func (c *Client) Request(method string, url string, body io.Reader) (*http.Response, error)

func (*Client) SyncWhitelist

func (c *Client) SyncWhitelist(members Members) error

type Credentials

type Credentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type MemberInfo

type MemberInfo struct {
	Id        string `json:"id"`
	Title     string `json:"title"`
	Firstname string `json:"firstname"`
	Lastname  string `json:"lastname"`
	Email     string `json:"email"`
	Role      string `json:"role"`
}

func (*MemberInfo) ToRow

func (s *MemberInfo) ToRow() []string

type Members

type Members struct {
	Usernames []string `json:"usernames"`
}

type Review

type Review struct {
	Challenge     string `json:"challengeId"`
	Reviewer      User   `json:"reviewer"`
	Student       User   `json:"student"`
	Deadline      string `json:"deadline"`
	Content       string `json:"content"`
	PointsRevoked bool   `json:"pointsRevoked"`
}

type SubmissionInfo

type SubmissionInfo struct {
	Challenge string `json:"challenge"`
	User      string `json:"user"`
	Points    int    `json:"points"`
}

func (*SubmissionInfo) ToRow

func (s *SubmissionInfo) ToRow() []string

type User

type User struct {
	Id string `json:"id"`
}

Jump to

Keyboard shortcuts

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