diff --git a/arg.go b/arg.go new file mode 100644 index 0000000..6404885 --- /dev/null +++ b/arg.go @@ -0,0 +1,39 @@ +/* +Copyright 2014 go-trello authors. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package trello + +import "net/url" + +type Argument struct { + Name string + Value string +} + +func NewArgument(name, value string) *Argument { + return &Argument{ + Name: name, + Value: value, + } +} + +func EncodeArgs(args []*Argument) string { + v := url.Values{} + for _, arg := range args { + v.Set(arg.Name, arg.Value) + } + return v.Encode() +} diff --git a/board.go b/board.go index 2182c6a..9f7d7cc 100644 --- a/board.go +++ b/board.go @@ -167,8 +167,13 @@ func (b *Board) MemberCards(IdMember string) (cards []Card, err error) { return } -func (b *Board) Actions() (actions []Action, err error) { - body, err := b.client.Get("/boards/" + b.Id + "/actions") +func (b *Board) Actions(arg ...*Argument) (actions []Action, err error) { + ep := "/boards/" + b.Id + "/actions" + if query := EncodeArgs(arg); query != "" { + ep += "?" + query + } + + body, err := b.client.Get(ep) if err != nil { return }