filled in request bll
This commit is contained in:
parent
1f94357521
commit
622086c0eb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,25 +1,54 @@
|
||||
using System;
|
||||
using RestSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Mail;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace DeskHubSharp
|
||||
{
|
||||
class Request
|
||||
{
|
||||
// TODO: this is rudimentary, fix it
|
||||
// i.e. try catch statements
|
||||
|
||||
private string _apiEndpoint = "https://api.github.com/";
|
||||
private string _query;
|
||||
|
||||
public Request()
|
||||
public Request(string query)
|
||||
{
|
||||
|
||||
_query = query;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
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...
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user