account_activity.go raw

   1  package rest
   2  
   3  import (
   4  	"net/http"
   5  
   6  	"gopkg.in/ns1/ns1-go.v2/rest/model/account"
   7  )
   8  
   9  // ActivityService handles 'account/activity' endpoint.
  10  type ActivityService service
  11  
  12  // List returns all activity in the account. It accepts a variadic number of
  13  // optional URL parameters that can be used to edit the endpoint's behavior.
  14  // Parameters are in the form of a `rest.Param` struct. The full list of valid
  15  // parameters for this endpoint are available in the documentation.
  16  //
  17  // NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/api/API--ns1--ibm-ns1-connect-api#getActivity
  18  func (s *ActivityService) List(params ...Param) ([]*account.Activity, *http.Response, error) {
  19  	req, err := s.client.NewRequest("GET", "account/activity", nil)
  20  	if err != nil {
  21  		return nil, nil, err
  22  	}
  23  
  24  	al := []*account.Activity{}
  25  	resp, err := s.client.Do(req, &al, params...)
  26  	if err != nil {
  27  		return nil, resp, err
  28  	}
  29  
  30  	return al, resp, nil
  31  }
  32