public StatusResponse Get(StatusRequest request) { string platform; switch (Environment.OSVersion.Platform) { case PlatformID.MacOSX: platform = "mac"; break; case PlatformID.Unix: platform = "unix"; break; default: platform = "windows"; break; } return new StatusResponse { Build = new Build { Version = typeof(AppHost).Assembly.GetName().Version.ToString() }, OS = new OperatingSystem { Name = platform, Version = Environment.OSVersion.Version.ToString(), Arch = Environment.Is64BitProcess ? "64bit" : "32bit" } }; }
public StatusResponse Get(StatusRequest request) { var matchers = m_evaluator.GetMatchers(); return new StatusResponse() { Matchers = matchers }; }
public StatusResponse Status(string token) { ValidationUtil.hasTextWithMaxLength(token, ApiConstants.TOKEN_LENGTH, "token"); return(ExceptionHandler.Perform <StatusResponse, TransactionStatusException>(() => { var statusRequest = new StatusRequest(token); return _requestService.Perform <StatusResponse, TransactionStatusException>( statusRequest, Options); })); }
public ActionResult <StatusResponse> GetTransactionStatus([FromBody] StatusRequest statusRequest) { var result = this._IGetStatus.Execute(statusRequest.TransactionId); if (result == null) { return(NotFound($"Transaction '{statusRequest.TransactionId}' not found")); } return(Ok(result)); }
public IHttpActionResult GetStatusRequest(int id) { StatusRequest statusRequest = db.StatusRequests.Find(id); if (statusRequest == null) { return(NotFound()); } return(Ok(statusRequest)); }
public bool ChangePostStatusCMS(Guid id, StatusRequest request) { bool updated = _postService.UpdateStatus(id, request.UserStatus) != null; if (updated == false) { throw new InternalServerErrorException(CommonConstant.Error.InternalServerError); } return(updated); }
public void statusPlayer() { StatusRequest statusRequest = new StatusRequest(); Ready.SetActive(false); Cancel.SetActive(true); statusRequest.action = "playerReady"; statusRequest.ready = true; statusRequest.token = token; SendWebSocketMessage(JsonUtility.ToJson(statusRequest)); }
private void Dialog_RequestReceived(Object sender, MessageReceivedEventArgs <StatusRequest> e) { StatusRequest request = e.Message; this.OnMessageReceived(request, () => { IStatusRequestedProcessState processState = new StatusRequestedProcessState(this, request); this.ProcessStarted?.Invoke(this, new ProcessStartedEventArgs <IStatusRequestedProcessState>(processState)); }); }
public IHttpActionResult PostStatusRequest(StatusRequest statusRequest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.StatusRequests.Add(statusRequest); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = statusRequest.StatusRequestId }, statusRequest)); }
//------------------------------------------------------------------------- async void c2sStatusRequest(StatusRequest status_request) { IRpcSession s = EntityMgr.LastRpcSession; ClientInfo client_info = CoApp.getClientInfo(s); if (client_info == null) { return; } var task = await Task.Factory.StartNew <Task <MethodData> >(async() => { MethodData method_data = new MethodData(); method_data.method_id = MethodType.c2sStatusRequest; method_data.param1 = EbTool.protobufSerialize <StatusRequest>(status_request); MethodData r = null; try { var grain_playerproxy = GrainClient.GrainFactory.GetGrain <ICellPlayer>(new Guid(client_info.et_player_guid)); r = await grain_playerproxy.c2sRequest(method_data); } catch (Exception ex) { EbLog.Error(ex.ToString()); } return(r); }); if (task.Status == TaskStatus.Faulted || task.Result == null) { if (task.Exception != null) { EbLog.Error(task.Exception.ToString()); } return; } MethodData result = task.Result; if (result.method_id == MethodType.None) { return; } lock (CoApp.RpcLock) { var status_response = EbTool.protobufDeserialize <StatusResponse>(result.param1); CoApp.rpcBySession(s, (ushort)MethodType.s2cStatusResponse, status_response); } }
public async Task <IStatusFinishedProcessState> StartProcessAsync(bool?includeDetails, CancellationToken cancellationToken = default) { StatusRequest request = this.CreateRequest(includeDetails); StatusResponse response = await this.SendRequestAsync(request, () => { return(this.Dialog.SendRequestAsync(request, cancellationToken)); }).ConfigureAwait(continueOnCapturedContext: false); return(new StatusFinishedProcessState(request, response)); }
protected async override Task Handle(StatusRequest <AzureDevOpsPullRequestsWidget> request, CancellationToken cancellationToken) { var api = new AzureDevOpsApi(Endpoint); var pullRequests = await api.GetPullRequestsAsync(request.Context.Account, request.Context.Project).ConfigureAwait(false); request.Context.Text = pullRequests.Count.ToString(); if (pullRequests is null || pullRequests.Count == 0) { _dispatcher.InvokeAsync(request.Context.Clear); }
public IStatusFinishedProcessState StartProcess(bool?includeDetails) { StatusRequest request = this.CreateRequest(includeDetails); StatusResponse response = this.SendRequest(request, () => { return(this.Dialog.SendRequest(request)); }); return(new StatusFinishedProcessState(request, response)); }
public StatusResponse Status() { var request = new StatusRequest(); try { return(client.status(request)); } catch (RpcException e) { Console.WriteLine("Status Did not work"); Console.WriteLine(e.Message); return(new StatusResponse()); } }
protected override Task Handle(StatusRequest <PortHealthCheckWidget> request, CancellationToken cancellationToken) { var protocol = request.Context.Protocol == NetworkProtocol.TCP ? ProtocolType.Tcp : ProtocolType.Udp; using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, protocol)) { socket.Connect(request.Context.Host, request.Context.PortNumber); request.Context.Status = Status.OK; } return(Task.CompletedTask); }
public IHttpActionResult DeleteStatusRequest(int id) { StatusRequest statusRequest = db.StatusRequests.Find(id); if (statusRequest == null) { return(NotFound()); } db.StatusRequests.Remove(statusRequest); db.SaveChanges(); return(Ok(statusRequest)); }
public BaseResult <StatusResult> Status(StatusRequest status) { var validator = new StatusRequestValidator(); var results = validator.Validate(status); if (results.IsValid) { return(_gameManager.Execute(status)); } else { return(BaseResult <StatusResult> .Fail(errors : results.Errors.Select(e => e.ErrorMessage))); } }
public async Task <ActionResult <StatusResult> > Status([FromBody] StatusRequest request) { if (!await _authManager.HasSitePermissionsAsync(request.SiteId, GatherManager.PermissionsList)) { return(Unauthorized()); } var cache = _gatherManager.GetCache(request.Guid); return(new StatusResult { Cache = cache }); }
public async Task <StatusResponse> StatusAsync(string channel) { var accessToken = this.channelStore.Get(channel).AccessToken; var client = new RestClient(ApiUrl); var request = new RestRequest(StatusApi); request.AddParameter("Authorization", $"Bearer {accessToken}", ParameterType.HttpHeader); var requestObject = new StatusRequest() { }; request.AddObject(requestObject); return(await client.GetAsync <StatusResponse>(request)); }
protected override async Task Handle(StatusRequest <HomeAssistantStateWidget> request, CancellationToken cancellationToken) { request.Context.Status = Status.Running; var client = new HAClient(Endpoint.Token, Endpoint.Address); var state = await client.GetState(request.Context.EntityId); string value = state.state; if (state.attributes.ContainsKey("device_class")) { var device_class = state.attributes["device_class"]; if (device_class.ToString() == "timestamp") { if (DateTime.TryParse(value, out DateTime date)) { var age = DateTime.Now - date; if (age.TotalDays > 1) { value = Math.Round(age.TotalDays).ToString() + " days ago"; } else if (age.TotalHours > 1) { value = Math.Round(age.TotalHours).ToString() + " hours ago"; } else if (age.TotalMinutes > 1) { value = Math.Round(age.TotalMinutes).ToString() + " minutes ago"; } else if (age.TotalSeconds > 1) { value = Math.Round(age.TotalSeconds).ToString() + " seconds ago"; } else { value = age.ToString(); } } } } if (state.attributes.ContainsKey("unit_of_measurement")) { value = value + state.attributes["unit_of_measurement"]; } if (request.Context.Notify && request.Context.Text != value) { _notificationService.Send(new Notification($"State changed from {request.Context.Text} to {value}.", request.Context.Name, NotificationIcon.Info)); } request.Context.Text = value; request.Context.Status = Status.OK; }
public Status Get(StatusRequest req) { var s = new Status(); s.Uptime = MainClass.Uptime; s.NumberOfRequests = MainClass.ServedRequests; // determine number of users using (var conn = DbConfig.GetConnection()) { s.NumberOfUser = conn.Scalar <int>("SELECT COUNT(*) FROM DBUser"); s.TotalNumberOfNotes = conn.Scalar <int>("SELECT COUNT(*) FROM DBNote"); s.AverageNotesPerUser = (float)s.TotalNumberOfNotes / (float)s.NumberOfUser; }; return(s); }
public IEnumerable <ValidationResult> Validate(StatusRequest <TContext> request) { if (request.Context is null) { throw new ValidationException("Request context is null."); } var context = new ValidationContext(request.Context, null, null); var results = new List <ValidationResult>(); Validator.TryValidateObject(request.Context, context, results); return(results); }
public void updateClientRequestStatus(GuestRequest gr, StatusRequest s) { XElement GuestRequestElement = (from p in GuestRequestRoot.Elements() where Convert.ToInt32(p.Element("GuestRequestKey").Value) == gr.GuestRequestKey select p).FirstOrDefault(); if (GuestRequestElement == null) { throw new Exceptions("This guest request isn't exist, can't update (DAL)", gr.GuestRequestKey, gr.PrivateName); } GuestRequestElement.Remove(); GuestRequestRoot.Add(ConverGRToXElement(gr)); GuestRequestRoot.Save(GuestRequestPath); }
public async Task <bool> Status() { try { var request = new StatusRequest(); var response = await _client.StatusASync(request); return(response != null); } catch (Exception e) { Console.WriteLine(e); return(false); } }
public override ServerBoundPacket ParsePacket(Stream Stream, int Length, int PacketID, MinecraftVersion Version, ConnectionState CurrentState) { ServerBoundPacket result = new UnknownServerBoundPacket(); switch (CurrentState) { case ConnectionState.Handshake: switch (PacketID) { case 0x00: Handshake handshake = new Handshake(); handshake.ParseFromStream(Stream, Length, Version); result = handshake; break; } break; case ConnectionState.Status: switch (PacketID) { case 0x00: StatusRequest request = new StatusRequest(); request.ParseFromStream(Stream, Length, Version); result = request; break; case 0x01: StatusPing ping = new StatusPing(); ping.ParseFromStream(Stream, Length, Version); result = ping; break; } break; case ConnectionState.Login: switch (PacketID) { } break; case ConnectionState.Play: switch (PacketID) { } break; } return(result); }
protected override async Task Handle(StatusRequest <GitHubPagesBuildStatusWidget> request, CancellationToken cancellationToken) { var response = await new GitHubAPI(Endpoint).GetPagesAsync(request.Context.Repository); request.Context.Status = response.Status switch { "queued" => Status.Queued, "building" => Status.Running, "built" => Status.OK, "errored" => Status.Failed, _ => null }; request.Context.URL = response.HtmlUrl; } }
public Status AddStatus(StatusRequest request) { Status newStatus = new Status { Name = request.Name, StateTypeId = (StateEnum)request.status }; using (var db = new TimeTrackerModelContainer()) { db.Status.Add(newStatus); db.SaveChanges(); } return(newStatus); }
private void CarregarStatus() { IServicoPoupeDirect lServico = Ativador.Get <IServicoPoupeDirect>(); StatusRequest request = new StatusRequest(); request.Status = new StatusInfo(); var lRetornoResgate = lServico.SelecionarStatusAplicacaoResgate(request); if (lRetornoResgate.StatusResposta == OMS.Library.MensagemResponseStatusEnum.OK) { this.rptStatus_FiltroAplicacaoResgate.DataSource = lRetornoResgate.ListaStatus; this.rptStatus_FiltroAplicacaoResgate.DataBind(); } }
public override async Task RunScan(StatusRequest request, IServerStreamWriter <StatusReply> responseStream, ServerCallContext context) { float progress = 0f; while (progress < 1f) { progress += (float)rng.NextDouble() / 10f; await responseStream.WriteAsync(new StatusReply { Progress = (progress >= 1f) ? 1f : progress, Finished = (progress >= 1f) ? true : false, Message = (progress >= 1f) ? "Scan finished!" : "Scanning devices..." }); await Task.Delay(500); } }
public void ProcessStatus(StatusRequest request) { StatusResponse response = new StatusResponse(); response.AdoptHeader(request); response.Component = new StatusComponent(); response.Component.Type = "Mosaic"; response.Component.Description = "Mosaic Service"; response.Component.State = this.status; response.Component.StateDescription = this.stateDescriptions; if (request.IncludeDetails) { response.Component.SubComponents = this.statusSubComponentList.ToArray(); } request.ConverterStream.Write(response); }
/// <summary> /// Optional connection warm-up to speed up initial access. /// </summary> public async Task <bool> ConnectAsync() { try { var statusRequest = new StatusRequest(); StatusResponse response = await _etcdClient.StatusASync(statusRequest); _logger.LogDebug("Successfully connected to etcd: {response}", response.ToString()); } catch (Exception e) { _logger.LogWarning(e, "Error connecting to etcd using {client}", _etcdClient); return(false); } return(true); }
public IActionResult Post([FromBody] StatusRequest statusRequest) { if (!EnumHelper.TryGetFromDescription(statusRequest.Status, out TipoStatus status)) { return(StatusCode(422, new ErroResponse($"O status {statusRequest.Status} é inválido"))); } var statusDoPedido = _statusService.ModificarStatus( statusRequest.Pedido, status, statusRequest.ItensAprovados, statusRequest.ValorAprovado); return(StatusCode(200, new StatusResponse { Pedido = statusRequest.Pedido, Status = statusDoPedido.Select(EnumHelper.GetDescription).ToList(), })); }