public AnalyticsConfigUser AddUser(AnalyticsConfigClient client, AddUserModel.UserModel userModel, IUser user) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (userModel == null) { throw new ArgumentNullException(nameof(userModel)); } string id = Guid.NewGuid().ToString(); AnalyticsConfigUser u = new AnalyticsConfigUser { Id = id, UserId = userModel.Id, Name = userModel.Name, Email = userModel.Email, RefreshToken = userModel.RefreshToken }; client.Users.Add(u); Save(); return(u); }
public AnalyticsConfigClient AddClient(string name, string clientId, string clientSecret, IUser user) { if (String.IsNullOrWhiteSpace(clientId)) { throw new ArgumentNullException(nameof(clientId)); } if (String.IsNullOrWhiteSpace(clientSecret)) { throw new ArgumentNullException(nameof(clientSecret)); } string id = Guid.NewGuid().ToString(); AnalyticsConfigClient client = new AnalyticsConfigClient { Id = id, Name = String.IsNullOrWhiteSpace(name) ? "Untitled client" : name, ClientId = clientId, ClientSecret = clientSecret }; _config.Clients.Add(client); Save(); return(client); }
private AnalyticsConfigUser(AnalyticsConfigClient client, JObject obj) { Client = client; Id = obj.GetString("id"); UserId = obj.GetString("userId"); Email = obj.GetString("email"); Name = obj.GetString("name"); RefreshToken = obj.GetString("refreshToken"); }
public void DeleteClient(AnalyticsConfigClient client, IUser user) { if (client == null) { throw new ArgumentNullException(nameof(client)); } _config.Clients.Remove(client); Save(); }
public AnalyticsConfigUser AddUser(AnalyticsConfigClient client, string name, string userId, string email, string refreshToken, IUser user) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (String.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name)); } if (String.IsNullOrWhiteSpace(userId)) { throw new ArgumentNullException(nameof(userId)); } if (String.IsNullOrWhiteSpace(email)) { throw new ArgumentNullException(nameof(email)); } if (String.IsNullOrWhiteSpace(refreshToken)) { throw new ArgumentNullException(nameof(refreshToken)); } string id = Guid.NewGuid().ToString(); AnalyticsConfigUser u = new AnalyticsConfigUser { Id = id, Name = name, Email = email, RefreshToken = refreshToken }; client.Users.Add(u); Save(); return(u); }
public AnalyticsConfigClient SaveClient(AnalyticsConfigClient client, IUser user) { Save(); return(client); }
public static AnalyticsConfigUser Parse(AnalyticsConfigClient client, JObject obj) { return(obj == null ? null : new AnalyticsConfigUser(client, obj)); }