Documentation ¶
Overview ¶
Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).
To use uritemplates, parse a template string and expand it with a value map:
template, _ := uritemplates.Parse("https://api.github.com/repos{/user,repo}") values := make(map[string]interface{}) values["user"] = "jtacoma" values["repo"] = "uritemplates" expanded, _ := template.Expand(values) fmt.Printf(expanded)
Index ¶
Constants ¶
View Source
const ( BuildInformation = "/api/{spaceId}/build-information{/id}{?packageId,filter,latest,skip,take,overwriteMode}" BuildInformationBulk = "/api/{spaceId}/build-information/bulk{?ids}" CreateReleaseCommandV1 = "/api/{spaceId}/releases/create/v1" // POST CreateDeploymentTenantedCommandV1 = "/api/{spaceId}/deployments/create/tenanted/v1" // POST CreateDeploymentUntenantedCommandV1 = "/api/{spaceId}/deployments/create/untenanted/v1" // POST CreateRunRunbookCommand = "/api/{spaceId}/runbook-runs/create/v1" // POST DeploymentProcesses = "/api/{spaceId}/deploymentprocesses{/id}{?skip,take,ids}" // GET FeedSearchPackageVersions = "" // GET /* 141-byte string literal not displayed */ PackageDeltaSignature = "/api/{spaceId}/packages/{packageId}/{version}/delta-signature" // GET PackageDeltaUpload = "/api/{spaceId}/packages/{packageId}/{baseVersion}/delta{?replace,overwriteMode}" // POST Packages = "/api/{spaceId}/packages{/id}{?nuGetPackageId,filter,latest,skip,take,includeNotes}" // GET LibraryVariableSets = "/api/{spaceId}/libraryvariablesets{/id}{?skip,contentType,take,ids,partialName}" PackageUpload = "/api/{spaceId}/packages/raw{?replace,overwriteMode}" // POST multipart form ReleaseDeploymentPreview = "/api/{spaceId}/releases/{releaseId}/deployments/preview/{environmentId}{?includeDisabledSteps}" // GET ReleaseDeploymentPreviews = "/api/{spaceId}/releases/{releaseId}/deployments/previews" // POST multipart form Releases = "/api/{spaceId}/releases{/id}{?skip,ignoreChannelRules,take,ids}" // GET ReleasesByProject = "/api/{spaceId}/projects/{projectId}/releases{/version}{?skip,take,searchByVersion}" // GET ReleasesByProjectAndChannel = "/api/{spaceId}/projects/{projectId}/channels/{channelId}/releases{?skip,take,searchByVersion}" // GET Runbooks = "/api/{spaceId}/runbooks{/id}{?skip,take,ids,partialName,clone,projectIds}" // GET RunbooksByProject = "/api/{spaceId}/projects/{projectId}/runbooks{?skip,take,partialName}" // GET RunbookEnvironments = "/api/{spaceId}/projects/{projectId}/runbooks/{runbookId}/environments" // GET RunbookProcess = "/api/{spaceId}/projects/{projectId}/runbookProcesses/{id}" // GET RunbookRunPreview = "/api/{spaceId}/projects/{projectId}/runbooks/{runbookId}/runbookRuns/preview/{environment}{?includeDisabledSteps}" // GET RunbookSnapshotsByRunbook = "/api/{spaceId}/projects/{projectId}/runbooks/{runbookId}/runbookSnapshots{/name}{?skip,take,searchByName}" // GET RunbookSnapshotsByProject = "/api/{spaceId}/projects/{projectId}/runbookSnapshots{/name}{?skip,take,searchByName}" // GET RunbookSnapshotRunPreview = "/api/{spaceId}/runbookSnapshots/{snapshotId}/runbookRuns/preview/{environmentId}{?includeDisabledSteps}" // GET RunbookRunTenantPreview = "/api/{spaceId}/projects/{projectId}/runbooks/{runbookId}/runbookRuns/previews" // POST Variables = "/api/{spaceId}/variables{/id}{?ids}" // GET ProjectVariablesByGitRef = "/api/{spaceId}/projects/{projectId}/{gitRef}/variables" ProjectBranchesV2 = "/api/{spaceId}/projects/{projectId}/git/branches/v2" ProjectBranches = "/api/{spaceId}/projects/{projectId}/git/branches" )
Variables ¶
This section is empty.
Functions ¶
func Struct2map ¶ added in v2.33.0
Types ¶
type URITemplateCache ¶ added in v2.4.0
type URITemplateCache struct {
// contains filtered or unexported fields
}
func NewUriTemplateCache ¶ added in v2.4.0
func NewUriTemplateCache() *URITemplateCache
func (*URITemplateCache) Expand ¶ added in v2.4.0
func (c *URITemplateCache) Expand(uriTemplate string, value any) (string, error)
func (*URITemplateCache) ExpandLinked ¶ added in v2.4.0
func (*URITemplateCache) Intern ¶ added in v2.4.0
func (c *URITemplateCache) Intern(uriTemplate string) (*UriTemplate, error)
type UriTemplate ¶
type UriTemplate struct {
// contains filtered or unexported fields
}
A UriTemplate is a parsed representation of a URI template.
func Parse ¶
func Parse(rawtemplate string) (template *UriTemplate, err error)
Parse parses a URI template string into a UriTemplate object.
func (*UriTemplate) Expand ¶
func (self *UriTemplate) Expand(value interface{}) (string, error)
Expand expands a URI template with a set of values to produce a string.
func (*UriTemplate) Names ¶
func (self *UriTemplate) Names() []string
Names returns the names of all variables within the template.
func (UriTemplate) String ¶
func (t UriTemplate) String() string
Click to show internal directories.
Click to hide internal directories.