client/server rebuilding in progress
This commit is contained in:
+15
-6
@@ -4,6 +4,7 @@ import (
|
||||
"net/url"
|
||||
"path"
|
||||
"strings"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -35,7 +36,7 @@ func ParsePath(rawpath string) (*Repository, error) {
|
||||
repo.pass, _ = urlobj.User.Password()
|
||||
urlobj.User = nil
|
||||
}
|
||||
repo.resource = urlobj.Path
|
||||
repo.resource = path.Join("/", urlobj.Path)
|
||||
urlobj.Path = "/"
|
||||
repo.urlobj = urlobj
|
||||
repo.values = urlobj.Query()
|
||||
@@ -52,30 +53,38 @@ func (repo *Repository) Raw() string {
|
||||
}
|
||||
|
||||
func (repo *Repository) SetResource(resource string) {
|
||||
repo.resource = resource
|
||||
repo.resource = path.Join("/", resource)
|
||||
}
|
||||
|
||||
func (repo *Repository) JoinResource(resource string) {
|
||||
repo.resource = path.Join("/", repo.resource, resource)
|
||||
}
|
||||
|
||||
func (repo *Repository) PathType(typ string) {
|
||||
repo.values.Set("pathType", typ)
|
||||
}
|
||||
|
||||
func (repo *Repository) DryRun(yesno bool) {
|
||||
repo.values.Set("dryRun", strconv.FormatBool(yesno))
|
||||
}
|
||||
|
||||
func (repo *Repository) File() string {
|
||||
curl := repo.urlobj.JoinPath("/v3/api/file", repo.resource)
|
||||
curl := repo.urlobj.JoinPath("/v3/api/file/", repo.resource)
|
||||
return curl.String()
|
||||
}
|
||||
|
||||
func (repo *Repository) Files() string {
|
||||
curl := repo.urlobj.JoinPath("/v3/api/files", repo.resource)
|
||||
curl := repo.urlobj.JoinPath("/v3/api/files/", repo.resource)
|
||||
return curl.String()
|
||||
}
|
||||
|
||||
func (repo *Repository) Collection() string {
|
||||
curl := repo.urlobj.JoinPath("/v3/api/collection", repo.resource)
|
||||
curl := repo.urlobj.JoinPath("/v3/api/collection/", repo.resource)
|
||||
return curl.String()
|
||||
}
|
||||
|
||||
func (repo *Repository) Collections() string {
|
||||
curl := repo.urlobj.JoinPath("/v3/api/collections", repo.resource)
|
||||
curl := repo.urlobj.JoinPath("/v3/api/collections/", repo.resource)
|
||||
return curl.String()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user