apis

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package apis provides multiple APIs to interact with the Apicurio Registry.

The apis package exposes high-level APIs to manage resources in the Apicurio Registry, such as artifacts, versions, metadata, and administrative operations. Each API encapsulates specific functionalities of the Apicurio Registry, ensuring a modular and user-friendly interface.

Available APIs:

  1. **ArtifactsAPI**: Manages artifacts (schemas), including creation, retrieval, updating, and deletion.

  2. **VersionsAPI**: Handles operations related to artifact versions, such as retrieving and managing version history.

  3. **GroupsAPI**: Supports grouping of artifacts to enable multi-tenancy and organizational categorization.

  4. **MetadataAPI**: Provides methods to manage artifact metadata and perform compatibility checks.

  5. **AdminAPI**: Enables administrative operations like clearing caches, monitoring system health, and managing global settings.

6. **SystemAPI**: Offers methods for querying registry status and configuration.

Example Usage:

The following example demonstrates how to use the ArtifactsAPI to create and retrieve an artifact:

package main

import (
	"fmt"
	"github.com/mollie/go-apicurio-registry/apis"
	"github.com/mollie/go-apicurio-registry/client"
	"github.com/mollie/go-apicurio-registry/models"
)

func main() {
	// Initialize the API client
	config := client.Config{
		BaseURL: "https://my-registry.example.com",
		AuthToken: "my-token",
	}
	apiClient := client.NewApicurioClient(config)

	// Access the ArtifactsAPI
	artifactsAPI := apis.NewArtifactsAPI(apiClient)

	// Create a new artifact
	artifact := models.Artifact{
		GroupID: "example-group",
		ID: "example-artifact",
		Content: []byte(`{"type": "record", "name": "Example", "fields": [{"name": "field1", "type": "string"}]}`),
		ContentType: "application/json",
	}
	response, err := artifactsAPI.Create(artifact)
	if err != nil {
		fmt.Printf("Error creating artifact: %v\n", err)
		return
	}
	fmt.Printf("Artifact created with ID: %s\n", response.ID)

	// Retrieve artifact metadata
	metadata, err := artifactsAPI.GetMetadata("example-group", "example-artifact")
	if err != nil {
		fmt.Printf("Error retrieving metadata: %v\n", err)
		return
	}
	fmt.Printf("Artifact metadata: %+v\n", metadata)
}

Note:

Each API can be accessed via its respective constructor function (e.g., `NewArtifactsAPI`, `NewAdminAPI`). These APIs are designed to integrate seamlessly with the client package.

Index

Constants

View Source
const (
	ContentTypeJSON = "application/json"
	ContentTypeAll  = "*/*"
)

Variables

View Source
var (
	ErrInvalidInput = errors.New("input did not pass validation with regex")
)

Functions

This section is empty.

Types

type AdminAPI

type AdminAPI struct {
	Client *client.Client
}

func NewAdminAPI

func NewAdminAPI(client *client.Client) *AdminAPI

func (*AdminAPI) CreateGlobalRule

func (api *AdminAPI) CreateGlobalRule(
	ctx context.Context,
	rule models.Rule,
	level models.RuleLevel,
) error

CreateGlobalRule Creates a new global rule. POST /admin/rules See: https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Global-rules/operation/createGlobalRule

func (*AdminAPI) DeleteAllGlobalRule

func (api *AdminAPI) DeleteAllGlobalRule(ctx context.Context) error

DeleteAllGlobalRule Adds a rule to the list of globally configured rules. DELETE /admin/rules See: https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Global-rules/operation/deleteAllGlobalRules

func (*AdminAPI) DeleteGlobalRule

func (api *AdminAPI) DeleteGlobalRule(ctx context.Context, rule models.Rule) error

DeleteGlobalRule Deletes the named globally configured rule. DELETE /admin/rules/{rule} See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Global-rules/operation/deleteGlobalRule

func (*AdminAPI) GetGlobalRule

func (api *AdminAPI) GetGlobalRule(
	ctx context.Context,
	rule models.Rule,
) (models.RuleLevel, error)

GetGlobalRule Returns information about the named globally configured rule. GET /admin/rules/{rule} See: https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Global-rules/operation/getGlobalRuleConfig

func (*AdminAPI) ListArtifactTypes

func (api *AdminAPI) ListArtifactTypes(ctx context.Context) ([]models.ArtifactType, error)

ListArtifactTypes Gets a list of all the currently configured artifact types (if any). GET admin/config/artifactTypes See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifact-Type/operation/listArtifactTypes

func (*AdminAPI) ListGlobalRules

func (api *AdminAPI) ListGlobalRules(ctx context.Context) ([]models.Rule, error)

ListGlobalRules Gets a list of all the currently configured global rules (if any). GET /admin/rules See: https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Global-rules/operation/listGlobalRules

func (*AdminAPI) UpdateGlobalRule

func (api *AdminAPI) UpdateGlobalRule(
	ctx context.Context,
	rule models.Rule,
	level models.RuleLevel,
) error

UpdateGlobalRule Updates the configuration of the named globally configured rule. PUT /admin/rules/{rule} See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Global-rules/operation/updateGlobalRuleConfig

type ArtifactsAPI

type ArtifactsAPI struct {
	Client *client.Client
}

func NewArtifactsAPI

func NewArtifactsAPI(client *client.Client) *ArtifactsAPI

func (*ArtifactsAPI) CreateArtifactRule

func (api *ArtifactsAPI) CreateArtifactRule(
	ctx context.Context,
	groupID, artifactId string,
	rule models.Rule,
	level models.RuleLevel,
) error

CreateArtifactRule creates a new artifact rule for a given artifact. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifact-rules/operation/createArtifactRule

func (*ArtifactsAPI) DeleteAllArtifactRule

func (api *ArtifactsAPI) DeleteAllArtifactRule(
	ctx context.Context,
	groupID, artifactId string,
) error

DeleteAllArtifactRule deletes all artifact rules for a given artifact. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifact-rules/operation/deleteArtifactRules

func (*ArtifactsAPI) DeleteArtifact

func (api *ArtifactsAPI) DeleteArtifact(ctx context.Context, groupID, artifactId string) error

DeleteArtifact deletes a specific artifact identified by groupId and artifactId. Deletes an artifact completely, resulting in all versions of the artifact also being deleted. This may fail for one of the following reasons: See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifacts/operation/deleteArtifact

func (*ArtifactsAPI) DeleteArtifactRule

func (api *ArtifactsAPI) DeleteArtifactRule(
	ctx context.Context,
	groupID, artifactId string,
	rule models.Rule,
) error

DeleteArtifactRule deletes a specific artifact rule for a given artifact. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifact-rules/operation/deleteArtifactRule

func (*ArtifactsAPI) DeleteArtifactsInGroup

func (api *ArtifactsAPI) DeleteArtifactsInGroup(ctx context.Context, groupID string) error

DeleteArtifactsInGroup deletes all artifacts in a given group. Deletes all the artifacts that exist in a given group. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifacts/operation/deleteArtifactsInGroup

func (*ArtifactsAPI) GetArtifactByGlobalID

func (api *ArtifactsAPI) GetArtifactByGlobalID(
	ctx context.Context,
	globalID int64,
	params *models.GetArtifactByGlobalIDParams,
) (*models.ArtifactContent, error)

GetArtifactByGlobalID Gets the content for an artifact version in the registry using its globally unique identifier. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifacts/operation/getContentByGlobalId

func (*ArtifactsAPI) GetArtifactContentByHash

func (api *ArtifactsAPI) GetArtifactContentByHash(
	ctx context.Context,
	contentHash string,
) (*models.ArtifactContent, error)

GetArtifactContentByHash Gets the content for an artifact version in the registry using the SHA-256 hash of the content This content hash may be shared by multiple artifact versions in the case where the artifact versions have identical content. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifacts/operation/getContentByHash

func (*ArtifactsAPI) GetArtifactContentByID

func (api *ArtifactsAPI) GetArtifactContentByID(
	ctx context.Context,
	contentID int64,
) (*models.ArtifactContent, error)

GetArtifactContentByID Gets the content for an artifact version in the registry using the unique content identifier for that content This content ID may be shared by multiple artifact versions in the case where the artifact versions are identical. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifacts/operation/getContentById

func (*ArtifactsAPI) GetArtifactRule

func (api *ArtifactsAPI) GetArtifactRule(
	ctx context.Context,
	groupID, artifactId string,
	rule models.Rule,
) (models.RuleLevel, error)

GetArtifactRule gets the rule level for a given artifact rule. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifact-rules/operation/getArtifactRuleConfig

func (*ArtifactsAPI) ListArtifactReferences

func (api *ArtifactsAPI) ListArtifactReferences(
	ctx context.Context,
	contentID int64,
) (*[]models.ArtifactReference, error)

ListArtifactReferences Returns a list containing all the artifact references using the artifact content ID. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifacts/operation/referencesByContentId

func (*ArtifactsAPI) ListArtifactReferencesByGlobalID

func (api *ArtifactsAPI) ListArtifactReferencesByGlobalID(
	ctx context.Context,
	globalID int64,
	params *models.ListArtifactReferencesByGlobalIDParams,
) (*[]models.ArtifactReference, error)

ListArtifactReferencesByGlobalID Returns a list containing all the artifact references using the artifact global ID. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifacts/operation/referencesByContentHash

func (*ArtifactsAPI) ListArtifactReferencesByHash

func (api *ArtifactsAPI) ListArtifactReferencesByHash(
	ctx context.Context,
	contentHash string,
) ([]models.ArtifactReference, error)

ListArtifactReferencesByHash Returns a list containing all the artifact references using the artifact content hash. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifacts/operation/referencesByContentHash

func (*ArtifactsAPI) ListArtifactRules

func (api *ArtifactsAPI) ListArtifactRules(
	ctx context.Context,
	groupID, artifactId string,
) ([]models.Rule, error)

ListArtifactRules lists all artifact rules for a given artifact. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifact-rules/operation/createArtifactRule

func (*ArtifactsAPI) SearchArtifacts

func (api *ArtifactsAPI) SearchArtifacts(
	ctx context.Context,
	params *models.SearchArtifactsParams,
) ([]models.SearchedArtifact, error)

SearchArtifacts - Search for artifacts using the given filter parameters. Search for artifacts using the given filter parameters. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifacts/operation/searchArtifacts

func (*ArtifactsAPI) SearchArtifactsByContent

func (api *ArtifactsAPI) SearchArtifactsByContent(
	ctx context.Context,
	content []byte,
	params *models.SearchArtifactsByContentParams,
) ([]models.SearchedArtifact, error)

SearchArtifactsByContent searches for artifacts that match the provided content. Returns a paginated list of all artifacts with at least one version that matches the posted content. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifacts/operation/searchArtifactsByContent

func (*ArtifactsAPI) UpdateArtifactRule

func (api *ArtifactsAPI) UpdateArtifactRule(
	ctx context.Context,
	groupID, artifactId string,
	rule models.Rule,
	level models.RuleLevel,
) error

UpdateArtifactRule updates the rule level for a given artifact rule. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Artifact-rules/operation/updateArtifactRuleConfig

type BranchAPI

type BranchAPI struct {
	Client *client.Client
}

func NewBranchAPI

func NewBranchAPI(client *client.Client) *BranchAPI

func (*BranchAPI) AddVersionToBranch

func (api *BranchAPI) AddVersionToBranch(
	ctx context.Context,
	groupId, artifactId, branchId, version string,
) error

AddVersionToBranch Add a new version to an artifact branch. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Branches/operation/addVersionToBranch

func (*BranchAPI) CreateBranch

func (api *BranchAPI) CreateBranch(
	ctx context.Context,
	groupId, artifactId string,
	branch *models.CreateBranchRequest,
) (*models.BranchInfo, error)

CreateBranch Creates a new branch for the artifact. A new branch consists of metadata and a list of versions. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Branches/operation/createBranch

func (*BranchAPI) DeleteBranch

func (api *BranchAPI) DeleteBranch(
	ctx context.Context,
	groupId, artifactId, branchId string,
) error

DeleteBranch Deletes a single branch in the artifact. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Branches/operation/deleteBranch

func (*BranchAPI) GetBranchMetaData

func (api *BranchAPI) GetBranchMetaData(
	ctx context.Context,
	groupId, artifactId, branchId string,
) (*models.BranchInfo, error)

GetBranchMetaData Get branch metaData See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Branches/operation/getBranchMetaData

func (*BranchAPI) GetVersionsInBranch

func (api *BranchAPI) GetVersionsInBranch(
	ctx context.Context,
	groupId, artifactId, branchId string,
	params *models.ListBranchesParams,
) ([]models.ArtifactVersion, error)

GetVersionsInBranch Get a list of all versions in the branch. Returns a list of version identifiers in the branch, ordered from the latest (tip of the branch) to the oldest. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Branches/operation/listBranchVersions

func (*BranchAPI) ListBranches

func (api *BranchAPI) ListBranches(
	ctx context.Context,
	groupId, artifactId string,
	params *models.ListBranchesParams,
) ([]models.BranchInfo, error)

ListBranches Returns a list of all branches in the artifact. Each branch is a list of version identifiers, ordered from the latest (tip of the branch) to the oldest. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Branches/operation/listBranches

func (*BranchAPI) ReplaceVersionsInBranch

func (api *BranchAPI) ReplaceVersionsInBranch(
	ctx context.Context,
	groupId, artifactId, branchId string,
	versions []string,
) error

ReplaceVersionsInBranch Add a new version to an artifact branch. Branch is created if it does not exist. Returns a list of version identifiers in the artifact branch, ordered from the latest (tip of the branch) to the oldest. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Branches/operation/replaceBranchVersions

func (*BranchAPI) UpdateBranchMetaData

func (api *BranchAPI) UpdateBranchMetaData(
	ctx context.Context,
	groupId, artifactId, branchId, description string,
) error

UpdateBranchMetaData Update branch metaData See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Branches/operation/updateBranchMetaData

type GroupAPI

type GroupAPI struct {
	Client *client.Client
}

func NewGroupAPI

func NewGroupAPI(client *client.Client) *GroupAPI

func (*GroupAPI) CreateGroupRule

func (api *GroupAPI) CreateGroupRule(
	ctx context.Context,
	groupID string,
	rule models.Rule,
	level models.RuleLevel,
) error

CreateGroupRule Adds a rule to the list of rules that get applied to an artifact in the group when adding new versions. All configured rules must pass to successfully add a new artifact version. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Group-rules/operation/createGroupRule

func (*GroupAPI) DeleteAllGroupRule

func (api *GroupAPI) DeleteAllGroupRule(ctx context.Context, groupID string) error

DeleteAllGroupRule Deletes all the rules configured for the group. After this is done, the global rules apply to artifacts in the group again. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Group-rules/operation/deleteGroupRules

func (*GroupAPI) GetGroupRule

func (api *GroupAPI) GetGroupRule(
	ctx context.Context,
	groupID string,
	rule models.Rule,
) (models.RuleLevel, error)

GetGroupRule returns the configuration of a single rule for the group. Returns information about a single rule configured for a group. This is useful when you want to know what the current configuration settings are for a specific rule. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Group-rules/operation/getGroupRuleConfig

func (*GroupAPI) ListGroupRules

func (api *GroupAPI) ListGroupRules(ctx context.Context, groupID string) ([]models.Rule, error)

ListGroupRules Returns a list of all rules configured for the group. The set of rules determines how the content of an artifact in the group can evolve over time. If no rules are configured for a group, the set of globally configured rules are used. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Group-rules/operation/listGroupRules

func (*GroupAPI) ListGroups

func (api *GroupAPI) ListGroups(
	ctx context.Context,
	params *models.ListGroupsParams,
) ([]models.GroupInfo, error)

ListGroups Returns a list of all groups. This list is paged. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Groups/operation/listGroups

func (*GroupAPI) SearchGroups

func (api *GroupAPI) SearchGroups(
	ctx context.Context,
	params *models.SearchGroupsParams,
) ([]models.GroupInfo, error)

SearchGroups Returns a list of groups that match the specified criteria. This list is paged. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Groups/operation/searchGroups

func (*GroupAPI) UpdateGroupMetadata

func (api *GroupAPI) UpdateGroupMetadata(
	ctx context.Context,
	groupId string,
	description string,
	labels map[string]string,
) error

UpdateGroupMetadata Updates the metadata of the group with the specified ID. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Groups/operation/updateGroupById

func (*GroupAPI) UpdateGroupRule

func (api *GroupAPI) UpdateGroupRule(
	ctx context.Context,
	groupID string,
	rule models.Rule,
	level models.RuleLevel,
) error

UpdateGroupRule Updates the configuration of a single rule for the group. The configuration data is specific to each rule type, so the configuration of the COMPATIBILITY rule is in a different format from the configuration of the VALIDITY rule. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Group-rules/operation/updateGroupRuleConfig

type MetadataAPI

type MetadataAPI struct {
	Client *client.Client
}

MetadataAPI handles metadata-related operations for artifacts.

func NewMetadataAPI

func NewMetadataAPI(client *client.Client) *MetadataAPI

NewMetadataAPI creates a new MetadataAPI instance.

func (*MetadataAPI) GetArtifactMetadata

func (api *MetadataAPI) GetArtifactMetadata(
	ctx context.Context,
	groupId, artifactId string,
) (*models.ArtifactMetadata, error)

GetArtifactMetadata retrieves metadata for an artifact based on the latest version or the next available non-disabled version.

func (*MetadataAPI) GetArtifactVersionMetadata

func (api *MetadataAPI) GetArtifactVersionMetadata(
	ctx context.Context,
	groupId, artifactId, versionExpression string,
) (*models.ArtifactVersionMetadata, error)

GetArtifactVersionMetadata retrieves metadata for a single artifact version.

func (*MetadataAPI) UpdateArtifactMetadata

func (api *MetadataAPI) UpdateArtifactMetadata(
	ctx context.Context,
	groupId, artifactId string,
	metadata models.UpdateArtifactMetadataRequest,
) error

UpdateArtifactMetadata updates the editable parts of an artifact's metadata.

func (*MetadataAPI) UpdateArtifactVersionMetadata

func (api *MetadataAPI) UpdateArtifactVersionMetadata(
	ctx context.Context,
	groupId, artifactId, versionExpression string,
	metadata models.UpdateArtifactMetadataRequest,
) error

UpdateArtifactVersionMetadata updates the user-editable metadata of an artifact version.

type SystemAPI

type SystemAPI struct {
	Client *client.Client
}

func NewSystemAPI

func NewSystemAPI(client *client.Client) *SystemAPI

NewSystemAPI creates a new SystemAPI

func (*SystemAPI) GetCurrentUser

func (api *SystemAPI) GetCurrentUser(ctx context.Context) (*models.UserInfo, error)

GetCurrentUser Returns information about the currently authenticated user. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Users

func (*SystemAPI) GetSystemInfo

func (api *SystemAPI) GetSystemInfo(ctx context.Context) (*models.SystemInfoResponse, error)

GetSystemInfo gets the system info This operation retrieves information about the running registry system, such as the version of the software and when it was built. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/System/operation/getSystemInfo

func (*SystemAPI) GetUIConfig

func (api *SystemAPI) GetUIConfig(ctx context.Context) (*models.SystemUIConfigResponse, error)

GetUIConfig gets the UI config Returns the UI configuration properties for this server. The registry UI can be connected to a backend using just a URL. The rest of the UI configuration can then be fetched from the backend using this operation. This allows UI and backend to both be configured in the same place. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/System/operation/getUIConfig

type VersionsAPI

type VersionsAPI struct {
	Client *client.Client
}

func NewVersionsAPI

func NewVersionsAPI(client *client.Client) *VersionsAPI

func (*VersionsAPI) AddArtifactVersionComment

func (api *VersionsAPI) AddArtifactVersionComment(
	ctx context.Context,
	groupId, artifactId, versionExpression string,
	commentValue string,
) (*models.ArtifactComment, error)

AddArtifactVersionComment Adds a new comment to the artifact version. Both the artifactId and the unique version number must be provided. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/addArtifactVersionComment

func (*VersionsAPI) CreateArtifactVersion

func (api *VersionsAPI) CreateArtifactVersion(
	ctx context.Context,
	groupId, artifactId string,
	request *models.CreateVersionRequest,
	dryRun bool,
) (*models.ArtifactVersionDetailed, error)

CreateArtifactVersion Creates a new version of the artifact by uploading new content. The configured rules for the artifact are applied, and if they all pass, the new content is added as the most recent version of the artifact. If any of the rules fail, an error is returned. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/createArtifactVersion

func (*VersionsAPI) DeleteArtifactVersion

func (api *VersionsAPI) DeleteArtifactVersion(
	ctx context.Context,
	groupID, artifactID, versionExpression string,
) error

DeleteArtifactVersion deletes a single version of the artifact. Parameters `groupId`, `artifactId`, and the unique `versionExpression` are needed. This feature must be enabled using the `registry.rest.artifact.deletion.enabled` property. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/deleteArtifactVersion

func (*VersionsAPI) DeleteArtifactVersionComment

func (api *VersionsAPI) DeleteArtifactVersionComment(
	ctx context.Context,
	groupId, artifactId, versionExpression, commentId string,
) error

DeleteArtifactVersionComment Deletes a single comment in an artifact version. Only the owner of the comment can delete it. The artifactId, unique version number, and commentId must be provided. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/deleteArtifactVersionComment

func (*VersionsAPI) GetArtifactVersionComments

func (api *VersionsAPI) GetArtifactVersionComments(
	ctx context.Context,
	groupId, artifactId, versionExpression string,
) (*[]models.ArtifactComment, error)

GetArtifactVersionComments Retrieves all comments for a version of an artifact. Both the artifactId and the unique version number must be provided. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/getArtifactVersionComments

func (*VersionsAPI) GetArtifactVersionContent

func (api *VersionsAPI) GetArtifactVersionContent(
	ctx context.Context,
	groupId, artifactId, versionExpression string,
	params *models.ArtifactReferenceParams,
) (*models.ArtifactContent, error)

GetArtifactVersionContent Retrieves a single version of the artifact content. Both the artifactId and the unique version number must be provided. The Content-Type of the response depends on the artifact type. In most cases, this is application/json, but for some types it may be different (for example, PROTOBUF). See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/getArtifactVersionContent

func (*VersionsAPI) GetArtifactVersionReferences

func (api *VersionsAPI) GetArtifactVersionReferences(ctx context.Context,
	groupId, artifactId, versionExpression string,
	params *models.ArtifactVersionReferencesParams,
) ([]models.ArtifactReference, error)

GetArtifactVersionReferences Retrieves all references for a single version of an artifact. Both the artifactId and the unique version number must be provided. Using the refType query parameter, it is possible to retrieve an array of either the inbound or outbound references. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/getArtifactVersionReferences

func (*VersionsAPI) GetArtifactVersionState

func (api *VersionsAPI) GetArtifactVersionState(
	ctx context.Context,
	groupId, artifactId, versionExpression string,
) (*models.State, error)

GetArtifactVersionState Gets the current state of an artifact version. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/getArtifactVersionState

func (*VersionsAPI) ListArtifactVersions

func (api *VersionsAPI) ListArtifactVersions(
	ctx context.Context,
	groupId, artifactId string,
	params *models.ListArtifactsVersionsParams,
) ([]models.ArtifactVersion, error)

ListArtifactVersions Returns a list of all versions of the artifact. The result set is paged. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/listArtifactVersions

func (*VersionsAPI) SearchForArtifactVersionByContent

func (api *VersionsAPI) SearchForArtifactVersionByContent(
	ctx context.Context,
	content string,
	params *models.SearchVersionByContentParams,
) ([]models.ArtifactVersion, error)

SearchForArtifactVersionByContent Returns a paginated list of all versions that match the posted content. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/searchVersionsByContent

func (*VersionsAPI) SearchForArtifactVersions

func (api *VersionsAPI) SearchForArtifactVersions(
	ctx context.Context,
	params *models.SearchVersionParams,
) ([]models.ArtifactVersion, error)

SearchForArtifactVersions Returns a paginated list of all versions that match the provided filter criteria. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/searchVersions

func (*VersionsAPI) UpdateArtifactVersionComment

func (api *VersionsAPI) UpdateArtifactVersionComment(
	ctx context.Context,
	groupId, artifactId, versionExpression, commentId string,
	updatedComment string,
) error

UpdateArtifactVersionComment Updates the value of a single comment in an artifact version. Only the owner of the comment can modify it. The artifactId, unique version number, and commentId must be provided. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/updateArtifactVersionComment

func (*VersionsAPI) UpdateArtifactVersionContent

func (api *VersionsAPI) UpdateArtifactVersionContent(
	ctx context.Context,
	groupId, artifactId, versionExpression string,
	content *models.CreateContentRequest,
) error

UpdateArtifactVersionContent Updates the content of a single version of an artifact. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/updateArtifactVersionContent

func (*VersionsAPI) UpdateArtifactVersionState

func (api *VersionsAPI) UpdateArtifactVersionState(
	ctx context.Context,
	groupId, artifactId, versionExpression string,
	state models.State,
	dryRun bool,
) error

UpdateArtifactVersionState Updates the state of an artifact version. NOTE: There are some restrictions on state transitions. Notably a version cannot be transitioned to the DRAFT state from any other state. The DRAFT state can only be entered (optionally) when creating a new artifact/version. A version in DRAFT state can only be transitioned to ENABLED. When this happens, any configured content rules will be applied. This may result in a failure to change the state. See https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Versions/operation/updateArtifactVersionState

Jump to

Keyboard shortcuts

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