xcontest

package module
v0.0.0-...-317c9fc Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-xcontest

PkgGoDev

Package xcontest is a client for tools.xcontest.org.

License

MIT

Documentation

Overview

Package xcontest is a client for https://tools.xcontest.org/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

A Client is an XContest client.

func NewClient

func NewClient(options ...ClientOption) *Client

NewClient returns a new Client.

func (*Client) TaskURL

func (c *Client) TaskURL(taskCode string) string

TaskURL returns the URL for the give task code.

func (*Client) XCTskLoad

func (c *Client) XCTskLoad(ctx context.Context, taskCode string) (*SavedTask, error)

XCTskLoad loads the saved task with the given task code.

func (*Client) XCTskLoadV2

func (c *Client) XCTskLoadV2(ctx context.Context, taskCode string) (*SavedTaskV2, error)

XCTskLoadV2 loads the saved task with the given task code in QR code format.

func (*Client) XCTskQR

func (c *Client) XCTskQR(ctx context.Context, task *xctrack.QRCodeTask) ([]byte, error)

XCTskQR returns SVG data for the given task.

func (*Client) XCTskSave

func (c *Client) XCTskSave(ctx context.Context, task *xctrack.QRCodeTask, author string) (string, error)

XCTskSave saves the given task and returns the task code.

type ClientOption

type ClientOption func(*Client)

A ClientOption sets an option on a Client.

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL sets the base URL on a Client.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientOption

WithHTTPClient sets the http.Client used by a Client.

type SavedTask

type SavedTask struct {
	Task         *xctrack.Task
	Author       string
	LastModified time.Time
}

A SavedTask is a saved task.

type SavedTaskV2

type SavedTaskV2 struct {
	Task         *xctrack.QRCodeTask
	Author       string
	LastModified time.Time
}

A SavedTaskV2 is a saved task in QR code format.

Jump to

Keyboard shortcuts

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