api: google.golang.org/api/internal/third_party/uritemplates Index | Examples | Files

package uritemplates

import "google.golang.org/api/internal/third_party/uritemplates"

Package uritemplates is a level 3 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570). uritemplates does not support composite values (in Go: slices or maps) and so does not qualify as a level 4 implementation.



Package Files

uritemplates.go utils.go

func Expand Uses

func Expand(path string, values map[string]string) (escaped, unescaped string, err error)

Expand parses then expands a URI template with a set of values to produce the resultant URI. Two forms of the result are returned: one with all the elements escaped, and one with the elements unescaped.


values := map[string]string{
    "user": "golang",
    "repo": "go",
expanded, _, err := Expand("https://api.github.com/repos{/user,repo}", values)
if err != nil {
    log.Fatalf("Error expanding template: %v", err)



Package uritemplates imports 5 packages (graph) and is imported by 1 packages. Updated 2020-05-21. Refresh now. Tools for package owners.