filled in request bll

This commit is contained in:
Wyatt Miller 2018-11-27 20:36:31 -05:00
parent 1f94357521
commit 622086c0eb
6 changed files with 35 additions and 8 deletions

Binary file not shown.

View File

@ -1,25 +1,54 @@
using System; using RestSharp;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Mail; using System.Net.Mail;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json;
namespace DeskHubSharp namespace DeskHubSharp
{ {
class Request class Request
{ {
// TODO: this is rudimentary, fix it
// i.e. try catch statements
private string _apiEndpoint = "https://api.github.com/"; private string _apiEndpoint = "https://api.github.com/";
private string _query;
public Request() public Request(string query)
{ {
_query = query;
} }
public void SearchRequest() public void SearchRequest()
{ {
var client = new RestClient(_apiEndpoint);
RestRequest requestRepo = new RestRequest($"users//{_query}//repos", Method.GET);
var response = client.Execute(requestRepo).ToString();
Deserialize(response);
}
public void UserRequest()
{
var client = new RestClient(_apiEndpoint);
RestRequest requestUser = new RestRequest($"users//{_query}", Method.GET);
string response = client.Execute(requestUser).ToString();
Deserialize(response);
}
private void Deserialize(string response)
{
var deserialized = JsonConvert.DeserializeObject<RepoDetail>(response);
} }
} }

View File

@ -1,16 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DeskHubSharp namespace DeskHubSharp
{ {
class RepoList class RepoList : ObservableCollection<RepoDetail>
{ {
// ideas
// 1. have a for loop iterate on copies on this one particular file, if possible :p
// 2. have the request/reponse go through the DAL/jsondataservice.cs and have it dish out the response that way
// to be continued...
} }
} }