Repository: PagerDuty/go-pagerduty
Pull request #264 (2021-01-28 15:41:27)

Fix logentry.channel json marshaling/unmarshaling
Hello.

I've faced an issue when unmarshalling and marshalling back of LogEntry lead to results that differ from initial.

First of all just because of absent json tags, so it lead to `"Type"` instead of `"type"`, so the next unmarshaling was broken.
Also "fixing" tags leads to nested object and
```json
{
    ...
    "channel": {
	    "type": "web_trigger",
	    "summary": "My new incident",
	    "details_omitted": false
    }
}
```

transforms to
```json
{
    ...
    "channel": {
	    "type": "web_trigger",
            "raw": {
	        "summary": "My new incident",
	        "details_omitted": false
            }
    }
}
```

So this PR will fix this, however it require Channel type changes.

Looking forward for your feedback.

theckman: So this change is technically breaking API compatibility, and under normal circumstances would be a candidate for a v2.0.0 release. That said, digging further I'm not confident that the old format was actually functional based on the API documentation. As such, I'm not confident we should hold this to the same compatibility guarantee under the v1.0.0 released.

I'm going to sync up with @stmcallister to propose a `v1.5.0` release that includes this change, and other "breaking" changes, which fix an implementation that has never worked reliably. 
StupidScience: @theckman may be better instead of breaking API would be to provide custom `MarshalJSON()` function? It won't break things but should resolve issue as well. WDYT?
theckman: Yeah, that may be more ideal. Unmarshal into a map, extract the type field out, and then the rest of the map on the Raw field. 

Patch:
diff --git a/README.md b/README.md
index 0ef8358..eebb7de 100644
--- a/README.md
+++ b/README.md
@@ -73,46 +73,6 @@ If you need to use your own HTTP client, for doing things like defining your own
 transport settings, you can replace the default HTTP client with your own by
 simply by setting a new value in the `HTTPClient` field.
 
-#### API Error Responses
-
-For cases where your request results in an error from the API, you can use the
-`errors.As()` function from the standard library to extract the
-`pagerduty.APIError` error value and inspect more details about the error,
-including the HTTP response code and PagerDuty API Error Code.
-
-```go
-package main
-
-import (
-	"fmt"
-	"github.com/PagerDuty/go-pagerduty"
-)
-
-var	authtoken = "" // Set your auth token here
-
-func main() {
-	client := pagerduty.NewClient(authtoken)
-	user, err := client.GetUser("NOTREAL", pagerduty.GetUserOptions{})
-	if err != nil {
-		var aerr pagerduty.APIError
-
-		if errors.As(err, &aerr) {
-			if aerr.RateLimited() {
-				fmt.Println("rate limited")
-				return
-			}
-
-			fmt.Println("unknown status code:", aerr.StatusCode)
-
-			return
-		}
-
-		panic(err)
-	}
-	fmt.Println(user)
-}
-```
-
 ## Contributing
 
 1. Fork it ( https://github.com/PagerDuty/go-pagerduty/fork )
diff --git a/ability.go b/ability.go
index 36ea26b..26fe909 100644
--- a/ability.go
+++ b/ability.go
@@ -1,7 +1,5 @@
 package pagerduty
 
-import "context"
-
 // ListAbilityResponse is the response when calling the ListAbility API endpoint.
 type ListAbilityResponse struct {
 	Abilities []string `json:"abilities"`
@@ -9,7 +7,7 @@ type ListAbilityResponse struct {
 
 // ListAbilities lists all abilities on your account.
 func (c *Client) ListAbilities() (*ListAbilityResponse, error) {
-	resp, err := c.get(context.TODO(), "/abilities")
+	resp, err := c.get("/abilities")
 	if err != nil {
 		return nil, err
 	}
@@ -19,6 +17,6 @@ func (c *Client) ListAbilities() (*ListAbilityResponse, error) {
 
 // TestAbility Check if your account has the given ability.
 func (c *Client) TestAbility(ability string) error {
-	_, err := c.get(context.TODO(), "/abilities/"+ability)
+	_, err := c.get("/abilities/" + ability)
 	return err
 }
diff --git a/addon.go b/addon.go
index 1a32640..d5490f3 100644
--- a/addon.go
+++ b/addon.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -36,7 +35,7 @@ func (c *Client) ListAddons(o ListAddonOptions) (*ListAddonResponse, error) {
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/addons?"+v.Encode())
+	resp, err := c.get("/addons?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -48,8 +47,8 @@ func (c *Client) ListAddons(o ListAddonOptions) (*ListAddonResponse, error) {
 func (c *Client) InstallAddon(a Addon) (*Addon, error) {
 	data := make(map[string]Addon)
 	data["addon"] = a
-	resp, err := c.post(context.TODO(), "/addons", data, nil)
-	defer resp.Body.Close() // TODO(theckman): validate that this is safe
+	resp, err := c.post("/addons", data, nil)
+	defer resp.Body.Close()
 	if err != nil {
 		return nil, err
 	}
@@ -61,13 +60,13 @@ func (c *Client) InstallAddon(a Addon) (*Addon, error) {
 
 // DeleteAddon deletes an add-on from your account.
 func (c *Client) DeleteAddon(id string) error {
-	_, err := c.delete(context.TODO(), "/addons/"+id)
+	_, err := c.delete("/addons/" + id)
 	return err
 }
 
 // GetAddon gets details about an existing add-on.
 func (c *Client) GetAddon(id string) (*Addon, error) {
-	resp, err := c.get(context.TODO(), "/addons/"+id)
+	resp, err := c.get("/addons/" + id)
 	if err != nil {
 		return nil, err
 	}
@@ -78,7 +77,7 @@ func (c *Client) GetAddon(id string) (*Addon, error) {
 func (c *Client) UpdateAddon(id string, a Addon) (*Addon, error) {
 	v := make(map[string]Addon)
 	v["addon"] = a
-	resp, err := c.put(context.TODO(), "/addons/"+id, v, nil)
+	resp, err := c.put("/addons/"+id, v, nil)
 	if err != nil {
 		return nil, err
 	}
diff --git a/business_service.go b/business_service.go
index 2ce9710..1541729 100644
--- a/business_service.go
+++ b/business_service.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -76,7 +75,7 @@ func (c *Client) ListBusinessServices(o ListBusinessServiceOptions) (*ListBusine
 	}
 
 	// Make call to get all pages associated with the base endpoint.
-	if err := c.pagedGet(context.TODO(), "/business_services"+queryParms.Encode(), responseHandler); err != nil {
+	if err := c.pagedGet("/business_services"+queryParms.Encode(), responseHandler); err != nil {
 		return nil, err
 	}
 	businessServiceResponse.BusinessServices = businessServices
@@ -88,19 +87,19 @@ func (c *Client) ListBusinessServices(o ListBusinessServiceOptions) (*ListBusine
 func (c *Client) CreateBusinessService(b *BusinessService) (*BusinessService, *http.Response, error) {
 	data := make(map[string]*BusinessService)
 	data["business_service"] = b
-	resp, err := c.post(context.TODO(), "/business_services", data, nil)
+	resp, err := c.post("/business_services", data, nil)
 	return getBusinessServiceFromResponse(c, resp, err)
 }
 
 // GetBusinessService gets details about a business service.
 func (c *Client) GetBusinessService(ID string) (*BusinessService, *http.Response, error) {
-	resp, err := c.get(context.TODO(), "/business_services/"+ID)
+	resp, err := c.get("/business_services/" + ID)
 	return getBusinessServiceFromResponse(c, resp, err)
 }
 
 // DeleteBusinessService deletes a business_service.
 func (c *Client) DeleteBusinessService(ID string) error {
-	_, err := c.delete(context.TODO(), "/business_services/"+ID)
+	_, err := c.delete("/business_services/" + ID)
 	return err
 }
 
@@ -110,7 +109,7 @@ func (c *Client) UpdateBusinessService(b *BusinessService) (*BusinessService, *h
 	id := b.ID
 	b.ID = ""
 	v["business_service"] = b
-	resp, err := c.put(context.TODO(), "/business_services/"+id, v, nil)
+	resp, err := c.put("/business_services/"+id, v, nil)
 	return getBusinessServiceFromResponse(c, resp, err)
 }
 
diff --git a/change_events.go b/change_events.go
index 5bae1ec..1d7b7af 100644
--- a/change_events.go
+++ b/change_events.go
@@ -2,10 +2,8 @@ package pagerduty
 
 import (
 	"bytes"
-	"context"
 	"encoding/json"
 	"errors"
-	"net/http"
 )
 
 const changeEventPath = "/v2/change/enqueue"
@@ -57,13 +55,12 @@ func (c *Client) CreateChangeEvent(e ChangeEvent) (*ChangeEventResponse, error)
 	}
 
 	resp, err := c.doWithEndpoint(
-		context.TODO(),
 		c.v2EventsAPIEndpoint,
-		http.MethodPost,
+		"POST",
 		changeEventPath,
 		false,
 		bytes.NewBuffer(data),
-		headers,
+		&headers,
 	)
 	if err != nil {
 		return nil, err
diff --git a/client.go b/client.go
index b3eebd9..68fe571 100644
--- a/client.go
+++ b/client.go
@@ -2,14 +2,12 @@ package pagerduty
 
 import (
 	"bytes"
-	"context"
 	"encoding/json"
 	"fmt"
 	"io"
 	"net"
 	"net/http"
 	"runtime"
-	"strings"
 	"time"
 )
 
@@ -58,102 +56,10 @@ type APIDetails struct {
 	Details string `json:"details,omitempty"`
 }
 
-// APIErrorObject represents the object returned by the API when an error
-// occurs. This includes messages that should hopefully provide useful context
-// to the end user.
-type APIErrorObject struct {
-	Code    int      `json:"code,omitempty"`
-	Message string   `json:"message,omitempty"`
-	Errors  []string `json:"errors,omitempty"`
-}
-
-// NullAPIErrorObject is a wrapper around the APIErrorObject type. If the Valid
-// field is true, the API response included a structured error JSON object. This
-// structured object is then set on the ErrorObject field.
-//
-// While the PagerDuty REST API is documented to always return the error object,
-// we assume it's possible in exceptional failure modes for this to be omitted.
-// As such, this wrapper type provides us a way to check if the object was
-// provided while avoiding cosnumers accidentally missing a nil pointer check,
-// thus crashing their whole program.
-type NullAPIErrorObject struct {
-	Valid       bool
-	ErrorObject APIErrorObject
-}
-
-// UnmarshalJSON satisfies encoding/json.Unmarshaler
-func (n *NullAPIErrorObject) UnmarshalJSON(data []byte) error {
-	var aeo APIErrorObject
-	if err := json.Unmarshal(data, &aeo); err != nil {
-		return err
-	}
-
-	n.ErrorObject = aeo
-	n.Valid = true
-
-	return nil
-}
-
-// APIError represents the error response received when an API call fails. The
-// HTTP response code is set inside of the StatusCode field, with the APIError
-// field being the structured JSON error object returned from the API.
-//
-// This type also provides some helper methods like .RateLimited(), .NotFound(),
-// and .Temporary() to help callers reason about how to handle the error.
-//
-// You can read more about the HTTP status codes and API error codes returned
-// from the API here: https://developer.pagerduty.com/docs/rest-api-v2/errors/
-type APIError struct {
-	// StatusCode is the HTTP response status code
-	StatusCode int `json:"-"`
-
-	// APIError represents the object returned by the API when an error occurs,
-	// which includes messages that should hopefully provide useful context
-	// to the end user.
-	//
-	// If the API response did not contain an error object, the .Valid field of
-	// APIError will be false. If .Valid is true, the .ErrorObject field is
-	// valid and should be consulted.
-	APIError NullAPIErrorObject `json:"error"`
-
-	message string
-}
-
-// Error satisfies the error interface, and should contain the StatusCode,
-// APIErrorObject.Message, and APIErrorObject.Code.
-func (a APIError) Error() string {
-	if len(a.message) > 0 {
-		return a.message
-	}
-
-	if !a.APIError.Valid {
-		return fmt.Sprintf("HTTP response failed with status code %d and no JSON error object was present", a.StatusCode)
-	}
-
-	return fmt.Sprintf(
-		"HTTP response failed with status code %d, message: %s (code: %d)",
-		a.StatusCode, a.APIError.ErrorObject.Message, a.APIError.ErrorObject.Code,
-	)
-}
-
-// RateLimited returns whether the response had a status of 429, and as such the
-// client is rate limited. The PagerDuty rate limits should reset once per
-// minute, and for the REST API they are an account-wide rate limit (not per
-// API key or IP).
-func (a APIError) RateLimited() bool {
-	return a.StatusCode == http.StatusTooManyRequests
-}
-
-// Temporary returns whether it was a temporary error, one of which is a
-// RateLimited error.
-func (a APIError) Temporary() bool {
-	return a.RateLimited() || (a.StatusCode >= 500 && a.StatusCode < 600)
-}
-
-// NotFound returns whether this was an error where it seems like the resource
-// was not found.
-func (a APIError) NotFound() bool {
-	return a.StatusCode == http.StatusNotFound || (a.APIError.Valid && a.APIError.ErrorObject.Code == 2100)
+type errorObject struct {
+	Code    int         `json:"code,omitempty"`
+	Message string      `json:"message,omitempty"`
+	Errors  interface{} `json:"errors,omitempty"`
 }
 
 func newDefaultHTTPClient() *http.Client {
@@ -250,44 +156,42 @@ func WithOAuth() ClientOptions {
 	}
 }
 
-func (c *Client) delete(ctx context.Context, path string) (*http.Response, error) {
-	return c.do(ctx, http.MethodDelete, path, nil, nil)
+func (c *Client) delete(path string) (*http.Response, error) {
+	return c.do("DELETE", path, nil, nil)
 }
 
-func (c *Client) put(ctx context.Context, path string, payload interface{}, headers map[string]string) (*http.Response, error) {
+func (c *Client) put(path string, payload interface{}, headers *map[string]string) (*http.Response, error) {
+
 	if payload != nil {
 		data, err := json.Marshal(payload)
 		if err != nil {
 			return nil, err
 		}
-		return c.do(ctx, http.MethodPut, path, bytes.NewBuffer(data), headers)
+		return c.do("PUT", path, bytes.NewBuffer(data), headers)
 	}
-	return c.do(ctx, http.MethodPut, path, nil, headers)
+	return c.do("PUT", path, nil, headers)
 }
 
-func (c *Client) post(ctx context.Context, path string, payload interface{}, headers map[string]string) (*http.Response, error) {
+func (c *Client) post(path string, payload interface{}, headers *map[string]string) (*http.Response, error) {
 	data, err := json.Marshal(payload)
 	if err != nil {
 		return nil, err
 	}
-	return c.do(ctx, http.MethodPost, path, bytes.NewBuffer(data), headers)
+	return c.do("POST", path, bytes.NewBuffer(data), headers)
 }
 
-func (c *Client) get(ctx context.Context, path string) (*http.Response, error) {
-	return c.do(ctx, http.MethodGet, path, nil, nil)
+func (c *Client) get(path string) (*http.Response, error) {
+	return c.do("GET", path, nil, nil)
 }
 
 // needed where pagerduty use a different endpoint for certain actions (eg: v2 events)
-func (c *Client) doWithEndpoint(ctx context.Context, endpoint, method, path string, authRequired bool, body io.Reader, headers map[string]string) (*http.Response, error) {
-	req, err := http.NewRequestWithContext(ctx, method, endpoint+path, body)
-	if err != nil {
-		return nil, fmt.Errorf("failed to build request: %w", err)
-	}
-
+func (c *Client) doWithEndpoint(endpoint, method, path string, authRequired bool, body io.Reader, headers *map[string]string) (*http.Response, error) {
+	req, _ := http.NewRequest(method, endpoint+path, body)
 	req.Header.Set("Accept", "application/vnd.pagerduty+json;version=2")
-
-	for k, v := range headers {
-		req.Header.Set(k, v)
+	if headers != nil {
+		for k, v := range *headers {
+			req.Header.Set(k, v)
+		}
 	}
 
 	if authRequired {
@@ -306,8 +210,8 @@ func (c *Client) doWithEndpoint(ctx context.Context, endpoint, method, path stri
 	return c.checkResponse(resp, err)
 }
 
-func (c *Client) do(ctx context.Context, method, path string, body io.Reader, headers map[string]string) (*http.Response, error) {
-	return c.doWithEndpoint(ctx, c.apiEndpoint, method, path, true, body, headers)
+func (c *Client) do(method, path string, body io.Reader, headers *map[string]string) (*http.Response, error) {
+	return c.doWithEndpoint(c.apiEndpoint, method, path, true, body, headers)
 }
 
 func (c *Client) decodeJSON(resp *http.Response, payload interface{}) error {
@@ -320,40 +224,27 @@ func (c *Client) checkResponse(resp *http.Response, err error) (*http.Response,
 	if err != nil {
 		return resp, fmt.Errorf("Error calling the API endpoint: %v", err)
 	}
-
-	if resp.StatusCode < 200 || resp.StatusCode > 299 {
-		return resp, c.getErrorFromResponse(resp)
+	if 199 >= resp.StatusCode || 300 <= resp.StatusCode {
+		var eo *errorObject
+		var getErr error
+		if eo, getErr = c.getErrorFromResponse(resp); getErr != nil {
+			return resp, fmt.Errorf("Response did not contain formatted error: %s. HTTP response code: %v. Raw response: %+v", getErr, resp.StatusCode, resp)
+		}
+		return resp, fmt.Errorf("Failed call API endpoint. HTTP response code: %v. Error: %v", resp.StatusCode, eo)
 	}
-
 	return resp, nil
 }
 
-func (c *Client) getErrorFromResponse(resp *http.Response) APIError {
-	// check whether the error response is declared as JSON
-	if !strings.HasPrefix(resp.Header.Get("Content-Type"), "application/json") {
-		aerr := APIError{
-			StatusCode: resp.StatusCode,
-			message:    fmt.Sprintf("HTTP response with status code %d does not contain Content-Type: application/json", resp.StatusCode),
-		}
-
-		return aerr
+func (c *Client) getErrorFromResponse(resp *http.Response) (*errorObject, error) {
+	var result map[string]errorObject
+	if err := c.decodeJSON(resp, &result); err != nil {
+		return nil, fmt.Errorf("Could not decode JSON response: %v", err)
 	}
-
-	var document APIError
-
-	// because of above check this probably won't fail, but it's possible...
-	if err := c.decodeJSON(resp, &document); err != nil {
-		aerr := APIError{
-			StatusCode: resp.StatusCode,
-			message:    fmt.Sprintf("HTTP response with status code %d, JSON error object decode failed: %s", resp.StatusCode, err),
-		}
-
-		return aerr
+	s, ok := result["error"]
+	if !ok {
+		return nil, fmt.Errorf("JSON response does not have error field")
 	}
-
-	document.StatusCode = resp.StatusCode
-
-	return document
+	return &s, nil
 }
 
 // responseHandler is capable of parsing a response. At a minimum it must
@@ -363,7 +254,7 @@ func (c *Client) getErrorFromResponse(resp *http.Response) APIError {
 // a specific slice. The responseHandler is responsible for closing the response.
 type responseHandler func(response *http.Response) (APIListObject, error)
 
-func (c *Client) pagedGet(ctx context.Context, basePath string, handler responseHandler) error {
+func (c *Client) pagedGet(basePath string, handler responseHandler) error {
 	// Indicates whether there are still additional pages associated with request.
 	var stillMore bool
 
@@ -372,7 +263,7 @@ func (c *Client) pagedGet(ctx context.Context, basePath string, handler response
 
 	// While there are more pages, keep adjusting the offset to get all results.
 	for stillMore, nextOffset = true, 0; stillMore; {
-		response, err := c.do(ctx, http.MethodGet, fmt.Sprintf("%s?offset=%d", basePath, nextOffset), nil, nil)
+		response, err := c.do("GET", fmt.Sprintf("%s?offset=%d", basePath, nextOffset), nil, nil)
 		if err != nil {
 			return err
 		}
diff --git a/escalation_policy.go b/escalation_policy.go
index b094c0a..74befc6 100644
--- a/escalation_policy.go
+++ b/escalation_policy.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -63,7 +62,7 @@ func (c *Client) ListEscalationPolicies(o ListEscalationPoliciesOptions) (*ListE
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), escPath+"?"+v.Encode())
+	resp, err := c.get(escPath + "?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -75,13 +74,13 @@ func (c *Client) ListEscalationPolicies(o ListEscalationPoliciesOptions) (*ListE
 func (c *Client) CreateEscalationPolicy(e EscalationPolicy) (*EscalationPolicy, error) {
 	data := make(map[string]EscalationPolicy)
 	data["escalation_policy"] = e
-	resp, err := c.post(context.TODO(), escPath, data, nil)
+	resp, err := c.post(escPath, data, nil)
 	return getEscalationPolicyFromResponse(c, resp, err)
 }
 
 // DeleteEscalationPolicy deletes an existing escalation policy and rules.
 func (c *Client) DeleteEscalationPolicy(id string) error {
-	_, err := c.delete(context.TODO(), escPath+"/"+id)
+	_, err := c.delete(escPath + "/" + id)
 	return err
 }
 
@@ -96,7 +95,7 @@ func (c *Client) GetEscalationPolicy(id string, o *GetEscalationPolicyOptions) (
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), escPath+"/"+id+"?"+v.Encode())
+	resp, err := c.get(escPath + "/" + id + "?" + v.Encode())
 	return getEscalationPolicyFromResponse(c, resp, err)
 }
 
@@ -104,7 +103,7 @@ func (c *Client) GetEscalationPolicy(id string, o *GetEscalationPolicyOptions) (
 func (c *Client) UpdateEscalationPolicy(id string, e *EscalationPolicy) (*EscalationPolicy, error) {
 	data := make(map[string]EscalationPolicy)
 	data["escalation_policy"] = *e
-	resp, err := c.put(context.TODO(), escPath+"/"+id, data, nil)
+	resp, err := c.put(escPath+"/"+id, data, nil)
 	return getEscalationPolicyFromResponse(c, resp, err)
 }
 
@@ -113,7 +112,7 @@ func (c *Client) UpdateEscalationPolicy(id string, e *EscalationPolicy) (*Escala
 func (c *Client) CreateEscalationRule(escID string, e EscalationRule) (*EscalationRule, error) {
 	data := make(map[string]EscalationRule)
 	data["escalation_rule"] = e
-	resp, err := c.post(context.TODO(), escPath+"/"+escID+"/escalation_rules", data, nil)
+	resp, err := c.post(escPath+"/"+escID+"/escalation_rules", data, nil)
 	return getEscalationRuleFromResponse(c, resp, err)
 }
 
@@ -123,13 +122,13 @@ func (c *Client) GetEscalationRule(escID string, id string, o *GetEscalationRule
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), escPath+"/"+escID+"/escalation_rules/"+id+"?"+v.Encode())
+	resp, err := c.get(escPath + "/" + escID + "/escalation_rules/" + id + "?" + v.Encode())
 	return getEscalationRuleFromResponse(c, resp, err)
 }
 
 // DeleteEscalationRule deletes an existing escalation rule.
 func (c *Client) DeleteEscalationRule(escID string, id string) error {
-	_, err := c.delete(context.TODO(), escPath+"/"+escID+"/escalation_rules/"+id)
+	_, err := c.delete(escPath + "/" + escID + "/escalation_rules/" + id)
 	return err
 }
 
@@ -137,13 +136,13 @@ func (c *Client) DeleteEscalationRule(escID string, id string) error {
 func (c *Client) UpdateEscalationRule(escID string, id string, e *EscalationRule) (*EscalationRule, error) {
 	data := make(map[string]EscalationRule)
 	data["escalation_rule"] = *e
-	resp, err := c.put(context.TODO(), escPath+"/"+escID+"/escalation_rules/"+id, data, nil)
+	resp, err := c.put(escPath+"/"+escID+"/escalation_rules/"+id, data, nil)
 	return getEscalationRuleFromResponse(c, resp, err)
 }
 
 // ListEscalationRules lists all of the escalation rules for an existing escalation policy.
 func (c *Client) ListEscalationRules(escID string) (*ListEscalationRulesResponse, error) {
-	resp, err := c.get(context.TODO(), escPath+"/"+escID+"/escalation_rules")
+	resp, err := c.get(escPath + "/" + escID + "/escalation_rules")
 	if err != nil {
 		return nil, err
 	}
diff --git a/event_v2.go b/event_v2.go
index 6a72831..852e24e 100644
--- a/event_v2.go
+++ b/event_v2.go
@@ -2,7 +2,6 @@ package pagerduty
 
 import (
 	"bytes"
-	"context"
 	"encoding/json"
 	"fmt"
 	"io/ioutil"
@@ -49,16 +48,9 @@ func ManageEvent(e V2Event) (*V2EventResponse, error) {
 	if err != nil {
 		return nil, err
 	}
-
-	req, err := http.NewRequestWithContext(context.TODO(), http.MethodPost, v2eventEndPoint, bytes.NewBuffer(data))
-	if err != nil {
-		return nil, fmt.Errorf("failed to create HTTP request: %w", err)
-	}
-
+	req, _ := http.NewRequest("POST", v2eventEndPoint, bytes.NewBuffer(data))
 	req.Header.Set("User-Agent", "go-pagerduty/"+Version)
 	req.Header.Set("Content-Type", "application/json")
-
-	// TODO(theckman): switch to a package-local default client
 	resp, err := http.DefaultClient.Do(req)
 	if err != nil {
 		return nil, err
@@ -86,8 +78,7 @@ func (c *Client) ManageEvent(e *V2Event) (*V2EventResponse, error) {
 	if err != nil {
 		return nil, err
 	}
-
-	resp, err := c.doWithEndpoint(context.TODO(), c.v2EventsAPIEndpoint, http.MethodPost, "/v2/enqueue", false, bytes.NewBuffer(data), headers)
+	resp, err := c.doWithEndpoint(c.v2EventsAPIEndpoint, "POST", "/v2/enqueue", false, bytes.NewBuffer(data), &headers)
 	if err != nil {
 		return nil, err
 	}
diff --git a/extension.go b/extension.go
index b8fe0d5..3e6722b 100644
--- a/extension.go
+++ b/extension.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -35,7 +34,7 @@ func (c *Client) ListExtensions(o ListExtensionOptions) (*ListExtensionResponse,
 		return nil, err
 	}
 
-	resp, err := c.get(context.TODO(), "/extensions?"+v.Encode())
+	resp, err := c.get("/extensions?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -46,22 +45,22 @@ func (c *Client) ListExtensions(o ListExtensionOptions) (*ListExtensionResponse,
 }
 
 func (c *Client) CreateExtension(e *Extension) (*Extension, error) {
-	resp, err := c.post(context.TODO(), "/extensions", e, nil)
+	resp, err := c.post("/extensions", e, nil)
 	return getExtensionFromResponse(c, resp, err)
 }
 
 func (c *Client) DeleteExtension(id string) error {
-	_, err := c.delete(context.TODO(), "/extensions/"+id)
+	_, err := c.delete("/extensions/" + id)
 	return err
 }
 
 func (c *Client) GetExtension(id string) (*Extension, error) {
-	resp, err := c.get(context.TODO(), "/extensions/"+id)
+	resp, err := c.get("/extensions/" + id)
 	return getExtensionFromResponse(c, resp, err)
 }
 
 func (c *Client) UpdateExtension(id string, e *Extension) (*Extension, error) {
-	resp, err := c.put(context.TODO(), "/extensions/"+id, e, nil)
+	resp, err := c.put("/extensions/"+id, e, nil)
 	return getExtensionFromResponse(c, resp, err)
 }
 
diff --git a/extension_schema.go b/extension_schema.go
index b9af781..eeee2dd 100644
--- a/extension_schema.go
+++ b/extension_schema.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -36,7 +35,7 @@ func (c *Client) ListExtensionSchemas(o ListExtensionSchemaOptions) (*ListExtens
 		return nil, err
 	}
 
-	resp, err := c.get(context.TODO(), "/extension_schemas?"+v.Encode())
+	resp, err := c.get("/extension_schemas?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -47,7 +46,7 @@ func (c *Client) ListExtensionSchemas(o ListExtensionSchemaOptions) (*ListExtens
 }
 
 func (c *Client) GetExtensionSchema(id string) (*ExtensionSchema, error) {
-	resp, err := c.get(context.TODO(), "/extension_schemas/"+id)
+	resp, err := c.get("/extension_schemas/" + id)
 	return getExtensionSchemaFromResponse(c, resp, err)
 }
 
diff --git a/incident.go b/incident.go
index b90873c..7739b08 100644
--- a/incident.go
+++ b/incident.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"encoding/json"
 	"fmt"
 	"net/http"
@@ -126,7 +125,7 @@ func (c *Client) ListIncidents(o ListIncidentsOptions) (*ListIncidentsResponse,
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/incidents?"+v.Encode())
+	resp, err := c.get("/incidents?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -173,7 +172,7 @@ func (c *Client) CreateIncident(from string, o *CreateIncidentOptions) (*Inciden
 	headers["From"] = from
 	data := make(map[string]*CreateIncidentOptions)
 	data["incident"] = o
-	resp, e := c.post(context.TODO(), "/incidents", data, headers)
+	resp, e := c.post("/incidents", data, &headers)
 	if e != nil {
 		return nil, e
 	}
@@ -194,7 +193,7 @@ func (c *Client) ManageIncidents(from string, incidents []ManageIncidentsOptions
 	headers["From"] = from
 	data["incidents"] = incidents
 
-	resp, err := c.put(context.TODO(), "/incidents", data, headers)
+	resp, err := c.put("/incidents", data, &headers)
 	if err != nil {
 		return nil, err
 	}
@@ -209,7 +208,7 @@ func (c *Client) MergeIncidents(from string, id string, sourceIncidents []MergeI
 	headers := make(map[string]string)
 	headers["From"] = from
 
-	resp, err := c.put(context.TODO(), "/incidents/"+id+"/merge", r, headers)
+	resp, err := c.put("/incidents/"+id+"/merge", r, &headers)
 	if err != nil {
 		return nil, err
 	}
@@ -219,7 +218,7 @@ func (c *Client) MergeIncidents(from string, id string, sourceIncidents []MergeI
 
 // GetIncident shows detailed information about an incident.
 func (c *Client) GetIncident(id string) (*Incident, error) {
-	resp, err := c.get(context.TODO(), "/incidents/"+id)
+	resp, err := c.get("/incidents/" + id)
 	if err != nil {
 		return nil, err
 	}
@@ -249,7 +248,7 @@ type CreateIncidentNoteResponse struct {
 
 // ListIncidentNotes lists existing notes for the specified incident.
 func (c *Client) ListIncidentNotes(id string) ([]IncidentNote, error) {
-	resp, err := c.get(context.TODO(), "/incidents/"+id+"/notes")
+	resp, err := c.get("/incidents/" + id + "/notes")
 	if err != nil {
 		return nil, err
 	}
@@ -313,7 +312,7 @@ func (c *Client) ListIncidentAlertsWithOpts(id string, o ListIncidentAlertsOptio
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/incidents/"+id+"/alerts?"+v.Encode())
+	resp, err := c.get("/incidents/" + id + "/alerts?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -329,7 +328,7 @@ func (c *Client) CreateIncidentNoteWithResponse(id string, note IncidentNote) (*
 	headers["From"] = note.User.Summary
 
 	data["note"] = note
-	resp, err := c.post(context.TODO(), "/incidents/"+id+"/notes", data, headers)
+	resp, err := c.post("/incidents/"+id+"/notes", data, &headers)
 	if err != nil {
 		return nil, err
 	}
@@ -349,8 +348,9 @@ func (c *Client) CreateIncidentNote(id string, note IncidentNote) error {
 	data := make(map[string]IncidentNote)
 	headers := make(map[string]string)
 	headers["From"] = note.User.Summary
+
 	data["note"] = note
-	_, err := c.post(context.TODO(), "/incidents/"+id+"/notes", data, headers)
+	_, err := c.post("/incidents/"+id+"/notes", data, &headers)
 	return err
 }
 
@@ -358,7 +358,7 @@ func (c *Client) CreateIncidentNote(id string, note IncidentNote) error {
 func (c *Client) SnoozeIncidentWithResponse(id string, duration uint) (*Incident, error) {
 	data := make(map[string]uint)
 	data["duration"] = duration
-	resp, err := c.post(context.TODO(), "/incidents/"+id+"/snooze", data, nil)
+	resp, err := c.post("/incidents/"+id+"/snooze", data, nil)
 	if err != nil {
 		return nil, err
 	}
@@ -376,7 +376,7 @@ func (c *Client) SnoozeIncidentWithResponse(id string, duration uint) (*Incident
 func (c *Client) SnoozeIncident(id string, duration uint) error {
 	data := make(map[string]uint)
 	data["duration"] = duration
-	_, err := c.post(context.TODO(), "/incidents/"+id+"/snooze", data, nil)
+	_, err := c.post("/incidents/"+id+"/snooze", data, nil)
 	return err
 }
 
@@ -392,8 +392,8 @@ type ListIncidentLogEntriesOptions struct {
 	Includes   []string `url:"include,omitempty,brackets"`
 	IsOverview bool     `url:"is_overview,omitempty"`
 	TimeZone   string   `url:"time_zone,omitempty"`
-	Since      string   `url:"since,omitempty"`
-	Until      string   `url:"until,omitempty"`
+	Since      string   `url:since,omitempty`
+	Until      string   `url:until,omitempty`
 }
 
 // ListIncidentLogEntries lists existing log entries for the specified incident.
@@ -402,7 +402,7 @@ func (c *Client) ListIncidentLogEntries(id string, o ListIncidentLogEntriesOptio
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/incidents/"+id+"/log_entries?"+v.Encode())
+	resp, err := c.get("/incidents/" + id + "/log_entries?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -459,7 +459,7 @@ func (c *Client) ResponderRequest(id string, o ResponderRequestOptions) (*Respon
 	headers := make(map[string]string)
 	headers["From"] = o.From
 
-	resp, err := c.post(context.TODO(), "/incidents/"+id+"/responder_requests", o, headers)
+	resp, err := c.post("/incidents/"+id+"/responder_requests", o, &headers)
 	if err != nil {
 		return nil, err
 	}
@@ -471,7 +471,7 @@ func (c *Client) ResponderRequest(id string, o ResponderRequestOptions) (*Respon
 
 // GetIncidentAlert
 func (c *Client) GetIncidentAlert(incidentID, alertID string) (*IncidentAlertResponse, *http.Response, error) {
-	resp, err := c.get(context.TODO(), "/incidents/"+incidentID+"/alerts/"+alertID)
+	resp, err := c.get("/incidents/" + incidentID + "/alerts/" + alertID)
 	if err != nil {
 		return nil, nil, err
 	}
@@ -485,7 +485,7 @@ func (c *Client) GetIncidentAlert(incidentID, alertID string) (*IncidentAlertRes
 func (c *Client) ManageIncidentAlerts(incidentID string, alerts *IncidentAlertList) (*ListAlertsResponse, *http.Response, error) {
 	headers := make(map[string]string)
 
-	resp, err := c.put(context.TODO(), "/incidents/"+incidentID+"/alerts/", alerts, headers)
+	resp, err := c.put("/incidents/"+incidentID+"/alerts/", alerts, &headers)
 	if err != nil {
 		return nil, nil, err
 	}
diff --git a/log_entry.go b/log_entry.go
index 3a5d145..d01bf60 100644
--- a/log_entry.go
+++ b/log_entry.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"encoding/json"
 	"fmt"
 
@@ -41,7 +40,7 @@ type CommonLogEntryField struct {
 // LogEntry is a list of all of the events that happened to an incident.
 type LogEntry struct {
 	CommonLogEntryField
-	Incident Incident
+	Incident Incident `json:"incident"`
 }
 
 // ListLogEntryResponse is the response data when calling the ListLogEntry API endpoint.
@@ -66,7 +65,7 @@ func (c *Client) ListLogEntries(o ListLogEntriesOptions) (*ListLogEntryResponse,
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/log_entries?"+v.Encode())
+	resp, err := c.get("/log_entries?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -89,12 +88,12 @@ func (c *Client) GetLogEntry(id string, o GetLogEntryOptions) (*LogEntry, error)
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/log_entries/"+id+"?"+v.Encode())
+	resp, err := c.get("/log_entries/" + id + "?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
-
 	var result map[string]LogEntry
+
 	if err := c.decodeJSON(resp, &result); err != nil {
 		return nil, err
 	}
@@ -109,6 +108,7 @@ func (c *Client) GetLogEntry(id string, o GetLogEntryOptions) (*LogEntry, error)
 // UnmarshalJSON Expands the LogEntry.Channel object to parse out a raw value
 func (c *Channel) UnmarshalJSON(b []byte) error {
 	var raw map[string]interface{}
+
 	if err := json.Unmarshal(b, &raw); err != nil {
 		return err
 	}
@@ -120,3 +120,15 @@ func (c *Channel) UnmarshalJSON(b []byte) error {
 
 	return nil
 }
+
+// MarshalJSON Expands the LogEntry.Channel object to correctly marshal it back
+func (c *Channel) MarshalJSON() ([]byte, error) {
+	raw := map[string]interface{}{}
+	if c != nil && c.Type != "" {
+		for k, v := range c.Raw {
+			raw[k] = v
+		}
+	}
+
+	return json.Marshal(raw)
+}
diff --git a/maintenance_window.go b/maintenance_window.go
index 262c90a..21e9061 100644
--- a/maintenance_window.go
+++ b/maintenance_window.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -42,7 +41,7 @@ func (c *Client) ListMaintenanceWindows(o ListMaintenanceWindowsOptions) (*ListM
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/maintenance_windows?"+v.Encode())
+	resp, err := c.get("/maintenance_windows?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -59,7 +58,7 @@ func (c *Client) CreateMaintenanceWindow(from string, o MaintenanceWindow) (*Mai
 	if from != "" {
 		headers["From"] = from
 	}
-	resp, err := c.post(context.TODO(), "/maintenance_windows", data, headers)
+	resp, err := c.post("/maintenance_windows", data, &headers)
 	return getMaintenanceWindowFromResponse(c, resp, err)
 }
 
@@ -71,7 +70,7 @@ func (c *Client) CreateMaintenanceWindows(o MaintenanceWindow) (*MaintenanceWind
 
 // DeleteMaintenanceWindow deletes an existing maintenance window if it's in the future, or ends it if it's currently on-going.
 func (c *Client) DeleteMaintenanceWindow(id string) error {
-	_, err := c.delete(context.TODO(), "/maintenance_windows/"+id)
+	_, err := c.delete("/maintenance_windows/" + id)
 	return err
 }
 
@@ -86,13 +85,13 @@ func (c *Client) GetMaintenanceWindow(id string, o GetMaintenanceWindowOptions)
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/maintenance_windows/"+id+"?"+v.Encode())
+	resp, err := c.get("/maintenance_windows/" + id + "?" + v.Encode())
 	return getMaintenanceWindowFromResponse(c, resp, err)
 }
 
 // UpdateMaintenanceWindow updates an existing maintenance window.
 func (c *Client) UpdateMaintenanceWindow(m MaintenanceWindow) (*MaintenanceWindow, error) {
-	resp, err := c.put(context.TODO(), "/maintenance_windows/"+m.ID, m, nil)
+	resp, err := c.put("/maintenance_windows/"+m.ID, m, nil)
 	return getMaintenanceWindowFromResponse(c, resp, err)
 }
 
diff --git a/notification.go b/notification.go
index 5e5e704..cdd87c1 100644
--- a/notification.go
+++ b/notification.go
@@ -1,8 +1,6 @@
 package pagerduty
 
 import (
-	"context"
-
 	"github.com/google/go-querystring/query"
 )
 
@@ -37,7 +35,7 @@ func (c *Client) ListNotifications(o ListNotificationOptions) (*ListNotification
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/notifications?"+v.Encode())
+	resp, err := c.get("/notifications?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
diff --git a/on_call.go b/on_call.go
index da59fcd..537ef10 100644
--- a/on_call.go
+++ b/on_call.go
@@ -1,8 +1,6 @@
 package pagerduty
 
 import (
-	"context"
-
 	"github.com/google/go-querystring/query"
 )
 
@@ -41,7 +39,7 @@ func (c *Client) ListOnCalls(o ListOnCallOptions) (*ListOnCallsResponse, error)
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/oncalls?"+v.Encode())
+	resp, err := c.get("/oncalls?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
diff --git a/priorites.go b/priorites.go
index 1fec4d9..69a33a2 100644
--- a/priorites.go
+++ b/priorites.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"encoding/json"
 )
 
@@ -19,17 +18,15 @@ type Priorities struct {
 
 // ListPriorities lists existing priorities
 func (c *Client) ListPriorities() (*Priorities, error) {
-	resp, err := c.get(context.TODO(), "/priorities")
-	if err != nil {
-		return nil, err
+	resp, e := c.get("/priorities")
+	if e != nil {
+		return nil, e
 	}
 
-	// TODO(theckman): make sure we close the resp.Body here
-
 	var p Priorities
-	err = json.NewDecoder(resp.Body).Decode(&p)
-	if err != nil {
-		return nil, err
+	e = json.NewDecoder(resp.Body).Decode(&p)
+	if e != nil {
+		return nil, e
 	}
 
 	return &p, nil
diff --git a/ruleset.go b/ruleset.go
index e53e8db..1202233 100644
--- a/ruleset.go
+++ b/ruleset.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 )
@@ -158,7 +157,7 @@ func (c *Client) ListRulesets() (*ListRulesetsResponse, error) {
 	}
 
 	// Make call to get all pages associated with the base endpoint.
-	if err := c.pagedGet(context.TODO(), "/rulesets/", responseHandler); err != nil {
+	if err := c.pagedGet("/rulesets/", responseHandler); err != nil {
 		return nil, err
 	}
 	rulesetResponse.Rulesets = rulesets
@@ -170,19 +169,19 @@ func (c *Client) ListRulesets() (*ListRulesetsResponse, error) {
 func (c *Client) CreateRuleset(r *Ruleset) (*Ruleset, *http.Response, error) {
 	data := make(map[string]*Ruleset)
 	data["ruleset"] = r
-	resp, err := c.post(context.TODO(), "/rulesets", data, nil)
+	resp, err := c.post("/rulesets", data, nil)
 	return getRulesetFromResponse(c, resp, err)
 }
 
 // DeleteRuleset deletes a ruleset.
 func (c *Client) DeleteRuleset(id string) error {
-	_, err := c.delete(context.TODO(), "/rulesets/"+id)
+	_, err := c.delete("/rulesets/" + id)
 	return err
 }
 
 // GetRuleset gets details about a ruleset.
 func (c *Client) GetRuleset(id string) (*Ruleset, *http.Response, error) {
-	resp, err := c.get(context.TODO(), "/rulesets/"+id)
+	resp, err := c.get("/rulesets/" + id)
 	return getRulesetFromResponse(c, resp, err)
 }
 
@@ -190,7 +189,7 @@ func (c *Client) GetRuleset(id string) (*Ruleset, *http.Response, error) {
 func (c *Client) UpdateRuleset(r *Ruleset) (*Ruleset, *http.Response, error) {
 	v := make(map[string]*Ruleset)
 	v["ruleset"] = r
-	resp, err := c.put(context.TODO(), "/rulesets/"+r.ID, v, nil)
+	resp, err := c.put("/rulesets/"+r.ID, v, nil)
 	return getRulesetFromResponse(c, resp, err)
 }
 
@@ -235,7 +234,7 @@ func (c *Client) ListRulesetRules(rulesetID string) (*ListRulesetRulesResponse,
 	}
 
 	// Make call to get all pages associated with the base endpoint.
-	if err := c.pagedGet(context.TODO(), "/rulesets/"+rulesetID+"/rules", responseHandler); err != nil {
+	if err := c.pagedGet("/rulesets/"+rulesetID+"/rules", responseHandler); err != nil {
 		return nil, err
 	}
 	rulesResponse.Rules = rules
@@ -245,13 +244,13 @@ func (c *Client) ListRulesetRules(rulesetID string) (*ListRulesetRulesResponse,
 
 // GetRulesetRule gets an event rule
 func (c *Client) GetRulesetRule(rulesetID, ruleID string) (*RulesetRule, *http.Response, error) {
-	resp, err := c.get(context.TODO(), "/rulesets/"+rulesetID+"/rules/"+ruleID)
+	resp, err := c.get("/rulesets/" + rulesetID + "/rules/" + ruleID)
 	return getRuleFromResponse(c, resp, err)
 }
 
 // DeleteRulesetRule deletes a rule.
 func (c *Client) DeleteRulesetRule(rulesetID, ruleID string) error {
-	_, err := c.delete(context.TODO(), "/rulesets/"+rulesetID+"/rules/"+ruleID)
+	_, err := c.delete("/rulesets/" + rulesetID + "/rules/" + ruleID)
 	return err
 }
 
@@ -259,7 +258,7 @@ func (c *Client) DeleteRulesetRule(rulesetID, ruleID string) error {
 func (c *Client) CreateRulesetRule(rulesetID string, rule *RulesetRule) (*RulesetRule, *http.Response, error) {
 	data := make(map[string]*RulesetRule)
 	data["rule"] = rule
-	resp, err := c.post(context.TODO(), "/rulesets/"+rulesetID+"/rules/", data, nil)
+	resp, err := c.post("/rulesets/"+rulesetID+"/rules/", data, nil)
 	return getRuleFromResponse(c, resp, err)
 }
 
@@ -267,7 +266,7 @@ func (c *Client) CreateRulesetRule(rulesetID string, rule *RulesetRule) (*Rulese
 func (c *Client) UpdateRulesetRule(rulesetID, ruleID string, r *RulesetRule) (*RulesetRule, *http.Response, error) {
 	v := make(map[string]*RulesetRule)
 	v["rule"] = r
-	resp, err := c.put(context.TODO(), "/rulesets/"+rulesetID+"/rules/"+ruleID, v, nil)
+	resp, err := c.put("/rulesets/"+rulesetID+"/rules/"+ruleID, v, nil)
 	return getRuleFromResponse(c, resp, err)
 }
 
diff --git a/schedule.go b/schedule.go
index 3792951..5851029 100644
--- a/schedule.go
+++ b/schedule.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -74,7 +73,7 @@ func (c *Client) ListSchedules(o ListSchedulesOptions) (*ListSchedulesResponse,
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/schedules?"+v.Encode())
+	resp, err := c.get("/schedules?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -86,7 +85,7 @@ func (c *Client) ListSchedules(o ListSchedulesOptions) (*ListSchedulesResponse,
 func (c *Client) CreateSchedule(s Schedule) (*Schedule, error) {
 	data := make(map[string]Schedule)
 	data["schedule"] = s
-	resp, err := c.post(context.TODO(), "/schedules", data, nil)
+	resp, err := c.post("/schedules", data, nil)
 	if err != nil {
 		return nil, err
 	}
@@ -109,13 +108,13 @@ func (c *Client) PreviewSchedule(s Schedule, o PreviewScheduleOptions) error {
 	}
 	var data map[string]Schedule
 	data["schedule"] = s
-	_, err = c.post(context.TODO(), "/schedules/preview?"+v.Encode(), data, nil)
-	return err
+	_, e := c.post("/schedules/preview?"+v.Encode(), data, nil)
+	return e
 }
 
 // DeleteSchedule deletes an on-call schedule.
 func (c *Client) DeleteSchedule(id string) error {
-	_, err := c.delete(context.TODO(), "/schedules/"+id)
+	_, err := c.delete("/schedules/" + id)
 	return err
 }
 
@@ -133,7 +132,7 @@ func (c *Client) GetSchedule(id string, o GetScheduleOptions) (*Schedule, error)
 	if err != nil {
 		return nil, fmt.Errorf("Could not parse values for query: %v", err)
 	}
-	resp, err := c.get(context.TODO(), "/schedules/"+id+"?"+v.Encode())
+	resp, err := c.get("/schedules/" + id + "?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -149,7 +148,7 @@ type UpdateScheduleOptions struct {
 func (c *Client) UpdateSchedule(id string, s Schedule) (*Schedule, error) {
 	v := make(map[string]Schedule)
 	v["schedule"] = s
-	resp, err := c.put(context.TODO(), "/schedules/"+id, v, nil)
+	resp, err := c.put("/schedules/"+id, v, nil)
 	if err != nil {
 		return nil, err
 	}
@@ -185,7 +184,7 @@ func (c *Client) ListOverrides(id string, o ListOverridesOptions) (*ListOverride
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/schedules/"+id+"/overrides?"+v.Encode())
+	resp, err := c.get("/schedules/" + id + "/overrides?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -197,7 +196,7 @@ func (c *Client) ListOverrides(id string, o ListOverridesOptions) (*ListOverride
 func (c *Client) CreateOverride(id string, o Override) (*Override, error) {
 	data := make(map[string]Override)
 	data["override"] = o
-	resp, err := c.post(context.TODO(), "/schedules/"+id+"/overrides", data, nil)
+	resp, err := c.post("/schedules/"+id+"/overrides", data, nil)
 	if err != nil {
 		return nil, err
 	}
@@ -206,7 +205,7 @@ func (c *Client) CreateOverride(id string, o Override) (*Override, error) {
 
 // DeleteOverride removes an override.
 func (c *Client) DeleteOverride(scheduleID, overrideID string) error {
-	_, err := c.delete(context.TODO(), "/schedules/"+scheduleID+"/overrides/"+overrideID)
+	_, err := c.delete("/schedules/" + scheduleID + "/overrides/" + overrideID)
 	return err
 }
 
@@ -223,7 +222,7 @@ func (c *Client) ListOnCallUsers(id string, o ListOnCallUsersOptions) ([]User, e
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/schedules/"+id+"/users?"+v.Encode())
+	resp, err := c.get("/schedules/" + id + "/users?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
diff --git a/service.go b/service.go
index 91562e0..79b0850 100644
--- a/service.go
+++ b/service.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -113,7 +112,7 @@ func (c *Client) ListServices(o ListServiceOptions) (*ListServiceResponse, error
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/services?"+v.Encode())
+	resp, err := c.get("/services?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -129,7 +128,7 @@ type GetServiceOptions struct {
 // GetService gets details about an existing service.
 func (c *Client) GetService(id string, o *GetServiceOptions) (*Service, error) {
 	v, err := query.Values(o)
-	resp, err := c.get(context.TODO(), "/services/"+id+"?"+v.Encode())
+	resp, err := c.get("/services/" + id + "?" + v.Encode())
 	return getServiceFromResponse(c, resp, err)
 }
 
@@ -137,7 +136,7 @@ func (c *Client) GetService(id string, o *GetServiceOptions) (*Service, error) {
 func (c *Client) CreateService(s Service) (*Service, error) {
 	data := make(map[string]Service)
 	data["service"] = s
-	resp, err := c.post(context.TODO(), "/services", data, nil)
+	resp, err := c.post("/services", data, nil)
 	return getServiceFromResponse(c, resp, err)
 }
 
@@ -148,13 +147,13 @@ func (c *Client) UpdateService(s Service) (*Service, error) {
 	}{
 		s,
 	}
-	resp, err := c.put(context.TODO(), "/services/"+s.ID, body, nil)
+	resp, err := c.put("/services/"+s.ID, body, nil)
 	return getServiceFromResponse(c, resp, err)
 }
 
 // DeleteService deletes an existing service.
 func (c *Client) DeleteService(id string) error {
-	_, err := c.delete(context.TODO(), "/services/"+id)
+	_, err := c.delete("/services/" + id)
 	return err
 }
 
@@ -162,7 +161,7 @@ func (c *Client) DeleteService(id string) error {
 func (c *Client) CreateIntegration(id string, i Integration) (*Integration, error) {
 	data := make(map[string]Integration)
 	data["integration"] = i
-	resp, err := c.post(context.TODO(), "/services/"+id+"/integrations", data, nil)
+	resp, err := c.post("/services/"+id+"/integrations", data, nil)
 	return getIntegrationFromResponse(c, resp, err)
 }
 
@@ -177,19 +176,19 @@ func (c *Client) GetIntegration(serviceID, integrationID string, o GetIntegratio
 	if queryErr != nil {
 		return nil, queryErr
 	}
-	resp, err := c.get(context.TODO(), "/services/"+serviceID+"/integrations/"+integrationID+"?"+v.Encode())
+	resp, err := c.get("/services/" + serviceID + "/integrations/" + integrationID + "?" + v.Encode())
 	return getIntegrationFromResponse(c, resp, err)
 }
 
 // UpdateIntegration updates an integration belonging to a service.
 func (c *Client) UpdateIntegration(serviceID string, i Integration) (*Integration, error) {
-	resp, err := c.put(context.TODO(), "/services/"+serviceID+"/integrations/"+i.ID, i, nil)
+	resp, err := c.put("/services/"+serviceID+"/integrations/"+i.ID, i, nil)
 	return getIntegrationFromResponse(c, resp, err)
 }
 
 // DeleteIntegration deletes an existing integration.
 func (c *Client) DeleteIntegration(serviceID string, integrationID string) error {
-	_, err := c.delete(context.TODO(), "/services/"+serviceID+"/integrations/"+integrationID)
+	_, err := c.delete("/services/" + serviceID + "/integrations/" + integrationID)
 	return err
 }
 
diff --git a/service_dependency.go b/service_dependency.go
index d4755f6..4d85dd1 100644
--- a/service_dependency.go
+++ b/service_dependency.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"net/http"
 )
 
@@ -26,7 +25,7 @@ type ListServiceDependencies struct {
 
 // ListBusinessServiceDependencies lists dependencies of a business service.
 func (c *Client) ListBusinessServiceDependencies(businessServiceID string) (*ListServiceDependencies, *http.Response, error) {
-	resp, err := c.get(context.TODO(), "/service_dependencies/business_services/"+businessServiceID)
+	resp, err := c.get("/service_dependencies/business_services/" + businessServiceID)
 	if err != nil {
 		return nil, nil, err
 	}
@@ -36,7 +35,7 @@ func (c *Client) ListBusinessServiceDependencies(businessServiceID string) (*Lis
 
 // ListTechnicalServiceDependencies lists dependencies of a technical service.
 func (c *Client) ListTechnicalServiceDependencies(serviceID string) (*ListServiceDependencies, *http.Response, error) {
-	resp, err := c.get(context.TODO(), "/service_dependencies/technical_services/"+serviceID)
+	resp, err := c.get("/service_dependencies/technical_services/" + serviceID)
 	if err != nil {
 		return nil, nil, err
 	}
@@ -46,7 +45,7 @@ func (c *Client) ListTechnicalServiceDependencies(serviceID string) (*ListServic
 
 // AssociateServiceDependencies Create new dependencies between two services.
 func (c *Client) AssociateServiceDependencies(dependencies *ListServiceDependencies) (*ListServiceDependencies, *http.Response, error) {
-	resp, err := c.post(context.TODO(), "/service_dependencies/associate", dependencies, nil)
+	resp, err := c.post("/service_dependencies/associate", dependencies, nil)
 	if err != nil {
 		return nil, nil, err
 	}
@@ -56,7 +55,7 @@ func (c *Client) AssociateServiceDependencies(dependencies *ListServiceDependenc
 
 // DisassociateServiceDependencies Disassociate dependencies between two services.
 func (c *Client) DisassociateServiceDependencies(dependencies *ListServiceDependencies) (*ListServiceDependencies, *http.Response, error) {
-	resp, err := c.post(context.TODO(), "/service_dependencies/disassociate", dependencies, nil)
+	resp, err := c.post("/service_dependencies/disassociate", dependencies, nil)
 	if err != nil {
 		return nil, nil, err
 	}
diff --git a/tag.go b/tag.go
index 9b396b8..dc8d959 100644
--- a/tag.go
+++ b/tag.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -59,37 +58,36 @@ type TagAssignment struct {
 
 // ListTags lists tags of your PagerDuty account, optionally filtered by a search query.
 func (c *Client) ListTags(o ListTagOptions) (*ListTagResponse, error) {
-	return getTagList(context.TODO(), c, "", "", o)
+	return getTagList(c, "", "", o)
 }
 
 // CreateTag creates a new tag.
 func (c *Client) CreateTag(t *Tag) (*Tag, *http.Response, error) {
 	data := make(map[string]*Tag)
 	data["tag"] = t
-	resp, err := c.post(context.TODO(), "/tags", data, nil)
+	resp, err := c.post("/tags", data, nil)
 	return getTagFromResponse(c, resp, err)
 }
 
 // DeleteTag removes an existing tag.
 func (c *Client) DeleteTag(id string) error {
-	_, err := c.delete(context.TODO(), "/tags/"+id)
+	_, err := c.delete("/tags/" + id)
 	return err
 }
 
 // GetTag gets details about an existing tag.
 func (c *Client) GetTag(id string) (*Tag, *http.Response, error) {
-	resp, err := c.get(context.TODO(), "/tags/"+id)
+	resp, err := c.get("/tags/" + id)
 	return getTagFromResponse(c, resp, err)
 }
 
 // AssignTags adds and removes tag assignments with entities
 func (c *Client) AssignTags(e, eid string, a *TagAssignments) (*http.Response, error) {
-	resp, err := c.post(context.TODO(), "/"+e+"/"+eid+"/change_tags", a, nil)
-	if err != nil {
+	if resp, err := c.post("/"+e+"/"+eid+"/change_tags", a, nil); err != nil {
 		return nil, err
+	} else {
+		return resp, nil
 	}
-
-	return resp, nil
 }
 
 // GetUsersByTag get related Users for the Tag.
@@ -117,11 +115,11 @@ func (c *Client) GetUsersByTag(tid string) (*ListUserResponse, error) {
 	}
 
 	// Make call to get all pages associated with the base endpoint.
-	if err := c.pagedGet(context.TODO(), "/tags/"+tid+"/users/", responseHandler); err != nil {
+	if err := c.pagedGet("/tags/"+tid+"/users/", responseHandler); err != nil {
 		return nil, err
 	}
 	userResponse.Users = users
-
+	fmt.Println()
 	return userResponse, nil
 }
 
@@ -150,7 +148,7 @@ func (c *Client) GetTeamsByTag(tid string) (*ListTeamsForTagResponse, error) {
 	}
 
 	// Make call to get all pages associated with the base endpoint.
-	if err := c.pagedGet(context.TODO(), "/tags/"+tid+"/teams/", responseHandler); err != nil {
+	if err := c.pagedGet("/tags/"+tid+"/teams/", responseHandler); err != nil {
 		return nil, err
 	}
 	teamsResponse.Teams = teams
@@ -183,7 +181,7 @@ func (c *Client) GetEscalationPoliciesByTag(tid string) (*ListEPResponse, error)
 	}
 
 	// Make call to get all pages associated with the base endpoint.
-	if err := c.pagedGet(context.TODO(), "/tags/"+tid+"/escalation_policies/", responseHandler); err != nil {
+	if err := c.pagedGet("/tags/"+tid+"/escalation_policies/", responseHandler); err != nil {
 		return nil, err
 	}
 	epResponse.EscalationPolicies = eps
@@ -193,7 +191,7 @@ func (c *Client) GetEscalationPoliciesByTag(tid string) (*ListEPResponse, error)
 
 // GetTagsForEntity Get related tags for Users, Teams or Escalation Policies.
 func (c *Client) GetTagsForEntity(e, eid string, o ListTagOptions) (*ListTagResponse, error) {
-	return getTagList(context.TODO(), c, e, eid, o)
+	return getTagList(c, e, eid, o)
 }
 
 func getTagFromResponse(c *Client, resp *http.Response, err error) (*Tag, *http.Response, error) {
@@ -213,7 +211,7 @@ func getTagFromResponse(c *Client, resp *http.Response, err error) (*Tag, *http.
 }
 
 // getTagList  is a utility function that processes all pages of a ListTagResponse
-func getTagList(ctx context.Context, c *Client, e, eid string, o ListTagOptions) (*ListTagResponse, error) {
+func getTagList(c *Client, e, eid string, o ListTagOptions) (*ListTagResponse, error) {
 	queryParms, err := query.Values(o)
 	if err != nil {
 		return nil, err
@@ -244,7 +242,7 @@ func getTagList(ctx context.Context, c *Client, e, eid string, o ListTagOptions)
 		path = "/" + e + "/" + eid + "/tags"
 	}
 	// Make call to get all pages associated with the base endpoint.
-	if err := c.pagedGet(ctx, path+queryParms.Encode(), responseHandler); err != nil {
+	if err := c.pagedGet(path+queryParms.Encode(), responseHandler); err != nil {
 		return nil, err
 	}
 	tagResponse.Tags = tags
diff --git a/team.go b/team.go
index b0c0b7f..735b928 100644
--- a/team.go
+++ b/team.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -34,7 +33,7 @@ func (c *Client) ListTeams(o ListTeamOptions) (*ListTeamResponse, error) {
 		return nil, err
 	}
 
-	resp, err := c.get(context.TODO(), "/teams?"+v.Encode())
+	resp, err := c.get("/teams?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -44,49 +43,49 @@ func (c *Client) ListTeams(o ListTeamOptions) (*ListTeamResponse, error) {
 
 // CreateTeam creates a new team.
 func (c *Client) CreateTeam(t *Team) (*Team, error) {
-	resp, err := c.post(context.TODO(), "/teams", t, nil)
+	resp, err := c.post("/teams", t, nil)
 	return getTeamFromResponse(c, resp, err)
 }
 
 // DeleteTeam removes an existing team.
 func (c *Client) DeleteTeam(id string) error {
-	_, err := c.delete(context.TODO(), "/teams/"+id)
+	_, err := c.delete("/teams/" + id)
 	return err
 }
 
 // GetTeam gets details about an existing team.
 func (c *Client) GetTeam(id string) (*Team, error) {
-	resp, err := c.get(context.TODO(), "/teams/"+id)
+	resp, err := c.get("/teams/" + id)
 	return getTeamFromResponse(c, resp, err)
 }
 
 // UpdateTeam updates an existing team.
 func (c *Client) UpdateTeam(id string, t *Team) (*Team, error) {
-	resp, err := c.put(context.TODO(), "/teams/"+id, t, nil)
+	resp, err := c.put("/teams/"+id, t, nil)
 	return getTeamFromResponse(c, resp, err)
 }
 
 // RemoveEscalationPolicyFromTeam removes an escalation policy from a team.
 func (c *Client) RemoveEscalationPolicyFromTeam(teamID, epID string) error {
-	_, err := c.delete(context.TODO(), "/teams/"+teamID+"/escalation_policies/"+epID)
+	_, err := c.delete("/teams/" + teamID + "/escalation_policies/" + epID)
 	return err
 }
 
 // AddEscalationPolicyToTeam adds an escalation policy to a team.
 func (c *Client) AddEscalationPolicyToTeam(teamID, epID string) error {
-	_, err := c.put(context.TODO(), "/teams/"+teamID+"/escalation_policies/"+epID, nil, nil)
+	_, err := c.put("/teams/"+teamID+"/escalation_policies/"+epID, nil, nil)
 	return err
 }
 
 // RemoveUserFromTeam removes a user from a team.
 func (c *Client) RemoveUserFromTeam(teamID, userID string) error {
-	_, err := c.delete(context.TODO(), "/teams/"+teamID+"/users/"+userID)
+	_, err := c.delete("/teams/" + teamID + "/users/" + userID)
 	return err
 }
 
 // AddUserToTeam adds a user to a team.
 func (c *Client) AddUserToTeam(teamID, userID string) error {
-	_, err := c.put(context.TODO(), "/teams/"+teamID+"/users/"+userID, nil, nil)
+	_, err := c.put("/teams/"+teamID+"/users/"+userID, nil, nil)
 	return err
 }
 
@@ -132,7 +131,7 @@ func (c *Client) ListMembers(teamID string, o ListMembersOptions) (*ListMembersR
 		return nil, err
 	}
 
-	resp, err := c.get(context.TODO(), "/teams/"+teamID+"/members?"+v.Encode())
+	resp, err := c.get("/teams/" + teamID + "/members?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -164,7 +163,7 @@ func (c *Client) ListAllMembers(teamID string) ([]Member, error) {
 	}
 
 	// Make call to get all pages associated with the base endpoint.
-	if err := c.pagedGet(context.TODO(), "/teams/"+teamID+"/members", responseHandler); err != nil {
+	if err := c.pagedGet("/teams/"+teamID+"/members", responseHandler); err != nil {
 		return nil, err
 	}
 
diff --git a/user.go b/user.go
index d232b1c..ed2a174 100644
--- a/user.go
+++ b/user.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -95,7 +94,7 @@ func (c *Client) ListUsers(o ListUsersOptions) (*ListUsersResponse, error) {
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/users?"+v.Encode())
+	resp, err := c.get("/users?" + v.Encode())
 	if err != nil {
 		return nil, err
 	}
@@ -107,13 +106,13 @@ func (c *Client) ListUsers(o ListUsersOptions) (*ListUsersResponse, error) {
 func (c *Client) CreateUser(u User) (*User, error) {
 	data := make(map[string]User)
 	data["user"] = u
-	resp, err := c.post(context.TODO(), "/users", data, nil)
+	resp, err := c.post("/users", data, nil)
 	return getUserFromResponse(c, resp, err)
 }
 
 // DeleteUser deletes a user.
 func (c *Client) DeleteUser(id string) error {
-	_, err := c.delete(context.TODO(), "/users/"+id)
+	_, err := c.delete("/users/" + id)
 	return err
 }
 
@@ -123,7 +122,7 @@ func (c *Client) GetUser(id string, o GetUserOptions) (*User, error) {
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/users/"+id+"?"+v.Encode())
+	resp, err := c.get("/users/" + id + "?" + v.Encode())
 	return getUserFromResponse(c, resp, err)
 }
 
@@ -131,7 +130,7 @@ func (c *Client) GetUser(id string, o GetUserOptions) (*User, error) {
 func (c *Client) UpdateUser(u User) (*User, error) {
 	v := make(map[string]User)
 	v["user"] = u
-	resp, err := c.put(context.TODO(), "/users/"+u.ID, v, nil)
+	resp, err := c.put("/users/"+u.ID, v, nil)
 	return getUserFromResponse(c, resp, err)
 }
 
@@ -141,7 +140,7 @@ func (c *Client) GetCurrentUser(o GetCurrentUserOptions) (*User, error) {
 	if err != nil {
 		return nil, err
 	}
-	resp, err := c.get(context.TODO(), "/users/me?"+v.Encode())
+	resp, err := c.get("/users/me?" + v.Encode())
 	return getUserFromResponse(c, resp, err)
 }
 
@@ -163,7 +162,7 @@ func getUserFromResponse(c *Client, resp *http.Response, err error) (*User, erro
 
 // ListUserContactMethods fetches contact methods of the existing user.
 func (c *Client) ListUserContactMethods(userID string) (*ListContactMethodsResponse, error) {
-	resp, err := c.get(context.TODO(), "/users/"+userID+"/contact_methods")
+	resp, err := c.get("/users/" + userID + "/contact_methods")
 	if err != nil {
 		return nil, err
 	}
@@ -173,13 +172,13 @@ func (c *Client) ListUserContactMethods(userID string) (*ListContactMethodsRespo
 
 // GetUserContactMethod gets details about a contact method.
 func (c *Client) GetUserContactMethod(userID, contactMethodID string) (*ContactMethod, error) {
-	resp, err := c.get(context.TODO(), "/users/"+userID+"/contact_methods/"+contactMethodID)
+	resp, err := c.get("/users/" + userID + "/contact_methods/" + contactMethodID)
 	return getContactMethodFromResponse(c, resp, err)
 }
 
 // DeleteUserContactMethod deletes a user.
 func (c *Client) DeleteUserContactMethod(userID, contactMethodID string) error {
-	_, err := c.delete(context.TODO(), "/users/"+userID+"/contact_methods/"+contactMethodID)
+	_, err := c.delete("/users/" + userID + "/contact_methods/" + contactMethodID)
 	return err
 }
 
@@ -187,7 +186,7 @@ func (c *Client) DeleteUserContactMethod(userID, contactMethodID string) error {
 func (c *Client) CreateUserContactMethod(userID string, cm ContactMethod) (*ContactMethod, error) {
 	data := make(map[string]ContactMethod)
 	data["contact_method"] = cm
-	resp, err := c.post(context.TODO(), "/users/"+userID+"/contact_methods", data, nil)
+	resp, err := c.post("/users/"+userID+"/contact_methods", data, nil)
 	return getContactMethodFromResponse(c, resp, err)
 }
 
@@ -195,7 +194,7 @@ func (c *Client) CreateUserContactMethod(userID string, cm ContactMethod) (*Cont
 func (c *Client) UpdateUserContactMethod(userID string, cm ContactMethod) (*ContactMethod, error) {
 	v := make(map[string]ContactMethod)
 	v["contact_method"] = cm
-	resp, err := c.put(context.TODO(), "/users/"+userID+"/contact_methods/"+cm.ID, v, nil)
+	resp, err := c.put("/users/"+userID+"/contact_methods/"+cm.ID, v, nil)
 	return getContactMethodFromResponse(c, resp, err)
 }
 
@@ -217,7 +216,7 @@ func getContactMethodFromResponse(c *Client, resp *http.Response, err error) (*C
 
 // GetUserNotificationRule gets details about a notification rule.
 func (c *Client) GetUserNotificationRule(userID, ruleID string) (*NotificationRule, error) {
-	resp, err := c.get(context.TODO(), "/users/"+userID+"/notification_rules/"+ruleID)
+	resp, err := c.get("/users/" + userID + "/notification_rules/" + ruleID)
 	return getUserNotificationRuleFromResponse(c, resp, err)
 }
 
@@ -225,7 +224,7 @@ func (c *Client) GetUserNotificationRule(userID, ruleID string) (*NotificationRu
 func (c *Client) CreateUserNotificationRule(userID string, rule NotificationRule) (*NotificationRule, error) {
 	data := make(map[string]NotificationRule)
 	data["notification_rule"] = rule
-	resp, err := c.post(context.TODO(), "/users/"+userID+"/notification_rules", data, nil)
+	resp, err := c.post("/users/"+userID+"/notification_rules", data, nil)
 	return getUserNotificationRuleFromResponse(c, resp, err)
 }
 
@@ -233,19 +232,19 @@ func (c *Client) CreateUserNotificationRule(userID string, rule NotificationRule
 func (c *Client) UpdateUserNotificationRule(userID string, rule NotificationRule) (*NotificationRule, error) {
 	data := make(map[string]NotificationRule)
 	data["notification_rule"] = rule
-	resp, err := c.put(context.TODO(), "/users/"+userID+"/notification_rules/"+rule.ID, data, nil)
+	resp, err := c.put("/users/"+userID+"/notification_rules/"+rule.ID, data, nil)
 	return getUserNotificationRuleFromResponse(c, resp, err)
 }
 
 // DeleteUserNotificationRule deletes a notification rule for a user.
 func (c *Client) DeleteUserNotificationRule(userID, ruleID string) error {
-	_, err := c.delete(context.TODO(), "/users/"+userID+"/notification_rules/"+ruleID)
+	_, err := c.delete("/users/" + userID + "/notification_rules/" + ruleID)
 	return err
 }
 
 // ListUserNotificationRules fetches notification rules of the existing user.
 func (c *Client) ListUserNotificationRules(userID string) (*ListUserNotificationRulesResponse, error) {
-	resp, err := c.get(context.TODO(), "/users/"+userID+"/notification_rules")
+	resp, err := c.get("/users/" + userID + "/notification_rules")
 	if err != nil {
 		return nil, err
 	}
diff --git a/vendor.go b/vendor.go
index bfc42dc..cb97160 100644
--- a/vendor.go
+++ b/vendor.go
@@ -1,7 +1,6 @@
 package pagerduty
 
 import (
-	"context"
 	"fmt"
 	"net/http"
 
@@ -40,11 +39,13 @@ type ListVendorOptions struct {
 // ListVendors lists existing vendors.
 func (c *Client) ListVendors(o ListVendorOptions) (*ListVendorResponse, error) {
 	v, err := query.Values(o)
+
 	if err != nil {
 		return nil, err
 	}
 
-	resp, err := c.get(context.TODO(), "/vendors?"+v.Encode())
+	resp, err := c.get("/vendors?" + v.Encode())
+
 	if err != nil {
 		return nil, err
 	}
@@ -55,7 +56,7 @@ func (c *Client) ListVendors(o ListVendorOptions) (*ListVendorResponse, error) {
 
 // GetVendor gets details about an existing vendor.
 func (c *Client) GetVendor(id string) (*Vendor, error) {
-	resp, err := c.get(context.TODO(), "/vendors/"+id)
+	resp, err := c.get("/vendors/" + id)
 	return getVendorFromResponse(c, resp, err)
 }
 
diff --git a/webhook.go b/webhook.go
index 17d77cd..88f92aa 100644
--- a/webhook.go
+++ b/webhook.go
@@ -29,7 +29,6 @@ type IncidentDetails struct {
 	AlertCounts          AlertCounts       `json:"alert_counts"`
 	Metadata             interface{}       `json:"metadata"`
 	Description          string            `json:"description"`
-	Alerts               []IncidentAlert   `json:"alerts,omitempty"`
 }
 
 // WebhookPayloadMessages is the wrapper around the Webhook payloads. The Array may contain multiple message elements if webhook firing actions occurred in quick succession


Test patch:
diff --git a/client_test.go b/client_test.go
index 9c5d8cb..84f5b1d 100644
--- a/client_test.go
+++ b/client_test.go
@@ -1,8 +1,6 @@
 package pagerduty
 
 import (
-	"encoding/json"
-	"fmt"
 	"net/http"
 	"net/http/httptest"
 	"reflect"
@@ -23,7 +21,7 @@ var (
 func setup() {
 	mux = http.NewServeMux()
 	server = httptest.NewServer(mux)
-	authToken := "foo"
+	var authToken = "foo"
 	client = NewClient(authToken)
 }
 
@@ -42,244 +40,3 @@ func testEqual(t *testing.T, expected interface{}, actual interface{}) {
 		t.Errorf("returned %#v; want %#v", expected, actual)
 	}
 }
-
-func TestAPIError_Error(t *testing.T) {
-	const jsonBody = `{"error":{"code": 420, "message": "Enhance Your Calm", "errors":["Enhance Your Calm", "Slow Your Roll"]}}`
-
-	var a APIError
-
-	if err := json.Unmarshal([]byte(jsonBody), &a); err != nil {
-		t.Fatalf("failed to unmarshal JSON: %s", err)
-	}
-
-	a.StatusCode = 429
-
-	const want = "HTTP response failed with status code 429, message: Enhance Your Calm (code: 420)"
-
-	if got := a.Error(); got != want {
-		t.Errorf("a.Error() = %q, want %q", got, want)
-	}
-
-	tests := []struct {
-		name string
-		a    APIError
-		want string
-	}{
-		{
-			name: "message",
-			a: APIError{
-				message: "test message",
-			},
-			want: "test message",
-		},
-		{
-			name: "APIError_nil",
-			a: APIError{
-				StatusCode: http.StatusServiceUnavailable,
-			},
-			want: "HTTP response failed with status code 503 and no JSON error object was present",
-		},
-	}
-
-	for _, tt := range tests {
-		tt := tt
-
-		t.Run(tt.name, func(t *testing.T) {
-			if got := tt.a.Error(); got != tt.want {
-				fmt.Println(got)
-				fmt.Println(tt.want)
-				t.Fatalf("tt.a.Error() = %q, want %q", got, tt.want)
-			}
-		})
-	}
-}
-
-func TestAPIError_RateLimited(t *testing.T) {
-	tests := []struct {
-		name string
-		a    APIError
-		want bool
-	}{
-		{
-			name: "rate_limited",
-			a: APIError{
-				StatusCode: http.StatusTooManyRequests,
-				APIError: NullAPIErrorObject{
-					Valid: true,
-					ErrorObject: APIErrorObject{
-						Code:    420,
-						Message: "Enhance Your Calm",
-						Errors:  []string{"Enhance Your Calm"},
-					},
-				},
-			},
-			want: true,
-		},
-		{
-			name: "not_found",
-			a: APIError{
-				StatusCode: http.StatusNotFound,
-				APIError: NullAPIErrorObject{
-					Valid: true,
-					ErrorObject: APIErrorObject{
-						Code:    2100,
-						Message: "Not Found",
-						Errors:  []string{"Not Found"},
-					},
-				},
-			},
-			want: false,
-		},
-	}
-
-	for _, tt := range tests {
-		tt := tt
-
-		t.Run(tt.name, func(t *testing.T) {
-			if got := tt.a.RateLimited(); got != tt.want {
-				t.Fatalf("tt.a.RateLimited() = %t, want %t", got, tt.want)
-			}
-		})
-	}
-}
-
-func TestAPIError_Temporary(t *testing.T) {
-	tests := []struct {
-		name string
-		a    APIError
-		want bool
-	}{
-		{
-			name: "rate_limited",
-			a: APIError{
-				StatusCode: http.StatusTooManyRequests,
-				APIError: NullAPIErrorObject{
-					Valid: true,
-					ErrorObject: APIErrorObject{
-						Code:    420,
-						Message: "Enhance Your Calm",
-						Errors:  []string{"Enhance Your Calm"},
-					},
-				},
-			},
-			want: true,
-		},
-		{
-			name: "not_found",
-			a: APIError{
-				StatusCode: http.StatusNotFound,
-				APIError: NullAPIErrorObject{
-					Valid: true,
-					ErrorObject: APIErrorObject{
-						Code:    2100,
-						Message: "Not Found",
-						Errors:  []string{"Not Found"},
-					},
-				},
-			},
-			want: false,
-		},
-		{
-			name: "InternalServerError",
-			a: APIError{
-				StatusCode: http.StatusInternalServerError,
-			},
-			want: true,
-		},
-		{
-			name: "ServiceUnavailable",
-			a: APIError{
-				StatusCode: http.StatusServiceUnavailable,
-			},
-			want: true,
-		},
-	}
-
-	for _, tt := range tests {
-		tt := tt
-
-		t.Run(tt.name, func(t *testing.T) {
-			if got := tt.a.Temporary(); got != tt.want {
-				t.Fatalf("tt.a.Temporary() = %t, want %t", got, tt.want)
-			}
-		})
-	}
-}
-
-func TestAPIError_NotFound(t *testing.T) {
-	tests := []struct {
-		name string
-		a    APIError
-		want bool
-	}{
-		{
-			name: "rate_limited",
-			a: APIError{
-				StatusCode: http.StatusTooManyRequests,
-				APIError: NullAPIErrorObject{
-					Valid: true,
-					ErrorObject: APIErrorObject{
-						Code:    420,
-						Message: "Enhance Your Calm",
-						Errors:  []string{"Enhance Your Calm"},
-					},
-				},
-			},
-			want: false,
-		},
-		{
-			name: "not_found",
-			a: APIError{
-				StatusCode: http.StatusNotFound,
-				APIError: NullAPIErrorObject{
-					Valid: true,
-					ErrorObject: APIErrorObject{
-						Code:    2100,
-						Message: "Not Found",
-						Errors:  []string{"Not Found"},
-					},
-				},
-			},
-			want: true,
-		},
-		{
-			name: "not_found_weird_status",
-			a: APIError{
-				StatusCode: http.StatusBadRequest,
-				APIError: NullAPIErrorObject{
-					Valid: true,
-					ErrorObject: APIErrorObject{
-						Code:    2100,
-						Message: "Not Found",
-						Errors:  []string{"Not Found"},
-					},
-				},
-			},
-			want: true,
-		},
-		{
-			name: "not_found_weird_error_code",
-			a: APIError{
-				StatusCode: http.StatusNotFound,
-				APIError: NullAPIErrorObject{
-					ErrorObject: APIErrorObject{
-						Code:    2101,
-						Message: "Not Found",
-						Errors:  []string{"Not Found"},
-					},
-				},
-			},
-			want: true,
-		},
-	}
-
-	for _, tt := range tests {
-		tt := tt
-
-		t.Run(tt.name, func(t *testing.T) {
-			if got := tt.a.NotFound(); got != tt.want {
-				t.Fatalf("tt.a.NotFound() = %t, want %t", got, tt.want)
-			}
-		})
-	}
-}
diff --git a/log_entry_test.go b/log_entry_test.go
index fbc6e03..ee2114a 100644
--- a/log_entry_test.go
+++ b/log_entry_test.go
@@ -1,6 +1,7 @@
 package pagerduty
 
 import (
+	"encoding/json"
 	"net/http"
 	"testing"
 )
@@ -72,3 +73,51 @@ func TestLogEntry_Get(t *testing.T) {
 	}
 	testEqual(t, want, res)
 }
+
+func TestChannel_MarhalUnmarshal(t *testing.T) {
+	logEntryRaw := []byte(`{
+		"id": "1",
+		"type": "trigger_log_entry",
+		"summary": "foo",
+		"channel": {
+			"type": "web_trigger",
+			"summary": "My new incident",
+			"details_omitted": false
+		}
+	}`)
+	want := &LogEntry{
+		CommonLogEntryField: CommonLogEntryField{
+			APIObject: APIObject{
+				ID:      "1",
+				Type:    "trigger_log_entry",
+				Summary: "foo",
+			},
+			Channel: Channel{
+				Type: "web_trigger",
+				Raw: map[string]interface{}{
+					"type":            "web_trigger",
+					"summary":         "My new incident",
+					"details_omitted": false,
+				},
+			},
+		},
+	}
+
+	logEntry := &LogEntry{}
+	if err := json.Unmarshal(logEntryRaw, logEntry); err != nil {
+		t.Fatal(err)
+	}
+
+	testEqual(t, want, logEntry)
+
+	newLogEntryRaw, err := json.Marshal(logEntry)
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	newLogEntry := &LogEntry{}
+	if err := json.Unmarshal(newLogEntryRaw, newLogEntry); err != nil {
+		t.Fatal(err)
+	}
+	testEqual(t, want, newLogEntry)
+}