public static void Delete(Setting setting, User user) { Fallball.Call <User>(setting, HttpMethod.Delete, string.Format("resellers/{0}/clients/{1}/users/{2}", FbReseller.GetId(user.Tenant.App), FbClient.GetId(user.Tenant), GetId(user))); }
public static string GetUserLogin(Setting setting, User user) { return(Fallball.Call <String>(setting, HttpMethod.Get, string.Format("resellers/{0}/clients/{1}/users/{2}/link", FbReseller.GetId(user.Tenant.App), FbClient.GetId(user.Tenant), GetId(user) ))); }
public static string Create(Setting setting, Application app) { var r = new FbReseller { Name = GetId(app), Rid = GetId(app), Storage = new Storage { Limit = ResellersStorage } }; var body = JsonConvert.SerializeObject(r); var fbReseller = Fallball.Call <FbReseller>(setting, HttpMethod.Post, "resellers/", body); return(fbReseller.Name); }
public static void Delete(Setting setting, Tenant tenant) { var fbReseller = Fallball.Call <FbReseller>( setting, HttpMethod.Get, string.Format("resellers/{0}", FbReseller.GetId(tenant.App))); Fallball.Call <string>( setting, HttpMethod.Delete, string.Format("resellers/{0}/clients/{1}", FbReseller.GetId(tenant.App), GetId(tenant)), "", fbReseller.Token); }
public static Usage GetUsage(Setting setting, Tenant tenant) { var fbClient = Fallball.Call <FbClient>( setting, HttpMethod.Get, string.Format("resellers/{0}/clients/{1}", FbReseller.GetId(tenant.App), GetId(tenant))); Usage u = new Usage(); u["USERS"] = fbClient.UsersAmount; u["DISKSPACE"] = fbClient.Storage.Usage; return(u); }
public static string Create(Setting setting, User user) { var u = new FbUser { Email = user.Email, Admin = true, Storage = new Storage { Limit = UsersStorage } }; var fbUser = Fallball.Call <FbUser>(setting, HttpMethod.Post, string.Format("resellers/{0}/clients/{1}/users/", FbReseller.GetId(user.Tenant.App), FbClient.GetId(user.Tenant)), JsonConvert.SerializeObject(u)); return(fbUser.UserId); }
public static string GetAdminLogin(Setting setting, Tenant tenant) { var adminlogin = string.Format("admin@{0}.{1}.fallball.io", GetId(tenant), FbReseller.GetId(tenant.App)); string userId; using (var md5 = MD5.Create()) { var hash = md5.ComputeHash(Encoding.ASCII.GetBytes(adminlogin)); var result = new Guid(hash); userId = result.ToString(); } return(Fallball.Call <string>(setting, HttpMethod.Get, string.Format("resellers/{0}/clients/{1}/users/{2}/link", FbReseller.GetId(tenant.App), GetId(tenant), userId ))); }
public static void Update(Setting setting, Tenant tenant) { var c = new FbClient { Name = GetId(tenant), Storage = new Storage { Limit = tenant.DiskspaceLimit } }; var body = JsonConvert.SerializeObject(c); var fbReseller = Fallball.Call <FbReseller>( setting, HttpMethod.Get, string.Format("resellers/{0}", FbReseller.GetId(tenant.App))); Fallball.Call <FbClient>( setting, HttpMethod.Put, string.Format("resellers/{0}/clients/{1}/", FbReseller.GetId(tenant.App), GetId(tenant)), body, fbReseller.Token); }