models

package
v0.0.0-...-0a2a880 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthCodeURL

func AuthCodeURL(p string) string

AuthCodeUrl return url for redirect user for oauth.

func Exchange

func Exchange(p string, c string) (*oauth2.Token, error)

Exchange converts an authorization code into a token.

func NewEngine

func NewEngine(r *redis.Client) error

NewEngine creates new services for data from config settings

Types

type Avatar

type Avatar struct {
	Url string `json:"url"`
}

Avatar represent a Avatar url.

type Board

type Board struct {
	Id                int64      `json:"id"`
	Name              string     `json:"name"`
	NamespaceWithName string     `json:"name_with_namespace"`
	PathWithNamespace string     `json:"path_with_namespace"`
	Namespace         *Namespace `json:"namespace,nil,omitempty"`
	Description       string     `json:"description"`
	LastModified      string     `json:"last_modified"`
	CreatedAt         string     `json:"created_at"`
	Owner             *User      `json:"owner,nil,omitempty"`
	AvatarUrl         string     `json:"avatar_url,nil,omitempty"`
}

Board represents a kanban board.

type BoardRequest

type BoardRequest struct {
	BoardId string `json:"project_id"`
}

type Card

type Card struct {
	Id                int64        `json:"id"`
	Iid               int64        `json:"iid"`
	Assignee          *User        `json:"assignee"`
	Milestone         *Milestone   `json:"milestone"`
	Author            *User        `json:"author"`
	Description       string       `json:"description"`
	Labels            *[]string    `json:"labels"`
	ProjectId         int64        `json:"project_id"`
	BoardID           string       `json:"board_id"`
	PathWithNamespace string       `json:"path_with_namespace"`
	Properties        *Properties  `json:"properties"`
	State             string       `json:"state"`
	Title             string       `json:"title"`
	Todo              []*Todo      `json:"todo"`
	TodoMetrics       *TodoMetrics `json:"todo_metrics"`
	UserCommentsCount int          `json:"user_comments_count"`
	Subscribed        bool         `json:"subscribed"`
	CreatedAt         int64        `json:"created_at"`
	UpdatedAt         int64        `json:"updated_at"`
	DueDate           string       `json:"due_date"`
	Confidential      bool         `json:"confidential"`
	WebURL            string       `json:"web_url"`
}

Card represents an card in kanban board

func (*Card) RoutingKey

func (c *Card) RoutingKey() string

type CardRequest

type CardRequest struct {
	CardId       int64             `json:"issue_id"`
	ProjectId    int64             `json:"project_id"`
	Title        string            `json:"title"`
	Description  string            `json:"description"`
	AssigneeId   *int64            `json:"assignee_id"`
	MilestoneId  *int64            `json:"milestone_id"`
	Labels       string            `json:"labels"`
	Properties   *Properties       `json:"properties"`
	Stage        map[string]string `json:"stage"`
	Todo         []*Todo           `json:"todo"`
	DueDate      string            `json:"due_date"`
	Confidential bool              `json:"confidential"`
}

CardRequest represents a card request for create, update, delete card on kanban

type Comment

type Comment struct {
	Id        int64     `json:"id"`
	Author    *User     `json:"author"`
	Body      string    `json:"body"`
	CreatedAt time.Time `json:"created_at"`
	IsInfo    bool      `json:"is_info"`
}

Comment represents a card comment

func (*Comment) MarshalJSON

func (c *Comment) MarshalJSON() ([]byte, error)

Marshal returns the JSON encoding of comment

type CommentRequest

type CommentRequest struct {
	CardId    int64  `json:"issue_id"`
	ProjectId int64  `json:"project_id"`
	Body      string `json:"body"`
}

CommentRequest represents a request for create or update comment on card

type Credential

type Credential struct {
	PrivateToken string `json:"private_access_token"`
	Token        *oauth2.Token
}

type File

type File struct {
	Alt      string `json:"alt"`
	URL      string `json:"url"`
	Markdown string `json:"markdown"`
}

File represents uploaded file

type Label

type Label struct {
	ID                    int64  `json:"id"`
	Color                 string `json:"color"`
	Name                  string `json:"name"`
	Description           string `json:"description"`
	OpenCardCount         int    `json:"open_card_count"`
	ClosedCardCount       int    `json:"closed_card_count"`
	OpenMergeRequestCount int    `json:"open_merge_requests_count"`
	Subscribed            bool   `json:"subscribed"`
	Priority              int    `json:"priority"`
}

Label represent label

type LabelRequest

type LabelRequest struct {
	Name    string `json:"name"`
	Color   string `json:"color"`
	NewName string `json:"new_name"`
}

LabelRequest represent request for update label

type Milestone

type Milestone struct {
	ID          int64  `json:"id"`
	IID         int64  `json:"iid"`
	State       string `json:"state,omitempty"`
	Title       string `json:"title,omitempty"`
	DueDate     string `json:"due_date,omitempty"`
	Description string `json:"description"`
	UpdatedAt   string `json:"updated_at"`
	CreatedAt   string `json:"created_at"`
}

Milestone represents a kanban milestone

type MilestoneRequest

type MilestoneRequest struct {
	MilestoneID int64  `json:"milestone_id"`
	ProjectID   int64  `json:"project_id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	DueDate     string `json:"due_date"`
}

MilestoneRequest represents a milestone request for create, update, delete milestone on kanban

type Namespace

type Namespace struct {
	Id     int64   `json:"id"`
	Name   string  `json:"name,omitempty"`
	Avatar *Avatar `json:"avatar,nil,omitempty"`
}

Board represents a namespace kanban board.

type Properties

type Properties struct {
	Andon string `json:"andon"`
}

Properties represents a card properties

type ReceivedDataErr

type ReceivedDataErr struct {
	Message    string
	StatusCode int
}

ReceivedDataError represents get data from storage or other api

func (ReceivedDataErr) Error

func (r ReceivedDataErr) Error() string

Error realised error type ReceivedDataErr interface

type Response

type Response struct {
	Data  interface{} `json:"data"`
	Event string      `json:"event"`
}

type ResponseError

type ResponseError struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

type ResponseUser

type ResponseUser struct {
	Id      int64  `json:"id"`
	Name    string `json:"name"`
	Token   string `json:"token"`
	Success bool   `json:"success"`
}

type Stage

type Stage struct {
	Name     string
	Position int
}

Stage represent board stage

func ParseLabelToStage

func ParseLabelToStage(l string) *Stage

ParseLabelToStage transform label to stage

type Todo

type Todo struct {
	Body    string `json:"body"`
	Checked bool   `json:"checked"`
}

Todo represents an todo an card

type TodoMetrics

type TodoMetrics struct {
	Checked  int `json:"checked"`
	Quantity int `json:"quantity"`
}

TodoMetrics represents metrics by todo for card

type UploadForm

type UploadForm struct {
	File *multipart.FileHeader `form:"file"`
}

UploadForm represents file uploaded

type User

type User struct {
	Id         int64
	Name       string
	IsAdmin    bool
	Token      *jwt.Token
	Credential map[string]*Credential
	AvatarUrl  string
	State      string
	Username   string
	Passwd     string
	Salt       string
	Email      string
}

func CreateUser

func CreateUser(u *User) (*User, error)

CreateUser creates new user

func LoadByToken

func LoadByToken(u *User, provider string) (*User, error)

LoadByToken is

func LoadUserByUsername

func LoadUserByUsername(uname string) (*User, error)

LoadUserByUsername is

func UpdateUser

func UpdateUser(u *User) (*User, error)

UpdateUser updates user's information.

func UserOauthSignIn

func UserOauthSignIn(provider string, tok *oauth2.Token) (*User, error)

UserOauthSignIn is

func UserSignIn

func UserSignIn(uname, pass string) (*User, error)

UserSignIn is

func UserSignUp

func UserSignUp(uname, email, pass, token, provider string) (*User, error)

UserSignUp is

func (*User) EncodePasswd

func (u *User) EncodePasswd()

EncodePasswd encodes password to safe format.

func (*User) MarshalJSON

func (u *User) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding value.

func (*User) SignedString

func (u *User) SignedString() (string, error)

SignedString returns user token for access

func (*User) ValidatePassword

func (u *User) ValidatePassword(pass string) bool

ValidatePassword checks if given password matches the one belongs to the user.

type UserNotFound

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

func (*UserNotFound) Error

func (e *UserNotFound) Error() string

Jump to

Keyboard shortcuts

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