1// code generated; DO NOT EDIT.
2
3package egoscale
4
5import "fmt"
6
7// Response returns the struct to unmarshal
8func (ListAccounts) Response() interface{} {
9	return new(ListAccountsResponse)
10}
11
12// ListRequest returns itself
13func (ls *ListAccounts) ListRequest() (ListCommand, error) {
14	if ls == nil {
15		return nil, fmt.Errorf("%T cannot be nil", ls)
16	}
17	return ls, nil
18}
19
20// SetPage sets the current apge
21func (ls *ListAccounts) SetPage(page int) {
22	ls.Page = page
23}
24
25// SetPageSize sets the page size
26func (ls *ListAccounts) SetPageSize(pageSize int) {
27	ls.PageSize = pageSize
28}
29
30// Each triggers the callback for each, valid answer or any non 404 issue
31func (ListAccounts) Each(resp interface{}, callback IterateItemFunc) {
32	items, ok := resp.(*ListAccountsResponse)
33	if !ok {
34		callback(nil, fmt.Errorf("wrong type, ListAccountsResponse was expected, got %T", resp))
35		return
36	}
37
38	for i := range items.Account {
39		if !callback(&items.Account[i], nil) {
40			break
41		}
42	}
43}
44