login

package
v0.0.0-...-391253a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package login - This file is auto-generated from the update_all.sh script. Do not modify anything here. Any changes to this EndPoint should be made in the data.go file. The only exception is the AppService.login package.

Index

Constants

View Source
const (
	DateTimeFormat       = "2006-01-02T15:04:05"
	DefaultAuthTokenFile = "AuthToken.json"
	TokenValidHours      = 24
	LastLoginDateFormat  = "2006-01-02 15:04:05"
)
View Source
const Disabled = false
View Source
const EndPointName = "AppService.login"
View Source
const Url = "/v1/userService/login"

Variables

This section is empty.

Functions

This section is empty.

Types

type EndPoint

type EndPoint struct {
	api.EndPointStruct
	Request  Request
	Response Response
	Auth     *SunGrowAuth
}

EndPoint - Holds the request, response and web method structures.

func Assert

func Assert(e api.EndPoint) EndPoint

Assert - Used to obtain locally scoped EndPoint methods, (not visible from api.EndPoint).

func Init

func Init(apiRoot api.Web) EndPoint

Init - Used to initialize a new endpoint instance. Usually called from an area.

func (*EndPoint) AppKey

func (e *EndPoint) AppKey() string

func (EndPoint) CacheFilename

func (e EndPoint) CacheFilename() string

CacheFilename - Check if a cache file exists for this EndPoint.

func (EndPoint) Call

func (e EndPoint) Call() api.EndPoint

Call - Once RequestData is populated, this will access the iSolarCloud API and populate ResultData.

func (*EndPoint) CreateDate

func (e *EndPoint) CreateDate() string

func (*EndPoint) Email

func (e *EndPoint) Email() string

func (EndPoint) GetArea

func (e EndPoint) GetArea() api.AreaName

GetArea - Returns the API area that this EndPoint is located.

func (EndPoint) GetCacheTimeout

func (e EndPoint) GetCacheTimeout() time.Duration

GetCacheTimeout - Return the cache timeout for this EndPoint.

func (*EndPoint) GetData

func (e *EndPoint) GetData() api.DataMap

func (EndPoint) GetEndPointData

func (e EndPoint) GetEndPointData() api.DataMap

func (EndPoint) GetEndPointDataTables

func (e EndPoint) GetEndPointDataTables() output.Tables

func (EndPoint) GetEndPointResultTable

func (e EndPoint) GetEndPointResultTable() output.Table

func (EndPoint) GetError

func (e EndPoint) GetError() error

GetError - Get the error code for this EndPoint.

func (EndPoint) GetJsonData

func (e EndPoint) GetJsonData(raw bool) output.Json

GetJsonData - Get the JSON representation of ResultData, either as condensed or "pretty".

func (EndPoint) GetName

func (e EndPoint) GetName() api.EndPointName

GetName - Returns the API EndPoint name.

func (EndPoint) GetRequest

func (e EndPoint) GetRequest() Request

GetRequest - Get the Request structure as scoped by this endpoint.

func (EndPoint) GetRequestArgNames

func (e EndPoint) GetRequestArgNames() map[string]string

GetRequestArgNames -

func (EndPoint) GetRequestJson

func (e EndPoint) GetRequestJson() output.Json

GetRequestJson - Return the Request structure as a JSON string.

func (EndPoint) GetResponse

func (e EndPoint) GetResponse() Response

GetResponse - Get the Response structure as scoped by this endpoint.

func (EndPoint) GetResponseJson

func (e EndPoint) GetResponseJson() output.Json

GetResponseJson - Return the Response structure as a JSON string.

func (EndPoint) GetUrl

func (e EndPoint) GetUrl() api.EndPointUrl

GetUrl - Returns the API EndPoint url.

func (*EndPoint) HasTokenChanged

func (e *EndPoint) HasTokenChanged() bool

func (EndPoint) Help

func (e EndPoint) Help() string

Help - Return help information on the JSON structure used to populate RequestData.

func (*EndPoint) HoursFromLastLogin

func (e *EndPoint) HoursFromLastLogin() float64

func (EndPoint) Init

func (e EndPoint) Init(apiRoot api.Web) *EndPoint

Init - If the endpoint needs to be re-initialized.

func (EndPoint) IsDebug

func (e EndPoint) IsDebug() bool

IsDebug - Are we in debug mode?

func (EndPoint) IsDisabled

func (e EndPoint) IsDisabled() bool

IsDisabled - Is this endpoint disabled? See data.go Disabled constant.

func (EndPoint) IsError

func (e EndPoint) IsError() bool

IsError - Is there an error?

func (*EndPoint) IsOnline

func (e *EndPoint) IsOnline() bool

func (EndPoint) IsRequestValid

func (e EndPoint) IsRequestValid() error

IsRequestValid - Is api.RequestCommon and RequestData valid?

func (EndPoint) IsResponseValid

func (e EndPoint) IsResponseValid() error

IsResponseValid - Is api.ResponseCommon and ResultData valid?

func (*EndPoint) IsTokenInvalid

func (e *EndPoint) IsTokenInvalid() bool

func (*EndPoint) IsTokenValid

func (e *EndPoint) IsTokenValid() bool

func (*EndPoint) LastLogin

func (e *EndPoint) LastLogin() time.Time

func (*EndPoint) Login

func (e *EndPoint) Login(auth *SunGrowAuth) error

func (*EndPoint) LoginLastDate

func (e *EndPoint) LoginLastDate() string

func (*EndPoint) LoginLastIP

func (e *EndPoint) LoginLastIP() string

func (*EndPoint) LoginState

func (e *EndPoint) LoginState() string

func (EndPoint) MarshalJSON

func (e EndPoint) MarshalJSON() ([]byte, error)

MarshalJSON - Marshall the EndPoint.

func (*EndPoint) Print

func (e *EndPoint) Print()

func (EndPoint) ReadDataFile

func (e EndPoint) ReadDataFile() error

ReadDataFile - Read a JSON file and populate the ResultData structure. (File names will default to AREA-ENDPOINT.json )

func (*EndPoint) RemoveToken

func (e *EndPoint) RemoveToken() error

RemoveToken - Removes a token from a file path.

func (EndPoint) RequestFingerprint

func (e EndPoint) RequestFingerprint() string

RequestFingerprint - Check if a cache file exists for this EndPoint.

func (EndPoint) RequestRef

func (e EndPoint) RequestRef() interface{}

RequestRef - Return the locally scoped Request structure.

func (EndPoint) RequestString

func (e EndPoint) RequestString() string

RequestString - Return the Request structure as a human-readable string.

func (EndPoint) ResponseRef

func (e EndPoint) ResponseRef() interface{}

ResponseRef - Return the locally scoped Response structure.

func (EndPoint) ResponseString

func (e EndPoint) ResponseString() string

ResponseString - Return the Response structure as a human-readable string.

func (EndPoint) ResultDataRef

func (e EndPoint) ResultDataRef() ResultData

ResultDataRef - Return the locally scoped ResultData structure.

func (EndPoint) SetCacheTimeout

func (e EndPoint) SetCacheTimeout(duration time.Duration) api.EndPoint

SetCacheTimeout - Set the cache timeout for this EndPoint. (Defaults to 1 hour.)

func (EndPoint) SetError

func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint

SetError - Set the error code for this EndPoint.

func (EndPoint) SetFilenamePrefix

func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string

SetFilenamePrefix - Produce filename based on area and endpoint name.

func (EndPoint) SetRequest

func (e EndPoint) SetRequest(ref interface{}) api.EndPoint

SetRequest - Save an interface reference as either api.RequestCommon or RequestData.

func (EndPoint) SetRequestByJson

func (e EndPoint) SetRequestByJson(j output.Json) api.EndPoint

SetRequestByJson - Save RequestData from a JSON string.

func (EndPoint) SetResponse

func (e EndPoint) SetResponse(ref []byte) api.EndPoint

SetResponse - Save a JSON string to the Response structure. (Used by the web call method.)

func (*EndPoint) SetTokenInvalid

func (e *EndPoint) SetTokenInvalid()

func (EndPoint) String

func (e EndPoint) String() string

String - Stringer method for this EndPoint.

func (*EndPoint) Token

func (e *EndPoint) Token() string

func (*EndPoint) UserAccount

func (e *EndPoint) UserAccount() string

func (*EndPoint) UserId

func (e *EndPoint) UserId() string

func (*EndPoint) UserName

func (e *EndPoint) UserName() string

func (EndPoint) WriteDataFile

func (e EndPoint) WriteDataFile() error

WriteDataFile - Write to a file, the contents of ResultData as JSON. (File names will default to AREA-ENDPOINT.json )

type Request

type Request struct {
	api.RequestCommon
	RequestData
}

Request - Holds the api.RequestCommon and user RequestData structures. See data.go for request fields.

type RequestData

type RequestData struct {
	UserAccount  valueTypes.String `json:"user_account" required:"true"`
	UserPassword valueTypes.String `json:"user_password" required:"true"`
}

func (RequestData) Help

func (rd RequestData) Help() string

func (RequestData) IsValid

func (rd RequestData) IsValid() error

type Response

type Response struct {
	api.ResponseCommon
	ResultData ResultData `json:"result_data" PointIdReplace:"true"`
}

Response - Holds the api.ResponseCommon and endpoint specific ResultData structures. See data.go for response fields.

type ResultData

type ResultData struct {
	ErrTimes    valueTypes.String `json:"err_times"`
	LoginState  valueTypes.String `json:"login_state"`
	Msg         valueTypes.String `json:"msg"`
	RemainTimes valueTypes.String `json:"remain_times"`

	AcceptOrderNum         valueTypes.Integer  `json:"accept_order_num"`
	BackgroundColor        valueTypes.Integer  `json:"background_color"`
	CountryId              valueTypes.String   `json:"countryid"`
	CreateDate             valueTypes.String   `json:"createdate"`
	CreateUserId           valueTypes.String   `json:"createuserid"`
	CurrentOrderNum        valueTypes.Integer  `json:"current_order_num"`
	DisableTime            valueTypes.String   `json:"disable_time"`
	Email                  valueTypes.String   `json:"email"`
	EnglishName            interface{}         `json:"englishname"`
	GcjLatitude            valueTypes.Float    `json:"gcj_latitude"`
	GcjLongitude           valueTypes.Float    `json:"gcj_longitude"`
	ImToken                interface{}         `json:"im_token"`
	IsDST                  valueTypes.Bool     `json:"isDST"`
	IsAfsFlag              valueTypes.Bool     `json:"is_afs_flag"`
	IsAgreeGdpr            valueTypes.Bool     `json:"is_agree_gdpr"`
	IsAu                   valueTypes.Bool     `json:"is_au"`
	IsCanModifyUserAccount valueTypes.Bool     `json:"is_can_modify_user_account"`
	IsDisableMap           valueTypes.Bool     `json:"is_disable_map"`
	IsGdpr                 valueTypes.Bool     `json:"is_gdpr"`
	IsHaveIm               valueTypes.Bool     `json:"is_have_im"`
	IsNewVersion           valueTypes.Bool     `json:"is_new_version"`
	IsOnline               valueTypes.Bool     `json:"is_online"`
	IsOpenProtocol         valueTypes.Bool     `json:"is_open_protocol"`
	IsReceiveNotice        valueTypes.Bool     `json:"is_receive_notice"`
	IsSharePosition        valueTypes.Bool     `json:"is_share_position"`
	IsUploadLocation       valueTypes.Bool     `json:"is_upload_location"`
	IsUseSungrowBrand      valueTypes.Bool     `json:"is_use_sungrow_brand"`
	IsValidMobileEmail     valueTypes.Bool     `json:"is_valid_mobile_email"`
	Isdst                  valueTypes.Bool     `json:"isdst"`
	Jobs                   interface{}         `json:"jobs"`
	Language               valueTypes.String   `json:"language"`
	LoginFirstDate         valueTypes.DateTime `json:"loginFirstDate" PointNameDateFormat:"DateTimeLayout"`
	LoginFirstDate2        valueTypes.DateTime `json:"loginFristDate" PointNameDateFormat:"DateTimeLayout"`
	LoginLastDate          valueTypes.DateTime `json:"loginLastDate" PointNameDateFormat:"DateTimeLayout"`
	LoginLastIP            valueTypes.String   `json:"loginLastIp"`
	LoginTimes             valueTypes.Integer  `json:"loginTimes"`
	LogoHTTPSURL           interface{}         `json:"logo_https_url"`
	MapType                valueTypes.String   `json:"map_type"`
	MinDate                valueTypes.DateTime `json:"min_date" PointNameDateFormat:"DateTimeLayout"`
	MobileTel              interface{}         `json:"mobile_tel"`
	OrgId                  valueTypes.Integer  `json:"org_id"`
	OrgName                valueTypes.String   `json:"org_name"`
	OrgTimezone            valueTypes.String   `json:"org_timezone"`
	PasswordIsSimple       valueTypes.Integer  `json:"password_is_simple"`
	PhotoId                interface{}         `json:"photo_id"`
	PhotoURL               interface{}         `json:"photo_url"`
	Privileges             []struct {
		FatherId        valueTypes.Integer `json:"father_id"`
		IconURL         interface{}        `json:"icon_url"`
		IsOpen          valueTypes.Bool    `json:"is_open"`
		IsThirdPlatform valueTypes.Bool    `json:"is_third_platform"`
		MenuCode        valueTypes.String  `json:"menu_code"`
		MenuLevel       valueTypes.Integer `json:"menu_level"`
		MenuName        valueTypes.String  `json:"menu_name"`
		MenuOrder       interface{}        `json:"menu_order"`
		MenuType        valueTypes.String  `json:"menu_type"`
		MenuURL         valueTypes.String  `json:"menu_url"`
		PrivilegeId     valueTypes.Integer `json:"privilege_id"`
		RoleId          valueTypes.Integer `json:"role_id"`
		URLTarget       valueTypes.String  `json:"url_target"`
		VueIcon         interface{}        `json:"vue_icon"`
		VuePath         interface{}        `json:"vue_path"`
	} `json:"privileges" DataTable:"true"`
	RoleId                       valueTypes.String  `json:"role_id"`
	SecondaryOrgIds              []interface{}      `json:"secondaryOrgIds"`
	ServerTel                    valueTypes.String  `json:"server_tel"`
	ServiceVersion               valueTypes.String  `json:"service_version"`
	Sex                          valueTypes.String  `json:"sex"`
	Stylename                    valueTypes.String  `json:"stylename"`
	TimeZone                     valueTypes.String  `json:"timeZone"`
	Timezone                     valueTypes.String  `json:"timezone"`
	Timezoneid                   valueTypes.String  `json:"timezoneid"`
	Toggleflag                   valueTypes.String  `json:"toggleflag"`
	Token                        valueTypes.String  `json:"token"`
	UnlockLaveMinute             valueTypes.Integer `json:"unlock_lave_minute"`
	UploadTime                   interface{}        `json:"upload_time"`
	UserAccount                  valueTypes.String  `json:"user_account"`
	UserAccountModifyCount       valueTypes.Integer `json:"user_account_modify_count"`
	UserAccountModifyRemainTimes valueTypes.Integer `json:"user_account_modify_remain_times"`
	UserDealerOrgCode            interface{}        `json:"user_dealer_org_code"`
	UserId                       valueTypes.String  `json:"user_id"`
	UserLevel                    valueTypes.String  `json:"user_level"`
	UserMasterOrgId              valueTypes.Integer `json:"user_master_org_id"`
	UserMasterOrgName            valueTypes.String  `json:"user_master_org_name"`
	UserMasterOrgTimeZoneId      valueTypes.String  `json:"user_master_org_time_zone_id"`
	UserMasterOrgTimeZoneName    valueTypes.String  `json:"user_master_org_time_zone_name"`
	UserName                     valueTypes.String  `json:"user_name"`
	UserRoleIdList               []string           `json:"user_role_id_list" DataTable:"true"`
	UserTelNationCode            interface{}        `json:"user_tel_nation_code"`
	UserauthorURL                []interface{}      `json:"userauthorURL"`
	Userauthorbutto              []string           `json:"userauthorbutto" DataTable:"true"`
	Userdesc                     interface{}        `json:"userdesc"`
	Userpassword                 valueTypes.String  `json:"userpassword"`
	Validflag                    valueTypes.String  `json:"validflag"`
	Voice                        valueTypes.String  `json:"voice"`
	Welcometext                  valueTypes.String  `json:"welcometext"`
	Wgs84Latitude                valueTypes.Float   `json:"wgs84_latitude"`
	Wgs84Longitude               valueTypes.Float   `json:"wgs84_longitude"`
	WorkTel                      interface{}        `json:"work_tel"`
}

func AssertResultData

func AssertResultData(e api.EndPoint) ResultData

AssertResultData - Used to obtain locally scoped ResultData methods, (not visible from api.EndPoint).

func (*ResultData) IsValid

func (e *ResultData) IsValid() error

type SunGrowAuth

type SunGrowAuth struct {
	AppKey       string
	UserAccount  string
	UserPassword string
	TokenFile    string
	// Token        string
	Force bool
	// contains filtered or unexported fields
}

func (*SunGrowAuth) Verify

func (a *SunGrowAuth) Verify() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL