diff options
Diffstat (limited to 'vendor/google.golang.org/api/googleapi/internal/uritemplates/utils.go')
-rw-r--r-- | vendor/google.golang.org/api/googleapi/internal/uritemplates/utils.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/vendor/google.golang.org/api/googleapi/internal/uritemplates/utils.go b/vendor/google.golang.org/api/googleapi/internal/uritemplates/utils.go new file mode 100644 index 0000000..2e70b81 --- /dev/null +++ b/vendor/google.golang.org/api/googleapi/internal/uritemplates/utils.go | |||
@@ -0,0 +1,17 @@ | |||
1 | // Copyright 2016 The Go Authors. All rights reserved. | ||
2 | // Use of this source code is governed by a BSD-style | ||
3 | // license that can be found in the LICENSE file. | ||
4 | |||
5 | package uritemplates | ||
6 | |||
7 | // Expand parses then expands a URI template with a set of values to produce | ||
8 | // the resultant URI. Two forms of the result are returned: one with all the | ||
9 | // elements escaped, and one with the elements unescaped. | ||
10 | func Expand(path string, values map[string]string) (escaped, unescaped string, err error) { | ||
11 | template, err := parse(path) | ||
12 | if err != nil { | ||
13 | return "", "", err | ||
14 | } | ||
15 | escaped, unescaped = template.Expand(values) | ||
16 | return escaped, unescaped, nil | ||
17 | } | ||