public static async Task Using_Custom_Requests() { PersonGetRequest personGetRequest = new PersonGetRequest(); RestResponse <Person> persGetResponse = await personGetRequest.Name("testUser").GetPerson(); if (persGetResponse.HasData) { Person person = persGetResponse.Data; //... } // or with actions await personGetRequest.Name("testUser").GetPerson( (r) => Debug.WriteLine(r.Data.Name + " is " + r.Data.Age + " years old."), (r) => Debug.WriteLine(r.Exception.Message)); }
public static PersonGetRequest GetByName(string name = "") { var personGet = new PersonGetRequest(); if (!String.IsNullOrEmpty(name)) { personGet.Name(name); } return(personGet); }
public static async Task Using_Custom_Requests() { PersonGetRequest personGetRequest = new PersonGetRequest(); RestResponse<Person> persGetResponse = await personGetRequest.Name("testUser").GetPerson(); if (persGetResponse.HasData) { Person person = persGetResponse.Data; //... } // or with actions await personGetRequest.Name("testUser").GetPerson( (r) => Debug.WriteLine(r.Data.Name + " is " + r.Data.Age + " years old."), (r) => Debug.WriteLine(r.Exception.Message)); }
public static PersonGetRequest GetByName(string name = "") { var personGet = new PersonGetRequest(); if (!String.IsNullOrEmpty(name)) personGet.Name(name); return personGet; }