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

Added APIListObject to Option types to allow setting offset and #10

Merged
merged 1 commit into from
Jun 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package pagerduty

import (
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/google/go-querystring/query"
"io/ioutil"
"net/http"

log "github.com/Sirupsen/logrus"
"github.com/google/go-querystring/query"
)

type Addon struct {
Expand All @@ -16,6 +17,7 @@ type Addon struct {
}

type ListAddonOptions struct {
APIListObject
Includes []string `url:"include,omitempty,brackets"`
ServiceIDs []string `url:"service_ids,omitempty,brackets"`
Filter string `url:"filter,omitempty"`
Expand Down
7 changes: 4 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"bytes"
"encoding/json"
"fmt"
log "github.com/Sirupsen/logrus"
"io"
"net/http"

log "github.com/Sirupsen/logrus"
)

// APIObject represents generic api json response that is shared by most
Expand All @@ -20,8 +21,8 @@ type APIObject struct {
}

type APIListObject struct {
Limit uint
Offset uint
Limit uint `url:"limit,omitempty"`
Offset uint `url:"offset,omitempty"`
More bool
Total uint
}
Expand Down
2 changes: 2 additions & 0 deletions esacalation_policy.go → escalation_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pagerduty

import (
"fmt"

"github.com/google/go-querystring/query"
)

Expand All @@ -27,6 +28,7 @@ type ListEscalationPolicyResponse struct {
}

type ListEscalationPoliciesOptions struct {
APIListObject
Query string `url:"query,omitempty"`
UserIDs []string `url:"user_ids,omitempty,brackets"`
TeamIDs []string `url:"team_ids,omitempty,brackets"`
Expand Down
2 changes: 2 additions & 0 deletions incident.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pagerduty

import (
"fmt"

"github.com/google/go-querystring/query"
)

Expand Down Expand Up @@ -43,6 +44,7 @@ type ListIncidentsResponse struct {
}

type ListIncidentsOptions struct {
APIListObject
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
DateRange string `url:"date_range,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions log_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pagerduty

import (
"fmt"

"github.com/google/go-querystring/query"
)

Expand All @@ -27,6 +28,7 @@ type ListLogEntryResponse struct {
}

type ListLogEntriesOptions struct {
APIListObject
TimeZone string `url:"time_zone"`
Since string `url:"omitempty"`
Until string `url:"omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions maintenance_window.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pagerduty

import (
"fmt"

"github.com/google/go-querystring/query"
)

Expand All @@ -22,6 +23,7 @@ type ListMaintenanceWindowsResponse struct {
}

type ListMaintenanceWindowsOptions struct {
APIListObject
Query string `url:"query,omitempty"`
Includes []string `url:"include,omitempty,brackets"`
TeamIDs []string `url:"team_ids,omitempty,brackets"`
Expand Down
1 change: 1 addition & 0 deletions notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Notification struct {
}

type ListNotificationOptions struct {
APIListObject
TimeZone string `url:"time_zone,omitempty"`
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions on_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type ListOnCallsResponse struct {
}

type ListOnCallOptions struct {
APIListObject
TimeZone string `url:"time_zone,omitempty"`
Includes []string `url:"include,omitempty,brackets"`
UserIDs []string `url:"user_ids,omitempty,brackets"`
Expand Down
6 changes: 6 additions & 0 deletions schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pagerduty

import (
"fmt"

"github.com/google/go-querystring/query"
)

Expand Down Expand Up @@ -43,6 +44,7 @@ type Schedule struct {
}

type ListSchedulesOptions struct {
APIListObject
Query string `url:"query,omitempty"`
}

Expand Down Expand Up @@ -72,6 +74,7 @@ func (c *Client) CreateSchedule(s Schedule) error {
}

type PreviewScheduleOptions struct {
APIListObject
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
Overflow bool `url:"overflow,omitempty"`
Expand All @@ -94,6 +97,7 @@ func (c *Client) DeleteSchedule(id string) error {
}

type GetScheduleOptions struct {
APIListObject
TimeZone string `url:"time_zone,omitempty"`
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
Expand Down Expand Up @@ -131,6 +135,7 @@ func (c *Client) UpdateSchedule(id string, s Schedule) error {
}

type ListOverridesOptions struct {
APIListObject
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
Editable bool `url:"editable,omitempty"`
Expand Down Expand Up @@ -175,6 +180,7 @@ func (c *Client) DeleteOverride(scheduleID, overrideID string) error {
}

type ListOnCallUsersOptions struct {
APIListObject
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
}
Expand Down
6 changes: 4 additions & 2 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package pagerduty

import (
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/google/go-querystring/query"
"io/ioutil"
"net/http"

log "github.com/Sirupsen/logrus"
"github.com/google/go-querystring/query"
)

type EmailFilter struct {
Expand Down Expand Up @@ -77,6 +78,7 @@ type Service struct {
}

type ListServiceOptions struct {
APIListObject
TeamIDs []string `url:"team_ids,omitempty,brackets"`
TimeZone string `url:"time_zone,omitempty"`
SortBy string `url:"sort_by,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions team.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pagerduty

import (
"fmt"

"github.com/google/go-querystring/query"
)

Expand All @@ -17,6 +18,7 @@ type ListTeamResponse struct {
}

type ListTeamOptions struct {
APIListObject
Query string `url:"query,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pagerduty

import (
"fmt"

"github.com/google/go-querystring/query"
)

Expand Down Expand Up @@ -44,6 +45,7 @@ type ListUsersResponse struct {
}

type ListUserOptions struct {
APIListObject
Query string `url:"query,omitempty"`
Includes []string `url:"include,omitempty,brackets"`
}
Expand Down