Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about repositories.ListForAccount() #45

Open
uggla opened this issue Aug 9, 2018 · 3 comments
Open

Question about repositories.ListForAccount() #45

uggla opened this issue Aug 9, 2018 · 3 comments

Comments

@uggla
Copy link

uggla commented Aug 9, 2018

Hello @ktrysmt ,

A question about repositories.ListForAccount() method.
Is it normal that this method is returning an interface{} ?
Note : I would expect to have a []string with repo names.

Maybe it is because this method is not finalized ? Any other reasons ?

In order to get the list of repo names, I did the following ugly code (just for testing). But maybe there is another smart way or magic method to get this ?

	res2, err2 := c.Repositories.ListForTeam(opt2)
	if err2 != nil {
		panic(err2)
	}

	repos := show_repo(res2)
	fmt.Printf("%#v\n", repos) // Just to debug content
func show_repo(data interface{}) []string {
	var output []string // New slice

	repos := data.(map[string]interface{})["values"].([]interface{})

	// Loop on slice
	for i := 0; i < len(repos); i++ {
		output = append(output, repos[i].(map[string]interface{})["name"].(string))
	}
	return output
}
@ktrysmt
Copy link
Owner

ktrysmt commented Aug 10, 2018

@uggla Perhaps this might be useful.

@uggla
Copy link
Author

uggla commented Aug 10, 2018

@ktrysmt thx. In fact the underlying question is will you accept PR that will change the behavior of these methods ? If yes we (@Xx-Parks-xX and I) will open a couple of PRs.

@ktrysmt
Copy link
Owner

ktrysmt commented Aug 10, 2018

@uggla Basically PR is welcomed. If there are any points to worry about, we can discuss it at that time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants