sales.go raw

   1  /**
   2   * Copyright 2016-2024 IBM Corp.
   3   *
   4   * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
   5   * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
   6   *
   7   * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
   8   * on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   9   * See the License for the specific language governing permissions and limitations under the License.
  10   */
  11  
  12  // AUTOMATICALLY GENERATED CODE - DO NOT MODIFY
  13  
  14  package services
  15  
  16  import (
  17  	"fmt"
  18  	"strings"
  19  
  20  	"github.com/softlayer/softlayer-go/datatypes"
  21  	"github.com/softlayer/softlayer-go/session"
  22  	"github.com/softlayer/softlayer-go/sl"
  23  )
  24  
  25  // The presale event data types indicate the information regarding an individual presale event. The ”'locationId”' will indicate the datacenter associated with the presale event. The ”'itemId”' will indicate the product item associated with a particular presale event - however these are more rare. The ”'startDate”' and ”'endDate”' will provide information regarding when the presale event is available for use. At the end of the presale event, the server or services purchased will be available once approved and provisioned.
  26  type Sales_Presale_Event struct {
  27  	Session session.SLSession
  28  	Options sl.Options
  29  }
  30  
  31  // GetSalesPresaleEventService returns an instance of the Sales_Presale_Event SoftLayer service
  32  func GetSalesPresaleEventService(sess session.SLSession) Sales_Presale_Event {
  33  	return Sales_Presale_Event{Session: sess}
  34  }
  35  
  36  func (r Sales_Presale_Event) Id(id int) Sales_Presale_Event {
  37  	r.Options.Id = &id
  38  	return r
  39  }
  40  
  41  func (r Sales_Presale_Event) Mask(mask string) Sales_Presale_Event {
  42  	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
  43  		mask = fmt.Sprintf("mask[%s]", mask)
  44  	}
  45  
  46  	r.Options.Mask = mask
  47  	return r
  48  }
  49  
  50  func (r Sales_Presale_Event) Filter(filter string) Sales_Presale_Event {
  51  	r.Options.Filter = filter
  52  	return r
  53  }
  54  
  55  func (r Sales_Presale_Event) Limit(limit int) Sales_Presale_Event {
  56  	r.Options.Limit = &limit
  57  	return r
  58  }
  59  
  60  func (r Sales_Presale_Event) Offset(offset int) Sales_Presale_Event {
  61  	r.Options.Offset = &offset
  62  	return r
  63  }
  64  
  65  // Retrieve A flag to indicate that the presale event is currently active. A presale event is active if the current time is between the start and end dates.
  66  func (r Sales_Presale_Event) GetActiveFlag() (resp bool, err error) {
  67  	err = r.Session.DoRequest("SoftLayer_Sales_Presale_Event", "getActiveFlag", nil, &r.Options, &resp)
  68  	return
  69  }
  70  
  71  // no documentation yet
  72  func (r Sales_Presale_Event) GetAllObjects() (resp []datatypes.Sales_Presale_Event, err error) {
  73  	err = r.Session.DoRequest("SoftLayer_Sales_Presale_Event", "getAllObjects", nil, &r.Options, &resp)
  74  	return
  75  }
  76  
  77  // Retrieve A flag to indicate that the presale event is expired. A presale event is expired if the current time is after the end date.
  78  func (r Sales_Presale_Event) GetExpiredFlag() (resp bool, err error) {
  79  	err = r.Session.DoRequest("SoftLayer_Sales_Presale_Event", "getExpiredFlag", nil, &r.Options, &resp)
  80  	return
  81  }
  82  
  83  // Retrieve The [[SoftLayer_Product_Item]] associated with the presale event.
  84  func (r Sales_Presale_Event) GetItem() (resp datatypes.Product_Item, err error) {
  85  	err = r.Session.DoRequest("SoftLayer_Sales_Presale_Event", "getItem", nil, &r.Options, &resp)
  86  	return
  87  }
  88  
  89  // Retrieve The [[SoftLayer_Location]] associated with the presale event.
  90  func (r Sales_Presale_Event) GetLocation() (resp datatypes.Location, err error) {
  91  	err = r.Session.DoRequest("SoftLayer_Sales_Presale_Event", "getLocation", nil, &r.Options, &resp)
  92  	return
  93  }
  94  
  95  // ”'getObject”' retrieves the [[SoftLayer_Sales_Presale_Event]] object whose id number corresponds to the id number of the init parameter passed to the SoftLayer_Sales_Presale_Event service. Customers may only retrieve presale events that are currently active.
  96  func (r Sales_Presale_Event) GetObject() (resp datatypes.Sales_Presale_Event, err error) {
  97  	err = r.Session.DoRequest("SoftLayer_Sales_Presale_Event", "getObject", nil, &r.Options, &resp)
  98  	return
  99  }
 100  
 101  // Retrieve The orders ([[SoftLayer_Billing_Order]]) associated with this presale event that were created for the customer's account.
 102  func (r Sales_Presale_Event) GetOrders() (resp []datatypes.Billing_Order, err error) {
 103  	err = r.Session.DoRequest("SoftLayer_Sales_Presale_Event", "getOrders", nil, &r.Options, &resp)
 104  	return
 105  }
 106