Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions plugins/gitee/api/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,26 @@ 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"`
}
58 changes: 54 additions & 4 deletions plugins/github/api/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ package api
import (
"context"
"fmt"
"github.com/apache/incubator-devlake/api/shared"
"net/http"
"strings"
"time"

"github.com/apache/incubator-devlake/plugins/github/models"
"github.com/apache/incubator-devlake/api/shared"

"github.com/apache/incubator-devlake/plugins/core"
"github.com/apache/incubator-devlake/plugins/github/models"
"github.com/apache/incubator-devlake/plugins/helper"
"github.com/mitchellh/mapstructure"

"github.com/apache/incubator-devlake/plugins/core"
)

type GithubTestConnResponse struct {
Expand Down Expand Up @@ -209,3 +208,54 @@ 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"`
}
49 changes: 49 additions & 0 deletions plugins/gitlab/api/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,52 @@ func GetConnection(input *core.ApiResourceInput) (*core.ApiResourceOutput, error
err := connectionHelper.First(connection, input.Params)
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
// @Accept application/json
// @Param blueprint body GitlabPipelinePlan true "json"
// @Router /pipelines/gitlab/pipeline-plan [post]
func PostGitlabPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
blueprint := &GitlabPipelinePlan{}
return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil
}

type GitlabPipelinePlan [][]struct {
Plugin string `json:"plugin"`
Subtasks []string `json:"subtasks"`
Options struct {
ConnectionID int `json:"connectionId"`
ProjectId int `json:"projectId"`
Since string
Transformation models.TransformationRules `json:"transformation"`
} `json:"options"`
}