github.com/optim-corp/cios-golang-sdk@v0.5.1/cios/model_subscription.go (about)

     1  /*
     2   * Cios Openapi
     3   *
     4   * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
     5   *
     6   * API version: 1.0.1
     7   */
     8  
     9  // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
    10  
    11  package cios
    12  
    13  import (
    14  	"encoding/json"
    15  )
    16  
    17  // Subscription struct for Subscription
    18  type Subscription struct {
    19  	Id string `json:"id"`
    20  	Owner *SubscriptionOwner `json:"owner,omitempty"`
    21  	Items *[]SubscriptionItem `json:"items,omitempty"`
    22  	// UUID形式
    23  	ProviderId *string `json:"provider_id,omitempty"`
    24  	Quantity *int32 `json:"quantity,omitempty"`
    25  	Unit *string `json:"unit,omitempty"`
    26  	LicenseType *string `json:"license_type,omitempty"`
    27  	Status *string `json:"status,omitempty"`
    28  	// ISO8601
    29  	PurchasedAt *string `json:"purchased_at,omitempty"`
    30  	// ISO8601
    31  	IssuedAt *string `json:"issued_at,omitempty"`
    32  	// ISO8601
    33  	ExpiresAt *string `json:"expires_at,omitempty"`
    34  }
    35  
    36  // NewSubscription instantiates a new Subscription object
    37  // This constructor will assign default values to properties that have it defined,
    38  // and makes sure properties required by API are set, but the set of arguments
    39  // will change when the set of required properties is changed
    40  func NewSubscription(id string, ) *Subscription {
    41  	this := Subscription{}
    42  	this.Id = id
    43  	return &this
    44  }
    45  
    46  // NewSubscriptionWithDefaults instantiates a new Subscription object
    47  // This constructor will only assign default values to properties that have it defined,
    48  // but it doesn't guarantee that properties required by API are set
    49  func NewSubscriptionWithDefaults() *Subscription {
    50  	this := Subscription{}
    51  	return &this
    52  }
    53  
    54  // GetId returns the Id field value
    55  func (o *Subscription) GetId() string {
    56  	if o == nil  {
    57  		var ret string
    58  		return ret
    59  	}
    60  
    61  	return o.Id
    62  }
    63  
    64  // GetIdOk returns a tuple with the Id field value
    65  // and a boolean to check if the value has been set.
    66  func (o *Subscription) GetIdOk() (*string, bool) {
    67  	if o == nil  {
    68  		return nil, false
    69  	}
    70  	return &o.Id, true
    71  }
    72  
    73  // SetId sets field value
    74  func (o *Subscription) SetId(v string) {
    75  	o.Id = v
    76  }
    77  
    78  // GetOwner returns the Owner field value if set, zero value otherwise.
    79  func (o *Subscription) GetOwner() SubscriptionOwner {
    80  	if o == nil || o.Owner == nil {
    81  		var ret SubscriptionOwner
    82  		return ret
    83  	}
    84  	return *o.Owner
    85  }
    86  
    87  // GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise
    88  // and a boolean to check if the value has been set.
    89  func (o *Subscription) GetOwnerOk() (*SubscriptionOwner, bool) {
    90  	if o == nil || o.Owner == nil {
    91  		return nil, false
    92  	}
    93  	return o.Owner, true
    94  }
    95  
    96  // HasOwner returns a boolean if a field has been set.
    97  func (o *Subscription) HasOwner() bool {
    98  	if o != nil && o.Owner != nil {
    99  		return true
   100  	}
   101  
   102  	return false
   103  }
   104  
   105  // SetOwner gets a reference to the given SubscriptionOwner and assigns it to the Owner field.
   106  func (o *Subscription) SetOwner(v SubscriptionOwner) {
   107  	o.Owner = &v
   108  }
   109  
   110  // GetItems returns the Items field value if set, zero value otherwise.
   111  func (o *Subscription) GetItems() []SubscriptionItem {
   112  	if o == nil || o.Items == nil {
   113  		var ret []SubscriptionItem
   114  		return ret
   115  	}
   116  	return *o.Items
   117  }
   118  
   119  // GetItemsOk returns a tuple with the Items field value if set, nil otherwise
   120  // and a boolean to check if the value has been set.
   121  func (o *Subscription) GetItemsOk() (*[]SubscriptionItem, bool) {
   122  	if o == nil || o.Items == nil {
   123  		return nil, false
   124  	}
   125  	return o.Items, true
   126  }
   127  
   128  // HasItems returns a boolean if a field has been set.
   129  func (o *Subscription) HasItems() bool {
   130  	if o != nil && o.Items != nil {
   131  		return true
   132  	}
   133  
   134  	return false
   135  }
   136  
   137  // SetItems gets a reference to the given []SubscriptionItem and assigns it to the Items field.
   138  func (o *Subscription) SetItems(v []SubscriptionItem) {
   139  	o.Items = &v
   140  }
   141  
   142  // GetProviderId returns the ProviderId field value if set, zero value otherwise.
   143  func (o *Subscription) GetProviderId() string {
   144  	if o == nil || o.ProviderId == nil {
   145  		var ret string
   146  		return ret
   147  	}
   148  	return *o.ProviderId
   149  }
   150  
   151  // GetProviderIdOk returns a tuple with the ProviderId field value if set, nil otherwise
   152  // and a boolean to check if the value has been set.
   153  func (o *Subscription) GetProviderIdOk() (*string, bool) {
   154  	if o == nil || o.ProviderId == nil {
   155  		return nil, false
   156  	}
   157  	return o.ProviderId, true
   158  }
   159  
   160  // HasProviderId returns a boolean if a field has been set.
   161  func (o *Subscription) HasProviderId() bool {
   162  	if o != nil && o.ProviderId != nil {
   163  		return true
   164  	}
   165  
   166  	return false
   167  }
   168  
   169  // SetProviderId gets a reference to the given string and assigns it to the ProviderId field.
   170  func (o *Subscription) SetProviderId(v string) {
   171  	o.ProviderId = &v
   172  }
   173  
   174  // GetQuantity returns the Quantity field value if set, zero value otherwise.
   175  func (o *Subscription) GetQuantity() int32 {
   176  	if o == nil || o.Quantity == nil {
   177  		var ret int32
   178  		return ret
   179  	}
   180  	return *o.Quantity
   181  }
   182  
   183  // GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise
   184  // and a boolean to check if the value has been set.
   185  func (o *Subscription) GetQuantityOk() (*int32, bool) {
   186  	if o == nil || o.Quantity == nil {
   187  		return nil, false
   188  	}
   189  	return o.Quantity, true
   190  }
   191  
   192  // HasQuantity returns a boolean if a field has been set.
   193  func (o *Subscription) HasQuantity() bool {
   194  	if o != nil && o.Quantity != nil {
   195  		return true
   196  	}
   197  
   198  	return false
   199  }
   200  
   201  // SetQuantity gets a reference to the given int32 and assigns it to the Quantity field.
   202  func (o *Subscription) SetQuantity(v int32) {
   203  	o.Quantity = &v
   204  }
   205  
   206  // GetUnit returns the Unit field value if set, zero value otherwise.
   207  func (o *Subscription) GetUnit() string {
   208  	if o == nil || o.Unit == nil {
   209  		var ret string
   210  		return ret
   211  	}
   212  	return *o.Unit
   213  }
   214  
   215  // GetUnitOk returns a tuple with the Unit field value if set, nil otherwise
   216  // and a boolean to check if the value has been set.
   217  func (o *Subscription) GetUnitOk() (*string, bool) {
   218  	if o == nil || o.Unit == nil {
   219  		return nil, false
   220  	}
   221  	return o.Unit, true
   222  }
   223  
   224  // HasUnit returns a boolean if a field has been set.
   225  func (o *Subscription) HasUnit() bool {
   226  	if o != nil && o.Unit != nil {
   227  		return true
   228  	}
   229  
   230  	return false
   231  }
   232  
   233  // SetUnit gets a reference to the given string and assigns it to the Unit field.
   234  func (o *Subscription) SetUnit(v string) {
   235  	o.Unit = &v
   236  }
   237  
   238  // GetLicenseType returns the LicenseType field value if set, zero value otherwise.
   239  func (o *Subscription) GetLicenseType() string {
   240  	if o == nil || o.LicenseType == nil {
   241  		var ret string
   242  		return ret
   243  	}
   244  	return *o.LicenseType
   245  }
   246  
   247  // GetLicenseTypeOk returns a tuple with the LicenseType field value if set, nil otherwise
   248  // and a boolean to check if the value has been set.
   249  func (o *Subscription) GetLicenseTypeOk() (*string, bool) {
   250  	if o == nil || o.LicenseType == nil {
   251  		return nil, false
   252  	}
   253  	return o.LicenseType, true
   254  }
   255  
   256  // HasLicenseType returns a boolean if a field has been set.
   257  func (o *Subscription) HasLicenseType() bool {
   258  	if o != nil && o.LicenseType != nil {
   259  		return true
   260  	}
   261  
   262  	return false
   263  }
   264  
   265  // SetLicenseType gets a reference to the given string and assigns it to the LicenseType field.
   266  func (o *Subscription) SetLicenseType(v string) {
   267  	o.LicenseType = &v
   268  }
   269  
   270  // GetStatus returns the Status field value if set, zero value otherwise.
   271  func (o *Subscription) GetStatus() string {
   272  	if o == nil || o.Status == nil {
   273  		var ret string
   274  		return ret
   275  	}
   276  	return *o.Status
   277  }
   278  
   279  // GetStatusOk returns a tuple with the Status field value if set, nil otherwise
   280  // and a boolean to check if the value has been set.
   281  func (o *Subscription) GetStatusOk() (*string, bool) {
   282  	if o == nil || o.Status == nil {
   283  		return nil, false
   284  	}
   285  	return o.Status, true
   286  }
   287  
   288  // HasStatus returns a boolean if a field has been set.
   289  func (o *Subscription) HasStatus() bool {
   290  	if o != nil && o.Status != nil {
   291  		return true
   292  	}
   293  
   294  	return false
   295  }
   296  
   297  // SetStatus gets a reference to the given string and assigns it to the Status field.
   298  func (o *Subscription) SetStatus(v string) {
   299  	o.Status = &v
   300  }
   301  
   302  // GetPurchasedAt returns the PurchasedAt field value if set, zero value otherwise.
   303  func (o *Subscription) GetPurchasedAt() string {
   304  	if o == nil || o.PurchasedAt == nil {
   305  		var ret string
   306  		return ret
   307  	}
   308  	return *o.PurchasedAt
   309  }
   310  
   311  // GetPurchasedAtOk returns a tuple with the PurchasedAt field value if set, nil otherwise
   312  // and a boolean to check if the value has been set.
   313  func (o *Subscription) GetPurchasedAtOk() (*string, bool) {
   314  	if o == nil || o.PurchasedAt == nil {
   315  		return nil, false
   316  	}
   317  	return o.PurchasedAt, true
   318  }
   319  
   320  // HasPurchasedAt returns a boolean if a field has been set.
   321  func (o *Subscription) HasPurchasedAt() bool {
   322  	if o != nil && o.PurchasedAt != nil {
   323  		return true
   324  	}
   325  
   326  	return false
   327  }
   328  
   329  // SetPurchasedAt gets a reference to the given string and assigns it to the PurchasedAt field.
   330  func (o *Subscription) SetPurchasedAt(v string) {
   331  	o.PurchasedAt = &v
   332  }
   333  
   334  // GetIssuedAt returns the IssuedAt field value if set, zero value otherwise.
   335  func (o *Subscription) GetIssuedAt() string {
   336  	if o == nil || o.IssuedAt == nil {
   337  		var ret string
   338  		return ret
   339  	}
   340  	return *o.IssuedAt
   341  }
   342  
   343  // GetIssuedAtOk returns a tuple with the IssuedAt field value if set, nil otherwise
   344  // and a boolean to check if the value has been set.
   345  func (o *Subscription) GetIssuedAtOk() (*string, bool) {
   346  	if o == nil || o.IssuedAt == nil {
   347  		return nil, false
   348  	}
   349  	return o.IssuedAt, true
   350  }
   351  
   352  // HasIssuedAt returns a boolean if a field has been set.
   353  func (o *Subscription) HasIssuedAt() bool {
   354  	if o != nil && o.IssuedAt != nil {
   355  		return true
   356  	}
   357  
   358  	return false
   359  }
   360  
   361  // SetIssuedAt gets a reference to the given string and assigns it to the IssuedAt field.
   362  func (o *Subscription) SetIssuedAt(v string) {
   363  	o.IssuedAt = &v
   364  }
   365  
   366  // GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise.
   367  func (o *Subscription) GetExpiresAt() string {
   368  	if o == nil || o.ExpiresAt == nil {
   369  		var ret string
   370  		return ret
   371  	}
   372  	return *o.ExpiresAt
   373  }
   374  
   375  // GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise
   376  // and a boolean to check if the value has been set.
   377  func (o *Subscription) GetExpiresAtOk() (*string, bool) {
   378  	if o == nil || o.ExpiresAt == nil {
   379  		return nil, false
   380  	}
   381  	return o.ExpiresAt, true
   382  }
   383  
   384  // HasExpiresAt returns a boolean if a field has been set.
   385  func (o *Subscription) HasExpiresAt() bool {
   386  	if o != nil && o.ExpiresAt != nil {
   387  		return true
   388  	}
   389  
   390  	return false
   391  }
   392  
   393  // SetExpiresAt gets a reference to the given string and assigns it to the ExpiresAt field.
   394  func (o *Subscription) SetExpiresAt(v string) {
   395  	o.ExpiresAt = &v
   396  }
   397  
   398  func (o Subscription) MarshalJSON() ([]byte, error) {
   399  	toSerialize := map[string]interface{}{}
   400  	if true {
   401  		toSerialize["id"] = o.Id
   402  	}
   403  	if o.Owner != nil {
   404  		toSerialize["owner"] = o.Owner
   405  	}
   406  	if o.Items != nil {
   407  		toSerialize["items"] = o.Items
   408  	}
   409  	if o.ProviderId != nil {
   410  		toSerialize["provider_id"] = o.ProviderId
   411  	}
   412  	if o.Quantity != nil {
   413  		toSerialize["quantity"] = o.Quantity
   414  	}
   415  	if o.Unit != nil {
   416  		toSerialize["unit"] = o.Unit
   417  	}
   418  	if o.LicenseType != nil {
   419  		toSerialize["license_type"] = o.LicenseType
   420  	}
   421  	if o.Status != nil {
   422  		toSerialize["status"] = o.Status
   423  	}
   424  	if o.PurchasedAt != nil {
   425  		toSerialize["purchased_at"] = o.PurchasedAt
   426  	}
   427  	if o.IssuedAt != nil {
   428  		toSerialize["issued_at"] = o.IssuedAt
   429  	}
   430  	if o.ExpiresAt != nil {
   431  		toSerialize["expires_at"] = o.ExpiresAt
   432  	}
   433  	return json.Marshal(toSerialize)
   434  }
   435  
   436  type NullableSubscription struct {
   437  	value *Subscription
   438  	isSet bool
   439  }
   440  
   441  func (v NullableSubscription) Get() *Subscription {
   442  	return v.value
   443  }
   444  
   445  func (v *NullableSubscription) Set(val *Subscription) {
   446  	v.value = val
   447  	v.isSet = true
   448  }
   449  
   450  func (v NullableSubscription) IsSet() bool {
   451  	return v.isSet
   452  }
   453  
   454  func (v *NullableSubscription) Unset() {
   455  	v.value = nil
   456  	v.isSet = false
   457  }
   458  
   459  func NewNullableSubscription(val *Subscription) *NullableSubscription {
   460  	return &NullableSubscription{value: val, isSet: true}
   461  }
   462  
   463  func (v NullableSubscription) MarshalJSON() ([]byte, error) {
   464  	return json.Marshal(v.value)
   465  }
   466  
   467  func (v *NullableSubscription) UnmarshalJSON(src []byte) error {
   468  	v.isSet = true
   469  	return json.Unmarshal(src, &v.value)
   470  }
   471  
   472