/// <summary> /// Gets a Resource by its <paramref name="id"/> /// </summary> /// <typeparam name="T">Type of the resource to be recovered</typeparam> /// <param name="id">Unique id for the resource to be recovered</param> /// <param name="cancellationToken"></param> /// <returns>Recovered resource of type <c>T</c></returns> public async Task <T> GetAsync <T>(string id, CancellationToken cancellationToken = default(CancellationToken)) where T : Document { var resourceExtension = new ResourceExtension(_sender); var resource = await resourceExtension.GetAsync <T>(id, cancellationToken).ConfigureAwait(false); return(resource); }
public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken = default(CancellationToken)) { //Pegando Informações do usuário DirectoryExtension d = new DirectoryExtension(_sender); var x = d.GetDirectoryAccountAsync(envelope.From.ToIdentity(), cancellationToken).Result; //Armazenando recursos ResourceExtension r = new ResourceExtension(_sender); var retorno = r.SetAsync <PlainText>("123649", new PlainText { Text = "Votações do Deputado" }); PlainText teste = null; if (!retorno.IsCompleted) { teste = r.GetAsync <PlainText>("123649").Result; } await _sender.SendMessageAsync(teste.Text, envelope.From, cancellationToken); }