Ejemplo n.º 1
0
func (p *loginAccountContext) SetFromJSON(obj jsonhelper.JSONObject) {
	p.username = obj.GetAsString("username")
	p.password = obj.GetAsString("password")
	p.inputValidated = false
	p.user = nil
	p.result = nil
}
Ejemplo n.º 2
0
func (p *Name) FromJSON(o jsonhelper.JSONObject) {
	p.GivenName = o.GetAsString("givenName")
	p.MiddleName = o.GetAsString("middleName")
	p.FamilyName = o.GetAsString("familyName")
	p.Prefix = o.GetAsString("prefix")
	p.Suffix = o.GetAsString("suffix")
	p.GivenNameSound = o.GetAsString("givenNameSound")
	p.FamilyNameSound = o.GetAsString("familyNameSound")
}
Ejemplo n.º 3
0
func (p *smugMugUserInfoResult) FromJSON(props jsonhelper.JSONObject) {
	LogDebug("user info result from json: ", props)
	p.id = props.GetAsInt64("id")
	p.accountStatus = props.GetAsString("AccountStatus")
	p.accountType = props.GetAsString("AccountType")
	p.fileSizeLimit = props.GetAsInt64("FileSizeLimit")
	p.name = props.GetAsString("Name")
	p.nickname = props.GetAsString("NickName")
	p.smugVault = props.GetAsBool("SmugVault")
	p.url = props.GetAsString("URL")
}
Ejemplo n.º 4
0
func (p *createAccountContext) SetFromJSON(obj jsonhelper.JSONObject) {
	p.user = nil
	p.consumer = nil
	p.externalUser = nil
	theType := p.theType
	if theType == "" {
		theType = obj.GetAsString("type")
	}
	switch theType {
	case "user":
		p.user = new(dm.User)
		p.user.InitFromJSONObject(obj)
	case "consumer":
		p.consumer = new(dm.Consumer)
		p.consumer.InitFromJSONObject(obj)
	case "external_user":
		p.externalUser = new(dm.ExternalUser)
		p.externalUser.InitFromJSONObject(obj)
	}
}
Ejemplo n.º 5
0
func (p *Address) FromJSON(o jsonhelper.JSONObject) {
	p.Street = o.GetAsString("street")
	p.City = o.GetAsString("city")
	p.StateOrProvince = o.GetAsString("stateOrProvince")
	p.PostalCode = o.GetAsString("postalCode")
	p.Country = o.GetAsString("country")
	p.CountryCode = o.GetAsString("countryCode")
}
Ejemplo n.º 6
0
func (p *Consumer) InitFromJSONObject(obj jsonhelper.JSONObject) {
	p.PersistableModel.InitFromJSONObject(obj)
	p.DomainName = obj.GetAsString("domain_name")
	p.HomePage = obj.GetAsString("home_page")
	p.AuthorizationPage = obj.GetAsString("authorization_page")
	p.ShortName = obj.GetAsString("short_name")
	p.Name = obj.GetAsString("name")
	p.Email = obj.GetAsString("email")
	p.PhoneNumber = obj.GetAsString("phone_number")
	p.IsTrusted = obj.GetAsBool("is_trusted")
	p.IsSuggested = obj.GetAsBool("is_suggested")
	p.AllowLogin = obj.GetAsBool("allow_login")
	p.DisableLoginAt = obj.GetAsInt64("disable_login_at")
}
Ejemplo n.º 7
0
func (p *ExternalUser) InitFromJSONObject(obj jsonhelper.JSONObject) {
	p.PersistableModel.InitFromJSONObject(obj)
	p.ConsumerId = obj.GetAsString("consumer_id")
	p.ExternalUserId = obj.GetAsString("external_user_id")
	p.Name = obj.GetAsString("name")
}
Ejemplo n.º 8
0
func (p *User) InitFromJSONObject(obj jsonhelper.JSONObject) {
	p.PersistableModel.InitFromJSONObject(obj)
	p.Role = obj.GetAsInt32("role")
	p.Name = obj.GetAsString("name")
	p.Username = obj.GetAsString("username")
	p.Email = obj.GetAsString("email")
	p.PhoneNumber = obj.GetAsString("phone_number")
	p.Address = obj.GetAsString("address")
	p.ContactId = obj.GetAsString("contact_id")
	p.AllowLogin = obj.GetAsBool("allow_login")
	p.IsPayingUser = obj.GetAsBool("is_paying_user")
	p.Notes = obj.GetAsString("notes")
	p.DisableLoginAt = obj.GetAsInt64("disable_login_at")
}
Ejemplo n.º 9
0
func (p *setPasswordContext) SetFromJSON(obj jsonhelper.JSONObject) {
	p.password = obj.GetAsString("password")
	p.result = nil
}
Ejemplo n.º 10
0
func (p *linkedInClient) Initialize(properties jsonhelper.JSONObject) {
	if p.currentCredentials == nil {
		p.currentCredentials = NewStandardAuthToken()
	}
	if properties == nil {
		return
	}
	if v := properties.GetAsString("linkedin.api.key"); len(v) > 0 {
		p.consumerKey = v
		//p.Credentials.Token = v
	}
	if v := properties.GetAsString("linkedin.client.redirect_uri"); len(v) > 0 {
		p.callbackUrl = v
	}
	if v := properties.GetAsString("linkedin.secret.key"); len(v) > 0 {
		p.consumerSecret = v
		//p.Credentials.Secret = v
	}
	if v := properties.GetAsString("linkedin.oauth1.scope"); len(v) > 0 {
		//p.Scope = v
	}
	if v := properties.GetAsString("linkedin.client.token"); len(v) > 0 {
		p.currentCredentials.SetToken(v)
	}
	if v := properties.GetAsString("linkedin.client.secret"); len(v) > 0 {
		p.currentCredentials.SetSecret(v)
	}
}
Ejemplo n.º 11
0
func (p *yahooUserInfoIm) FromJSON(props jsonhelper.JSONObject) {
	p.handle = props.GetAsString("handle")
	p.id = props.GetAsInt("id")
	p.theType = props.GetAsString("type")
}
Ejemplo n.º 12
0
func (p *yahooClient) Initialize(properties jsonhelper.JSONObject) {
	if p.currentCredentials == nil {
		p.currentCredentials = &yahooAccessTokenResult{}
	}
	if properties == nil {
		return
	}
	if v := properties.GetAsString("yahoo.realm"); len(v) > 0 {
		p.realm = v
	}
	if v := properties.GetAsString("yahoo.consumer.key"); len(v) > 0 {
		p.consumerKey = v
		//p.Credentials.Token = v
	}
	if v := properties.GetAsString("yahoo.consumer.secret"); len(v) > 0 {
		p.consumerSecret = v
		//p.Credentials.Secret = v
	}
	if v := properties.GetAsString("yahoo.client.redirect_uri"); len(v) > 0 {
		p.callbackUrl = v
	}
	if v := properties.GetAsString("yahoo.oauth1.scope"); len(v) > 0 {
		//p.Scope = v
	}
	if v := properties.GetAsString("yahoo.client.token"); len(v) > 0 {
		p.currentCredentials.SetToken(v)
	}
	if v := properties.GetAsString("yahoo.client.secret"); len(v) > 0 {
		p.currentCredentials.SetSecret(v)
	}
}
Ejemplo n.º 13
0
func (p *yahooUserInfoResult) FromJSON(props jsonhelper.JSONObject) {
	p.guid = props.GetAsString("guid")
	p.uri = props.GetAsString("uri")
	p.birthYear = props.GetAsInt("birthYear")
	p.birthdate = props.GetAsString("birthdate")
	p.created = props.GetAsTime("created", YAHOO_DATETIME_FORMAT)
	p.displayAge = props.GetAsInt("displayAge")
	emails := props.GetAsArray("emails")
	p.emails = make([]YahooUserInfoEmail, len(emails))
	for i, email := range emails {
		v := new(yahooUserInfoEmail)
		v.FromJSON(jsonhelper.JSONValueToObject(email))
		p.emails[i] = v
	}
	p.familyName = props.GetAsString("familyName")
	p.givenName = props.GetAsString("givenName")
	p.gender = props.GetAsString("gender")
	ims := props.GetAsArray("ims")
	p.ims = make([]YahooUserInfoIm, len(ims))
	for i, im := range ims {
		v := new(yahooUserInfoIm)
		v.FromJSON(jsonhelper.JSONValueToObject(im))
		p.ims[i] = v
	}
	p.lang = props.GetAsString("lang")
	p.location = props.GetAsString("location")
	p.memberSince = props.GetAsTime("memberSince", YAHOO_DATETIME_FORMAT)
	p.nickname = props.GetAsString("nickname")
	p.profileUrl = props.GetAsString("profileUrl")
	p.searchable = props.GetAsBool("searchable")
	p.timeZone = props.GetAsString("timeZone")
	p.updated = props.GetAsTime("updated", YAHOO_DATETIME_FORMAT)
	p.isConnected = props.GetAsBool("isConnected")
}
Ejemplo n.º 14
0
func (p *smugMugClient) Initialize(properties jsonhelper.JSONObject) {
	if p.currentCredentials == nil {
		p.currentCredentials = NewStandardAuthToken()
	}
	if properties == nil {
		return
	}
	if v := properties.GetAsString("smugmug.realm"); len(v) > 0 {
		p.realm = v
	}
	if v := properties.GetAsString("smugmug.app.name"); len(v) > 0 {
		p.appName = v
	}
	if v := properties.GetAsString("smugmug.consumer.key"); len(v) > 0 {
		p.consumerKey = v
		//p.Credentials.Token = v
	}
	if v := properties.GetAsString("smugmug.consumer.secret"); len(v) > 0 {
		p.consumerSecret = v
		//p.Credentials.Secret = v
	}
	if v := properties.GetAsString("smugmug.client.redirect_uri"); len(v) > 0 {
		p.callbackUrl = v
	}
	if v := properties.GetAsString("smugmug.oauth1.scope"); len(v) > 0 {
		//p.Scope = v
	}
	if v := properties.GetAsString("smugmug.client.token"); len(v) > 0 {
		p.currentCredentials.SetToken(v)
	}
	if v := properties.GetAsString("smugmug.client.secret"); len(v) > 0 {
		p.currentCredentials.SetSecret(v)
	}
}
Ejemplo n.º 15
0
func (p *facebookLocation) FromJSON(props jsonhelper.JSONObject) {
	p.id = props.GetAsString("id")
	p.name = props.GetAsString("name")
}
Ejemplo n.º 16
0
func (p *PersistableModel) InitFromJSONObject(obj jsonhelper.JSONObject) {
	p.Id = obj.GetAsString("id")
	p.Etag = obj.GetAsString("etag")
	p.CreatedAt = obj.GetAsInt64("created_at")
	p.ModifiedAt = obj.GetAsInt64("modified_at")
}
Ejemplo n.º 17
0
func (p *linkedInUserInfoResult) FromJSON(props jsonhelper.JSONObject) {
	p.id = props.GetAsString("id")
	p.firstName = props.GetAsString("firstName")
	p.lastName = props.GetAsString("lastName")
	p.publicProfileUrl = props.GetAsString("publicProfileUrl")
}