yandex

package
v0.0.0-...-d57ca31 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API is a singleton client for Yandex.Taxi API

func (*API) DisableUser

func (a *API) DisableUser(user User) error

DisableUser makes it impossible for user to call a taxi

func (*API) EnableUser

func (a *API) EnableUser(user User) error

EnableUser makes it possible for user to call a taxi

func (API) GetRoles

func (a API) GetRoles() (roles map[string]Role, err error)

GetRoles fetches all existing roles from Yandex.Taxi API

func (API) GetUsersByRole

func (a API) GetUsersByRole(role string) (users map[string]User, err error)

GetUsersByRole fetches all existing users and then filters them by role from Yandex.Taxi API

func (*API) Init

func (a *API) Init(sessionID, clientID string) error

Init establishes authenticated session with Yandex.Passport

type Restriction

type Restriction struct {
	Days      []string `json:"days,omitempty"`
	StartTime string   `json:"start_time,omitempty"`
	EndTime   string   `json:"end_time,omitempty"`
	Type      string   `json:"type,omitempty"`
}

Restriction is an element of a role that makes coding slightly easier

type Role

type Role struct {
	ID   string `json:"_id"`
	Name string `json:"name"`
}

Role is a group of Yandex.Taxi users with shared configuration

type RoleResponse

type RoleResponse struct {
	Items []Role `json:"items"`
}

RoleResponse is Yandex.Taxi API DTO for roles

type User

type User struct {
	ID         string `json:"_id,omitempty"`
	Name       string `json:"fullname"`
	Phone      string `json:"phone"`
	Email      string `json:"email"`
	Nickname   string `json:"nickname"`
	CostCenter string `json:"cost_center"`
	IsActive   bool   `json:"is_active"`
	Role       struct {
		ID              string        `json:"role_id,omitempty"`
		Name            string        `json:"name,omitempty"`
		Limit           float32       `json:"limit,omitempty"`
		Classes         []string      `json:"classes,omitempty"`
		NoSpecificLimit bool          `json:"no_specific_limit,omitempty"`
		Restrictions    []Restriction `json:"restrictions,omitempty"`
	} `json:"role"`
}

User is a single Yandex.Taxi user

type UserResponse

type UserResponse struct {
	Items []User `json:"items"`
}

UserResponse is Yandex.Taxi API DTO for users

Jump to

Keyboard shortcuts

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