account_agreements.go raw

   1  package linodego
   2  
   3  import "context"
   4  
   5  // AccountAgreements represents the agreements and their acceptance status for an Account
   6  type AccountAgreements struct {
   7  	EUModel                bool `json:"eu_model"`
   8  	MasterServiceAgreement bool `json:"master_service_agreement"`
   9  	PrivacyPolicy          bool `json:"privacy_policy"`
  10  }
  11  
  12  // AccountAgreementsUpdateOptions fields are those accepted by UpdateAccountAgreements
  13  type AccountAgreementsUpdateOptions struct {
  14  	EUModel                bool `json:"eu_model,omitempty"`
  15  	MasterServiceAgreement bool `json:"master_service_agreement,omitempty"`
  16  	PrivacyPolicy          bool `json:"privacy_policy,omitempty"`
  17  }
  18  
  19  // GetUpdateOptions converts an AccountAgreements to AccountAgreementsUpdateOptions for use in UpdateAccountAgreements
  20  func (i AccountAgreements) GetUpdateOptions() (o AccountAgreementsUpdateOptions) {
  21  	o.EUModel = i.EUModel
  22  	o.MasterServiceAgreement = i.MasterServiceAgreement
  23  	o.PrivacyPolicy = i.PrivacyPolicy
  24  
  25  	return o
  26  }
  27  
  28  // GetAccountAgreements gets all agreements and their acceptance status for the Account.
  29  func (c *Client) GetAccountAgreements(ctx context.Context) (*AccountAgreements, error) {
  30  	return doGETRequest[AccountAgreements](ctx, c, "account/agreements")
  31  }
  32  
  33  // AcknowledgeAccountAgreements acknowledges account agreements for the Account
  34  func (c *Client) AcknowledgeAccountAgreements(ctx context.Context, opts AccountAgreementsUpdateOptions) error {
  35  	return doPOSTRequestNoResponseBody(ctx, c, "account/agreements", opts)
  36  }
  37