~xenrox/srhtctl

a6bc0dd68747beab777c01b3162a79d793b44ab3 — Thorben Günther 2 months ago ad994ca
lists: Get lists and patchsets from other users
1 files changed, 15 insertions(+), 2 deletions(-)

M api/lists.go
M api/lists.go => api/lists.go +15 -2
@@ 5,6 5,7 @@ import (
	"strings"

	"git.xenrox.net/~xenrox/srhtctl/config"
	"git.xenrox.net/~xenrox/srhtctl/helpers"
)

// ListName is the name of a mailing list


@@ 118,7 119,13 @@ func PrintPatchsets(args []string) error {
}

func getPatchsets(response *patchPagerStruct, listName string) error {
	url := fmt.Sprintf("%s/api/lists/%s/patchsets", config.GetURL("lists"), listName)
	var url string
	if UserName != "" {
		url = fmt.Sprintf("%s/api/user/%s/lists/%s/patchsets", config.GetURL("lists"),
			helpers.TransformCanonical(UserName), listName)
	} else {
		url = fmt.Sprintf("%s/api/lists/%s/patchsets", config.GetURL("lists"), listName)
	}
	err := Request(url, "GET", "", &response)
	if err != nil {
		return err


@@ 127,7 134,13 @@ func getPatchsets(response *patchPagerStruct, listName string) error {
}

func getLists(response *listsPagerStruct) error {
	url := fmt.Sprintf("%s/api/lists", config.GetURL("lists"))
	var url string
	if UserName != "" {
		url = fmt.Sprintf("%s/api/user/%s/lists", config.GetURL("lists"),
			helpers.TransformCanonical(UserName))
	} else {
		url = fmt.Sprintf("%s/api/lists", config.GetURL("lists"))
	}
	err := Request(url, "GET", "", &response)
	if err != nil {
		return err