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 Locale struct {
34	Session *session.Session
35	Options sl.Options
36}
37
38// GetLocaleService returns an instance of the Locale SoftLayer service
39func GetLocaleService(sess *session.Session) Locale {
40	return Locale{Session: sess}
41}
42
43func (r Locale) Id(id int) Locale {
44	r.Options.Id = &id
45	return r
46}
47
48func (r Locale) Mask(mask string) Locale {
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 Locale) Filter(filter string) Locale {
58	r.Options.Filter = filter
59	return r
60}
61
62func (r Locale) Limit(limit int) Locale {
63	r.Options.Limit = &limit
64	return r
65}
66
67func (r Locale) Offset(offset int) Locale {
68	r.Options.Offset = &offset
69	return r
70}
71
72// no documentation yet
73func (r Locale) GetClosestToLanguageTag(languageTag *string) (resp datatypes.Locale, err error) {
74	params := []interface{}{
75		languageTag,
76	}
77	err = r.Session.DoRequest("SoftLayer_Locale", "getClosestToLanguageTag", params, &r.Options, &resp)
78	return
79}
80
81// no documentation yet
82func (r Locale) GetObject() (resp datatypes.Locale, err error) {
83	err = r.Session.DoRequest("SoftLayer_Locale", "getObject", nil, &r.Options, &resp)
84	return
85}
86
87// no documentation yet
88type Locale_Country struct {
89	Session *session.Session
90	Options sl.Options
91}
92
93// GetLocaleCountryService returns an instance of the Locale_Country SoftLayer service
94func GetLocaleCountryService(sess *session.Session) Locale_Country {
95	return Locale_Country{Session: sess}
96}
97
98func (r Locale_Country) Id(id int) Locale_Country {
99	r.Options.Id = &id
100	return r
101}
102
103func (r Locale_Country) Mask(mask string) Locale_Country {
104	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
105		mask = fmt.Sprintf("mask[%s]", mask)
106	}
107
108	r.Options.Mask = mask
109	return r
110}
111
112func (r Locale_Country) Filter(filter string) Locale_Country {
113	r.Options.Filter = filter
114	return r
115}
116
117func (r Locale_Country) Limit(limit int) Locale_Country {
118	r.Options.Limit = &limit
119	return r
120}
121
122func (r Locale_Country) Offset(offset int) Locale_Country {
123	r.Options.Offset = &offset
124	return r
125}
126
127// This method is to get the collection of VAT country codes and VAT ID Regexes.
128func (r Locale_Country) GetAllVatCountryCodesAndVatIdRegexes() (resp []datatypes.Container_Collection_Locale_VatCountryCodeAndFormat, err error) {
129	err = r.Session.DoRequest("SoftLayer_Locale_Country", "getAllVatCountryCodesAndVatIdRegexes", nil, &r.Options, &resp)
130	return
131}
132
133// Use this method to retrieve a list of countries and locale information available to the current user.
134func (r Locale_Country) GetAvailableCountries() (resp []datatypes.Locale_Country, err error) {
135	err = r.Session.DoRequest("SoftLayer_Locale_Country", "getAvailableCountries", nil, &r.Options, &resp)
136	return
137}
138
139// Use this method to retrieve a list of countries and locale information such as country code and state/provinces.
140func (r Locale_Country) GetCountries() (resp []datatypes.Locale_Country, err error) {
141	err = r.Session.DoRequest("SoftLayer_Locale_Country", "getCountries", nil, &r.Options, &resp)
142	return
143}
144
145// This method will return a collection of [[SoftLayer_Container_Collection_Locale_CountryCode]] objects. If the country has states, a [[SoftLayer_Container_Collection_Locale_StateCode]] collection will be provided with the country.
146func (r Locale_Country) GetCountriesAndStates(usFirstFlag *bool) (resp []datatypes.Container_Collection_Locale_CountryCode, err error) {
147	params := []interface{}{
148		usFirstFlag,
149	}
150	err = r.Session.DoRequest("SoftLayer_Locale_Country", "getCountriesAndStates", params, &r.Options, &resp)
151	return
152}
153
154// no documentation yet
155func (r Locale_Country) GetObject() (resp datatypes.Locale_Country, err error) {
156	err = r.Session.DoRequest("SoftLayer_Locale_Country", "getObject", nil, &r.Options, &resp)
157	return
158}
159
160// This method will return an array of country codes that require postal code
161func (r Locale_Country) GetPostalCodeRequiredCountryCodes() (resp []string, err error) {
162	err = r.Session.DoRequest("SoftLayer_Locale_Country", "getPostalCodeRequiredCountryCodes", nil, &r.Options, &resp)
163	return
164}
165
166// Retrieve States that belong to this country.
167func (r Locale_Country) GetStates() (resp []datatypes.Locale_StateProvince, err error) {
168	err = r.Session.DoRequest("SoftLayer_Locale_Country", "getStates", nil, &r.Options, &resp)
169	return
170}
171
172// This method will return an array of ISO 3166 Alpha-2 country codes that use a Value-Added Tax (VAT) ID. Note the difference between [[SoftLayer_Locale_Country/getVatRequiredCountryCodes]] - this method will provide <strong>all</strong> country codes that use VAT ID, including those which are required.
173func (r Locale_Country) GetVatCountries() (resp []string, err error) {
174	err = r.Session.DoRequest("SoftLayer_Locale_Country", "getVatCountries", nil, &r.Options, &resp)
175	return
176}
177
178// This method will return an array of ISO 3166 Alpha-2 country codes that use a Value-Added Tax (VAT) ID. Note the difference between [[SoftLayer_Locale_Country/getVatCountries]] - this method will provide country codes where a VAT ID is required for onboarding to IBM Cloud.
179func (r Locale_Country) GetVatRequiredCountryCodes() (resp []string, err error) {
180	err = r.Session.DoRequest("SoftLayer_Locale_Country", "getVatRequiredCountryCodes", nil, &r.Options, &resp)
181	return
182}
183
184// Returns true if the country code is in the European Union (EU), false otherwise.
185func (r Locale_Country) IsEuropeanUnionCountry(iso2CountryCode *string) (resp bool, err error) {
186	params := []interface{}{
187		iso2CountryCode,
188	}
189	err = r.Session.DoRequest("SoftLayer_Locale_Country", "isEuropeanUnionCountry", params, &r.Options, &resp)
190	return
191}
192
193// Each User is assigned a timezone allowing for a precise local timestamp.
194type Locale_Timezone struct {
195	Session *session.Session
196	Options sl.Options
197}
198
199// GetLocaleTimezoneService returns an instance of the Locale_Timezone SoftLayer service
200func GetLocaleTimezoneService(sess *session.Session) Locale_Timezone {
201	return Locale_Timezone{Session: sess}
202}
203
204func (r Locale_Timezone) Id(id int) Locale_Timezone {
205	r.Options.Id = &id
206	return r
207}
208
209func (r Locale_Timezone) Mask(mask string) Locale_Timezone {
210	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
211		mask = fmt.Sprintf("mask[%s]", mask)
212	}
213
214	r.Options.Mask = mask
215	return r
216}
217
218func (r Locale_Timezone) Filter(filter string) Locale_Timezone {
219	r.Options.Filter = filter
220	return r
221}
222
223func (r Locale_Timezone) Limit(limit int) Locale_Timezone {
224	r.Options.Limit = &limit
225	return r
226}
227
228func (r Locale_Timezone) Offset(offset int) Locale_Timezone {
229	r.Options.Offset = &offset
230	return r
231}
232
233// Retrieve all timezone objects.
234func (r Locale_Timezone) GetAllObjects() (resp []datatypes.Locale_Timezone, err error) {
235	err = r.Session.DoRequest("SoftLayer_Locale_Timezone", "getAllObjects", nil, &r.Options, &resp)
236	return
237}
238
239// getObject retrieves the SoftLayer_Locale_Timezone object whose ID number corresponds to the ID number of the init parameter passed to the SoftLayer_Locale_Timezone service.
240func (r Locale_Timezone) GetObject() (resp datatypes.Locale_Timezone, err error) {
241	err = r.Session.DoRequest("SoftLayer_Locale_Timezone", "getObject", nil, &r.Options, &resp)
242	return
243}
244