Skip to content

Commit

Permalink
On Premise: Add TODO comments to methods that need a double check
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrunwald committed Oct 19, 2022
1 parent 5fccdb3 commit 6c76fac
Show file tree
Hide file tree
Showing 21 changed files with 332 additions and 0 deletions.
18 changes: 18 additions & 0 deletions onpremise/board.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ type BoardConfigurationColumnStatus struct {
// GetAllBoards will returns all boards. This only includes boards that the user has permission to view.
//
// Jira API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getAllBoards
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (s *BoardService) GetAllBoards(ctx context.Context, opt *BoardListOptions) (*BoardsList, *Response, error) {
apiEndpoint := "rest/agile/1.0/board"
url, err := addOptions(apiEndpoint, opt)
Expand All @@ -153,6 +156,9 @@ func (s *BoardService) GetAllBoards(ctx context.Context, opt *BoardListOptions)
// This board will only be returned if the user has permission to view it.
//
// Jira API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getBoard
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (s *BoardService) GetBoard(ctx context.Context, boardID int) (*Board, *Response, error) {
apiEndpoint := fmt.Sprintf("rest/agile/1.0/board/%v", boardID)
req, err := s.client.NewRequest(ctx, http.MethodGet, apiEndpoint, nil)
Expand All @@ -178,6 +184,9 @@ func (s *BoardService) GetBoard(ctx context.Context, boardID int) (*Board, *Resp
// board will be created instead (remember that board sharing depends on the filter sharing).
//
// Jira API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-createBoard
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (s *BoardService) CreateBoard(ctx context.Context, board *Board) (*Board, *Response, error) {
apiEndpoint := "rest/agile/1.0/board"
req, err := s.client.NewRequest(ctx, http.MethodPost, apiEndpoint, board)
Expand All @@ -199,6 +208,9 @@ func (s *BoardService) CreateBoard(ctx context.Context, board *Board) (*Board, *
//
// Jira API docs: https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-deleteBoard
// Caller must close resp.Body
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (s *BoardService) DeleteBoard(ctx context.Context, boardID int) (*Board, *Response, error) {
apiEndpoint := fmt.Sprintf("rest/agile/1.0/board/%v", boardID)
req, err := s.client.NewRequest(ctx, http.MethodDelete, apiEndpoint, nil)
Expand All @@ -217,6 +229,9 @@ func (s *BoardService) DeleteBoard(ctx context.Context, boardID int) (*Board, *R
// This only includes sprints that the user has permission to view.
//
// Jira API docs: https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-sprint-get
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (s *BoardService) GetAllSprints(ctx context.Context, boardID int, options *GetAllSprintsOptions) (*SprintsList, *Response, error) {
apiEndpoint := fmt.Sprintf("rest/agile/1.0/board/%d/sprint", boardID)
url, err := addOptions(apiEndpoint, options)
Expand All @@ -239,6 +254,9 @@ func (s *BoardService) GetAllSprints(ctx context.Context, boardID int, options *

// GetBoardConfiguration will return a board configuration for a given board Id
// Jira API docs:https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-board-boardId-configuration-get
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (s *BoardService) GetBoardConfiguration(ctx context.Context, boardID int) (*BoardConfiguration, *Response, error) {
apiEndpoint := fmt.Sprintf("rest/agile/1.0/board/%d/configuration", boardID)

Expand Down
3 changes: 3 additions & 0 deletions onpremise/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ type CreateComponentOptions struct {
}

// Create creates a new Jira component based on the given options.
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (s *ComponentService) Create(ctx context.Context, options *CreateComponentOptions) (*ProjectComponent, *Response, error) {
apiEndpoint := "rest/api/2/component"
req, err := s.client.NewRequest(ctx, http.MethodPost, apiEndpoint, options)
Expand Down
3 changes: 3 additions & 0 deletions onpremise/customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ type CustomerList struct {
// Create creates a ServiceDesk customer.
//
// https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-customer/#api-rest-servicedeskapi-customer-post
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (c *CustomerService) Create(ctx context.Context, email, displayName string) (*Customer, *Response, error) {
const apiEndpoint = "rest/servicedeskapi/customer"

Expand Down
3 changes: 3 additions & 0 deletions onpremise/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ type FieldSchema struct {
// GetList gets all fields from Jira
//
// Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-field-get
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (s *FieldService) GetList(ctx context.Context) ([]Field, *Response, error) {
apiEndpoint := "rest/api/2/field"
req, err := s.client.NewRequest(ctx, http.MethodGet, apiEndpoint, nil)
Expand Down
15 changes: 15 additions & 0 deletions onpremise/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ type FilterSearchOptions struct {
}

// GetList retrieves all filters from Jira
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (fs *FilterService) GetList(ctx context.Context) ([]*Filter, *Response, error) {

options := &GetQueryOptions{}
Expand All @@ -145,6 +148,9 @@ func (fs *FilterService) GetList(ctx context.Context) ([]*Filter, *Response, err
}

// GetFavouriteList retrieves the user's favourited filters from Jira
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (fs *FilterService) GetFavouriteList(ctx context.Context) ([]*Filter, *Response, error) {
apiEndpoint := "rest/api/2/filter/favourite"
req, err := fs.client.NewRequest(ctx, http.MethodGet, apiEndpoint, nil)
Expand All @@ -161,6 +167,9 @@ func (fs *FilterService) GetFavouriteList(ctx context.Context) ([]*Filter, *Resp
}

// Get retrieves a single Filter from Jira
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (fs *FilterService) Get(ctx context.Context, filterID int) (*Filter, *Response, error) {
apiEndpoint := fmt.Sprintf("rest/api/2/filter/%d", filterID)
req, err := fs.client.NewRequest(ctx, http.MethodGet, apiEndpoint, nil)
Expand All @@ -180,6 +189,9 @@ func (fs *FilterService) Get(ctx context.Context, filterID int) (*Filter, *Respo
// GetMyFilters retrieves the my Filters.
//
// https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-filter-my-get
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (fs *FilterService) GetMyFilters(ctx context.Context, opts *GetMyFiltersQueryOptions) ([]*Filter, *Response, error) {
apiEndpoint := "rest/api/3/filter/my"
url, err := addOptions(apiEndpoint, opts)
Expand All @@ -203,6 +215,9 @@ func (fs *FilterService) GetMyFilters(ctx context.Context, opts *GetMyFiltersQue
// Search will search for filter according to the search options
//
// Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-filter-search-get
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (fs *FilterService) Search(ctx context.Context, opt *FilterSearchOptions) (*FiltersList, *Response, error) {
apiEndpoint := "rest/api/3/filter/search"
url, err := addOptions(apiEndpoint, opt)
Expand Down
9 changes: 9 additions & 0 deletions onpremise/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ type GroupSearchOptions struct {
// Jira API docs: https://docs.atlassian.com/jira/REST/server/#api/2/group-getUsersFromGroup
//
// WARNING: This API only returns the first page of group members
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (s *GroupService) Get(ctx context.Context, name string, options *GroupSearchOptions) ([]GroupMember, *Response, error) {
var apiEndpoint string
if options == nil {
Expand Down Expand Up @@ -95,6 +98,9 @@ func (s *GroupService) Get(ctx context.Context, name string, options *GroupSearc
// Add adds user to group
//
// Jira API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/group-addUserToGroup
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (s *GroupService) Add(ctx context.Context, groupname string, username string) (*Group, *Response, error) {
apiEndpoint := fmt.Sprintf("/rest/api/2/group/user?groupname=%s", groupname)
var user struct {
Expand All @@ -120,6 +126,9 @@ func (s *GroupService) Add(ctx context.Context, groupname string, username strin
//
// Jira API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/group-removeUserFromGroup
// Caller must close resp.Body
//
// TODO Double check this method if this works as expected, is using the latest API and the response is complete
// This double check effort is done for v2 - Remove this two lines if this is completed.
func (s *GroupService) Remove(ctx context.Context, groupname string, username string) (*Response, error) {
apiEndpoint := fmt.Sprintf("/rest/api/2/group/user?groupname=%s&username=%s", groupname, username)
req, err := s.client.NewRequest(ctx, http.MethodDelete, apiEndpoint, nil)
Expand Down
Loading

0 comments on commit 6c76fac

Please sign in to comment.