Documentation ¶
Index ¶
- func CheckResponse(r *http.Response) error
- func NewOpenProjectError(resp *Response, httpError error) error
- type Attachment
- type AttachmentDigest
- type AttachmentLinks
- type AttachmentService
- func (s *AttachmentService) Download(attachmentID string) (*[]byte, error)
- func (s *AttachmentService) DownloadWithContext(ctx context.Context, attachmentID string) (*[]byte, error)
- func (s *AttachmentService) Get(attachmentID string) (*Attachment, *Response, error)
- func (s *AttachmentService) GetWithContext(ctx context.Context, attachmentID string) (*Attachment, *Response, error)
- type AuthenticationService
- func (s *AuthenticationService) AcquireSessionCookie(username, password string) (bool, error)
- func (s *AuthenticationService) AcquireSessionCookieWithContext(ctx context.Context, username, password string) (bool, error)
- func (s *AuthenticationService) Authenticated() bool
- func (s *AuthenticationService) GetCurrentUser() (*Session, error)
- func (s *AuthenticationService) GetCurrentUserWithContext(ctx context.Context) (*Session, error)
- func (s *AuthenticationService) SetBasicAuth(username, password string)
- type BasicAuthTransport
- type Category
- type CategoryElements
- type CategoryList
- type CategoryService
- func (s *CategoryService) Get(categoryID string) (*Category, *Response, error)
- func (s *CategoryService) GetList(projectID string) (*CategoryList, *Response, error)
- func (s *CategoryService) GetListWithContext(ctx context.Context, projectID string) (*CategoryList, *Response, error)
- func (s *CategoryService) GetWithContext(ctx context.Context, categoryID string) (*Category, *Response, error)
- type Client
- func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)
- func (c *Client) Download(req *http.Request) (*http.Response, error)
- func (c *Client) GetBaseURL() url.URL
- func (c *Client) NewMultiPartRequest(method, urlStr string, buf *bytes.Buffer) (*http.Request, error)
- func (c *Client) NewMultiPartRequestWithContext(ctx context.Context, method, urlStr string, buf *bytes.Buffer) (*http.Request, error)
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) NewRequestWithContext(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)
- type Date
- type Error
- type FilterOptions
- type OPGenericDescription
- type OPGenericLink
- type OptionsFields
- type ProjDescription
- type Project
- type ProjectService
- func (s *ProjectService) Create(project *Project) (*Project, *Response, error)
- func (s *ProjectService) CreateWithContext(ctx context.Context, project *Project) (*Project, *Response, error)
- func (s *ProjectService) Get(projectID string) (*Project, *Response, error)
- func (s *ProjectService) GetList() (*SearchResultProject, *Response, error)
- func (s *ProjectService) GetListWithContext(ctx context.Context) (*SearchResultProject, *Response, error)
- func (s *ProjectService) GetWithContext(ctx context.Context, projectID string) (*Project, *Response, error)
- type Query
- type QueryElements
- type QueryFilter
- type QueryService
- func (s *QueryService) Create(queryObj *Query) (*Query, *Response, error)
- func (s *QueryService) CreateWithContext(ctx context.Context, queryObj *Query) (*Query, *Response, error)
- func (s *QueryService) Delete(queryID string) (*Response, error)
- func (s *QueryService) DeleteWithContext(ctx context.Context, queryID string) (*Response, error)
- func (s *QueryService) Get(queryID string) (*Query, *Response, error)
- func (s *QueryService) GetList() (*SearchResultQuery, *Response, error)
- func (s *QueryService) GetListWithContext(ctx context.Context) (*SearchResultQuery, *Response, error)
- func (s *QueryService) GetWithContext(ctx context.Context, queryID string) (*Query, *Response, error)
- type Response
- func CreateWithContext(ctx context.Context, object interface{}, objService interface{}, ...) (interface{}, *Response, error)
- func DeleteWithContext(ctx context.Context, objService interface{}, apiEndPoint string) (*Response, error)
- func GetListWithContext(ctx context.Context, objService interface{}, apiEndPoint string, ...) (interface{}, *Response, error)
- func GetWithContext(ctx context.Context, objService interface{}, apiEndPoint string) (interface{}, *Response, error)
- type SearchEmbeddedWP
- type SearchOperator
- type SearchResultProject
- type SearchResultQuery
- type SearchResultStatus
- type SearchResultUser
- type SearchResultWP
- type Session
- type Status
- type StatusService
- func (s *StatusService) Get(statusID string) (*Status, *Response, error)
- func (s *StatusService) GetList() (*SearchResultStatus, *Response, error)
- func (s *StatusService) GetListWithContext(ctx context.Context) (*SearchResultStatus, *Response, error)
- func (s *StatusService) GetWithContext(ctx context.Context, statusID string) (*Status, *Response, error)
- type Time
- type User
- type UserService
- func (s *UserService) Create(user *User) (*User, *Response, error)
- func (s *UserService) CreateWithContext(ctx context.Context, user *User) (*User, *Response, error)
- func (s *UserService) Delete(userID string) (*Response, error)
- func (s *UserService) DeleteWithContext(ctx context.Context, userID string) (*Response, error)
- func (s *UserService) Get(accountID string) (*User, *Response, error)
- func (s *UserService) GetList(options *FilterOptions) (*SearchResultUser, *Response, error)
- func (s *UserService) GetListWithContext(ctx context.Context, options *FilterOptions) (*SearchResultUser, *Response, error)
- func (s *UserService) GetWithContext(ctx context.Context, accountID string) (*User, *Response, error)
- type WPDescription
- type WPEmbedded
- type WPForm
- type WPFormEmbedded
- type WPFormLinks
- type WPLinks
- type WPLinksField
- type WPPayload
- type WikiEmbedded
- type WikiPage
- type WikiPageService
- type WikiProject
- type WorkPackage
- type WorkPackageService
- func (s *WorkPackageService) Create(wpObject *WorkPackage, projectName string) (*WorkPackage, *Response, error)
- func (s *WorkPackageService) CreateWithContext(ctx context.Context, wpObject *WorkPackage, projectName string) (*WorkPackage, *Response, error)
- func (s *WorkPackageService) Delete(workpackageID string) (*Response, error)
- func (s *WorkPackageService) DeleteWithContext(ctx context.Context, workpackageID string) (*Response, error)
- func (s *WorkPackageService) Get(workpackageID string) (*WorkPackage, *Response, error)
- func (s *WorkPackageService) GetList(options *FilterOptions) ([]WorkPackage, *Response, error)
- func (s *WorkPackageService) GetListWithContext(ctx context.Context, options *FilterOptions) ([]WorkPackage, *Response, error)
- func (s *WorkPackageService) GetWithContext(ctx context.Context, workpackageID string) (*WorkPackage, *Response, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. The caller is responsible to analyze the response body.
func NewOpenProjectError ¶
NewOpenProjectError creates a new OpenProject Error
Types ¶
type Attachment ¶
type Attachment struct { Type string `json:"_type,omitempty" structs:"_type,omitempty"` ID int `json:"id,omitempty" structs:"id,omitempty"` FileName string `json:"filename,omitempty" structs:"filename,omitempty"` FileSize int `json:"filesize,omitempty" structs:"filesize,omitempty"` Description OPGenericDescription `json:"description,omitempty" structs:"description,omitempty"` ContentType string `json:"contentType,omitempty" structs:"contentType,omitempty"` Digest AttachmentDigest `json:"digest,omitempty" structs:"digest,omitempty"` Links *AttachmentLinks `json:"_links,omitempty" structs:"_links,omitempty"` }
Attachment is the object representing OpenProject attachments. TODO: Complete fields and complex fields (user, links, downloadlocation, container...)
type AttachmentDigest ¶
type AttachmentDigest struct { Algorithm string `json:"algorithm,omitempty" structs:"algorithm,omitempty"` Hash string `json:"hash,omitempty" structs:"hash,omitempty"` }
AttachmentDigest wraps algorithm and hash
type AttachmentLinks ¶
type AttachmentLinks struct {
DownloadLocation OPGenericLink `json:"downloadLocation,omitempty" structs:"downloadLocation,omitempty"`
}
AttachmentLinks contains several links to object that related to this attachment. TODO: For now it is only download location. For details on the other object, please refer to Attachment API response.
type AttachmentService ¶
type AttachmentService struct {
// contains filtered or unexported fields
}
AttachmentService handles attachments for the OpenProject instance / API.
func (*AttachmentService) Download ¶
func (s *AttachmentService) Download(attachmentID string) (*[]byte, error)
Download wraps DownloadWithContext using the background context.
func (*AttachmentService) DownloadWithContext ¶
func (s *AttachmentService) DownloadWithContext(ctx context.Context, attachmentID string) (*[]byte, error)
DownloadWithContext downloads a file from attachment using attachment ID
func (*AttachmentService) Get ¶
func (s *AttachmentService) Get(attachmentID string) (*Attachment, *Response, error)
Get wraps GetWithContext using the background context.
func (*AttachmentService) GetWithContext ¶
func (s *AttachmentService) GetWithContext(ctx context.Context, attachmentID string) (*Attachment, *Response, error)
GetWithContext gets a wiki page from OpenProject using its ID
type AuthenticationService ¶
type AuthenticationService struct {
// contains filtered or unexported fields
}
AuthenticationService handles authentication for the OpenProject instance / API.
func (*AuthenticationService) AcquireSessionCookie ¶
func (s *AuthenticationService) AcquireSessionCookie(username, password string) (bool, error)
AcquireSessionCookie wraps AcquireSessionCookieWithContext using the background context. Deprecated: Use CookieAuthTransport instead
func (*AuthenticationService) AcquireSessionCookieWithContext ¶
func (s *AuthenticationService) AcquireSessionCookieWithContext(ctx context.Context, username, password string) (bool, error)
AcquireSessionCookieWithContext creates a new session for a user in OpenProject. Once a session has been successfully created it can be used to access any of OpenProject's remote APIs and also the web UI by passing the appropriate HTTP Cookie header. The header will by automatically applied to every API request. Note that it is generally preferable to use HTTP BASIC authentication with the REST API. Deprecated: Use CookieAuthTransport instead
func (*AuthenticationService) Authenticated ¶
func (s *AuthenticationService) Authenticated() bool
Authenticated reports if the current Client has authentication details for OpenProject
func (*AuthenticationService) GetCurrentUser ¶
func (s *AuthenticationService) GetCurrentUser() (*Session, error)
GetCurrentUser wraps GetCurrentUserWithContext using the background context.
func (*AuthenticationService) GetCurrentUserWithContext ¶
func (s *AuthenticationService) GetCurrentUserWithContext(ctx context.Context) (*Session, error)
GetCurrentUserWithContext gets the details of the current user.
func (*AuthenticationService) SetBasicAuth ¶
func (s *AuthenticationService) SetBasicAuth(username, password string)
SetBasicAuth sets username and password for the basic auth against the OpenProject instance. Deprecated: Use BasicAuthTransport instead
type BasicAuthTransport ¶
type BasicAuthTransport struct { Username string Password string // Transport is the underlying HTTP transport to use when making requests. // It will default to http.DefaultTransport if nil. Transport http.RoundTripper }
BasicAuthTransport is an http.RoundTripper that authenticates all requests using HTTP Basic Authentication with the provided username and password.
func (*BasicAuthTransport) Client ¶
func (t *BasicAuthTransport) Client() *http.Client
Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication. This is a nice little bit of sugar so we can just get the client instead of creating the client in the calling code. If it's necessary to send more information on client init, the calling code can always skip this and set the transport itself.
type Category ¶
type Category struct { Type string `json:"_type,omitempty" structs:"_type,omitempty"` ID int `json:"id,omitempty" structs:"id,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` }
Category wraps Work-package categories
type CategoryElements ¶
type CategoryElements struct {
Elements []Category `json:"elements,omitempty" structs:"elements,omitempty"`
}
CategoryElements is the list of elements nested within CategoryList
type CategoryList ¶
type CategoryList struct {
Embedded CategoryElements `json:"_embedded,omitempty" structs:"_embedded,omitempty"`
}
CategoryList represent a list of Projects
type CategoryService ¶
type CategoryService struct {
// contains filtered or unexported fields
}
CategoryService handles categories for the OpenProject instance / API.
func (*CategoryService) Get ¶
func (s *CategoryService) Get(categoryID string) (*Category, *Response, error)
Get wraps GetWithContext using the background context.
func (*CategoryService) GetList ¶
func (s *CategoryService) GetList(projectID string) (*CategoryList, *Response, error)
GetList wraps GetListWithContext using the background context.
func (*CategoryService) GetListWithContext ¶
func (s *CategoryService) GetListWithContext(ctx context.Context, projectID string) (*CategoryList, *Response, error)
GetListWithContext retrieve category list from project with context
func (*CategoryService) GetWithContext ¶
func (s *CategoryService) GetWithContext(ctx context.Context, categoryID string) (*Category, *Response, error)
GetWithContext returns a single category for the given category ID.
type Client ¶
type Client struct { // Services used for talking to different parts of OpenProject API. Authentication *AuthenticationService WorkPackage *WorkPackageService Project *ProjectService User *UserService Status *StatusService WikiPage *WikiPageService Attachment *AttachmentService Category *CategoryService Query *QueryService // contains filtered or unexported fields }
Client manages communication with the OpenProject API.
func NewClient ¶
NewClient returns a new OpenProject API client. If a nil httpClient is provided, http.DefaultClient will be used.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
func (*Client) GetBaseURL ¶
GetBaseURL will return you the Base URL. This is the same URL as in the NewClient constructor
func (*Client) NewMultiPartRequest ¶
func (c *Client) NewMultiPartRequest(method, urlStr string, buf *bytes.Buffer) (*http.Request, error)
NewMultiPartRequest wraps NewMultiPartRequestWithContext using the background context.
func (*Client) NewMultiPartRequestWithContext ¶
func (c *Client) NewMultiPartRequestWithContext(ctx context.Context, method, urlStr string, buf *bytes.Buffer) (*http.Request, error)
NewMultiPartRequestWithContext creates an API request including a multi-part file. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. If specified, the value pointed to by buf is a multipart form.
func (*Client) NewRequest ¶
NewRequest wraps NewRequestWithContext using the background context.
func (*Client) NewRequestWithContext ¶
func (c *Client) NewRequestWithContext(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)
NewRequestWithContext creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. If specified, the value pointed to by body is JSON encoded and included as the request body.
type Date ¶
Date represents the Date definition of OpenProject as a time.Time of go
func (Date) MarshalJSON ¶
MarshalJSON will transform the Date object into a short date string as OpenProject expects during the creation of a OpenProject request
func (*Date) UnmarshalJSON ¶
UnmarshalJSON will transform the OpenProject date into a time.Time during the transformation of the OpenProject JSON response
type Error ¶
type Error struct { HTTPError error ErrorMessages []string `json:"errorMessages"` Errors map[string]string `json:"errors"` }
Error message from OpenProject
type FilterOptions ¶
type FilterOptions struct {
Fields []OptionsFields
}
FilterOptions allows you to specify search parameters for the get-workpackage action When used they will be converted to GET parameters within the URL Up to now OpenProject only allows "AND" combinations. "OR" combinations feature is under development, tracked by this ticket https://community.openproject.org/projects/openproject/work_packages/26837/activity More information about filters https://docs.openproject.org/api/filters/
type OPGenericDescription ¶
type OPGenericDescription struct { Format string `json:"format,omitempty" structs:"format,omitempty"` Raw string `json:"raw,omitempty" structs:"raw,omitempty"` HTML string `json:"html,omitempty" structs:"html,omitempty"` }
OPGenericDescription is an structure widely used in several OpenProject API objects
type OPGenericLink ¶
type OPGenericLink struct { Href string `json:"href,omitempty" structs:"href,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` }
OPGenericLink is an structure widely used in several OpenProject API objects
type OptionsFields ¶
type OptionsFields struct { Field string Operator SearchOperator Value string }
OptionsFields array wraps field, Operator, Value within FilterOptions
type ProjDescription ¶
type ProjDescription OPGenericDescription
ProjDescription type contains description and format
type Project ¶
type Project struct { Type string `json:"_type,omitempty" structs:"_type,omitempty"` ID int `json:"id,omitempty" structs:"id,omitempty"` Identifier string `json:"identifier,omitempty" structs:"identifier,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` Active bool `json:"active,omitempty" structs:"active,omitempty"` Public bool `json:"public,omitempty" structs:"public,omitempty"` Description *ProjDescription `json:"description,omitempty" structs:"description,omitempty"` CreatedAt *Time `json:"createdAt,omitempty" structs:"createdAt,omitempty"` UpdatedAt *Time `json:"updatedAt,omitempty" structs:"updatedAt,omitempty"` Status string `json:"status,omitempty" structs:"status,omitempty"` }
Project structure representing OpenProject project
type ProjectService ¶
type ProjectService struct {
// contains filtered or unexported fields
}
ProjectService handles projects for the OpenProject instance / API.
func (*ProjectService) Create ¶
func (s *ProjectService) Create(project *Project) (*Project, *Response, error)
Create wraps CreateWithContext using the background context.
func (*ProjectService) CreateWithContext ¶
func (s *ProjectService) CreateWithContext(ctx context.Context, project *Project) (*Project, *Response, error)
CreateWithContext creates a project from a JSON representation.
func (*ProjectService) Get ¶
func (s *ProjectService) Get(projectID string) (*Project, *Response, error)
Get wraps GetWithContext using the background context.
func (*ProjectService) GetList ¶
func (s *ProjectService) GetList() (*SearchResultProject, *Response, error)
GetList wraps GetListWithContext using the background context.
func (*ProjectService) GetListWithContext ¶
func (s *ProjectService) GetListWithContext(ctx context.Context) (*SearchResultProject, *Response, error)
GetListWithContext retrieve project list with context TODO: Implement search options
func (*ProjectService) GetWithContext ¶
func (s *ProjectService) GetWithContext(ctx context.Context, projectID string) (*Project, *Response, error)
GetWithContext returns a single project for the given project key.
type Query ¶
type Query struct { Type string `json:"_type,omitempty" structs:"_type,omitempty"` Starred bool `json:"starred,omitempty" structs:"starred,omitempty"` ID int `json:"id,omitempty" structs:"id,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` Project string `json:"project,omitempty" structs:"columns,omitempty"` CreatedAt *Time `json:"createdAt,omitempty" structs:"createdAt,omitempty"` UpdatedAt *Time `json:"updatedAt,omitempty" structs:"updatedAt,omitempty"` Filters []QueryFilter `json:"filters,omitempty" structs:"filters,omitempty"` Sums bool `json:"sums,omitempty" structs:"sums,omitempty"` Public bool `json:"public,omitempty" structs:"public,omitempty"` Hidden bool `json:"hidden,omitempty" structs:"hidden,omitempty"` TimelineVisible bool `json:"timelineVisible,omitempty" structs:"timelineVisible,omitempty"` HighlightingMode string `json:"highlightingMode,omitempty" structs:"highlightingMode,omitempty"` ShowHierarchies bool `json:"showHierarchies,omitempty" structs:"showHierarchies,omitempty"` Columns []OPGenericLink `json:"columns,omitempty" structs:"columns,omitempty"` GroupBy []OPGenericLink `json:"groupBy,omitempty" structs:"groupBy,omitempty"` SortBy []OPGenericLink `json:"sortBy,omitempty" structs:"sortBy,omitempty"` }
Query is the object representing OpenProject queries. TODO: Complete fields (i.e. timelineVisible, showHierarchies, timelineZoomLevel, showHierarchies, etc...
type QueryElements ¶
type QueryElements struct {
Elements []Status `json:"elements,omitempty" structs:"elements,omitempty"`
}
QueryElements array of elements within a query
type QueryFilter ¶
type QueryFilter struct { Type string `json:"_type,omitempty" structs:"_type,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` }
QueryFilter filters within a query TODO:Complete fields ( i.e. _links)
type QueryService ¶
type QueryService struct {
// contains filtered or unexported fields
}
QueryService handles statuses from the OpenProject instance / API.
func (*QueryService) Create ¶
func (s *QueryService) Create(queryObj *Query) (*Query, *Response, error)
Create wraps CreateWithContext using the background context.
func (*QueryService) CreateWithContext ¶
func (s *QueryService) CreateWithContext(ctx context.Context, queryObj *Query) (*Query, *Response, error)
CreateWithContext creates a query from a JSON representation.
func (*QueryService) Delete ¶
func (s *QueryService) Delete(queryID string) (*Response, error)
Delete wraps DeleteWithContext using the background context.
func (*QueryService) DeleteWithContext ¶
DeleteWithContext will delete a single query object
func (*QueryService) Get ¶
func (s *QueryService) Get(queryID string) (*Query, *Response, error)
Get wraps GetWithContext using the background context.
func (*QueryService) GetList ¶
func (s *QueryService) GetList() (*SearchResultQuery, *Response, error)
GetList wraps GetListWithContext using the background context.
func (*QueryService) GetListWithContext ¶
func (s *QueryService) GetListWithContext(ctx context.Context) (*SearchResultQuery, *Response, error)
GetListWithContext Retrieve status list with context TODO: Implement search parameters-options
func (*QueryService) GetWithContext ¶
func (s *QueryService) GetWithContext(ctx context.Context, queryID string) (*Query, *Response, error)
GetWithContext gets query info from OpenProject using its query ID
type Response ¶
Response represents OpenProject API response. It wraps http.Response returned from API and provides information about paging.
func CreateWithContext ¶
func CreateWithContext(ctx context.Context, object interface{}, objService interface{}, apiEndPoint string) (interface{}, *Response, error)
CreateWithContext (generic) creates an instance af an object (HTTP POST verb) Return the instance of the object rendered into proper struct as interface{} to be cast in the caller
func DeleteWithContext ¶
func DeleteWithContext(ctx context.Context, objService interface{}, apiEndPoint string) (*Response, error)
DeleteWithContext (generic) retrieves object (HTTP DELETE verb) obj can be any main object (attachment, user, project, work-package, etc...)
func GetListWithContext ¶
func GetListWithContext(ctx context.Context, objService interface{}, apiEndPoint string, options *FilterOptions) (interface{}, *Response, error)
GetListWithContext (generic) retrieves list of objects (HTTP GET verb) obj list is a collection of any main object (attachment, user, project, work-package, etc...) as well as response interface{}
func GetWithContext ¶
func GetWithContext(ctx context.Context, objService interface{}, apiEndPoint string) (interface{}, *Response, error)
GetWithContext (generic) retrieves object (HTTP GET verb) obj can be any main object (attachment, user, project, work-package, etc...) as well as response interface{}
type SearchEmbeddedWP ¶
type SearchEmbeddedWP struct {
Elements []WorkPackage `json:"elements" structs:"elements"`
}
SearchEmbeddedWP represent elements within WorkPackage list
type SearchOperator ¶
type SearchOperator string
SearchOperator represents Search operators by custom type const Doc. https://docs.openproject.org/api/filters/#header-available-filters-1
const ( // Equal operator Equal SearchOperator = "=" // Different operator Different SearchOperator = "<>" // GreaterThan operator GreaterThan SearchOperator = ">" // LowerThan operator LowerThan SearchOperator = "<" // SearchString operator SearchString SearchOperator = "**" // Like operator Like SearchOperator = "~" // GreaterOrEqual operator GreaterOrEqual SearchOperator = ">=" // LowerOrEqual operator LowerOrEqual SearchOperator = "<=" )
type SearchResultProject ¶
type SearchResultProject struct { Embedded projectElements `json:"_embedded,omitempty" structs:"_embedded,omitempty"` Total int `json:"total" structs:"total"` Count int `json:"count" structs:"count"` PageSize int `json:"pageSize" structs:"pageSize"` Offset int `json:"offset" structs:"offset"` }
SearchResultProject represent a list of Projects
type SearchResultQuery ¶
type SearchResultQuery struct { Embedded statusElements `json:"_embedded,omitempty" structs:"_embedded,omitempty"` Total int `json:"total" structs:"total"` Count int `json:"count" structs:"count"` PageSize int `json:"pageSize" structs:"pageSize"` Offset int `json:"offset" structs:"offset"` }
SearchResultQuery represent a list of Projects
type SearchResultStatus ¶
type SearchResultStatus struct { Embedded statusElements `json:"_embedded,omitempty" structs:"_embedded,omitempty"` Total int `json:"total" structs:"total"` Count int `json:"count" structs:"count"` PageSize int `json:"pageSize" structs:"pageSize"` Offset int `json:"offset" structs:"offset"` }
SearchResultStatus represent a list of Statuses
type SearchResultUser ¶
type SearchResultUser struct { Embedded searchEmbeddedUser `json:"_embedded" structs:"_embedded"` Total int `json:"total" structs:"total"` Count int `json:"count" structs:"count"` PageSize int `json:"pageSize" structs:"pageSize"` Offset int `json:"offset" structs:"offset"` }
SearchResultUser is a small wrapper around the Search
type SearchResultWP ¶
type SearchResultWP struct { Embedded SearchEmbeddedWP `json:"_embedded" structs:"_embedded"` Total int `json:"total" structs:"total"` Count int `json:"count" structs:"count"` PageSize int `json:"pageSize" structs:"pageSize"` Offset int `json:"offset" structs:"offset"` }
SearchResultWP is only a small wrapper around the Search
type Session ¶
type Session struct { Self string `json:"self,omitempty"` Name string `json:"name,omitempty"` Session struct { Name string `json:"name"` Value string `json:"value"` } `json:"session,omitempty"` LoginInfo struct { FailedLoginCount int `json:"failedLoginCount"` LoginCount int `json:"loginCount"` LastFailedLoginTime string `json:"lastFailedLoginTime"` PreviousLoginTime string `json:"previousLoginTime"` } `json:"loginInfo"` Cookies []*http.Cookie }
Session represents a Session JSON response by the OpenProject API.
type Status ¶
type Status struct { Type string `json:"_type,omitempty" structs:"_type,omitempty"` ID int `json:"id,omitempty" structs:"id,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` IsClosed bool `json:"isClosed,omitempty" structs:"isClosed,omitempty"` Color string `json:"color,omitempty" structs:"color,omitempty"` IsDefault bool `json:"isDefault,omitempty" structs:"isDefault,omitempty"` IsReadOnly bool `json:"isReadOnly,omitempty" structs:"isReadOnly,omitempty"` Position int `json:"position,omitempty" structs:"position,omitempty"` }
Status is the object representing OpenProject statuses. TODO: Complete fields (add defaultDoneRatio, _links, ...)
type StatusService ¶
type StatusService struct {
// contains filtered or unexported fields
}
StatusService handles statuses from the OpenProject instance / API.
func (*StatusService) Get ¶
func (s *StatusService) Get(statusID string) (*Status, *Response, error)
Get wraps GetWithContext using the background context.
func (*StatusService) GetList ¶
func (s *StatusService) GetList() (*SearchResultStatus, *Response, error)
GetList wraps GetListWithContext using the background context.
func (*StatusService) GetListWithContext ¶
func (s *StatusService) GetListWithContext(ctx context.Context) (*SearchResultStatus, *Response, error)
GetListWithContext Retrieve status list with context TODO: Implement search parameters-options
func (*StatusService) GetWithContext ¶
func (s *StatusService) GetWithContext(ctx context.Context, statusID string) (*Status, *Response, error)
GetWithContext gets statuses info from OpenProject using its status ID TODO: Implement GetList and adapt tests
type Time ¶
Time represents the Time definition of OpenProject as a time.Time of go
func (Time) MarshalJSON ¶
MarshalJSON will transform the time.Time into a OpenProject time during the creation of a OpenProject request
func (*Time) UnmarshalJSON ¶
UnmarshalJSON will transform the OpenProject time into a time.Time during the transformation of the OpenProject JSON response
type User ¶
type User struct { Type string `json:"_type,omitempty" structs:"_type,omitempty"` ID int `json:"id,omitempty" structs:"id,omitempty"` Name string `json:"name,omitempty" structs:"name,omitempty"` CreatedAt *Time `json:"createdAt,omitempty" structs:"createdAt,omitempty"` UpdatedAt *Time `json:"updatedAt,omitempty" structs:"updatedAt,omitempty"` Login string `json:"login,omitempty" structs:"login,omitempty"` Admin bool `json:"admin,omitempty" structs:"admin,omitempty"` FirstName string `json:"firstName,omitempty" structs:"firstName,omitempty"` Email string `json:"email,omitempty" structs:"email,omitempty"` Avatar string `json:"avatar,omitempty" structs:"avatar,omitempty"` Status string `json:"status,omitempty" structs:"status,omitempty"` Language string `json:"language,omitempty" structs:"language,omitempty"` Password string `json:"password,omitempty" structs:"password,omitempty"` // contains filtered or unexported fields }
User is the object representing OpenProject users. TODO: Complete object with fields identityUrl, language, _links
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService handles users for the OpenProject instance / API.
func (*UserService) Create ¶
func (s *UserService) Create(user *User) (*User, *Response, error)
Create wraps CreateWithContext using the background context.
func (*UserService) CreateWithContext ¶
CreateWithContext creates a user from a JSON representation.
func (*UserService) Delete ¶
func (s *UserService) Delete(userID string) (*Response, error)
Delete wraps DeleteWithContext using the background context.
func (*UserService) DeleteWithContext ¶
DeleteWithContext will delete a single user.
func (*UserService) Get ¶
func (s *UserService) Get(accountID string) (*User, *Response, error)
Get wraps GetWithContext using the background context.
func (*UserService) GetList ¶
func (s *UserService) GetList(options *FilterOptions) (*SearchResultUser, *Response, error)
GetList wraps GetListWithContext using the background context.
func (*UserService) GetListWithContext ¶
func (s *UserService) GetListWithContext(ctx context.Context, options *FilterOptions) (*SearchResultUser, *Response, error)
GetListWithContext will retrieve a list of users using filters
func (*UserService) GetWithContext ¶
func (s *UserService) GetWithContext(ctx context.Context, accountID string) (*User, *Response, error)
GetWithContext gets user info from OpenProject using its Account ID TODO: Implement GetList and adapt tests
type WPDescription ¶
type WPDescription OPGenericDescription
WPDescription type contains description and format
type WPEmbedded ¶
type WPEmbedded struct { Attachments struct { Embedded struct { Elements []Attachment `json:"elements,omitempty" structs:"elements,omitempty"` } `json:"_embedded,omitempty" structs:"_embedded,omitempty"` } `json:"attachments,omitempty" structs:"attachments,omitempty"` }
WPEmbedded type contains many objects that related to this work package. As opposite to objects contained in Links object, objects in WPEmbedded also contain their value. TODO: For now it is only attachments. For details on the other objects please refer to API response of a WP request.
type WPForm ¶
type WPForm struct { Type string `json:"_type,omitempty" structs:"_type,omitempty"` Embedded WPFormEmbedded `json:"_embedded,omitempty" structs:"_embedded,omitempty"` Links WPFormLinks `json:"_links,omitempty" structs:"_links,omitempty"` }
WPForm represents WorkPackage form OpenProject API v3 provides a WorkPackage form to get a template of work-packages dynamically A "Form" endpoint is available for that purpose.
type WPFormEmbedded ¶
type WPFormEmbedded struct {
Payload WPPayload `json:"payload,omitempty" structs:"payload,omitempty"`
}
WPFormEmbedded represents the 'embedded' struct nested in 'form'
type WPLinks ¶
type WPLinks struct { Self WPLinksField `json:"self,omitempty" structs:"self,omitempty"` Assignee WPLinksField `json:"assignee,omitempty" structs:"assignee,omitempty"` Author WPLinksField `json:"author,omitempty" structs:"author,omitempty"` Parent WPLinksField `json:"parent,omitempty" structs:"parent,omitempty"` Priority WPLinksField `json:"priority,omitempty" structs:"priority,omitempty"` Project WPLinksField `json:"project,omitempty" structs:"project,omitempty"` Responsible WPLinksField `json:"responsible,omitempty" structs:"responsible,omitempty"` Status WPLinksField `json:"status,omitempty" structs:"status,omitempty"` Type WPLinksField `json:"type,omitempty" structs:"type,omitempty"` }
WPLinks are WorkPackage Links
type WPLinksField ¶
WPLinksField link and title
type WPPayload ¶
type WPPayload struct { Subject string `json:"subject,omitempty" structs:"subject,omitempty"` StartDate string `json:"startDate,omitempty" structs:"startDate,omitempty"` }
WPPayload represents the 'payload' struct nested in 'form.embedded'
type WikiEmbedded ¶
type WikiEmbedded struct {
Project WikiProject `json:"project,omitempty" structs:"project,omitempty"`
}
WikiEmbedded wraps embedded field of WikiPage
type WikiPage ¶
type WikiPage struct { Type string `json:"_type,omitempty" structs:"_type,omitempty"` ID int `json:"id,omitempty" structs:"id,omitempty"` Title string `json:"title,omitempty" structs:"title,omitempty"` Embedded WikiEmbedded `json:"_embedded,omitempty" structs:"_embedded,omitempty"` }
WikiPage is the object representing OpenProject users. TODO: Complete fields and complex fields (_embedded.attachments, links, project, ...)
type WikiPageService ¶
type WikiPageService struct {
// contains filtered or unexported fields
}
WikiPageService handles wiki-pages for the OpenProject instance / API.
func (*WikiPageService) Get ¶
func (s *WikiPageService) Get(wikiID string) (*WikiPage, *Response, error)
Get wraps GetWithContext using the background context.
func (*WikiPageService) GetWithContext ¶
func (s *WikiPageService) GetWithContext(ctx context.Context, wikiID string) (*WikiPage, *Response, error)
GetWithContext gets a wiki page from OpenProject using its ID
type WikiProject ¶
type WikiProject struct { Type string `json:"_type,omitempty" structs:"_type,omitempty"` ID int `json:"id,omitempty" structs:"id,omitempty"` Identifier string `json:"identifier,omitempty" structs:"identifier,omitempty"` CreatedAt *Time `json:"createdAt,omitempty" structs:"createdAt,omitempty"` UpdatedAt *Time `json:"updatedAt,omitempty" structs:"updatedAt,omitempty"` Status string `json:"status,omitempty" structs:"status,omitempty"` }
WikiProject wraps WikiEmbedded data
type WorkPackage ¶
type WorkPackage struct { Embedded *WPEmbedded `json:"_embedded,omitempty" structs:"_embedded,omitempty"` Subject string `json:"subject,omitempty" structs:"subject,omitempty"` Description *WPDescription `json:"description,omitempty" structs:"description,omitempty"` Type string `json:"_type,omitempty" structs:"_type,omitempty"` ID int `json:"id,omitempty" structs:"id,omitempty"` CreatedAt *Time `json:"createdAt,omitempty" structs:"createdAt,omitempty"` UpdatedAt *Time `json:"updatedAt,omitempty" structs:"updatedAt,omitempty"` StartDate *Date `json:"startDate,omitempty" structs:"startDate,omitempty"` DueDate *Date `json:"dueDate,omitempty" structs:"dueDate,omitempty"` LockVersion int `json:"lockVersion,omitempty" structs:"lockVersion,omitempty"` Position int `json:"position,omitempty" structs:"position,omitempty"` Custom tcontainer.MarshalMap `json:"custom,omitempty" structs:"custom,omitempty"` Links *WPLinks `json:"_links,omitempty" _links:"id,omitempty"` }
WorkPackage represents an OpenProject ticket or issue Please note: Time and Date fields are pointers in order to avoid rendering them when not initialized
type WorkPackageService ¶
type WorkPackageService struct {
// contains filtered or unexported fields
}
WorkPackageService handles workpackages for the OpenProject instance / API.
func (*WorkPackageService) Create ¶
func (s *WorkPackageService) Create(wpObject *WorkPackage, projectName string) (*WorkPackage, *Response, error)
Create wraps CreateWithContext using the background context.
func (*WorkPackageService) CreateWithContext ¶
func (s *WorkPackageService) CreateWithContext(ctx context.Context, wpObject *WorkPackage, projectName string) (*WorkPackage, *Response, error)
CreateWithContext creates a work-package or a sub-task from a JSON representation.
func (*WorkPackageService) Delete ¶
func (s *WorkPackageService) Delete(workpackageID string) (*Response, error)
Delete wraps DeleteWithContext using the background context.
func (*WorkPackageService) DeleteWithContext ¶
func (s *WorkPackageService) DeleteWithContext(ctx context.Context, workpackageID string) (*Response, error)
DeleteWithContext will delete a single work-package.
func (*WorkPackageService) Get ¶
func (s *WorkPackageService) Get(workpackageID string) (*WorkPackage, *Response, error)
Get wraps GetWithContext using the background context.
func (*WorkPackageService) GetList ¶
func (s *WorkPackageService) GetList(options *FilterOptions) ([]WorkPackage, *Response, error)
GetList wraps GetListWithContext using the background context.
func (*WorkPackageService) GetListWithContext ¶
func (s *WorkPackageService) GetListWithContext(ctx context.Context, options *FilterOptions) ([]WorkPackage, *Response, error)
GetListWithContext will retrieve a list of work-packages using filters
func (*WorkPackageService) GetWithContext ¶
func (s *WorkPackageService) GetWithContext(ctx context.Context, workpackageID string) (*WorkPackage, *Response, error)
GetWithContext returns a full representation of the issue for the given OpenProject key. The given options will be appended to the query string