You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "klesh (via GitHub)" <gi...@apache.org> on 2023/12/05 07:42:45 UTC

[PR] refactor: jira adopts new dshelpers [incubator-devlake]

klesh opened a new pull request, #6562:
URL: https://github.com/apache/incubator-devlake/pull/6562

   ### Summary
   refactor: jira adopts new dshelpers
   
   ### Does this close any open issues?
   Part of #5519 
   
   
   ### Screenshots
   
   ![image](https://github.com/apache/incubator-devlake/assets/61080/851f4d2b-3164-4f25-a1b2-8f8a7300e08a)
   
   
   ![image](https://github.com/apache/incubator-devlake/assets/61080/b7be8cca-2f6b-41fa-b598-9718ab8e271d)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor: jira adopts new dshelpers [incubator-devlake]

Posted by "abeizn (via GitHub)" <gi...@apache.org>.
abeizn merged PR #6562:
URL: https://github.com/apache/incubator-devlake/pull/6562


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor: jira adopts new dshelpers [incubator-devlake]

Posted by "abeizn (via GitHub)" <gi...@apache.org>.
abeizn commented on code in PR #6562:
URL: https://github.com/apache/incubator-devlake/pull/6562#discussion_r1415145097


##########
backend/plugins/jira/api/remote_api.go:
##########
@@ -0,0 +1,154 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package api
+
+import (
+	"fmt"
+	"net/url"
+
+	"github.com/apache/incubator-devlake/core/errors"
+	"github.com/apache/incubator-devlake/core/plugin"
+	"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
+	dsmodels "github.com/apache/incubator-devlake/helpers/pluginhelper/api/models"
+	"github.com/apache/incubator-devlake/plugins/jira/models"
+	"github.com/apache/incubator-devlake/plugins/jira/tasks/apiv2models"
+)
+
+type JiraRemotePagination struct {
+	MaxResults int `json:"maxResults"`
+	StartAt    int `json:"startAt"`
+}
+
+func queryJiraAgileBoards(
+	apiClient plugin.ApiClient,
+	keyword string,
+	page JiraRemotePagination,
+) (
+	children []dsmodels.DsRemoteApiScopeListEntry[models.JiraBoard],
+	nextPage *JiraRemotePagination,
+	err errors.Error,
+) {
+	if page.MaxResults == 0 {
+		page.MaxResults = 100
+	}
+	res, err := apiClient.Get("agile/1.0/board", url.Values{
+		"maxResults": {fmt.Sprintf("%v", page.MaxResults)},
+		"startAt":    {fmt.Sprintf("%v", page.StartAt)},
+		"name":       {keyword},
+	}, nil)
+	if err != nil {
+		return
+	}
+
+	resBody := struct {
+		JiraRemotePagination
+		IsLast bool                `json:"isLast"`
+		Values []apiv2models.Board `json:"values"`
+	}{}
+
+	err = api.UnmarshalResponse(res, &resBody)
+	if err != nil {
+		return
+	}
+
+	for _, board := range resBody.Values {
+		children = append(children, dsmodels.DsRemoteApiScopeListEntry[models.JiraBoard]{
+			Type:     api.RAS_ENTRY_TYPE_SCOPE,
+			Id:       fmt.Sprintf("%v", board.ID),
+			ParentId: nil,
+			Name:     board.Name,
+			FullName: board.Name,
+			Data:     board.ToToolLayer(0),

Review Comment:
   Is this 0?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org