本文整理汇总了C#中RestSharp.Portable.RestRequest.AddQueryParameter方法的典型用法代码示例。如果您正苦于以下问题:C# RestRequest.AddQueryParameter方法的具体用法?C# RestRequest.AddQueryParameter怎么用?C# RestRequest.AddQueryParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RestSharp.Portable.RestRequest
的用法示例。
在下文中一共展示了RestRequest.AddQueryParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCountriesRequest
public static RestRequest CreateCountriesRequest(int page, int countriesPerPage, RequestFormat format)
{
var restReq = new RestRequest(HttpMethod.Get);
restReq.AddQueryParameter("format", format.ToString());
restReq.AddQueryParameter("page", page);
restReq.AddQueryParameter("per_page", countriesPerPage);
return restReq;
}
示例2: ValidarUsuario
public async Task<UsuarioModel> ValidarUsuario(UsuarioModel usuario)
{
var request = new RestRequest("Usuario");
request.Method = Method.GET;
request.AddQueryParameter("Username", usuario.Username);
request.AddQueryParameter("Password", usuario.Password);
var response = await client.Execute<UsuarioModel>(request);
if (response.IsSuccess) return response.Data;
return null;
}
示例3: ValidarUsuario
public async Task<UsuarioModel> ValidarUsuario(UsuarioModel usuario)
{
var request = new RestRequest("Usuario");
//Al request se le pueden añadir Headers, y al client se le pueden añadir credentials
request.Method = Method.GET;
request.AddQueryParameter("login", usuario.login);
request.AddQueryParameter("password", usuario.password);
var reponse = await client.Execute<UsuarioModel>(request);
if (reponse.IsSuccess) return reponse.Data;
return null;
}
示例4: GetContactos
public async Task<List<ContactoModel>> GetContactos(bool actuales, int id)
{
var request = new RestRequest("Contactos");
request.Method = Method.GET;
request.AddQueryParameter("id", id);
request.AddQueryParameter("amigos", actuales);
var reponse = await client.Execute<List<ContactoModel>>(request);
if (reponse.IsSuccess) return reponse.Data;
return null;
}
示例5: ValidarUsuario
public async Task<UsuarioModel> ValidarUsuario(UsuarioModel model)
{
var request = new RestRequest("Usuario") { Method = Method.GET };
request.AddQueryParameter("username", model.Username);
request.AddQueryParameter("password", model.Password);
// la api devuelve error 404 si no existe, y restsharp peta
var response = await _client.Execute<UsuarioModel>(request);
if (response.IsSuccess)
return response.Data;
return null;
}
示例6: GetAthleteActivities
private async Task<List<ActivitySummary>> GetAthleteActivities(DateTime before, DateTime after, int page, int itemsPerPage)
{
var request = new RestRequest("/api/v3/athlete/activities");
if (before != DateTime.MinValue)
request.AddQueryParameter("before", before.GetSecondsSinceUnixEpoch());
if (after != DateTime.MinValue)
request.AddQueryParameter("after", after.GetSecondsSinceUnixEpoch());
if (page != 0)
request.AddParameter("page", page);
if (itemsPerPage != 0)
request.AddParameter("per_page", itemsPerPage);
var response = await _client.RestClient.Execute<List<ActivitySummary>>(request);
return response.Data;
}
示例7: GetComponentAsync
public Task<Component> GetComponentAsync(string roomId, string deviceId)
{
var request = new RestRequest("component") {Method = HttpMethod.Get};
request.AddQueryParameter("roomId", roomId);
request.AddQueryParameter("deviceId", deviceId);
var task = _client.Execute<Component>(request).ContinueWith(t =>
{
if (t.Result.StatusCode == HttpStatusCode.OK)
{
return t.Result.Data;
}
throw new Exception("There is something wrong here");
});
return task;
}
示例8: UsuarioNuevo
public async Task<bool> UsuarioNuevo(string username)
{
var request = new RestRequest("Usuario");
request.Method = Method.GET;
request.AddQueryParameter("Username", username);
var response = await client.Execute<bool>(request);
if (response.IsSuccess) return response.Data;
return false;
}
示例9: GetUsuariosId
public async Task<UsuarioModel> GetUsuariosId(int id)
{
var request = new RestRequest("Usuario");
request.Method = Method.GET;
request.AddQueryParameter("id", id);
var response = await client.Execute<UsuarioModel>(request);
if (response.IsSuccess)
return response.Data;
return null;
}
示例10: CheckUsuario
public async Task<bool> CheckUsuario(string email)
{
var request = new RestRequest("Usuario") { Method = Method.GET };
request.AddQueryParameter("email", email);
var response = await _client.Execute<bool>(request);
if (response.IsSuccess)
return response.Data;
return false;
}
示例11: GetByGrupo
public async Task<ICollection<TareaModel>> GetByGrupo(int id)
{
var request = new RestRequest("Tarea");
request.Method = Method.GET;
request.AddQueryParameter("idGrupo", id);
var response = await client.Execute<ICollection<TareaModel>>(request);
if (response.IsSuccess)
return response.Data;
return null;
}
示例12: GetTareas
public async Task<ICollection<TareaModel>> GetTareas(int grupoId)
{
var request = new RestRequest("Tarea") { Method = Method.GET };
request.AddQueryParameter("grupoId", grupoId);
var response = await _client.Execute<ICollection<TareaModel>>(request);
if (response.IsSuccess)
return response.Data;
return null;
}
示例13: GetMensajesEnviados
public async Task<ICollection<MensajeModel>> GetMensajesEnviados(int userId)
{
var request = new RestRequest("Mensaje") { Method = Method.GET };
request.AddQueryParameter("emisorId", userId);
var response = await _client.Execute<List<MensajeModel>>(request);
if (response.IsSuccess)
return response.Data;
return null;
}
示例14: GetGrupos
public async Task<ICollection<GrupoModel>> GetGrupos(int userId)
{
var request = new RestRequest("Grupo") { Method = Method.GET };
request.AddQueryParameter("userId", userId);
var response = await _client.Execute<ICollection<GrupoModel>>(request);
if (response.IsSuccess)
return response.Data;
return null;
}
示例15: DeleteAmigo
public async Task DeleteAmigo(int idUsuario, int idAmigo)
{
var request = new RestRequest("Contacto");
request.Method = Method.DELETE;
request.AddQueryParameter("idUsuario", idUsuario);
request.AddQueryParameter("idAmigo", idAmigo);
var response = await client.Execute<ContactoModel>(request);
}