// GetFriends gets the friendslist for a given user through either datastore
// or the steam web API.
// 		userWasFoundInDB, friendIDs, err := GetFriends(cntr, steamID)
GetFriends gets the friendslist for a given user through either datastore
or the steam web API.
userWasFoundInDB, friendIDs, err := GetFriends(cntr, steamID)
// GetFriends gets the friendslist for a given user through either datastore // or the steam web API . // userWasFoundInDB friendIDs err : = GetFriends ( cntr steamID )
func GetFriends(cntr controller.CntrInterface, steamID string) (bool, []string, error) {
	userFromDB, err := cntr.GetUserFromDataStore(steamID)
	if err != nil {
		configuration.Logger.Sugar().Infof("error getting user in DB: %+v", err)
	}
	if userFromDB.AccDetails.SteamID != "" {
		configuration.Logger.Sugar().Infof("returning user retrieved from DB: %+v", userFromDB.AccDetails.SteamID)
		return true, userFromDB.FriendIDs, nil
	}
	configuration.Logger.Sugar().Infof("user %s was not found in DB", steamID)
	friendsList, err := cntr.CallGetFriends(steamID)
	if err != nil {
		return false, []string{}, err
	}
	return false, friendsList, nil
}
func GetFriends ( cntr controller . CntrInterface , steamID string ) ( bool , [ ] string , error ) { userFromDB , err := cntr . GetUserFromDataStore ( steamID ) if err != nil { configuration . Logger . Sugar ( ) . Infof ( " " , err ) } if userFromDB . AccDetails . SteamID != " " { configuration . Logger . Sugar ( ) . Infof ( " " , userFromDB . AccDetails . SteamID ) return true , userFromDB . FriendIDs , nil } configuration . Logger . Sugar ( ) . Infof ( " " , steamID ) friendsList , err := cntr . CallGetFriends ( steamID ) if err != nil { return false , [ ] string { } , err } return false , friendsList , nil }
GetFriends gets the friendslist for a given user through either datastore
or the steam web API.
GetFriends gets the friendslist for a given user through either datastore or the steam web API .
// User was not found in DB, call the API