planfix

package
v0.0.0-...-9982b71 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	URL       string
	APIKey    string
	Account   string
	Sid       string
	User      string
	Password  string
	UserAgent string
	Logger    *log.Logger
}

API - реализация Планфикс API

func New

func New(url, apiKey, account, user, password string) API

New возвращает экземпляр planfix.API

func (*API) ActionAdd

func (a *API) ActionAdd(requestStruct XMLRequestActionAdd) (XMLResponseActionAdd, error)

ActionAdd = action.add

func (*API) ActionGet

func (a *API) ActionGet(actionID int) (XMLResponseActionGet, error)

ActionGet = action.get

func (*API) ActionGetList

func (a *API) ActionGetList(requestStruct XMLRequestActionGetList) (XMLResponseActionGetList, error)

ActionGetList = action.getList

func (*API) AnaliticGetHandbook

func (a *API) AnaliticGetHandbook(handbookID int) (XMLResponseAnaliticGetHandbook, error)

AnaliticGetHandbook = analitic.getHandbook

func (*API) AnaliticGetList

func (a *API) AnaliticGetList(groupID int) (XMLResponseAnaliticGetList, error)

AnaliticGetList = analitic.getList

func (*API) AnaliticGetOptions

func (a *API) AnaliticGetOptions(analiticID int) (XMLResponseAnaliticGetOptions, error)

AnaliticGetOptions = analitic.get

func (API) AuthLogin

func (a API) AuthLogin(user, password string) (string, error)

AuthLogin = auth.login

func (*API) GetActiveUserByLogin

func (a *API) GetActiveUserByLogin(login string) (XMLResponseUser, error)

GetHandbookRecordByName возвращает юзера по логину

func (*API) GetAnaliticByName

func (a *API) GetAnaliticByName(searchName string) (XMLResponseAnalitic, error)

GetAnaliticByName возвращает аналитику по названию

func (*API) GetHandbookRecordByName

func (a *API) GetHandbookRecordByName(handbookID int, searchName string) (XMLResponseAnaliticHandbookRecord, error)

GetHandbookRecordByName возвращает запись справочника ID справочника и названию

func (*API) TaskGet

func (a *API) TaskGet(taskID, taskGeneral int) (XMLResponseTaskGet, error)

TaskGet = task.get

func (*API) UserGet

func (a *API) UserGet(userID int) (XMLResponseUserGet, error)

UserGet = user.get

func (*API) UserGetList

func (a *API) UserGetList(requestStruct XMLRequestUserGetList) (XMLResponseUserGetList, error)

UserGetList = user.getList

type GroupsList

type GroupsList struct {
	Groups []IdName `xml:"group"`
}

type IdName

type IdName struct {
	ID   int    `xml:"id"`
	Name string `xml:"name,omitempty"`
}

type TaskCustomValue

type TaskCustomValue struct {
	Field IdName      `xml:"field"`
	Value interface{} `xml:"value,omitempty"`
	Text  string      `xml:"text"`
}

type UsersList

type UsersList struct {
	Users []IdName `xml:"user"`
}

type XMLRequestActionAdd

type XMLRequestActionAdd struct {
	XMLRequestAuth
	XMLName xml.Name `xml:"request"`

	Description    string                     `xml:"action>description"`
	TaskID         int                        `xml:"action>task>id,omitempty"`
	TaskGeneral    int                        `xml:"action>task>general,omitempty"`
	ContactGeneral int                        `xml:"action>contact>general,omitempty"`
	TaskNewStatus  int                        `xml:"action>taskNewStatus,omitempty"`
	NotifiedList   []XMLResponseUser          `xml:"action>notifiedList>user,omitempty"`
	IsHidden       int                        `xml:"action>isHidden"`
	Owner          XMLResponseUser            `xml:"action>owner,omitempty"`
	DateTime       string                     `xml:"action>dateTime,omitempty"`
	Analitics      []XMLRequestActionAnalitic `xml:"action>analitics>analitic,omitempty"`
}

XMLRequestActionAdd - запрос action.add

type XMLRequestActionAnalitic

type XMLRequestActionAnalitic struct {
	ID       int                       `xml:"id"`
	ItemData []XMLRequestAnaliticField `xml:"analiticData>itemData"`
}

XMLRequestActionAnalitic - аналитика в запросе на добавление действия analitic.add

type XMLRequestActionGet

type XMLRequestActionGet struct {
	XMLRequestAuth
	XMLName  xml.Name `xml:"request"`
	ActionID int      `xml:"action>id"`
}

XMLRequestActionGet - запрос action.get

type XMLRequestActionGetList

type XMLRequestActionGetList struct {
	XMLRequestAuth
	XMLName xml.Name `xml:"request"`

	TaskID         int    `xml:"task>id,omitempty"`
	TaskGeneral    int    `xml:"task>general,omitempty"`
	ContactGeneral int    `xml:"contact>general,omitempty"`
	PageCurrent    int    `xml:"pageCurrent"`
	PageSize       int    `xml:"pageSize"`
	Sort           string `xml:"sort"`
}

XMLRequestActionGetList - запрос action.getList

type XMLRequestAnaliticField

type XMLRequestAnaliticField struct {
	FieldID int         `xml:"fieldId"`
	Value   interface{} `xml:"value"`
}

XMLRequestAnaliticField - поле аналитики в запросе на добавление действия analitic.add

type XMLRequestAnaliticGetHandbook

type XMLRequestAnaliticGetHandbook struct {
	XMLRequestAuth
	XMLName xml.Name `xml:"request"`

	HandbookID int `xml:"handbook>id"`
}

XMLRequestAnaliticGetHandbook - запрос analitic.getHandbook

type XMLRequestAnaliticGetList

type XMLRequestAnaliticGetList struct {
	XMLRequestAuth
	XMLName xml.Name `xml:"request"`

	AnaliticGroupID int `xml:"analiticGroupId,omitempty"`
}

XMLRequestAnaliticGetList - запрос analitic.getList

type XMLRequestAnaliticGetOptions

type XMLRequestAnaliticGetOptions struct {
	XMLRequestAuth
	XMLName xml.Name `xml:"request"`

	AnaliticID int `xml:"analitic>id"`
}

XMLRequestAnaliticGetOptions - запрос analitic.getOptions

type XMLRequestAnaliticTimePeriodValue

type XMLRequestAnaliticTimePeriodValue struct {
	Begin string `xml:"begin"`
	End   string `xml:"end"`
}

XMLRequestAnaliticTimePeriodValue - поле аналитики с типом `TIMEPERIOD` в запросе на добавление действия analitic.add

type XMLRequestAuth

type XMLRequestAuth struct {
	XMLName xml.Name `xml:"request"`
	Method  string   `xml:"method,attr"`
	Account string   `xml:"account"`
	Sid     string   `xml:"sid"`
}

XMLRequestAuth - запрос авторизации

func (*XMLRequestAuth) GetMethod

func (a *XMLRequestAuth) GetMethod() string

GetMethod возвращает метод API (название)

func (*XMLRequestAuth) SetAccount

func (a *XMLRequestAuth) SetAccount(account string)

SetAccount задает account

func (*XMLRequestAuth) SetSid

func (a *XMLRequestAuth) SetSid(sid string)

SetSid задает sid

type XMLRequestAuthLogin

type XMLRequestAuthLogin struct {
	XMLName xml.Name `xml:"request"`
	Method  string   `xml:"method,attr"`

	Account  string `xml:"account"`
	Login    string `xml:"login"`
	Password string `xml:"password"`
}

XMLRequestAuthLogin - запрос auth.login

func (*XMLRequestAuthLogin) GetMethod

func (a *XMLRequestAuthLogin) GetMethod() string

GetMethod возвращает метод API (название)

func (*XMLRequestAuthLogin) SetAccount

func (a *XMLRequestAuthLogin) SetAccount(account string)

SetAccount задает account

func (*XMLRequestAuthLogin) SetSid

func (a *XMLRequestAuthLogin) SetSid(sid string)

- SetSid - заглушка, чтобы реализовать интерфейс

type XMLRequestTaskGet

type XMLRequestTaskGet struct {
	XMLRequestAuth
	XMLName xml.Name `xml:"request"`

	TaskID      int `xml:"task>id,omitempty"`
	TaskGeneral int `xml:"task>general,omitempty"`
}

XMLRequestTaskGet - запрос task.get

type XMLRequestUserGet

type XMLRequestUserGet struct {
	XMLRequestAuth
	XMLName xml.Name `xml:"request"`

	UserID int `xml:"user>id,omitempty"`
}

XMLRequestUserGet - запрос user.get

type XMLRequestUserGetList

type XMLRequestUserGetList struct {
	XMLRequestAuth
	XMLName xml.Name `xml:"request"`

	Status      string `xml:"status,omitempty"`
	OnlyOnline  int    `xml:"onlyOnline,omitempty"`
	UserGroupID int    `xml:"userGoup>id,omitempty"`
	SortType    string `xml:"sortType,omitempty"`
	PageCurrent int    `xml:"pageCurrent,omitempty"`
	PageSize    int    `xml:"pageSize,omitempty"`
}

XMLRequestUserGetList - запрос user.getList

type XMLRequester

type XMLRequester interface {
	SetSid(sid string)
	SetAccount(account string)
	GetMethod() string
}

XMLRequester - любая структура запроса

type XMLResponseAction

type XMLResponseAction struct {
	ID                           int                         `xml:"id"`
	Description                  string                      `xml:"description"`
	OldStatus                    int                         `xml:"statusChange>oldStatus,omitempty"`
	NewStatus                    int                         `xml:"statusChange>newStatus,omitempty"`
	IsNotRead                    bool                        `xml:"isNotRead"`
	FromEmail                    bool                        `xml:"fromEmail"`
	DateTime                     string                      `xml:"dateTime"`
	TaskID                       int                         `xml:"task>id"`
	TaskTitle                    string                      `xml:"task>title"`
	ContactGeneral               int                         `xml:"contact>general"`
	ContactName                  string                      `xml:"contact>name"`
	Owner                        XMLResponseActionUser       `xml:"owner"`
	ProjectID                    int                         `xml:"project>id"`
	ProjectTitle                 string                      `xml:"project>title"`
	TaskExpectDateChangedOldDate string                      `xml:"taskExpectDateChanged>oldDate"`
	TaskExpectDateChangedNewDate string                      `xml:"taskExpectDateChanged>newDate"`
	TaskStartTimeChangedOldDate  string                      `xml:"taskStartTimeChanged>oldDate"`
	TaskStartTimeChangedNewDate  string                      `xml:"taskStartTimeChanged>newDate"`
	Files                        []XMLResponseFile           `xml:"files>file"`
	NotifiedList                 []XMLResponseActionUser     `xml:"notifiedList>user"`
	Analitics                    []XMLResponseActionAnalitic `xml:"analitics>analitic"`
}

XMLResponseAction - действие в ответе action.getList

type XMLResponseActionAdd

type XMLResponseActionAdd struct {
	XMLName  xml.Name `xml:"response"`
	ActionID int      `xml:"action>id"`
}

XMLResponseActionAdd - ответ action.add

type XMLResponseActionAnalitic

type XMLResponseActionAnalitic struct {
	ID   int    `xml:"id"`
	Key  int    `xml:"key"`
	Name string `xml:"name"`
}

XMLResponseActionAnalitic - аналитика в ответе analitic.get

type XMLResponseActionGet

type XMLResponseActionGet struct {
	XMLName xml.Name          `xml:"response"`
	Action  XMLResponseAction `xml:"action"`
}

XMLResponseActionGet - ответ action.get

type XMLResponseActionGetList

type XMLResponseActionGetList struct {
	XMLName xml.Name `xml:"response"`
	Actions struct {
		ActionsCount      int                 `xml:"count,attr"`
		ActionsTotalCount int                 `xml:"totalCount,attr"`
		Actions           []XMLResponseAction `xml:"action"`
	} `xml:"actions"`
}

XMLResponseActionGetList - ответ action.getList

type XMLResponseActionUser

type XMLResponseActionUser struct {
	ID   int    `xml:"id,omitempty"`
	Name string `xml:"name,omitempty"`
}

XMLResponseActionUser - юзер в ответе analitic.get

type XMLResponseAnalitic

type XMLResponseAnalitic struct {
	ID        int    `xml:"id"`
	Name      string `xml:"name"`
	GroupID   int    `xml:"group>id"`
	GroupName string `xml:"group>name"`
}

XMLResponseAnalitic - аналитика в ответе analitic.getList

type XMLResponseAnaliticGetHandbook

type XMLResponseAnaliticGetHandbook struct {
	XMLName xml.Name                            `xml:"response"`
	Records []XMLResponseAnaliticHandbookRecord `xml:"records>record"`
}

XMLResponseAnaliticGetHandbook - ответ analitic.getHandbook

type XMLResponseAnaliticGetList

type XMLResponseAnaliticGetList struct {
	XMLName   xml.Name `xml:"response"`
	Analitics struct {
		AnaliticsCount      int                   `xml:"count,attr"`
		AnaliticsTotalCount int                   `xml:"totalCount,attr"`
		Analitics           []XMLResponseAnalitic `xml:"analitic"`
	} `xml:"analitics"`
}

XMLResponseAnaliticGetList - ответ analitic.getList

type XMLResponseAnaliticGetOptions

type XMLResponseAnaliticGetOptions struct {
	XMLName  xml.Name                   `xml:"response"`
	Analitic XMLResponseAnaliticOptions `xml:"analitic"`
}

XMLResponseAnaliticGetOptions - ответ analitic.getOptions

type XMLResponseAnaliticHandbookRecord

type XMLResponseAnaliticHandbookRecord struct {
	Key       int                                       `xml:"key"`
	ParentKey int                                       `xml:"parentKey"`
	IsGroup   int                                       `xml:"isGroup"`
	Values    []XMLResponseAnaliticHandbookRecordValues `xml:"value"`
	ValuesMap map[string]string
}

XMLResponseAnaliticHandbookRecord - запись справочника в ответе analitic.getHandbook

type XMLResponseAnaliticHandbookRecordValues

type XMLResponseAnaliticHandbookRecordValues struct {
	Name        string `xml:"name,attr"`
	Value       string `xml:"value,attr"`
	IsDisplayed int    `xml:"isDisplayed,attr"`
}

XMLResponseAnaliticHandbookRecordValues - значения полей в записи справочника в ответе analitic.getHandbook

type XMLResponseAnaliticOptions

type XMLResponseAnaliticOptions struct {
	ID      int                               `xml:"id"`
	Name    string                            `xml:"name"`
	GroupID int                               `xml:"group>id"`
	Fields  []XMLResponseAnaliticOptionsField `xml:"fields>field"`
}

XMLResponseAnaliticOptions - аналитика в ответе analitic.getOptions

type XMLResponseAnaliticOptionsField

type XMLResponseAnaliticOptionsField struct {
	ID         int      `xml:"id"`
	Num        int      `xml:"num"`
	Name       string   `xml:"name"`
	Type       string   `xml:"type"`
	ListValues []string `xml:"list>value"`
	HandbookID int      `xml:"handbook>id"`
}

XMLResponseAnaliticOptionsField - поле аналитики в ответе analitic.getOptions

type XMLResponseAuth

type XMLResponseAuth struct {
	XMLName xml.Name `xml:"response"`
	Sid     string   `xml:"sid"`
}

XMLResponseAuth - ответ auth.login

type XMLResponseFile

type XMLResponseFile struct {
	ID   int    `xml:"id"`
	Name string `xml:"name"`
}

XMLResponseFile - файл в ответе analitic.get

type XMLResponseStatus

type XMLResponseStatus struct {
	XMLName xml.Name `xml:"response"`
	Status  string   `xml:"status,attr"`
	Code    string   `xml:"code"`
	Message string   `xml:"message"`
}

XMLResponseStatus - любой ответ, подразумевает статус ответа и код ошибки в случае ошибки

type XMLResponseTask

type XMLResponseTask struct {
	ID             int               `xml:"id"`
	Title          string            `xml:"title"`
	Description    string            `xml:"description"`
	General        int               `xml:"general"`
	ProjectID      int               `xml:"project>id"`
	ProjectTitle   string            `xml:"project>title"`
	OwnerId        int               `xml:"owner>id"`
	ParentId       int               `xml:"parent>id"`
	TemplateId     int               `xml:"template>id"`
	WorkersUsers   UsersList         `xml:"workers>users,omitempty"`
	WorkersGroups  GroupsList        `xml:"workers>groups,omitempty"`
	MembersUsers   UsersList         `xml:"members>users,omitempty"`
	MembersGroups  GroupsList        `xml:"members>groups,omitempty"`
	AuditorsUsers  UsersList         `xml:"auditors>users,omitempty"`
	AuditorsGroups GroupsList        `xml:"auditors>groups,omitempty"`
	CustomValues   []TaskCustomValue `xml:"customData>customValue,omitempty"`
}

XMLResponseTask - задача в ответе task.get TODO: добавить все поля из https://planfix.ru/docs/ПланФикс_API_task.get

type XMLResponseTaskGet

type XMLResponseTaskGet struct {
	XMLName xml.Name        `xml:"response"`
	Task    XMLResponseTask `xml:"task"`
}

XMLResponseTaskGet - ответ task.get response

type XMLResponseUser

type XMLResponseUser struct {
	ID       int    `xml:"id"`
	Name     string `xml:"name"`
	LastName string `xml:"lastName"`
	Login    string `xml:"login"`
	Email    string `xml:"email"`
}

XMLResponseUser - юзер в ответе user.get, user.getList TODO: добавить все поля из https://planfix.ru/docs/ПланФикс_API_user.get

type XMLResponseUserGet

type XMLResponseUserGet struct {
	XMLName xml.Name        `xml:"response"`
	User    XMLResponseUser `xml:"user"`
}

XMLResponseUserGet - ответ user.get

type XMLResponseUserGetList

type XMLResponseUserGetList struct {
	XMLName xml.Name `xml:"response"`
	Users   struct {
		UsersCount      int               `xml:"count,attr"`
		UsersTotalCount int               `xml:"totalCount,attr"`
		Users           []XMLResponseUser `xml:"user"`
	} `xml:"users"`
}

XMLResponseUserGetList - ответ user.getList

Jump to

Keyboard shortcuts

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