CRDevelopment.BambooNET
0.1.22
dotnet add package CRDevelopment.BambooNET --version 0.1.22
NuGet\Install-Package CRDevelopment.BambooNET -Version 0.1.22
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CRDevelopment.BambooNET" Version="0.1.22" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CRDevelopment.BambooNET --version 0.1.22
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CRDevelopment.BambooNET, 0.1.22"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CRDevelopment.BambooNET as a Cake Addin #addin nuget:?package=CRDevelopment.BambooNET&version=0.1.22 // Install CRDevelopment.BambooNET as a Cake Tool #tool nuget:?package=CRDevelopment.BambooNET&version=0.1.22
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
BambooNET
A .NET client library for the BambooHR API.
Table of Contents
Usage
public class Program
{
private static readonly string COMPANY_SUBDOMAIN = "yourcompany";
private static readonly string API_KEY = "YourBamb00HRAPIKey";
private static readonly int BAMBOO_ID = 225;
private static readonly DateTime START_DATE = new(2024, 11, 30);
private static readonly DateTime END_DATE = new(2024, 12, 13);
public static async Task Main()
{
try
{
System.Console.WriteLine("Running...");
var bambooClient = new BambooClient(COMPANY_SUBDOMAIN, API_KEY);
//var bambooClient = new BambooClient(COMPANY_SUBDOMAIN, API_KEY, DATE_FORMAT);
var timesheets = await bambooClient.TimeTracking.GetTimesheetEntriesAsync(START_DATE, END_DATE);
System.Console.WriteLine($"TimeTracking.GetTimesheetEntriesAsync Results: {timesheets.Count}");
var requests = await bambooClient.TimeOff.GetRequestsAsync(START_DATE, END_DATE);
System.Console.WriteLine($"TimeOff.GetRequestsAsync Results: {requests.Count}");
var whosout = await bambooClient.TimeOff.GetWhosOutAsync(START_DATE, END_DATE);
System.Console.WriteLine($"TimeOff.GetWhosOutAsync Results: {whosout.Count}");
var employeedata = await bambooClient.Employees.GetEmployeeDataAsync(BAMBOO_ID);
System.Console.WriteLine($"Employees.GetEmployeeDataAsync Results: {employeedata.EmployeeNumber} {employeedata.FirstName} {employeedata.LastName}");
var ex_employeedata = await bambooClient.Employees.GetEmployeeDataAsync<ExtendedEmployeeData>(BAMBOO_ID);
System.Console.WriteLine($"Employees.GetEmployeeDataAsync Results: {ex_employeedata}");
var tabledata = await bambooClient.Employees.GetTabularDataAsync<JobInfoData>(BAMBOO_ID, "jobInfo");
System.Console.WriteLine($"Employees.GetTabularDataAsync Results: {tabledata.Count}");
var dataset = await bambooClient.Datasets.GetDatasetDataAsync<ExtendedEmployeeDataset>("employee",
new(FiltersMatch.ANY,
[
new("hireDate", FilterOperator.GreaterThanOrEqual, START_DATE.ToString(bambooClient.DateFormat))
]),
[
new("hireDate", SortDirection.DESC),
new("lastName", SortDirection.ASC),
new("firstName", SortDirection.ASC)
]
);
System.Console.WriteLine($"Datasets.GetDatasetData Results: {dataset.Count}");
foreach (var datarow in dataset)
{
System.Console.WriteLine($"\t{datarow}");
}
System.Console.WriteLine("Done.");
System.Console.ReadLine();
}
catch (Exception ex)
{
System.Console.WriteLine(ex.ToString());
}
} //end public static async void Main()
} //end public class Program
internal class ExtendedEmployeeData : EmployeeData
{
[JsonProperty("jobTitle")]
public string JobTitle { get; set; }
[JsonProperty("payGroup")]
public string PayGroup { get; set; }
/// <summary>
/// Override ToString()
/// </summary>
/// <returns></returns>
public override string ToString()
{
return $"{Id}: #{EmployeeNumber} {FirstName} {LastName}, Position: {JobTitle}, Pay Group: {PayGroup}";
}
} //end internal class ExtendedEmployeeData : EmployeeData
internal class ExtendedEmployeeDataset : EmployeeDataset
{
[JsonProperty("jobInformationJobTitle")]
public string JobTitle { get; set; }
[JsonProperty("payGroup")]
public string PayGroup { get; set; }
/// <summary>
/// Override ToString()
/// </summary>
/// <returns></returns>
public override string ToString()
{
return $"{Id}: #{EmployeeNumber} {FirstName} {LastName}, Position: {JobTitle}, Pay Group: {PayGroup}";
}
} //end internal class ExtendedEmployeeDataset : EmployeeDataset
internal class JobInfoData : DataAbstract
{
//public int Id { get; set; }
[JsonProperty("employeeNumber")]
public int EmployeeNumber { get; set; }
[JsonProperty("date")]
public DateTime? Date { get; set; }
[JsonProperty("location")]
public string Location { get; set; }
[JsonProperty("department")]
public string Department { get; set; }
[JsonProperty("division")]
public string Division { get; set; }
[JsonProperty("jobTitle")]
public string JobTitle { get; set; }
[JsonProperty("reportsTo")]
public string ReportsTo { get; set; }
/// <summary>
/// Override ToString()
/// </summary>
/// <returns></returns>
public override string ToString()
{
return $"Date: {Date:yyyy-MM-dd}, Location: {Location}, Department: {Department}, Division: {Division}, JobTitle: {JobTitle}, ReportsTo: {ReportsTo}";
}
} //end internal class TableData : DataAbstract
Reference
Code of Conduct
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior.
For more information see the Code of Conduct.
Issues / Support
See SECURITY.md for feature requests or bug reports.
Contributing
See CONTRIBUTING.md for more information.
Author
License
Copyright © 2024 CR Development. Licensed under the MIT license.
See LICENSE.md or https://opensource.org/license/mit for more details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
- RestSharp (>= 112.1.0)
- RestSharp.Serializers.NewtonsoftJson (>= 112.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
0.1.22 | 78 | 12/30/2024 | |
0.1.21 | 92 | 12/29/2024 | |
0.1.20 | 98 | 12/29/2024 | |
0.1.19 | 94 | 12/29/2024 | |
0.1.18 | 90 | 12/28/2024 | |
0.1.17 | 88 | 12/28/2024 | |
0.1.16 | 90 | 12/27/2024 | |
0.1.15 | 94 | 12/27/2024 | |
0.1.14 | 88 | 12/27/2024 | |
0.1.13 | 87 | 12/27/2024 | |
0.1.12 | 96 | 12/26/2024 | |
0.1.11 | 87 | 12/26/2024 | |
0.1.10 | 90 | 12/26/2024 | |
0.1.9 | 90 | 12/26/2024 | |
0.1.8 | 84 | 12/26/2024 | |
0.1.7 | 88 | 12/26/2024 | |
0.1.6 | 93 | 12/25/2024 | |
0.1.5 | 90 | 12/25/2024 | |
0.1.4 | 99 | 12/24/2024 |