okdesk

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

README

go-okdesk

Env

cp default.env .env

Add okdesk token

micro .env

GetIssueCount

  sd:=OKD{}
  result:=[]int{}
  err := sd.GetIssueCount(context.Background(), &result)
  if err!=nil{
    panic(err)
  }

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MultiPartRequest

func MultiPartRequest(ctx context.Context, method, URL string,
	values map[string]Value) (body io.ReadCloser, err error)

func Request

func Request(ctx context.Context, method, URL string,
	reader io.ReadCloser,
	header map[string]string) (body io.ReadCloser, err error)

Types

type Attachment

type Attachment struct {
	ID                 int       `json:"id"`
	AttachmentFileName string    `json:"attachment_file_name"`
	Description        string    `json:"description"`
	AttachmentFileSize int       `json:"attachment_file_size"`
	IsPublic           bool      `json:"is_public"`
	CreatedAt          time.Time `json:"created_at"`
}

type CommentStatus

type CommentStatus struct {
	Count  int       `json:"count"`
	LastAt time.Time `json:"last_at"`
}

type CommentType

type CommentType struct {
	ID          int    `json:"id"`
	Content     string `json:"content"`
	Public      bool   `json:"public"`
	PublishedAt string `json:"published_at"`
	Author      User   `json:"author"`
}

type CreateCompany

type CreateCompany struct {
	Company struct {
		Name              string    `json:"name"`
		AdditionalName    string    `json:"additional_name"`
		Site              string    `json:"site"`
		Email             string    `json:"email"`
		Phone             string    `json:"phone"`
		Address           string    `json:"address"`
		Coordinates       []float64 `json:"coordinates"`
		Comment           string    `json:"comment"`
		ObserverIds       []int     `json:"observer_ids"`
		DefaultAssigneeID int       `json:"default_assignee_id"`
		CategoryCode      string    `json:"category_code"`
		Crm1CID           string    `json:"crm_1c_id"`
		CustomParameters  struct {
			Code1 string `json:"code1"`
			Code2 string `json:"code2"`
			Code3 bool   `json:"code3"`
		} `json:"custom_parameters"`
	} `json:"company"`
}

type Executor

type Executor struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Group Group  `json:"group"`
}

type Group

type Group struct {
	ID   string  `json:"id"`
	Name *string `json:"name,omitempty"`
	Type *string `json:"type,omitempty"`
}

type Issue

type Issue struct {
	ID                      int           `json:"id"`
	Title                   string        `json:"title"`
	Description             string        `json:"description"`
	CreatedAt               time.Time     `json:"created_at"`
	CompletedAt             time.Time     `json:"completed_at"`
	DeadlineAt              time.Time     `json:"deadline_at"`
	Source                  string        `json:"source"`
	SpentTimeTotal          int           `json:"spent_time_total"`
	StartExecutionUntil     time.Time     `json:"start_execution_until"`
	PlannedExecutionInHours int           `json:"planned_execution_in_hours"`
	PlannedReactionAt       time.Time     `json:"planned_reaction_at"`
	ReactedAt               time.Time     `json:"reacted_at"`
	UpdatedAt               time.Time     `json:"updated_at"`
	DelayedTo               interface{}   `json:"delayed_to"`
	CompanyID               int           `json:"company_id"`
	GroupID                 int           `json:"group_id"`
	Coexecutors             []Executor    `json:"coexecutors"`
	ServiceObjectID         interface{}   `json:"service_object_id"`
	EquipmentIds            []interface{} `json:"equipment_ids"`
	Attachments             []Attachment  `json:"attachments"`
	StatusTimes             StatusTime    `json:"status_times"`
	Parameters              []interface{} `json:"parameters"`
	Comments                CommentStatus `json:"comments"`
	ParentID                interface{}   `json:"parent_id"`
	ChildIds                []interface{} `json:"child_ids"`
	Type                    Type          `json:"type"`
	Priority                Named         `json:"priority"`
	Status                  Named         `json:"status"`
	OldStatus               Named         `json:"old_status"`
	Rate                    Valued        `json:"rate"`
	Observers               []Named       `json:"observers"`
	ObserverGroups          []Named       `json:"observer_groups"`
	Contact                 Named         `json:"contact"`
	Agreement               interface{}   `json:"agreement"`
	Assignee                Named         `json:"assignee"`
	Author                  Named         `json:"author"`
}

type IssueCreate

type IssueCreate struct {
	Title               string   `json:"title"`
	Description         string   `json:"description"`
	CompanyID           string   `json:"company_id"`
	ContactID           string   `json:"contact_id"`
	AgreementID         string   `json:"agreement_id"`
	Type                string   `json:"type"`
	Priority            string   `json:"priority"`
	MaintenanceEntityID string   `json:"maintenance_entity_id"`
	EquipmentIds        []string `json:"equipment_ids"`
	DeadlineAt          string   `json:"deadline_at"`
	CustomParameters    struct {
		Address string `json:"address"`
		Checked bool   `json:"checked"`
	} `json:"custom_parameters"`
	ParentID string `json:"parent_id"`
	Author   struct {
		ID   string `json:"id"`
		Type string `json:"type"`
	} `json:"author"`
	ObserverIds        []int `json:"observer_ids"`
	ObserverGroupIds   []int `json:"observer_group_ids"`
	ContactObserverIds []int `json:"contact_observer_ids"`
}

type Named

type Named struct {
	ID   int    `json:"id"`
	Code string `json:"code"`
	Type string `json:"type"`
	Name string `json:"name"`
}

type OKD

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

func New

func New() OKD

func (OKD) CreateCompany

func (OKD OKD) CreateCompany(ctx context.Context, CreateCompany interface{}, response interface{}) error

func (OKD) CreateEmployer

func (OKD OKD) CreateEmployer(ctx context.Context, CreateEmployer interface{}, response interface{}) error

func (OKD) CreateIssue

func (OKD OKD) CreateIssue(ctx context.Context, createIssueRequest interface{}, response interface{}) error

func (OKD) CreateIssueComment

func (OKD OKD) CreateIssueComment(ctx context.Context, issueID, createCommentRequest, response interface{}) error

func (OKD) CreateIssueServices

func (OKD OKD) CreateIssueServices(ctx context.Context, issueID, createService, response interface{}) error

func (OKD) CreateIssueTimeEntry

func (OKD OKD) CreateIssueTimeEntry(ctx context.Context, issueID, IssueTimeEntry, response interface{}) error

func (OKD) CreateIssueWithAttach

func (OKD OKD) CreateIssueWithAttach(ctx context.Context, createIssueRequest interface{}, response interface{}) error

func (OKD) CreateMaintenanceEntity

func (OKD OKD) CreateMaintenanceEntity(ctx context.Context, IssueTimeEntry, response interface{}) error

func (OKD) FindCompany

func (OKD OKD) FindCompany(ctx context.Context, query map[string][]string, response interface{}) error

func (OKD) FindMaintenancesEntity

func (OKD OKD) FindMaintenancesEntity(ctx context.Context, query map[string][]string, response interface{}) error

func (OKD) GetCompanyAttachment

func (OKD OKD) GetCompanyAttachment(ctx context.Context,
	companyID, attachmentID string, response []interface{}) error

func (OKD) GetCompanyList

func (OKD OKD) GetCompanyList(ctx context.Context,
	Query map[string][]string, response []interface{}) error

func (OKD) GetIssue

func (OKD OKD) GetIssue(ctx context.Context, issueID, response interface{}) error

func (OKD) GetIssueAttachment

func (OKD OKD) GetIssueAttachment(ctx context.Context, issueID, attachmentID, response interface{}) error

func (OKD) GetIssueCheckList

func (OKD OKD) GetIssueCheckList(ctx context.Context, issueID, response interface{}) error

func (OKD) GetIssueComments

func (OKD OKD) GetIssueComments(ctx context.Context, issueID, response interface{}) error

func (OKD) GetIssueCount

func (OKD OKD) GetIssueCount(ctx context.Context, response interface{}) error

func (OKD) GetIssueList

func (OKD OKD) GetIssueList(ctx context.Context, response interface{}) error

func (OKD) GetIssueParameters

func (OKD OKD) GetIssueParameters(ctx context.Context, response interface{}) error

func (OKD) GetIssuePriorities

func (OKD OKD) GetIssuePriorities(ctx context.Context, response interface{}) error

func (OKD) GetIssueStatuses

func (OKD OKD) GetIssueStatuses(ctx context.Context, response interface{}) error

func (OKD) GetIssueTimeEntries

func (OKD OKD) GetIssueTimeEntries(ctx context.Context, issueID, response interface{}) error

func (OKD) GetMaintenanceEntity

func (OKD OKD) GetMaintenanceEntity(ctx context.Context, MaintenanceEntityID, response interface{}) error

func (OKD) GetMaintenanceEntityList

func (OKD OKD) GetMaintenanceEntityList(ctx context.Context, query map[string][]string, response interface{}) error

func (OKD) IdIdReqRes

func (OKD OKD) IdIdReqRes(method, path string) func(ctx context.Context, ID, ID1, request, response interface{}) error

func (OKD) IdIdRes

func (OKD OKD) IdIdRes(method, path string) func(ctx context.Context, ID, ID1, response interface{}) error

func (OKD) IdReaderRes

func (OKD OKD) IdReaderRes(method, path string) func(ctx context.Context, ID interface{}, Form io.Reader, response interface{}) error

func (OKD) IdReqRes

func (OKD OKD) IdReqRes(method, path string) func(ctx context.Context, ID, request, response interface{}) error

func (OKD) IdRes

func (OKD OKD) IdRes(method, path string) func(ctx context.Context, ID, response interface{}) error

func (OKD) ReaderRes

func (OKD OKD) ReaderRes(method, path string) func(ctx context.Context, Form io.Reader, response interface{}) error

func (OKD) ReqRes

func (OKD OKD) ReqRes(method, URL string) func(ctx context.Context, request interface{}, response interface{}) error

func (OKD) Res

func (OKD OKD) Res(method, URL string) func(ctx context.Context, response interface{}) error

func (OKD) SetCompany

func (OKD OKD) SetCompany(ctx context.Context,
	CompanyID string, UpdateCompany interface{}, response interface{}) error

func (OKD) SetEmployer

func (OKD OKD) SetEmployer(ctx context.Context,
	EmployerID string, UpdateEmployer interface{}, response interface{}) error

func (OKD) SetEmployerActivation

func (OKD OKD) SetEmployerActivation(ctx context.Context,
	EmployerID string, UpdateActivation UpdateActivation, response interface{}) error

func (OKD) SetEmployerGroups

func (OKD OKD) SetEmployerGroups(ctx context.Context, response interface{}) error

func (OKD) SetEmployerList

func (OKD OKD) SetEmployerList(ctx context.Context, query map[string][]string, response interface{}) error

func (OKD) SetEmployerRoles

func (OKD OKD) SetEmployerRoles(ctx context.Context, response interface{}) error

func (OKD) SetEmployerRoutes

func (OKD OKD) SetEmployerRoutes(ctx context.Context, response interface{}) error

func (OKD) SetIssueAssignee

func (OKD OKD) SetIssueAssignee(ctx context.Context, issueID, createIssueRequest, response interface{}) error

func (OKD) SetIssueCheckList

func (OKD OKD) SetIssueCheckList(ctx context.Context, issueID, checkID, item, response interface{}) error

func (OKD) SetIssueDeadline

func (OKD OKD) SetIssueDeadline(ctx context.Context, issueID, IssueDeadlineRequest, response interface{}) error

func (OKD) SetIssueStatus

func (OKD OKD) SetIssueStatus(ctx context.Context, issueID, IssueStatusRequest, response interface{}) error

func (OKD) SetIssueType

func (OKD OKD) SetIssueType(ctx context.Context, issueID, IssueTypeRequest, response interface{}) error

func (OKD) SetMaintenanceEntity

func (OKD OKD) SetMaintenanceEntity(ctx context.Context, MaintenanceEntityID, MaintenanceEntity, response interface{}) error

func (OKD) ValRes

func (OKD OKD) ValRes(method, URL string) func(ctx context.Context, val map[string][]string, response interface{}) error

type RequestIssueAssignee

type RequestIssueAssignee struct {
	AssigneeID string `json:"assignee_id"`
	GroupID    string `json:"group_id"`
}

type ResponseCompany

type ResponseCompany struct {
	ID             int         `json:"id"`
	Name           string      `json:"name"`
	AdditionalName interface{} `json:"additional_name"`
	Parameters     []struct {
		Code      string `json:"code"`
		Name      string `json:"name"`
		FieldType string `json:"field_type"`
		Value     string `json:"value"`
	} `json:"parameters"`
}

type ResponseCompanyAttachment

type ResponseCompanyAttachment struct {
	ID                 int       `json:"id"`
	AttachmentFileName string    `json:"attachment_file_name"`
	Description        string    `json:"description"`
	AttachmentFileSize int       `json:"attachment_file_size"`
	IsPublic           bool      `json:"is_public"`
	CreatedAt          time.Time `json:"created_at"`
	AttachmentURL      string    `json:"attachment_url"`
}

type ResponseCreateCompany

type ResponseCreateCompany struct {
	ID             int       `json:"id"`
	Name           string    `json:"name"`
	AdditionalName string    `json:"additional_name"`
	Site           string    `json:"site"`
	Email          string    `json:"email"`
	Phone          string    `json:"phone"`
	Address        string    `json:"address"`
	Comment        string    `json:"comment"`
	Crm1CID        string    `json:"crm_1c_id"`
	Coordinates    []float64 `json:"coordinates"`
	Observers      []struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"observers"`
	Contacts        []interface{} `json:"contacts"`
	DefaultAssignee struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"default_assignee"`
	Category struct {
		ID    int    `json:"id"`
		Code  string `json:"code"`
		Name  string `json:"name"`
		Color string `json:"color"`
	} `json:"category"`
	Attachments []interface{} `json:"attachments"`
	Parameters  []struct {
		Code      string `json:"code"`
		Name      string `json:"name"`
		FieldType string `json:"field_type"`
		Value     string `json:"value"`
	} `json:"parameters"`
}

type ResponseEmployerList

type ResponseEmployerList []struct {
	ID              int    `json:"id"`
	LastName        string `json:"last_name"`
	FirstName       string `json:"first_name"`
	Patronymic      string `json:"patronymic"`
	Position        string `json:"position"`
	Active          bool   `json:"active"`
	Email           string `json:"email"`
	Login           string `json:"login"`
	Phone           string `json:"phone"`
	TelephonyNumber string `json:"telephony_number"`
	Comment         string `json:"comment"`
	Groups          []struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"groups"`
	Roles []struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"roles"`
}

type ResponseError

type ResponseError struct {
	Errors *struct {
		CompanyID             string `json:"company_id"`
		Type                  string `json:"type"`
		CustomParametersTotal string `json:"custom_parameters_total"`
	} `json:"errors,omitempty"`
}

type ResponseFindCompany

type ResponseFindCompany struct {
	ID             int       `json:"id"`
	Name           string    `json:"name"`
	AdditionalName string    `json:"additional_name"`
	Site           string    `json:"site"`
	Email          string    `json:"email"`
	Phone          string    `json:"phone"`
	Crm1CID        string    `json:"crm_1c_id"`
	Address        string    `json:"address"`
	Comment        string    `json:"comment"`
	Coordinates    []float64 `json:"coordinates"`
	Observers      []struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"observers"`
	Contacts        []interface{} `json:"contacts"`
	DefaultAssignee struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"default_assignee"`
	Category struct {
		ID    int    `json:"id"`
		Code  string `json:"code"`
		Name  string `json:"name"`
		Color string `json:"color"`
	} `json:"category"`
	Attachments []struct {
		ID                 int       `json:"id"`
		AttachmentFileName string    `json:"attachment_file_name"`
		Description        string    `json:"description"`
		AttachmentFileSize int       `json:"attachment_file_size"`
		IsPublic           bool      `json:"is_public"`
		CreatedAt          time.Time `json:"created_at"`
	} `json:"attachments"`
	Parameters []struct {
		Code      string `json:"code"`
		Name      string `json:"name"`
		FieldType string `json:"field_type"`
		Value     string `json:"value"`
	} `json:"parameters"`
}

type ResponseUpdateCompany

type ResponseUpdateCompany struct {
	ID             int       `json:"id"`
	Name           string    `json:"name"`
	AdditionalName string    `json:"additional_name"`
	Site           string    `json:"site"`
	Email          string    `json:"email"`
	Phone          string    `json:"phone"`
	Address        string    `json:"address"`
	Comment        string    `json:"comment"`
	Crm1CID        string    `json:"crm_1c_id"`
	Coordinates    []float64 `json:"coordinates"`
	Observers      []struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"observers"`
	Contacts        []interface{} `json:"contacts"`
	DefaultAssignee struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"default_assignee"`
	Category struct {
		ID    int    `json:"id"`
		Code  string `json:"code"`
		Name  string `json:"name"`
		Color string `json:"color"`
	} `json:"category"`
	Attachments []struct {
		ID                 int       `json:"id"`
		AttachmentFileName string    `json:"attachment_file_name"`
		Description        string    `json:"description"`
		AttachmentFileSize int       `json:"attachment_file_size"`
		IsPublic           bool      `json:"is_public"`
		CreatedAt          time.Time `json:"created_at"`
	} `json:"attachments"`
	Parameters []struct {
		Code      string `json:"code"`
		Name      string `json:"name"`
		FieldType string `json:"field_type"`
		Value     string `json:"value"`
	} `json:"parameters"`
}

type StatusTime

type StatusTime struct {
	Opened    TimeStatus `json:"opened"`
	Completed TimeStatus `json:"completed"`
}

type TimeStatus

type TimeStatus struct {
	Total           string `json:"total"`
	OnScheduleTotal string `json:"on_schedule_total"`
}

type Type

type Type struct {
	ID                 int    `json:"id"`
	Code               string `json:"code"`
	Name               string `json:"name"`
	AvailableForClient bool   `json:"available_for_client"`
}

type UpdateActivation

type UpdateActivation struct {
	Active bool `json:"active"`
}

type UpdateCompany

type UpdateCompany struct {
	Company struct {
		Name              string    `json:"name"`
		AdditionalName    string    `json:"additional_name"`
		Site              string    `json:"site"`
		Email             string    `json:"email"`
		Phone             string    `json:"phone"`
		Address           string    `json:"address"`
		Coordinates       []float64 `json:"coordinates"`
		Comment           string    `json:"comment"`
		ObserverIds       []int     `json:"observer_ids"`
		DefaultAssigneeID int       `json:"default_assignee_id"`
		CategoryCode      string    `json:"category_code"`
		Crm1CID           string    `json:"crm_1c_id"`
		CustomParameters  struct {
			Code2 string `json:"code2"`
		} `json:"custom_parameters"`
	} `json:"company"`
}

type User

type User struct {
	ID   int     `json:"id"`
	Name *string `json:"name,omitempty"`
	Type *string `json:"type,omitempty"`
}

type Value

type Value struct {
	Name string
	Body io.ReadCloser
}

type Valued

type Valued struct {
	ID    int    `json:"id"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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