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 FlexibleCredit_Program struct {
34	Session *session.Session
35	Options sl.Options
36}
37
38// GetFlexibleCreditProgramService returns an instance of the FlexibleCredit_Program SoftLayer service
39func GetFlexibleCreditProgramService(sess *session.Session) FlexibleCredit_Program {
40	return FlexibleCredit_Program{Session: sess}
41}
42
43func (r FlexibleCredit_Program) Id(id int) FlexibleCredit_Program {
44	r.Options.Id = &id
45	return r
46}
47
48func (r FlexibleCredit_Program) Mask(mask string) FlexibleCredit_Program {
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 FlexibleCredit_Program) Filter(filter string) FlexibleCredit_Program {
58	r.Options.Filter = filter
59	return r
60}
61
62func (r FlexibleCredit_Program) Limit(limit int) FlexibleCredit_Program {
63	r.Options.Limit = &limit
64	return r
65}
66
67func (r FlexibleCredit_Program) Offset(offset int) FlexibleCredit_Program {
68	r.Options.Offset = &offset
69	return r
70}
71
72// no documentation yet
73func (r FlexibleCredit_Program) GetAffiliatesAvailableForSelfEnrollmentByVerificationType(verificationTypeKeyName *string) (resp []datatypes.FlexibleCredit_Affiliate, err error) {
74	params := []interface{}{
75		verificationTypeKeyName,
76	}
77	err = r.Session.DoRequest("SoftLayer_FlexibleCredit_Program", "getAffiliatesAvailableForSelfEnrollmentByVerificationType", params, &r.Options, &resp)
78	return
79}
80
81// no documentation yet
82func (r FlexibleCredit_Program) GetCompanyTypes() (resp []datatypes.FlexibleCredit_Company_Type, err error) {
83	err = r.Session.DoRequest("SoftLayer_FlexibleCredit_Program", "getCompanyTypes", nil, &r.Options, &resp)
84	return
85}
86
87// no documentation yet
88func (r FlexibleCredit_Program) GetObject() (resp datatypes.FlexibleCredit_Program, err error) {
89	err = r.Session.DoRequest("SoftLayer_FlexibleCredit_Program", "getObject", nil, &r.Options, &resp)
90	return
91}
92
93// no documentation yet
94func (r FlexibleCredit_Program) SelfEnrollNewAccount(accountTemplate *datatypes.Account) (resp datatypes.Account, err error) {
95	params := []interface{}{
96		accountTemplate,
97	}
98	err = r.Session.DoRequest("SoftLayer_FlexibleCredit_Program", "selfEnrollNewAccount", params, &r.Options, &resp)
99	return
100}
101