1/**
2 * Copyright 2016 IBM Corp.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *    http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/**
18 * AUTOMATICALLY GENERATED CODE - DO NOT MODIFY
19 */
20
21package services
22
23import (
24	"fmt"
25	"strings"
26
27	"github.com/softlayer/softlayer-go/datatypes"
28	"github.com/softlayer/softlayer-go/session"
29	"github.com/softlayer/softlayer-go/sl"
30)
31
32// no documentation yet
33type Email_Subscription struct {
34	Session *session.Session
35	Options sl.Options
36}
37
38// GetEmailSubscriptionService returns an instance of the Email_Subscription SoftLayer service
39func GetEmailSubscriptionService(sess *session.Session) Email_Subscription {
40	return Email_Subscription{Session: sess}
41}
42
43func (r Email_Subscription) Id(id int) Email_Subscription {
44	r.Options.Id = &id
45	return r
46}
47
48func (r Email_Subscription) Mask(mask string) Email_Subscription {
49	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
50		mask = fmt.Sprintf("mask[%s]", mask)
51	}
52
53	r.Options.Mask = mask
54	return r
55}
56
57func (r Email_Subscription) Filter(filter string) Email_Subscription {
58	r.Options.Filter = filter
59	return r
60}
61
62func (r Email_Subscription) Limit(limit int) Email_Subscription {
63	r.Options.Limit = &limit
64	return r
65}
66
67func (r Email_Subscription) Offset(offset int) Email_Subscription {
68	r.Options.Offset = &offset
69	return r
70}
71
72// no documentation yet
73func (r Email_Subscription) Disable() (resp bool, err error) {
74	err = r.Session.DoRequest("SoftLayer_Email_Subscription", "disable", nil, &r.Options, &resp)
75	return
76}
77
78// no documentation yet
79func (r Email_Subscription) Enable() (resp bool, err error) {
80	err = r.Session.DoRequest("SoftLayer_Email_Subscription", "enable", nil, &r.Options, &resp)
81	return
82}
83
84// no documentation yet
85func (r Email_Subscription) GetAllObjects() (resp []datatypes.Email_Subscription, err error) {
86	err = r.Session.DoRequest("SoftLayer_Email_Subscription", "getAllObjects", nil, &r.Options, &resp)
87	return
88}
89
90// Retrieve
91func (r Email_Subscription) GetEnabled() (resp bool, err error) {
92	err = r.Session.DoRequest("SoftLayer_Email_Subscription", "getEnabled", nil, &r.Options, &resp)
93	return
94}
95
96// no documentation yet
97func (r Email_Subscription) GetObject() (resp datatypes.Email_Subscription, err error) {
98	err = r.Session.DoRequest("SoftLayer_Email_Subscription", "getObject", nil, &r.Options, &resp)
99	return
100}
101
102// no documentation yet
103type Email_Subscription_Group struct {
104	Session *session.Session
105	Options sl.Options
106}
107
108// GetEmailSubscriptionGroupService returns an instance of the Email_Subscription_Group SoftLayer service
109func GetEmailSubscriptionGroupService(sess *session.Session) Email_Subscription_Group {
110	return Email_Subscription_Group{Session: sess}
111}
112
113func (r Email_Subscription_Group) Id(id int) Email_Subscription_Group {
114	r.Options.Id = &id
115	return r
116}
117
118func (r Email_Subscription_Group) Mask(mask string) Email_Subscription_Group {
119	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
120		mask = fmt.Sprintf("mask[%s]", mask)
121	}
122
123	r.Options.Mask = mask
124	return r
125}
126
127func (r Email_Subscription_Group) Filter(filter string) Email_Subscription_Group {
128	r.Options.Filter = filter
129	return r
130}
131
132func (r Email_Subscription_Group) Limit(limit int) Email_Subscription_Group {
133	r.Options.Limit = &limit
134	return r
135}
136
137func (r Email_Subscription_Group) Offset(offset int) Email_Subscription_Group {
138	r.Options.Offset = &offset
139	return r
140}
141
142// no documentation yet
143func (r Email_Subscription_Group) GetAllObjects() (resp []datatypes.Email_Subscription_Group, err error) {
144	err = r.Session.DoRequest("SoftLayer_Email_Subscription_Group", "getAllObjects", nil, &r.Options, &resp)
145	return
146}
147
148// no documentation yet
149func (r Email_Subscription_Group) GetObject() (resp datatypes.Email_Subscription_Group, err error) {
150	err = r.Session.DoRequest("SoftLayer_Email_Subscription_Group", "getObject", nil, &r.Options, &resp)
151	return
152}
153
154// Retrieve All email subscriptions associated with this group.
155func (r Email_Subscription_Group) GetSubscriptions() (resp []datatypes.Email_Subscription, err error) {
156	err = r.Session.DoRequest("SoftLayer_Email_Subscription_Group", "getSubscriptions", nil, &r.Options, &resp)
157	return
158}
159