public async Task <GetUsageResponse> Get(AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.Usage.Get()); } }
public async Task <ListDomainWhitelistResponse> List(AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.DomainWhitelist.List()); } }
public async Task <ApiKeyResponse> Update(AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.ApiKeyApi.Update()); } }
public async Task <ListUsageResponse> List(ListUsageRequest request, AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.Usage.List(request)); } }
public async Task<BillingAddressResponse> Get(AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return await api.BillingAddress.Get(); } }
public async static Task <GetUsageResponse> Get(GetAddesssApi api, string path, AdminKey adminKey, int day, int month, int year) { var fullPath = $"{path}{day}/{month}/{year}"; return(await Get(api, fullPath, adminKey)); }
public async Task <TestWebhookResponse> Test(AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.FirstLimitReachedWebhook.Test()); } }
public async Task <SubscriptionResponse> Subscription(AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.Subscription.Get()); } }
public async Task <AddWebhookResponse> Add(AddWebhookRequest request, AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.PaymentFailedWebhook.Add(request)); } }
public async Task <GetInvoiceCCResponse> Get(GetInvoiceCCRequest request, AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.InvoiceCC.Get(request)); } }
public async Task <ListWebhookResponse> List(AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.ExpiredWebhook.List()); } }
public async Task <DistanceResponse> Get(DistanceRequest request, AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.Distance.Get(request)); } }
/// <summary> /// Генерируем новый ключ для оператора. /// </summary> /// <returns></returns> private async Task <IActionResult> GenerateKey() { string hash = GeneralFunction.GenerateHash(); if (hash != null) { using (MarketBotDbContext db = new MarketBotDbContext()) { AdminKey key = new AdminKey { DateAdd = DateTime.Now, Enable = false, KeyValue = hash }; db.AdminKey.Add(key); if (db.SaveChanges() > 0) { await SendMessage(new BotMessage { TextMessage = "Пользователь который должен получить права оператора должен ввести следующую команду:" + Bot.BotMessage.NewLine() + Bot.BotMessage.Italic("/key " + key.KeyValue) }); return(OkResult); } else { return(NotFoundResult); } } } else { return(NotFoundResult); } }
public async Task <GetWebhookResponse> Get(GetWebhookRequest request, AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.ExpiredWebhook.Get(request)); } }
public async Task <AddPermissionResponse> Add(AddPermissionRequest request, AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.Permission.Add(request)); } }
public async Task <ListInvoiceCCResponse> List(AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, httpClient)) { return(await api.InvoiceCC.List()); } }
public async Task <ListPermissionResponse> List(AdminKey adminKey = null, HttpClient httpClient = null) { using (var api = new GetAddesssApi(adminKey ?? AdminKey, HttpClient ?? httpClient)) { return(await api.Permission.List()); } }
protected AdminApiBase(AdminKey adminKey, GetAddesssApi api) : base(api) { if (adminKey == null) { throw new ArgumentNullException(nameof(adminKey)); } AdminKey = adminKey; }
public async static Task <GetInvoiceResponse> Get(GetAddesssApi api, string path, AdminKey adminKey, GetInvoiceRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } var fullPath = $"{path}{request.Number}"; return(await GetInternal(api, fullPath, adminKey, request.Number)); }
public async static Task <ListUsageResponse> List(GetAddesssApi api, string path, AdminKey adminKey, ListUsageRequest request) { if (request is null) { throw new ArgumentNullException(nameof(request)); } var fullPath = $"{path}/from/{request.From.Day}/{request.From.Month}/{request.From.Year}/To/{request.To.Day}/{request.To.Month}/{request.To.Year}"; return(await List(api, fullPath, adminKey)); }
internal Hashgraph.TopicInfo ToTopicInfo() { return(new Hashgraph.TopicInfo { Memo = Memo, RunningHash = RunningHash.ToArray(), SequenceNumber = SequenceNumber, Expiration = ExpirationTime.ToDateTime(), Administrator = AdminKey?.ToEndorsement(), Participant = SubmitKey?.ToEndorsement(), AutoRenewPeriod = AutoRenewPeriod.ToTimeSpan(), RenewAccount = AutoRenewAccount?.ToAddress() }); }
/// <summary> /// Добавить нового оператора /// </summary> /// <param name="KeyId"></param> /// <returns></returns> private async Task <IActionResult> AddNewOpearator(AdminKey adminKey) { using (MarketBotDbContext db = new MarketBotDbContext()) { var admin = db.Admin.Where(a => a.FollowerId == FollowerId && a.Enable).Include(a => a.AdminKey).Include(a => a.Follower).FirstOrDefault(); Admin adminnew = new Admin { AdminKeyId = adminKey.Id, FollowerId = FollowerId, DateAdd = DateTime.Now, NotyfiActive = true, Enable = true, }; if (admin != null) { return(await SendAdminControlPanelMsg()); } else { Admin NewAdmin = new Admin { FollowerId = FollowerId, DateAdd = DateTime.Now, AdminKeyId = adminKey.Id, Enable = true, NotyfiActive = true }; db.Admin.Add(NewAdmin); adminKey.Enable = true; if (db.SaveChanges() > 0) { string meessage = "Зарегистрирован новый оператор системы: " + db.Follower.Where(f => f.Id == FollowerId).FirstOrDefault().FirstName + Bot.BotMessage.NewLine() + "Ключ: " + adminKey.KeyValue; await SendMessage(BotOwner, new BotMessage { TextMessage = meessage }); return(await SendAdminControlPanelMsg()); } else { return(OkResult); } } } }
internal Hashgraph.ContractInfo ToContractInfo() { return(new Hashgraph.ContractInfo { Contract = ContractID.ToAddress(), Address = AccountID.ToAddress(), SmartContractId = ContractAccountID, Administrator = AdminKey?.ToEndorsement(), Expiration = ExpirationTime.ToDateTime(), RenewPeriod = AutoRenewPeriod.ToTimeSpan(), Size = Storage, Memo = Memo, Balance = Balance, Tokens = TokenRelationships.ToBalances(), Deleted = Deleted }); }
private AdminKey AddOwnerKey(string key) { if (db == null) { db = new MarketBotDbContext(); } AdminKey adminKey = new AdminKey { DateAdd = DateTime.Now, Enable = true, KeyValue = key }; db.AdminKey.Add(adminKey); db.SaveChanges(); return(adminKey); }
public async Task GetAddress2() { var adminKey = new AdminKey("Your Admin Key"); using (var api = new GetAddesssApi(adminKey)) { var result = await api.Usage.Get(); if (result.IsSuccess) { var successfulResult = (GetUsageResponse.Success)result; var count = successfulResult.Usage.Count; var limit1 = successfulResult.Usage.Limit1; var limit2 = successfulResult.Usage.Limit2; } } }
private async Task GetAddressExpiredWebhookTest(AdminKey adminKey, IWebhookService getAddressExpiredWebhook) { var addResult = await getAddressExpiredWebhook.Add("https://enow375xiqy9k.x.pipedream.net/"); Assert.IsTrue(addResult.IsSuccess); var getResult = await getAddressExpiredWebhook.Get(addResult.SuccessfulResult.Id); Assert.IsTrue(getResult.IsSuccess); var listResult = await getAddressExpiredWebhook.List(); Assert.IsTrue(listResult.IsSuccess && listResult.SuccessfulResult.Webhooks.Any()); var testResult = await getAddressExpiredWebhook.Test(); Assert.IsTrue(testResult.IsSuccess); var removeResult = await getAddressExpiredWebhook.Remove(addResult.SuccessfulResult.Id); Assert.IsTrue(removeResult.IsSuccess); }
public static Admin InsertAdmin(int FollowerId, AdminKey adminKey) { MarketBotDbContext db = new MarketBotDbContext(); try { Admin NewAdmin = new Admin { FollowerId = FollowerId, DateAdd = DateTime.Now, AdminKeyId = adminKey.Id, Enable = true, NotyfiActive = true }; db.Admin.Add(NewAdmin); adminKey.Enable = true; db.Update <AdminKey>(adminKey); db.SaveChanges(); NewAdmin.Follower = db.Follower.Find(FollowerId); return(NewAdmin); } catch { return(null); } finally { db.Dispose(); } }
internal Hashgraph.TokenInfo ToTokenInfo() { return(new Hashgraph.TokenInfo { Token = TokenId.ToAddress(), Symbol = Symbol, Name = Name, Treasury = Treasury.ToAddress(), Circulation = TotalSupply, Decimals = Decimals, Administrator = AdminKey?.ToEndorsement(), GrantKycEndorsement = KycKey?.ToEndorsement(), SuspendEndorsement = FreezeKey?.ToEndorsement(), ConfiscateEndorsement = WipeKey?.ToEndorsement(), SupplyEndorsement = SupplyKey?.ToEndorsement(), TradableStatus = (Hashgraph.TokenTradableStatus)DefaultFreezeStatus, KycStatus = (Hashgraph.TokenKycStatus)DefaultKycStatus, Expiration = Expiry.ToDateTime(), RenewPeriod = AutoRenewPeriod?.ToTimeSpan(), RenewAccount = AutoRenewAccount?.ToAddress(), Deleted = Deleted }); }
public static AdminKey InsertAdminKey(string Hash, bool Enable = false) { MarketBotDbContext db = new MarketBotDbContext(); try { AdminKey key = new AdminKey { DateAdd = DateTime.Now, Enable = false, KeyValue = Hash }; db.AdminKey.Add(key); db.SaveChanges(); return(key); } catch { return(null); } finally { db.Dispose(); } }
public UsageService(AdminKey adminKey, HttpClient httpClient = null) { AdminKey = adminKey ?? throw new System.ArgumentNullException(nameof(adminKey)); HttpClient = httpClient; }