github.com/cobalt77/jfrog-client-go@v0.14.5/artifactory/services/go/publish.go (about)

     1  package _go
     2  
     3  import (
     4  	rthttpclient "github.com/cobalt77/jfrog-client-go/artifactory/httpclient"
     5  	"github.com/cobalt77/jfrog-client-go/auth"
     6  )
     7  
     8  var publishers []PublishGoPackage
     9  
    10  type PublishGoPackage interface {
    11  	isCompatible(artifactoryVersion string) bool
    12  	PublishPackage(params GoParams, client *rthttpclient.ArtifactoryHttpClient, ArtDetails auth.ServiceDetails) error
    13  }
    14  
    15  func register(publishApi PublishGoPackage) {
    16  	publishers = append(publishers, publishApi)
    17  }
    18  
    19  // Returns the compatible publisher to Artifactory
    20  func GetCompatiblePublisher(artifactoryVersion string) PublishGoPackage {
    21  	for _, publisher := range publishers {
    22  		if publisher.isCompatible(artifactoryVersion) {
    23  			return publisher
    24  		}
    25  	}
    26  	return nil
    27  }