using System.Collections.Generic; namespace FeatBit.Sdk.Server.Model { public class FbUser { public readonly string Key; public readonly string Name; public readonly Dictionary Custom; internal FbUser(string key, string name, Dictionary custom) { Key = key; Name = name; Custom = custom; } /// /// Creates an for constructing a user object using a fluent syntax. /// /// /// This is the only method for building a . The has methods /// for setting any number of properties, after which you call to get the /// resulting instance. /// /// /// /// var user = FbUser.Builder("a-unique-key-of-user") /// .Name("user-name") /// .Custom("email", "test@example.com") /// .Build(); /// /// /// a that uniquely identifies a user /// a builder object public static IFbUserBuilder Builder(string key) { return new FbUserBuilder(key); } public string ValueOf(string property) { if (string.IsNullOrWhiteSpace(property)) { return string.Empty; } if (property == "keyId") { return Key; } if (property == "name") { return Name; } return Custom.TryGetValue(property, out var value) ? value : string.Empty; } } }