Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Add list of playlist functionality #113

Closed
wants to merge 3 commits into from

Conversation

NissesSenap
Copy link

This to make it easier to gather playlist without knowing the uid/id.

@CLAassistant
Copy link

CLAassistant commented Oct 12, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ NissesSenap
❌ Edvin Norling


Edvin Norling seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

This to make it easier to gather playlist without knowing the uid/id.

Signed-off-by: Edvin Norling <edvin.norling@xenit.se>
Comment on lines +48 to +53
// Playlists fetches and returns a Grafana playlist.
func (c *Client) Playlists(params url.Values) (*[]Playlist, error) {
path := "/api/playlists/"
playlists := &[]Playlist{}

err := c.request("GET", path, params, nil, playlists)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest not making a pointer to a list, and definitely not returning one.

Suggested change
// Playlists fetches and returns a Grafana playlist.
func (c *Client) Playlists(params url.Values) (*[]Playlist, error) {
path := "/api/playlists/"
playlists := &[]Playlist{}
err := c.request("GET", path, params, nil, playlists)
// Playlists fetches and returns all Grafana playlists.
func (c *Client) Playlists(params url.Values) ([]Playlist, error) {
path := "/api/playlists/"
playlists := []Playlist{}
err := c.request("GET", path, params, nil, &playlists)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the slow reply.

I have no strong feelings in the matter.
I was trying to be consistent with the PlayList function

func (c *Client) Playlist(idOrUID string) (*Playlist, error) {

@julienduchesne
Copy link
Member

👋 I am closing this PR because this repository is now deprecated and will be archived. It will still be accessible in read-only mode.

We are now generating the Grafana client from its OpenAPI spec. Check out https://github.com/grafana/grafana-openapi-client-go for the new client. Consider opening an issue or a PR there if functionality is missing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants