public async Task <Company> GetCompanyAsync(int companyId, CompanyMethods extraMethods = CompanyMethods.Undefined) { RestRequest req = _client.Create("company/{companyId}"); req.AddUrlSegment("companyId", companyId.ToString()); string appends = string.Join(",", Enum.GetValues(typeof(CompanyMethods)) .OfType <CompanyMethods>() .Except(new[] { CompanyMethods.Undefined }) .Where(s => extraMethods.HasFlag(s)) .Select(s => s.GetDescription())); if (appends != string.Empty) { req.AddParameter("append_to_response", appends); } //req.DateFormat = "yyyy-MM-dd"; RestResponse <Company> resp = await req.ExecuteGet <Company>().ConfigureAwait(false); return(resp); }
public Company GetCompany(int companyId, CompanyMethods extraMethods = CompanyMethods.Undefined) { RestRequest req = new RestRequest("company/{companyId}"); req.AddUrlSegment("companyId", companyId.ToString()); string appends = string.Join(",", Enum.GetValues(typeof(CompanyMethods)) .OfType <CompanyMethods>() .Except(new[] { CompanyMethods.Undefined }) .Where(s => extraMethods.HasFlag(s)) .Select(s => s.GetDescription())); if (appends != string.Empty) { req.AddParameter("append_to_response", appends); } req.DateFormat = "yyyy-MM-dd"; IRestResponse <Company> resp = _client.Get <Company>(req); return(resp.Data); }