Help us shape the future of Go! Take the 2026 Go Developer Survey

importservice

package
v3.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package importservice implements MCP tools for GitLab external import operations.

The package wraps the GitLab Import API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBitbucketCloudImport

func FormatBitbucketCloudImport(out *BitbucketCloudImportOutput) string

FormatBitbucketCloudImport renders a Bitbucket Cloud import as a card.

func FormatBitbucketServerImport

func FormatBitbucketServerImport(out *BitbucketServerImportOutput) string

FormatBitbucketServerImport renders a Bitbucket Server import as a card. The endpoint answers with the created project alone: no import status, no provider link.

func FormatCancelledImport

func FormatCancelledImport(out *CancelledImportOutput) string

FormatCancelledImport renders a canceled GitHub import as a card.

func FormatGitHubImport

func FormatGitHubImport(out *GitHubImportOutput) string

FormatGitHubImport renders a GitHub import as a card.

The imported project's name is whatever the source repository was called, so every value here is one a person typed; the card escapes each for the row it writes. It used to drop the relation type and both addresses GitLab sends — the source repository and the refs endpoint — which left a reader of a mirror import unable to tell what was mirrored or from where.

func ImportGists

func ImportGists(ctx context.Context, client *gitlabclient.Client, input ImportGistsInput) error

ImportGists imports GitHub gists into GitLab snippets.

Types

type BitbucketCloudImportOutput

type BitbucketCloudImportOutput struct {
	ID                    int64  `json:"id"`
	Name                  string `json:"name"`
	FullPath              string `json:"full_path"`
	FullName              string `json:"full_name"`
	ImportSource          string `json:"import_source"`
	ImportStatus          string `json:"import_status"`
	HumanImportStatusName string `json:"human_import_status_name,omitempty"`
	ProviderLink          string `json:"provider_link,omitempty"`
}

BitbucketCloudImportOutput represents the output of a Bitbucket Cloud import.

func ImportFromBitbucketCloud

func ImportFromBitbucketCloud(ctx context.Context, client *gitlabclient.Client, input ImportFromBitbucketCloudInput) (*BitbucketCloudImportOutput, error)

ImportFromBitbucketCloud imports a repository from Bitbucket Cloud into GitLab.

type BitbucketServerImportOutput

type BitbucketServerImportOutput struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	FullPath string `json:"full_path"`
	FullName string `json:"full_name"`
}

BitbucketServerImportOutput represents the output of a Bitbucket Server import.

func ImportFromBitbucketServer

func ImportFromBitbucketServer(ctx context.Context, client *gitlabclient.Client, input ImportFromBitbucketServerInput) (*BitbucketServerImportOutput, error)

ImportFromBitbucketServer imports a repository from Bitbucket Server into GitLab.

type CancelGitHubImportInput

type CancelGitHubImportInput struct {
	ProjectID int64 `json:"project_id" jsonschema:"The GitLab project ID of the import to cancel,required"`
}

CancelGitHubImportInput represents input for canceling a GitHub import.

type CancelledImportOutput

type CancelledImportOutput struct {
	ID                    int64  `json:"id"`
	Name                  string `json:"name"`
	FullPath              string `json:"full_path"`
	FullName              string `json:"full_name"`
	ImportSource          string `json:"import_source"`
	ImportStatus          string `json:"import_status"`
	HumanImportStatusName string `json:"human_import_status_name,omitempty"`
	ProviderLink          string `json:"provider_link,omitempty"`
}

CancelledImportOutput represents the output of a canceled GitHub import.

func CancelGitHubImport

func CancelGitHubImport(ctx context.Context, client *gitlabclient.Client, input CancelGitHubImportInput) (*CancelledImportOutput, error)

CancelGitHubImport cancels an ongoing GitHub import.

type GitHubImportOutput

type GitHubImportOutput struct {
	ID                    int64  `json:"id"`
	Name                  string `json:"name"`
	FullPath              string `json:"full_path"`
	FullName              string `json:"full_name"`
	RefsURL               string `json:"refs_url,omitempty"`
	ImportSource          string `json:"import_source"`
	ImportStatus          string `json:"import_status"`
	HumanImportStatusName string `json:"human_import_status_name,omitempty"`
	ProviderLink          string `json:"provider_link,omitempty"`
	RelationType          string `json:"relation_type,omitempty"`
	ImportWarning         string `json:"import_warning,omitempty"`
}

GitHubImportOutput represents the output of a GitHub import operation.

func ImportFromGitHub

func ImportFromGitHub(ctx context.Context, client *gitlabclient.Client, input ImportFromGitHubInput) (*GitHubImportOutput, error)

ImportFromGitHub imports a repository from GitHub into GitLab.

type GitHubOptionalStagesInput

type GitHubOptionalStagesInput struct {
	SingleEndpointNotesImport *bool `` /* 140-byte string literal not displayed */
	AttachmentsImport         *bool `` /* 132-byte string literal not displayed */
	CollaboratorsImport       *bool `json:"collaborators_import,omitempty" jsonschema:"Import collaborators (project members) from the GitHub repository"`
}

GitHubOptionalStagesInput mirrors the GitLab GitHub-import optional_stages object, toggling the slower, opt-in import stages.

type ImportFromBitbucketCloudInput

type ImportFromBitbucketCloudInput struct {
	BitbucketAPIToken string `` /* 180-byte string literal not displayed */
	BitbucketEmail    string `json:"bitbucket_email" jsonschema:"Atlassian account email the API token belongs to,required"`
	RepoPath          string `json:"repo_path" jsonschema:"Bitbucket repository path (e.g. owner/repo),required"`
	TargetNamespace   string `json:"target_namespace" jsonschema:"Target namespace for the imported project,required"`
	NewName           string `json:"new_name,omitempty" jsonschema:"New name for the imported project"`
}

ImportFromBitbucketCloudInput represents input for importing from Bitbucket Cloud.

It carries the API token and the email it belongs to, and not the username and app password client-go's options still model: GitLab 19.0 dropped both from POST /import/bitbucket (lib/api/import_bitbucket.rb at v19.0.0-ee), an earlier instance refuses an app password beside the API token (mutually_exclusive at v18.11.0-ee) and a username without an app password (all_or_none_of), and Atlassian disabled app passwords in June 2026, so the pair could only make a call fail or be ignored.

type ImportFromBitbucketServerInput

type ImportFromBitbucketServerInput struct {
	BitbucketServerURL      string `json:"bitbucket_server_url" jsonschema:"Bitbucket Server URL,required"`
	BitbucketServerUsername string `json:"bitbucket_server_username" jsonschema:"Bitbucket Server username,required"`
	PersonalAccessToken     string `` /* 165-byte string literal not displayed */
	BitbucketServerProject  string `json:"bitbucket_server_project" jsonschema:"Bitbucket Server project key,required"`
	BitbucketServerRepo     string `json:"bitbucket_server_repo" jsonschema:"Bitbucket Server repository slug,required"`
	NewName                 string `json:"new_name,omitempty" jsonschema:"New name for the imported project"`
	NewNamespace            string `json:"new_namespace,omitempty" jsonschema:"Target namespace for the imported project"`
	TimeoutStrategy         string `json:"timeout_strategy,omitempty" jsonschema:"Timeout strategy (optimistic or pessimistic)"`
}

ImportFromBitbucketServerInput represents input for importing from Bitbucket Server.

type ImportFromGitHubInput

type ImportFromGitHubInput struct {
	PersonalAccessToken string `` /* 155-byte string literal not displayed */
	RepoID              int64  `json:"repo_id" jsonschema:"GitHub repository ID,required"`
	NewName             string `json:"new_name,omitempty" jsonschema:"New name for the imported project"`
	TargetNamespace     string `json:"target_namespace" jsonschema:"Target namespace for the imported project,required"`
	GitHubHostname      string `json:"github_hostname,omitempty" jsonschema:"GitHub hostname for GitHub Enterprise"`
	// OptionalStages selectively enables the slower, optional import stages.
	// Each flag defaults to disabled when omitted, matching the GitLab API.
	OptionalStages  *GitHubOptionalStagesInput `json:"optional_stages,omitempty" jsonschema:"Optional import stages to enable (each defaults to disabled when omitted)"`
	TimeoutStrategy string                     `json:"timeout_strategy,omitempty" jsonschema:"Timeout strategy (optimistic or pessimistic)"`
}

ImportFromGitHubInput represents input for importing a repository from GitHub.

type ImportGistsInput

type ImportGistsInput struct {
	PersonalAccessToken string `` /* 155-byte string literal not displayed */
}

ImportGistsInput represents input for importing GitHub gists as GitLab snippets.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL