Ejemplo n.º 1
0
        private static void TestFlatFilterByPlatform(string expected, ODataTargetPlatform platform)
        {
            ODataQuery <IWeb> query = new ODataQuery <IWeb>
            {
                Top  = 10,
                Skip = 5
            };

            // Add one filter
            query.Filters.Add(new FilterItem
            {
                Field    = "Title",
                Criteria = FilteringCriteria.Equal,
                Value    = "Test 01",
            });

            // Add another filter
            query.Filters.Add(new FilterItem
            {
                Field          = "Description",
                Criteria       = FilteringCriteria.NotEqual,
                Value          = "Test 02",
                ConcatOperator = FilteringConcatOperator.AND
            });

            var actual = query.ToQueryString(platform);

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        private static void TestInDepthFiltersByPlatform(string expected, ODataTargetPlatform platform)
        {
            ODataQuery <IWeb> query = new ODataQuery <IWeb>
            {
                Top  = 10,
                Skip = 5
            };

            // Add one filter
            query.Filters.Add(new FilterItem
            {
                Field    = "Title",
                Criteria = FilteringCriteria.Equal,
                Value    = "Test 01",
            });

            // Add a group filter
            query.Filters.Add(new FiltersGroup(
                                  new List <ODataFilter>(new ODataFilter[]
            {
                new FilterItem
                {
                    Field    = "ID",
                    Criteria = FilteringCriteria.Equal,
                    Value    = 7,
                },
                new FilterItem
                {
                    Field          = "AuthorID",
                    Criteria       = FilteringCriteria.Equal,
                    Value          = 15,
                    ConcatOperator = FilteringConcatOperator.OR
                },
                new FilterItem
                {
                    Field          = "ModifiedBy",
                    Criteria       = FilteringCriteria.Equal,
                    Value          = "*****@*****.**",
                    ConcatOperator = FilteringConcatOperator.AND
                },
            })
                                  )
            {
                ConcatOperator = FilteringConcatOperator.OR,
            });

            // Add another filter
            query.Filters.Add(new FilterItem
            {
                Field          = "Description",
                Criteria       = FilteringCriteria.NotEqual,
                Value          = "Test 02",
                ConcatOperator = FilteringConcatOperator.AND
            });

            var actual = query.ToQueryString(platform);

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        private static void TestInDepthFiltersSingleGroupByPlatform(string expected, ODataTargetPlatform platform)
        {
            ODataQuery <IWeb> query = new ODataQuery <IWeb>();

            // Add a group filter
            query.Filters.Add(new FiltersGroup(
                                  new List <ODataFilter>(new ODataFilter[]
            {
                new FilterItem
                {
                    Field    = "ID",
                    Criteria = FilteringCriteria.Equal,
                    Value    = 1,
                },
                new FilterItem
                {
                    Field          = "AuthorID",
                    Criteria       = FilteringCriteria.Equal,
                    Value          = 2,
                    ConcatOperator = FilteringConcatOperator.OR
                }
            })
                                  )
            {
                ConcatOperator = FilteringConcatOperator.OR,
            });

            var actual = query.ToQueryString(platform);

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Get Employee earnings line splits
 /// </summary>
 /// <remarks>
 /// Lists all the earnings line splits for this employee.
 /// This operation supports OData queries.
 /// </remarks>
 public List <EarningsLineSplitApiModel> GetEmployeeEarningsLineSplits(int businessId, int employeeId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <EarningsLineSplitApiModel> >($"/business/{businessId}/employee/{employeeId}/earningslinesplit{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// List Employees
 /// </summary>
 /// <remarks>
 /// This endpoint returns the unstructured employee details for all matching employees.
 /// <p>
 /// See also: List basic details for employees (which is much more efficient if that is all the information that is required)
 /// </p>
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public List <MyUnstructuredEmployeeModel> ListEmployees(int businessId, ListEmployeesQueryModel request, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <MyUnstructuredEmployeeModel> >($"/business/{businessId}/employee/unstructured?payScheduleId={request.PayScheduleId}&locationId={request.LocationId}{ODataQuery.ToQueryString(oDataQuery, "&")}", Method.GET));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// List basic details for employees
 /// </summary>
 /// <remarks>
 /// This endpoint returns a list of employees. The details are a subset of the 'unstructured' employee endpoint.
 /// This data can be filtered much more efficiently though so if you only need the basic employee details, this endpoint is preferred.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public List <EmployeeDetailsModel> ListBasicDetailsForEmployees(int businessId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <EmployeeDetailsModel> >($"/business/{businessId}/employee/details{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Get Employee Work Types
 /// </summary>
 /// <remarks>
 /// Lists all the work types for the employee.
 /// This operation supports OData queries.
 /// </remarks>
 public List <WorkTypeModel> GetEmployeeWorkTypes(int businessId, int employeeId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <WorkTypeModel> >($"/business/{businessId}/employee/{employeeId}/worktype{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Get Leave Requests for Employee
 /// </summary>
 /// <remarks>
 /// Returns all leave requests for this employee, optionally filtered by OData parameters.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public List <HourLeaveRequestResponseModel> GetLeaveRequestsForEmployee(int businessId, int employeeId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <HourLeaveRequestResponseModel> >($"/business/{businessId}/employee/{employeeId}/leaverequest{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// List Leave Categories
 /// </summary>
 /// <remarks>
 /// Lists all of the leave categories for the business.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public List <NzLeaveCategoryModel> ListLeaveCategories(int businessId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <NzLeaveCategoryModel> >($"/business/{businessId}/leavecategory{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// List Kiosks
 /// </summary>
 /// <remarks>
 /// Lists all kiosks for the specified business.
 /// This operation supports OData queries.
 /// </remarks>
 public List<TimeAndAttendanceKioskModel> ListKiosks(int businessId, ODataQuery oDataQuery = null)
 {
     return ApiRequest<List<TimeAndAttendanceKioskModel>>($"/business/{businessId}/kiosk{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// List Pay Schedules
 /// </summary>
 /// <remarks>
 /// Lists all the pay schedules for the business.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public List <MyPayScheduleModel> ListPaySchedules(int businessId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <MyPayScheduleModel> >($"/business/{businessId}/payschedule{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// List Businesses
 /// </summary>
 /// <remarks>
 /// Lists all the businesses associated with the current user.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public Task <List <MyBusinessExportModel> > ListBusinessesAsync(ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return(ApiRequestAsync <List <MyBusinessExportModel> >($"/business{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET, cancellationToken));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// List Businesses
 /// </summary>
 /// <remarks>
 /// Lists all the businesses associated with the current user.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public List <MyBusinessExportModel> ListBusinesses(ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <MyBusinessExportModel> >($"/business{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// List All Business Access Users
 /// </summary>
 /// <remarks>
 /// Lists all of the users with access to this business, as well as the types of access they each have.
 /// This operation supports OData queries.
 /// </remarks>
 public Task <List <BusinessAccessModel> > ListAllBusinessAccessUsersAsync(int businessId, ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return(ApiRequestAsync <List <BusinessAccessModel> >($"/business/{businessId}/access{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET, cancellationToken));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// List All Business Access Users
 /// </summary>
 /// <remarks>
 /// Lists all of the users with access to this business, as well as the types of access they each have.
 /// This operation supports OData queries.
 /// </remarks>
 public List <BusinessAccessModel> ListAllBusinessAccessUsers(int businessId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <BusinessAccessModel> >($"/business/{businessId}/access{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// List Pay Runs
 /// </summary>
 /// <remarks>
 /// Get a list of pay runs associated with the business.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public Task <List <PayRunModel> > ListPayRunsAsync(int businessId, ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return(ApiRequestAsync <List <PayRunModel> >($"/business/{businessId}/payrun{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET, cancellationToken));
 }
Ejemplo n.º 17
0
 /// <summary>
 /// List Deduction Categories
 /// </summary>
 /// <remarks>
 /// Lists all the deduction categories for the business.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public List <MyDeductionCategoryModel> ListDeductionCategories(int businessId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <MyDeductionCategoryModel> >($"/business/{businessId}/deductioncategory{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 18
0
 /// <summary>
 /// List Kiosks
 /// </summary>
 /// <remarks>
 /// Lists all kiosks for the specified business.
 /// This operation supports OData queries.
 /// </remarks>
 public Task<List<TimeAndAttendanceKioskModel>> ListKiosksAsync(int businessId, ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return ApiRequestAsync<List<TimeAndAttendanceKioskModel>>($"/business/{businessId}/kiosk{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET, cancellationToken);
 }
Ejemplo n.º 19
0
 /// <summary>
 /// List Leave Categories
 /// </summary>
 /// <remarks>
 /// Lists all of the leave categories for the business.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public Task <List <NzLeaveCategoryModel> > ListLeaveCategoriesAsync(int businessId, ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return(ApiRequestAsync <List <NzLeaveCategoryModel> >($"/business/{businessId}/leavecategory{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET, cancellationToken));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// List Employee Expense Categories
 /// </summary>
 /// <remarks>
 /// Lists all the employee expense categories for the business.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public List <EmployeeExpenseCategoryModel> ListEmployeeExpenseCategories(int businessId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <EmployeeExpenseCategoryModel> >($"/business/{businessId}/employeeexpensecategory{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Get Leave Requests for Employee
 /// </summary>
 /// <remarks>
 /// Returns all leave requests for this employee, optionally filtered by OData parameters.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public Task <List <HourLeaveRequestResponseModel> > GetLeaveRequestsForEmployeeAsync(int businessId, int employeeId, ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return(ApiRequestAsync <List <HourLeaveRequestResponseModel> >($"/business/{businessId}/employee/{employeeId}/leaverequest{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET, cancellationToken));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// List Employment Agreements
 /// </summary>
 /// <remarks>
 /// Lists all of the employment agreements for the business.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public List <BasicEmploymentAgreementModel> ListEmploymentAgreements(int businessId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <BasicEmploymentAgreementModel> >($"/business/{businessId}/employmentagreement{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Get Employee Work Types
 /// </summary>
 /// <remarks>
 /// Lists all the work types for the employee.
 /// This operation supports OData queries.
 /// </remarks>
 public Task <List <WorkTypeModel> > GetEmployeeWorkTypesAsync(int businessId, int employeeId, ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return(ApiRequestAsync <List <WorkTypeModel> >($"/business/{businessId}/employee/{employeeId}/worktype{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET, cancellationToken));
 }
Ejemplo n.º 24
0
 /// <summary>
 /// List Employment Agreements
 /// </summary>
 /// <remarks>
 /// Lists all of the employment agreements for the business.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public Task <List <BasicEmploymentAgreementModel> > ListEmploymentAgreementsAsync(int businessId, ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return(ApiRequestAsync <List <BasicEmploymentAgreementModel> >($"/business/{businessId}/employmentagreement{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET, cancellationToken));
 }
Ejemplo n.º 25
0
 /// <summary>
 /// List basic details for employees
 /// </summary>
 /// <remarks>
 /// This endpoint returns a list of employees. The details are a subset of the 'unstructured' employee endpoint.
 /// This data can be filtered much more efficiently though so if you only need the basic employee details, this endpoint is preferred.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public Task <List <EmployeeDetailsModel> > ListBasicDetailsForEmployeesAsync(int businessId, ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return(ApiRequestAsync <List <EmployeeDetailsModel> >($"/business/{businessId}/employee/details{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET, cancellationToken));
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Get Users With Access to Employee
 /// </summary>
 /// <remarks>
 /// Gets a list of all users with access to this employee.
 /// This operation supports OData queries.
 /// </remarks>
 public List <EmployeeAccessModel> GetUsersWithAccessToEmployee(int businessId, int employeeId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <EmployeeAccessModel> >($"/business/{businessId}/employee/{employeeId}/access{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }
Ejemplo n.º 27
0
 /// <summary>
 /// List Employees
 /// </summary>
 /// <remarks>
 /// This endpoint returns the unstructured employee details for all matching employees.
 /// <p>
 /// See also: List basic details for employees (which is much more efficient if that is all the information that is required)
 /// </p>
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public Task <List <MyUnstructuredEmployeeModel> > ListEmployeesAsync(int businessId, ListEmployeesQueryModel request, ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return(ApiRequestAsync <List <MyUnstructuredEmployeeModel> >($"/business/{businessId}/employee/unstructured?payScheduleId={request.PayScheduleId}&locationId={request.LocationId}{ODataQuery.ToQueryString(oDataQuery, "&")}", Method.GET, cancellationToken));
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Get Users With Access to Employee
 /// </summary>
 /// <remarks>
 /// Gets a list of all users with access to this employee.
 /// This operation supports OData queries.
 /// </remarks>
 public Task <List <EmployeeAccessModel> > GetUsersWithAccessToEmployeeAsync(int businessId, int employeeId, ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return(ApiRequestAsync <List <EmployeeAccessModel> >($"/business/{businessId}/employee/{employeeId}/access{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET, cancellationToken));
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Get Employee earnings line splits
 /// </summary>
 /// <remarks>
 /// Lists all the earnings line splits for this employee.
 /// This operation supports OData queries.
 /// </remarks>
 public Task <List <EarningsLineSplitApiModel> > GetEmployeeEarningsLineSplitsAsync(int businessId, int employeeId, ODataQuery oDataQuery = null, CancellationToken cancellationToken = default)
 {
     return(ApiRequestAsync <List <EarningsLineSplitApiModel> >($"/business/{businessId}/employee/{employeeId}/earningslinesplit{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET, cancellationToken));
 }
Ejemplo n.º 30
0
 /// <summary>
 /// List Pay Runs
 /// </summary>
 /// <remarks>
 /// Get a list of pay runs associated with the business.
 /// This operation supports OData queries (only $filter, $orderby, $top, $skip).
 /// </remarks>
 public List <PayRunModel> ListPayRuns(int businessId, ODataQuery oDataQuery = null)
 {
     return(ApiRequest <List <PayRunModel> >($"/business/{businessId}/payrun{ODataQuery.ToQueryString(oDataQuery, "?")}", Method.GET));
 }