From a914fdb1975336d26b5d73467932121d7b4d1508 Mon Sep 17 00:00:00 2001 From: Yingchu Chen Date: Wed, 17 Aug 2022 19:09:31 +0800 Subject: [PATCH] fix(framework): modify swagger closes #2735 --- api/blueprints/blueprint_plugin_setting.go | 219 +++++++++++++++++++++ api/pipelines/pipeline_plugin_plan.go | 176 +++++++++++++++++ models/blueprint.go | 12 +- plugins/dbt/api/connection.go | 48 ----- plugins/feishu/api/connection.go | 16 -- plugins/gitee/api/connection.go | 23 --- plugins/gitextractor/api/connection.go | 42 ---- plugins/github/api/connection.go | 51 ----- plugins/gitlab/api/connection.go | 27 --- plugins/jira/api/connection.go | 49 ----- plugins/tapd/api/connection.go | 50 ----- 11 files changed, 402 insertions(+), 311 deletions(-) create mode 100644 api/blueprints/blueprint_plugin_setting.go create mode 100644 api/pipelines/pipeline_plugin_plan.go delete mode 100644 plugins/dbt/api/connection.go delete mode 100644 plugins/gitextractor/api/connection.go diff --git a/api/blueprints/blueprint_plugin_setting.go b/api/blueprints/blueprint_plugin_setting.go new file mode 100644 index 00000000000..d3e2a7e78cd --- /dev/null +++ b/api/blueprints/blueprint_plugin_setting.go @@ -0,0 +1,219 @@ +package blueprints + +import ( + "github.com/apache/incubator-devlake/plugins/core" + "net/http" +) + +type CodeTransformationRules struct { + PrType string `mapstructure:"prType" json:"prType"` + PrComponent string `mapstructure:"prComponent" json:"prComponent"` + PrBodyClosePattern string `mapstructure:"prBodyClosePattern" json:"prBodyClosePattern"` + IssueSeverity string `mapstructure:"issueSeverity" json:"issueSeverity"` + IssuePriority string `mapstructure:"issuePriority" json:"issuePriority"` + IssueComponent string `mapstructure:"issueComponent" json:"issueComponent"` + IssueTypeBug string `mapstructure:"issueTypeBug" json:"issueTypeBug"` + IssueTypeIncident string `mapstructure:"issueTypeIncident" json:"issueTypeIncident"` + IssueTypeRequirement string `mapstructure:"issueTypeRequirement" json:"issueTypeRequirement"` +} + +type TicketTransformationRules struct { + EpicKeyField string `json:"epicKeyField"` + StoryPointField string `json:"storyPointField"` + RemotelinkCommitShaPattern string `json:"remotelinkCommitShaPattern"` + TypeMappings map[string]struct { + StandardType string `json:"standardType"` + } `json:"typeMappings"` +} + +// @Summary blueprints setting for tapd +// @Description blueprint setting for tapd +// @Tags framework/blueprints +// @Accept application/json +// @Param blueprint body TapdBlueprintSetting true "json" +// @Router /blueprints/tapd/blueprint-setting [post] +func PostTapdBlueprintSetting(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + blueprint := &TapdBlueprintSetting{} + return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil +} + +type TapdBlueprintSetting []struct { + Version string `json:"version"` + Connections []struct { + Plugin string `json:"plugin"` + ConnectionID int `json:"connectionId"` + Scope []struct { + Options struct { + WorkspaceId uint64 `mapstruct:"workspaceId"` + CompanyId uint64 `mapstruct:"companyId"` + Tasks []string `mapstruct:"tasks,omitempty"` + Since string + } `json:"options"` + Entities []string `json:"entities"` + } `json:"scope"` + } `json:"connections"` +} + +// @Summary blueprints plan for refdiff +// @Description blueprints plan for refdiff +// @Tags framework/blueprints +// @Accept application/json +// @Param blueprint body RefdiffBlueprintPlan true "json" +// @Router /blueprints/refdiff/blueprint-plan [post] +func PostRefdiffBlueprint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + blueprint := &RefdiffBlueprintPlan{} + return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil +} + +type RefdiffBlueprintPlan [][]struct { + Plugin string `json:"plugin"` + Options struct { + RepoID string `json:"repoId"` + Pairs []struct { + NewRef string `json:"newRef"` + OldRef string `json:"oldRef"` + } `json:"pairs"` + } `json:"options"` +} + +// @Summary blueprints setting for jira +// @Description blueprint setting for jira +// @Tags framework/blueprints +// @Accept application/json +// @Param blueprint-setting body JiraBlueprintSetting true "json" +// @Router /blueprints/jira/blueprint-setting [post] +func PostJiraBlueprintSetting(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + blueprint := &JiraBlueprintSetting{} + return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil +} + +type JiraBlueprintSetting []struct { + Version string `json:"version"` + Connections []struct { + Plugin string `json:"plugin"` + ConnectionID int `json:"connectionId"` + Scope []struct { + Transformation TicketTransformationRules `json:"transformation"` + Options struct { + BoardId uint64 `json:"boardId"` + Since string `json:"since"` + } `json:"options"` + Entities []string `json:"entities"` + } `json:"scope"` + } `json:"connections"` +} + +// @Summary blueprints setting for gitlab +// @Description blueprint setting for gitlab +// @Tags framework/blueprints +// @Accept application/json +// @Param blueprint body GitlabBlueprintSetting true "json" +// @Router /blueprints/gitlab/blueprint-setting [post] +func PostGitlabBluePrint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + blueprint := &GitlabBlueprintSetting{} + return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil +} + +type GitlabBlueprintSetting []struct { + Version string `json:"version"` + Connections []struct { + Plugin string `json:"plugin"` + ConnectionID int `json:"connectionId"` + Scope []struct { + Transformation CodeTransformationRules `json:"transformation"` + Options struct { + ProjectId int `json:"projectId"` + Since string + } `json:"options"` + Entities []string `json:"entities"` + } `json:"scope"` + } `json:"connections"` +} + +// @Summary blueprints plan for gitextractor +// @Description blueprints plan for gitextractor +// @Tags framework/blueprints +// @Accept application/json +// @Param blueprint body GitextractorBlueprintPlan true "json" +// @Router /blueprints/gitextractor/blueprint-plan [post] +func PostGitextractorBlueprint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + blueprint := &GitextractorBlueprintPlan{} + return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil +} + +type GitextractorBlueprintPlan [][]struct { + Plugin string `json:"plugin"` + Options struct { + URL string `json:"url"` + RepoID string `json:"repoId"` + } `json:"options"` +} + +// @Summary blueprints plan for feishu +// @Description blueprints plan for feishu +// @Tags framework/blueprints +// @Accept application/json +// @Param blueprint body FeishuBlueprintPlan true "json" +// @Router /blueprints/feishu/blueprint-plan [post] +func PostFeishuBlueprint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + blueprint := &FeishuBlueprintPlan{} + return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil +} + +type FeishuBlueprintPlan [][]struct { + Plugin string `json:"plugin"` + Options struct{} `json:"options"` +} + +// @Summary blueprints plan for dbt +// @Description blueprints plan for dbt +// @Tags framework/blueprints +// @Accept application/json +// @Param blueprint body DbtBlueprintPlan true "json" +// @Router /blueprints/dbt/blueprint-plan [post] +func PostDbtBlueprint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + blueprint := &DbtBlueprintPlan{} + return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil +} + +type DbtBlueprintPlan [][]struct { + Plugin string `json:"plugin"` + Options struct { + ProjectPath string `json:"projectPath"` + ProjectName string `json:"projectName"` + ProjectTarget string `json:"projectTarget"` + SelectedModels []string `json:"selectedModels"` + ProjectVars struct { + Demokey1 string `json:"demokey1"` + Demokey2 string `json:"demokey2"` + } `json:"projectVars"` + } `json:"options"` +} + +// @Summary blueprints setting for github +// @Description blueprint setting for github +// @Tags framework/blueprints +// @Accept application/json +// @Param blueprint body GithubBlueprintSetting true "json" +// @Router /blueprints/github/blueprint-setting [post] +func PostGithubBluePrint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + blueprint := &GithubBlueprintSetting{} + return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil +} + +type GithubBlueprintSetting []struct { + Version string `json:"version"` + Connections []struct { + Plugin string `json:"plugin"` + ConnectionID int `json:"connectionId"` + Scope []struct { + Transformation CodeTransformationRules `json:"transformation"` + Options struct { + Owner string `json:"owner"` + Repo string `json:"repo"` + Since string + } `json:"options"` + Entities []string `json:"entities"` + } `json:"scope"` + } `json:"connections"` +} diff --git a/api/pipelines/pipeline_plugin_plan.go b/api/pipelines/pipeline_plugin_plan.go new file mode 100644 index 00000000000..b2743838381 --- /dev/null +++ b/api/pipelines/pipeline_plugin_plan.go @@ -0,0 +1,176 @@ +package pipelines + +import ( + "github.com/apache/incubator-devlake/plugins/core" + "net/http" +) + +type CodeTransformationRules struct { + PrType string `mapstructure:"prType" json:"prType"` + PrComponent string `mapstructure:"prComponent" json:"prComponent"` + PrBodyClosePattern string `mapstructure:"prBodyClosePattern" json:"prBodyClosePattern"` + IssueSeverity string `mapstructure:"issueSeverity" json:"issueSeverity"` + IssuePriority string `mapstructure:"issuePriority" json:"issuePriority"` + IssueComponent string `mapstructure:"issueComponent" json:"issueComponent"` + IssueTypeBug string `mapstructure:"issueTypeBug" json:"issueTypeBug"` + IssueTypeIncident string `mapstructure:"issueTypeIncident" json:"issueTypeIncident"` + IssueTypeRequirement string `mapstructure:"issueTypeRequirement" json:"issueTypeRequirement"` +} + +type TicketTransformationRules struct { + EpicKeyField string `json:"epicKeyField"` + StoryPointField string `json:"storyPointField"` + RemotelinkCommitShaPattern string `json:"remotelinkCommitShaPattern"` + TypeMappings map[string]struct { + StandardType string `json:"standardType"` + } `json:"typeMappings"` +} + +// @Summary pipelines plan for jira +// @Description pipelines plan for jira +// @Tags framework/pipelines +// @Accept application/json +// @Param pipeline-plan body JiraPipelinePlan true "json" +// @Router /pipelines/jira/pipeline-plan [post] +func PostJiraPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + pipeline := &JiraPipelinePlan{} + return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil +} + +type JiraPipelinePlan [][]struct { + Plugin string `json:"plugin"` + Subtasks []string `json:"subtasks"` + Options struct { + BoardID int `json:"boardId"` + ConnectionID int `json:"connectionId"` + TransformationRules TicketTransformationRules `json:"transformationRules"` + } `json:"options"` +} + +// @Summary pipelines plan for gitextractor +// @Description pipelines plan for gitextractor +// @Tags framework/pipelines +// @Accept application/json +// @Param pipeline body GitextractorPipelinePlan true "json" +// @Router /pipelines/gitextractor/pipeline-plan [post] +func PostGitextractorPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + pipeline := &GitextractorPipelinePlan{} + return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil +} + +type GitextractorPipelinePlan [][]struct { + Plugin string `json:"plugin"` + Options struct { + URL string `json:"url"` + RepoID string `json:"repoId"` + } `json:"options"` +} + +// @Summary pipelines plan for gitee +// @Description pipelines plan for gitee +// @Tags framework/pipelines +// @Accept application/json +// @Param pipeline body GiteePipelinePlan true "json" +// @Router /pipelines/gitee/pipeline-plan [post] +func PostGiteePipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + pipeline := &GiteePipelinePlan{} + return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil +} + +type GiteePipelinePlan [][]struct { + Plugin string `json:"plugin"` + Subtasks []string `json:"subtasks"` + Options struct { + ConnectionID int `json:"connectionId"` + Owner string `json:"owner"` + Repo string `json:"repo"` + Since string + Transformation CodeTransformationRules `json:"transformation"` + } `json:"options"` +} + +// @Summary pipelines plan for feishu +// @Description pipelines plan for feishu +// @Tags framework/pipelines +// @Accept application/json +// @Param pipeline body FeishuPipelinePlan true "json" +// @Router /pipelines/feishu/pipeline-plan [post] +func PostFeishuPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + pipeline := &FeishuPipelinePlan{} + return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil +} + +type FeishuPipelinePlan [][]struct { + Plugin string `json:"plugin"` + Options struct{} `json:"options"` +} + +// @Summary pipelines plan for dbt +// @Description pipelines plan for dbt +// @Tags framework/pipelines +// @Accept application/json +// @Param pipeline body DbtPipelinePlan true "json" +// @Router /pipelines/dbt/pipeline-plan [post] +func PostDbtPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + pipeline := &DbtPipelinePlan{} + return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil +} + +type DbtPipelinePlan [][]struct { + Plugin string `json:"plugin"` + Options struct { + ProjectPath string `json:"projectPath"` + ProjectName string `json:"projectName"` + ProjectTarget string `json:"projectTarget"` + SelectedModels []string `json:"selectedModels"` + ProjectVars struct { + Demokey1 string `json:"demokey1"` + Demokey2 string `json:"demokey2"` + } `json:"projectVars"` + } `json:"options"` +} + +// @Summary pipelines plan for github +// @Description pipelines plan for github +// @Tags framework/pipelines +// @Accept application/json +// @Param pipeline body GithubPipelinePlan true "json" +// @Router /pipelines/github/pipeline-plan [post] +func PostGithubPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + pipeline := &GithubPipelinePlan{} + return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil +} + +type GithubPipelinePlan [][]struct { + Plugin string `json:"plugin"` + Subtasks []string `json:"subtasks"` + Options struct { + ConnectionID int `json:"connectionId"` + Owner string `json:"owner"` + Repo string `json:"repo"` + Since string + Transformation CodeTransformationRules `json:"transformation"` + } `json:"options"` +} + +// @Summary pipelines plan for tapd +// @Description pipelines plan for tapd +// @Tags framework/pipelines +// @Accept application/json +// @Param pipeline body TapdPipelinePlan true "json" +// @Router /pipelines/tapd/pipeline-plan [post] +func PostTapdPipelinePlan(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { + pipeline := &TapdPipelinePlan{} + return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil +} + +type TapdPipelinePlan [][]struct { + Plugin string `json:"plugin"` + Subtasks []string `json:"subtasks"` + Options struct { + WorkspaceId uint64 `mapstruct:"workspaceId"` + CompanyId uint64 `mapstruct:"companyId"` + Tasks []string `mapstruct:"tasks,omitempty"` + Since string + } `json:"options"` +} diff --git a/models/blueprint.go b/models/blueprint.go index d99ab5756c0..3af784feb63 100644 --- a/models/blueprint.go +++ b/models/blueprint.go @@ -29,12 +29,14 @@ const ( BLUEPRINT_MODE_ADVANCED = "ADVANCED" ) +// @Description CronConfig type Blueprint struct { - Name string `json:"name" validate:"required"` - Mode string `json:"mode" gorm:"varchar(20)" validate:"required,oneof=NORMAL ADVANCED"` - Plan json.RawMessage `json:"plan"` - Enable bool `json:"enable"` - CronConfig string `json:"cronConfig" format:"* * * * *" example:"0 0 * * 1; please check https://crontab.guru/ for detail"` + Name string `json:"name" validate:"required"` + Mode string `json:"mode" gorm:"varchar(20)" validate:"required,oneof=NORMAL ADVANCED"` + Plan json.RawMessage `json:"plan"` + Enable bool `json:"enable"` + //please check this https://crontab.guru/ for detail + CronConfig string `json:"cronConfig" format:"* * * * *" example:"0 0 * * 1"` IsManual bool `json:"isManual"` Settings json.RawMessage `json:"settings" swaggertype:"array,string" example:"please check api: /blueprints//blueprint-setting"` common.Model `swaggerignore:"true"` diff --git a/plugins/dbt/api/connection.go b/plugins/dbt/api/connection.go deleted file mode 100644 index 8b4f6127db4..00000000000 --- a/plugins/dbt/api/connection.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -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 ( - "github.com/apache/incubator-devlake/plugins/core" - "net/http" -) - -// @Summary pipelines plan for dbt -// @Description pipelines plan for dbt -// @Tags plugins/dbt -// @Accept application/json -// @Param blueprint body DbtPipelinePlan true "json" -// @Router /pipelines/dbt/pipeline-plan [post] -func PostDbtPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { - blueprint := &DbtPipelinePlan{} - return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil -} - -type DbtPipelinePlan [][]struct { - Plugin string `json:"plugin"` - Options struct { - ProjectPath string `json:"projectPath"` - ProjectName string `json:"projectName"` - ProjectTarget string `json:"projectTarget"` - SelectedModels []string `json:"selectedModels"` - ProjectVars struct { - Demokey1 string `json:"demokey1"` - Demokey2 string `json:"demokey2"` - } `json:"projectVars"` - } `json:"options"` -} diff --git a/plugins/feishu/api/connection.go b/plugins/feishu/api/connection.go index 36e9a256461..9b26d0a9ecc 100644 --- a/plugins/feishu/api/connection.go +++ b/plugins/feishu/api/connection.go @@ -160,19 +160,3 @@ func GetConnection(input *core.ApiResourceInput) (*core.ApiResourceOutput, error } return &core.ApiResourceOutput{Body: connection}, err } - -// @Summary pipelines plan for feishu -// @Description pipelines plan for feishu -// @Tags plugins/feishu -// @Accept application/json -// @Param blueprint body FeishuPipelinePlan true "json" -// @Router /pipelines/feishu/pipeline-plan [post] -func PostFeishuPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { - blueprint := &FeishuPipelinePlan{} - return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil -} - -type FeishuPipelinePlan [][]struct { - Plugin string `json:"plugin"` - Options struct{} `json:"options"` -} diff --git a/plugins/gitee/api/connection.go b/plugins/gitee/api/connection.go index c3fcc45c799..3fd10948ce4 100644 --- a/plugins/gitee/api/connection.go +++ b/plugins/gitee/api/connection.go @@ -162,26 +162,3 @@ func GetConnection(input *core.ApiResourceInput) (*core.ApiResourceOutput, error err := connectionHelper.First(connection, input.Params) return &core.ApiResourceOutput{Body: connection}, err } - -// @Summary pipelines plan for gitee -// @Description pipelines plan for gitee -// @Tags plugins/gitee -// @Accept application/json -// @Param blueprint body GiteePipelinePlan true "json" -// @Router /pipelines/gitee/pipeline-plan [post] -func PostGiteePipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { - blueprint := &GiteePipelinePlan{} - return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil -} - -type GiteePipelinePlan [][]struct { - Plugin string `json:"plugin"` - Subtasks []string `json:"subtasks"` - Options struct { - ConnectionID int `json:"connectionId"` - Owner string `json:"owner"` - Repo string `json:"repo"` - Since string - Transformation models.TransformationRules `json:"transformation"` - } `json:"options"` -} diff --git a/plugins/gitextractor/api/connection.go b/plugins/gitextractor/api/connection.go deleted file mode 100644 index ca55262ea45..00000000000 --- a/plugins/gitextractor/api/connection.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -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 ( - "github.com/apache/incubator-devlake/plugins/core" - "net/http" -) - -// @Summary pipelines plan for gitextractor -// @Description pipelines plan for gitextractor -// @Tags plugins/gitextractor -// @Accept application/json -// @Param blueprint body GitextractorPipelinePlan true "json" -// @Router /pipelines/gitextractor/pipeline-plan [post] -func PostGitextractorPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { - blueprint := &GitextractorPipelinePlan{} - return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil -} - -type GitextractorPipelinePlan [][]struct { - Plugin string `json:"plugin"` - Options struct { - URL string `json:"url"` - RepoID string `json:"repoId"` - } `json:"options"` -} diff --git a/plugins/github/api/connection.go b/plugins/github/api/connection.go index c48359cfe10..e7e4bf6c3e4 100644 --- a/plugins/github/api/connection.go +++ b/plugins/github/api/connection.go @@ -208,54 +208,3 @@ func GetConnection(input *core.ApiResourceInput) (*core.ApiResourceOutput, error } return &core.ApiResourceOutput{Body: connection}, err } - -// @Summary blueprints setting for github -// @Description blueprint setting for github -// @Tags plugins/github -// @Accept application/json -// @Param blueprint body GithubBlueprintSetting true "json" -// @Router /blueprints/github/blueprint-setting [post] -func PostGithubBluePrint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { - blueprint := &GithubBlueprintSetting{} - return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil -} - -type GithubBlueprintSetting []struct { - Version string `json:"version"` - Connections []struct { - Plugin string `json:"plugin"` - ConnectionID int `json:"connectionId"` - Scope []struct { - Transformation models.TransformationRules `json:"transformation"` - Options struct { - Owner string `json:"owner"` - Repo string `json:"repo"` - Since string - } `json:"options"` - Entities []string `json:"entities"` - } `json:"scope"` - } `json:"connections"` -} - -// @Summary pipelines plan for github -// @Description pipelines plan for github -// @Tags plugins/github -// @Accept application/json -// @Param blueprint body GithubPipelinePlan true "json" -// @Router /pipelines/github/pipeline-plan [post] -func PostGithubPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { - blueprint := &GithubPipelinePlan{} - return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil -} - -type GithubPipelinePlan [][]struct { - Plugin string `json:"plugin"` - Subtasks []string `json:"subtasks"` - Options struct { - ConnectionID int `json:"connectionId"` - Owner string `json:"owner"` - Repo string `json:"repo"` - Since string - Transformation models.TransformationRules `json:"transformation"` - } `json:"options"` -} diff --git a/plugins/gitlab/api/connection.go b/plugins/gitlab/api/connection.go index 7318483b267..e60417fac2a 100644 --- a/plugins/gitlab/api/connection.go +++ b/plugins/gitlab/api/connection.go @@ -162,33 +162,6 @@ func GetConnection(input *core.ApiResourceInput) (*core.ApiResourceOutput, error return &core.ApiResourceOutput{Body: connection}, err } -// @Summary blueprints setting for gitlab -// @Description blueprint setting for gitlab -// @Tags plugins/gitlab -// @Accept application/json -// @Param blueprint body GitlabBlueprintSetting true "json" -// @Router /blueprints/gitlab/blueprint-setting [post] -func PostGitlabBluePrint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { - blueprint := &GitlabBlueprintSetting{} - return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil -} - -type GitlabBlueprintSetting []struct { - Version string `json:"version"` - Connections []struct { - Plugin string `json:"plugin"` - ConnectionID int `json:"connectionId"` - Scope []struct { - Transformation models.TransformationRules `json:"transformation"` - Options struct { - ProjectId int `json:"projectId"` - Since string - } `json:"options"` - Entities []string `json:"entities"` - } `json:"scope"` - } `json:"connections"` -} - // @Summary pipelines plan for gitlab // @Description pipelines plan for gitlab // @Tags plugins/gitlab diff --git a/plugins/jira/api/connection.go b/plugins/jira/api/connection.go index 4b4f09c06d3..0289d50d023 100644 --- a/plugins/jira/api/connection.go +++ b/plugins/jira/api/connection.go @@ -20,7 +20,6 @@ package api import ( "context" "fmt" - "github.com/apache/incubator-devlake/plugins/jira/tasks" "net/http" "net/url" "strings" @@ -213,51 +212,3 @@ func GetConnection(input *core.ApiResourceInput) (*core.ApiResourceOutput, error err := connectionHelper.First(connection, input.Params) return &core.ApiResourceOutput{Body: connection}, err } - -// @Summary blueprints setting for jira -// @Description blueprint setting for jira -// @Tags plugins/jira -// @Accept application/json -// @Param blueprint-setting body JiraBlueprintSetting true "json" -// @Router /blueprints/jira/blueprint-setting [post] -func PostJiraBlueprintSetting(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { - blueprint := &JiraBlueprintSetting{} - return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil -} - -type JiraBlueprintSetting []struct { - Version string `json:"version"` - Connections []struct { - Plugin string `json:"plugin"` - ConnectionID int `json:"connectionId"` - Scope []struct { - Transformation tasks.TransformationRules `json:"transformation"` - Options struct { - BoardId uint64 `json:"boardId"` - Since string `json:"since"` - } `json:"options"` - Entities []string `json:"entities"` - } `json:"scope"` - } `json:"connections"` -} - -// @Summary pipelines plan for jira -// @Description pipelines plan for jira -// @Tags plugins/jira -// @Accept application/json -// @Param pipeline-plan body JiraPipelinePlan true "json" -// @Router /pipelines/jira/pipeline-plan [post] -func PostJiraPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { - blueprint := &JiraPipelinePlan{} - return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil -} - -type JiraPipelinePlan [][]struct { - Plugin string `json:"plugin"` - Subtasks []string `json:"subtasks"` - Options struct { - BoardID int `json:"boardId"` - ConnectionID int `json:"connectionId"` - TransformationRules tasks.TransformationRules `json:"transformationRules"` - } `json:"options"` -} diff --git a/plugins/tapd/api/connection.go b/plugins/tapd/api/connection.go index a8a2ce4ccac..4b1f3609d82 100644 --- a/plugins/tapd/api/connection.go +++ b/plugins/tapd/api/connection.go @@ -166,53 +166,3 @@ func GetConnection(input *core.ApiResourceInput) (*core.ApiResourceOutput, error err := connectionHelper.First(connection, input.Params) return &core.ApiResourceOutput{Body: connection}, err } - -// @Summary blueprints setting for tapd -// @Description blueprint setting for tapd -// @Tags plugins/tapd -// @Accept application/json -// @Param blueprint body TapdBlueprintSetting true "json" -// @Router /blueprints/tapd/blueprint-setting [post] -func PostTapdBlueprintSetting(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { - blueprint := &TapdBlueprintSetting{} - return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil -} - -type TapdBlueprintSetting []struct { - Version string `json:"version"` - Connections []struct { - Plugin string `json:"plugin"` - ConnectionID int `json:"connectionId"` - Scope []struct { - Options struct { - WorkspaceId uint64 `mapstruct:"workspaceId"` - CompanyId uint64 `mapstruct:"companyId"` - Tasks []string `mapstruct:"tasks,omitempty"` - Since string - } `json:"options"` - Entities []string `json:"entities"` - } `json:"scope"` - } `json:"connections"` -} - -// @Summary pipelines plan for tapd -// @Description pipelines plan for tapd -// @Tags plugins/tapd -// @Accept application/json -// @Param blueprint body TapdPipelinePlan true "json" -// @Router /pipelines/tapd/pipeline-plan [post] -func PostTapdPipelinePlan(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) { - blueprint := &TapdPipelinePlan{} - return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil -} - -type TapdPipelinePlan [][]struct { - Plugin string `json:"plugin"` - Subtasks []string `json:"subtasks"` - Options struct { - WorkspaceId uint64 `mapstruct:"workspaceId"` - CompanyId uint64 `mapstruct:"companyId"` - Tasks []string `mapstruct:"tasks,omitempty"` - Since string - } `json:"options"` -}