tycs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package tycs is the library behind the tycs CLI.

Index

Constants

View Source
const BaseURL = "https://" + Host

BaseURL is the root every request is built from.

View Source
const DefaultUserAgent = "tycs-cli/dev (+https://github.com/tamnd/tycs-cli)"
View Source
const Host = "teachyourselfcs.com"

Host is the site this client talks to.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client fetches data from teachyourselfcs.com.

func NewClient

func NewClient(cfg Config) *Client

NewClient returns a Client configured by cfg.

func (*Client) Subjects

func (c *Client) Subjects(ctx context.Context) ([]*Subject, error)

Subjects fetches the teachyourselfcs.com homepage and returns all 9 CS subject guides in document order.

type Config

type Config struct {
	BaseURL   string
	Rate      time.Duration
	Timeout   time.Duration
	Retries   int
	UserAgent string
}

Config holds per-client settings.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config pointed at teachyourselfcs.com.

type Domain

type Domain struct{}

Domain is the tycs driver for the kit host (ant).

func (Domain) Classify

func (Domain) Classify(input string) (uriType, id string, err error)

func (Domain) Info

func (Domain) Info() kit.DomainInfo

func (Domain) Locate

func (Domain) Locate(uriType, id string) (string, error)

func (Domain) Register

func (Domain) Register(app *kit.App)

type Subject

type Subject struct {
	Rank    int    `json:"rank"     csv:"rank"     tsv:"rank"`
	Slug    string `json:"slug"     csv:"slug"     tsv:"slug"     kit:"id"`
	Title   string `json:"title"    csv:"title"    tsv:"title"`
	URL     string `json:"url"      csv:"url"      tsv:"url"`
	BookURL string `json:"book_url" csv:"book_url" tsv:"book_url"`
}

Subject is one CS topic from the Teach Yourself CS curriculum.

Jump to

Keyboard shortcuts

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