/// <summary>
        /// Clock a user into a jobcode, on a timesheet.
        /// </summary>
        /// <returns>A tuple of the user and timesheet.</returns>
        private (User, Timesheet) ClockAUserIntoATimesheet()
        {
            // Get the user id
            var userFilter = new UserFilter {
                UserNames = new[] { "bobsmith" }
            };
            IList <User> users = this.apiClient.GetUsers(userFilter).Item1;

            User user = users.First();

            // Now get the jobcode id.
            var jobcodeFilter = new JobcodeFilter {
                Name = "TestJobcode3"
            };
            IList <Jobcode> jobcodes = this.apiClient.GetJobcodes(jobcodeFilter).Item1;

            Jobcode jobcode = jobcodes.First();

            // Now clock the user into the jobcode. Note that active (i.e. "on-the-clock") timesheets
            // are created with an End time of DateTimeOffset.MinValue. The dedicated constructor
            // we're using here does that for you automatically.
            var timesheetToCreate = new Timesheet(user.Id, jobcode.Id, DateTimeOffset.Now);
            var createdTimesheet  = this.apiClient.CreateTimesheet(timesheetToCreate).Item1;

            return(user, createdTimesheet);
        }
        /// <summary>
        /// Asynchronously Retrieve Jobcodes, with support for cancellation.
        /// </summary>
        /// <remarks>
        /// Retrieves a list of all jobcodes associated with your company,
        /// with optional filters to narrow down the results.
        /// </remarks>
        /// <param name="filter">
        /// An instance of the <see cref="JobcodeFilter"/> class, for narrowing down the results.
        /// </param>
        /// <param name="options">
        /// An instance of the <see cref="RequestOptions"/> class, for customizing method processing.
        /// </param>
        /// <param name="cancellationToken">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>
        /// An enumerable set of <see cref="Jobcode"/> objects, along with an output
        /// instance of the <see cref="ResultsMeta"/> class containing additional data.
        /// </returns>
        public async Task <(IList <Jobcode>, ResultsMeta)> GetJobcodesAsync(
            JobcodeFilter filter,
            RequestOptions options,
            CancellationToken cancellationToken)
        {
            var context = new GetContext <Jobcode>(EndpointName.Jobcodes, filter, options);

            await ExecuteOperationAsync(context, cancellationToken).ConfigureAwait(false);

            return(context.Results.Items, context.ResultsMeta);
        }
 /// <summary>
 /// Asynchronously Retrieve Jobcodes.
 /// </summary>
 /// <remarks>
 /// Retrieves a list of all jobcodes associated with your company,
 /// with optional filters to narrow down the results.
 /// </remarks>
 /// <param name="filter">
 /// An instance of the <see cref="JobcodeFilter"/> class, for narrowing down the results.
 /// </param>
 /// <param name="options">
 /// An instance of the <see cref="RequestOptions"/> class, for customizing method processing.
 /// </param>
 /// <returns>
 /// An enumerable set of <see cref="Jobcode"/> objects, along with an output
 /// instance of the <see cref="ResultsMeta"/> class containing additional data.
 /// </returns>
 public async Task <(IList <Jobcode>, ResultsMeta)> GetJobcodesAsync(
     JobcodeFilter filter,
     RequestOptions options)
 {
     return(await GetJobcodesAsync(filter, options, default).ConfigureAwait(false));
 }
 /// <summary>
 /// Asynchronously Retrieve Jobcodes, with support for cancellation.
 /// </summary>
 /// <remarks>
 /// Retrieves a list of all jobcodes associated with your company,
 /// with optional filters to narrow down the results.
 /// </remarks>
 /// <param name="filter">
 /// An instance of the <see cref="JobcodeFilter"/> class, for narrowing down the results.
 /// </param>
 /// <param name="cancellationToken">
 /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// <returns>
 /// An enumerable set of <see cref="Jobcode"/> objects, along with an output
 /// instance of the <see cref="ResultsMeta"/> class containing additional data.
 /// </returns>
 public async Task <(IList <Jobcode>, ResultsMeta)> GetJobcodesAsync(
     JobcodeFilter filter,
     CancellationToken cancellationToken)
 {
     return(await GetJobcodesAsync(filter, null, cancellationToken).ConfigureAwait(false));
 }
 /// <summary>
 /// Asynchronously Retrieve Jobcodes.
 /// </summary>
 /// <remarks>
 /// Retrieves a list of all jobcodes associated with your company,
 /// with optional filters to narrow down the results.
 /// </remarks>
 /// <param name="filter">
 /// An instance of the <see cref="JobcodeFilter"/> class, for narrowing down the results.
 /// </param>
 /// <returns>
 /// An enumerable set of <see cref="Jobcode"/> objects, along with an output
 /// instance of the <see cref="ResultsMeta"/> class containing additional data.
 /// </returns>
 public async Task <(IList <Jobcode>, ResultsMeta)> GetJobcodesAsync(
     JobcodeFilter filter)
 {
     return(await GetJobcodesAsync(filter, null, default).ConfigureAwait(false));
 }
 /// <summary>
 /// Retrieve Jobcodes.
 /// </summary>
 /// <remarks>
 /// Retrieves a list of all jobcodes associated with your company,
 /// with optional filters to narrow down the results.
 /// </remarks>
 /// <param name="filter">
 /// An instance of the <see cref="JobcodeFilter"/> class, for narrowing down the results.
 /// </param>
 /// <param name="options">
 /// An instance of the <see cref="RequestOptions"/> class, for customizing method processing.
 /// </param>
 /// <returns>
 /// An enumerable set of <see cref="Jobcode"/> objects, along with an output
 /// instance of the <see cref="ResultsMeta"/> class containing additional data.
 /// </returns>
 public (IList <Jobcode>, ResultsMeta) GetJobcodes(
     JobcodeFilter filter,
     RequestOptions options)
 {
     return(AsyncUtil.RunSync(() => GetJobcodesAsync(filter, options)));
 }
 /// <summary>
 /// Retrieve Jobcodes.
 /// </summary>
 /// <remarks>
 /// Retrieves a list of all jobcodes associated with your company,
 /// with optional filters to narrow down the results.
 /// </remarks>
 /// <param name="filter">
 /// An instance of the <see cref="JobcodeFilter"/> class, for narrowing down the results.
 /// </param>
 /// <returns>
 /// An enumerable set of <see cref="Jobcode"/> objects, along with an output
 /// instance of the <see cref="ResultsMeta"/> class containing additional data.
 /// </returns>
 public (IList <Jobcode>, ResultsMeta) GetJobcodes(
     JobcodeFilter filter)
 {
     return(AsyncUtil.RunSync(() => GetJobcodesAsync(filter)));
 }