You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(This is my first dive into Go, so I'm sure my terminology is wrong - please correct me where that's the case so I can learn ☺)
I'm working on making a custom Terraform provider for interacting with Trello, and am using this library for the underlying api calls.
This has been really good so far - while some of the API is missing methods, the exposure of the underlying CURD methods has made it super easy to implement support without needing to make changes to this library.
My plan is at some point contribute back to this library with some PRs expanding it to cover these gaps, but I've hit up against a particular issue that would be great to get addressed now - specifically, not being able to set the client property on structs.
For example, I'm currently in the process of writing a card_membership resource that uses the "Add a Member to a Card" and "Remove a User from a Card" endpoints to add and remove a member with a given id to and from the card with a given id.
Presently, the card package has AddMemberID & RemoveMember which calls these underlying endpoints - however they use the private client property on the card which I can't set, meaning the only way I can get an instance of trello.Card that won't crash if I try to use card.RemoveMember is by doing an API call like so:
func resourceTrelloCardMembershipDelete(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(*trello.Client)
card, err := client.GetCard(data.Get("card_id").(string), trello.Defaults())
if err != nil {
return diag.FromErr(err)
}
err = card.RemoveMember(data.Get("member_id").(string))
if err != nil {
return diag.FromErr(err)
}
var diags diag.Diagnostics
return diags
}
What I'd like to be able to do is this:
func resourceTrelloCardMembershipDelete(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(*trello.Client)
card := trello.Card{ID: data.Get("card_id").(string)}
card.SetClient(client)
err := card.RemoveMember(data.Get("member_id").(string))
if err != nil {
return diag.FromErr(err)
}
var diags diag.Diagnostics
return diags
}
Alternatively, client could be made public so that I can set that property when assigning.
This applies to most of the entities in this library, including Board as NewBoard doesn't assign client.
I'm happy to have a go at doing a PR that implements SetClient, but wanted to open an issue first as there might be a more Go-like solution that should be used :)
The text was updated successfully, but these errors were encountered:
(This is my first dive into Go, so I'm sure my terminology is wrong - please correct me where that's the case so I can learn ☺)
I'm working on making a custom Terraform provider for interacting with Trello, and am using this library for the underlying api calls.
This has been really good so far - while some of the API is missing methods, the exposure of the underlying CURD methods has made it super easy to implement support without needing to make changes to this library.
My plan is at some point contribute back to this library with some PRs expanding it to cover these gaps, but I've hit up against a particular issue that would be great to get addressed now - specifically, not being able to set the
client
property on structs.For example, I'm currently in the process of writing a
card_membership
resource that uses the "Add a Member to a Card" and "Remove a User from a Card" endpoints to add and remove a member with a given id to and from the card with a given id.Presently, the
card
package hasAddMemberID
&RemoveMember
which calls these underlying endpoints - however they use the privateclient
property on thecard
which I can't set, meaning the only way I can get an instance oftrello.Card
that won't crash if I try to usecard.RemoveMember
is by doing an API call like so:What I'd like to be able to do is this:
Alternatively,
client
could be made public so that I can set that property when assigning.This applies to most of the entities in this library, including
Board
asNewBoard
doesn't assignclient
.I'm happy to have a go at doing a PR that implements
SetClient
, but wanted to open an issue first as there might be a more Go-like solution that should be used :)The text was updated successfully, but these errors were encountered: