本文整理汇总了C#中ApiClient.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ApiClient.Get方法的具体用法?C# ApiClient.Get怎么用?C# ApiClient.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiClient
的用法示例。
在下文中一共展示了ApiClient.Get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
const string baseUrl = "https://web.foretagsplatsen.se";
// Create a client
var client = new ApiClient(new BasicAuthenticationRestClient("apiconsultant", "api", baseUrl));
// List all companies
var companyResource = client.GetCompanyResource();
var companies = companyResource.List(true);
foreach (var info in companies)
{
Console.WriteLine(info.name);
}
var firstCompany = companies.First();
// List fiscal years
var fiscalYears = client.GetCompanyFiscalYearResource(firstCompany).List();
foreach (FiscalYear year in fiscalYears)
{
Console.WriteLine("Year: " + year.id);
}
// Update a company
firstCompany.name = "A brand new name";
companyResource.Update(firstCompany);
// Get Single-Sign-On url
var loginUrl = client.GetLoginRequest(LoginParameters.CreateOAuthLoginParameters(firstCompany.businessIdentityCode, "MyCompanies"));
Console.WriteLine(loginUrl.RequestUri);
// Fetch latest 2 period reports
var latestPeriodReports = client.GetCompanyPeriodReportResource(firstCompany).List(latest: 2);
foreach (var report in latestPeriodReports)
{
Console.WriteLine(report.title);
}
// Execute custom requests
var moreCompanies = client.Get<List<CompanyInfo>>(baseUrl + "/Api/v2/Company");
foreach (CompanyInfo info in moreCompanies)
{
Console.WriteLine(info.name);
}
Console.ReadKey();
}