types

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: May 20, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package types contains types to use across the Consumer/Provider tests.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound represents a resource not found (404)
	ErrNotFound = errors.New("not found")

	// ErrUnauthorized represents a Forbidden (403)
	ErrUnauthorized = errors.New("unauthorized")

	// ErrEmpty is returned when input string is empty
	ErrEmpty = errors.New("empty string")
)

Functions

This section is empty.

Types

type LoginRequest

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

LoginRequest is the login request API struct.

type LoginResponse

type LoginResponse struct {
	User *User `json:"user"`
}

LoginResponse is the login response API struct.

type User

type User struct {
	Name     string `json:"name"`
	Username string
	Password string
	Type     string `json:"type"`
}

User is a representation of a User. Dah.

type UserRepository

type UserRepository struct {
	Users map[string]*User
}

UserRepository is an in-memory user database.

func (*UserRepository) ByUsername

func (u *UserRepository) ByUsername(username string) (*User, error)

ByUsername finds a user by their username.

Jump to

Keyboard shortcuts

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