# coding: utf-8

"""
Copyright 2017 Square, Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""


from __future__ import absolute_import

import sys
import os
import re

# python 2 and python 3 compatibility library
from six import iteritems

from ..api_client import ApiClient


class V1EmployeesApi(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def create_employee(self, body, **kwargs):
        """
        CreateEmployee
         Use the CreateEmployee endpoint to add an employee to a Square account. Employees created with the Connect API have an initial status of `INACTIVE`. Inactive employees cannot sign in to Square Point of Sale until they are activated from the Square Dashboard. Employee status cannot be changed with the Connect API.  <aside class=\"important\"> Employee entities cannot be deleted. To disable employee profiles, set the employee's status to <code>INACTIVE</code> </aside>

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.create_employee(body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param V1Employee body: An object containing the fields to POST for the request.  See the corresponding object definition for field details. (required)
        :return: V1Employee
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method create_employee" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'body' is set
        if ('body' not in params) or (params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `create_employee`")


        resource_path = '/v1/me/employees'.replace('{format}', 'json')
        path_params = {}

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'POST',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='V1Employee',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def create_employee_role(self, employee_role, **kwargs):
        """
        CreateEmployeeRole
        Creates an employee role you can then assign to employees.  Square accounts can include any number of roles that can be assigned to employees. These roles define the actions and permissions granted to an employee with that role. For example, an employee with a \"Shift Manager\" role might be able to issue refunds in Square Point of Sale, whereas an employee with a \"Clerk\" role might not.  Roles are assigned with the [V1UpdateEmployee](#endpoint-v1updateemployee) endpoint. An employee can have only one role at a time.  If an employee has no role, they have none of the permissions associated with roles. All employees can accept payments with Square Point of Sale.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.create_employee_role(employee_role, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param V1EmployeeRole employee_role: An EmployeeRole object with a name and permissions, and an optional owner flag. (required)
        :return: V1EmployeeRole
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['employee_role']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method create_employee_role" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'employee_role' is set
        if ('employee_role' not in params) or (params['employee_role'] is None):
            raise ValueError("Missing the required parameter `employee_role` when calling `create_employee_role`")


        resource_path = '/v1/me/roles'.replace('{format}', 'json')
        path_params = {}

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None
        if 'employee_role' in params:
            body_params = params['employee_role']

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'POST',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='V1EmployeeRole',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def create_timecard(self, body, **kwargs):
        """
        CreateTimecard
        Creates a timecard for an employee and clocks them in with an `API_CREATE` event and a `clockin_time` set to the current time unless the request provides a different value. To import timecards from another system (rather than clocking someone in). Specify the `clockin_time` and* `clockout_time` in the request.  Timecards correspond to exactly one shift for a given employee, bounded by the `clockin_time` and `clockout_time` fields. An employee is considered clocked in if they have a timecard that doesn't have a `clockout_time` set. An employee that is currently clocked in cannot be clocked in a second time.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.create_timecard(body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param V1Timecard body: An object containing the fields to POST for the request.  See the corresponding object definition for field details. (required)
        :return: V1Timecard
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method create_timecard" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'body' is set
        if ('body' not in params) or (params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `create_timecard`")


        resource_path = '/v1/me/timecards'.replace('{format}', 'json')
        path_params = {}

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'POST',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='V1Timecard',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def delete_timecard(self, timecard_id, **kwargs):
        """
        DeleteTimecard
        Deletes a timecard. Timecards can also be deleted through the Square Dashboard. Deleted timecards are still accessible through Connect API endpoints, but cannot be modified. The `deleted` field of the `Timecard` object indicates whether the timecard has been deleted.  *Note**: By default, deleted timecards appear alongside valid timecards in results returned by the [ListTimecards](#endpoint-v1employees-listtimecards) endpoint. To filter deleted timecards, include the `deleted` query parameter in the list request.  <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.delete_timecard(timecard_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str timecard_id: The ID of the timecard to delete. (required)
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['timecard_id']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_timecard" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'timecard_id' is set
        if ('timecard_id' not in params) or (params['timecard_id'] is None):
            raise ValueError("Missing the required parameter `timecard_id` when calling `delete_timecard`")


        resource_path = '/v1/me/timecards/{timecard_id}'.replace('{format}', 'json')
        path_params = {}
        if 'timecard_id' in params:
            path_params['timecard_id'] = params['timecard_id']

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'DELETE',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='object',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def list_cash_drawer_shifts(self, location_id, **kwargs):
        """
        ListCashDrawerShifts
        Provides the details for all of a location's cash drawer shifts during a date range. The date range you specify cannot exceed 90 days.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.list_cash_drawer_shifts(location_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str location_id: The ID of the location to list cash drawer shifts for. (required)
        :param str order: The order in which cash drawer shifts are listed in the response, based on their created_at field. Default value: ASC
        :param str begin_time: The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time minus 90 days.
        :param str end_time: The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time.
        :return: list[V1CashDrawerShift]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['location_id', 'order', 'begin_time', 'end_time']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_cash_drawer_shifts" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'location_id' is set
        if ('location_id' not in params) or (params['location_id'] is None):
            raise ValueError("Missing the required parameter `location_id` when calling `list_cash_drawer_shifts`")


        resource_path = '/v1/{location_id}/cash-drawer-shifts'.replace('{format}', 'json')
        path_params = {}
        if 'location_id' in params:
            path_params['location_id'] = params['location_id']

        query_params = {}
        if 'order' in params and params['order'] is not None:
            query_params['order'] = params['order']
        if 'begin_time' in params and params['begin_time'] is not None:
            query_params['begin_time'] = params['begin_time']
        if 'end_time' in params and params['end_time'] is not None:
            query_params['end_time'] = params['end_time']

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='list[V1CashDrawerShift]',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def list_employee_roles(self, **kwargs):
        """
        ListEmployeeRoles
        Provides summary information for all of a business's employee roles.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.list_employee_roles(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str order: The order in which employees are listed in the response, based on their created_at field.Default value: ASC
        :param int limit: The maximum integer number of employee entities to return in a single response. Default 100, maximum 200.
        :param str batch_token: A pagination cursor to retrieve the next set of results for your original query to the endpoint.
        :return: list[V1EmployeeRole]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['order', 'limit', 'batch_token']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_employee_roles" % key
                )
            params[key] = val
        del params['kwargs']



        resource_path = '/v1/me/roles'.replace('{format}', 'json')
        path_params = {}

        query_params = {}
        if 'order' in params and params['order'] is not None:
            query_params['order'] = params['order']
        if 'limit' in params and params['limit'] is not None:
            query_params['limit'] = params['limit']
        if 'batch_token' in params and params['batch_token'] is not None:
            query_params['batch_token'] = params['batch_token']

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='list[V1EmployeeRole]',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def list_employees(self, **kwargs):
        """
        ListEmployees
        Provides summary information for all of a business's employees.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.list_employees(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str order: The order in which employees are listed in the response, based on their created_at field.      Default value: ASC
        :param str begin_updated_at: If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format
        :param str end_updated_at: If filtering results by there updated_at field, the end of the requested reporting period, in ISO 8601 format.
        :param str begin_created_at: If filtering results by their created_at field, the beginning of the requested reporting period, in ISO 8601 format.
        :param str end_created_at: If filtering results by their created_at field, the end of the requested reporting period, in ISO 8601 format.
        :param str status: If provided, the endpoint returns only employee entities with the specified status (ACTIVE or INACTIVE).
        :param str external_id: If provided, the endpoint returns only employee entities with the specified external_id.
        :param int limit: The maximum integer number of employee entities to return in a single response. Default 100, maximum 200.
        :param str batch_token: A pagination cursor to retrieve the next set of results for your original query to the endpoint.
        :return: list[V1Employee]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['order', 'begin_updated_at', 'end_updated_at', 'begin_created_at', 'end_created_at', 'status', 'external_id', 'limit', 'batch_token']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_employees" % key
                )
            params[key] = val
        del params['kwargs']



        resource_path = '/v1/me/employees'.replace('{format}', 'json')
        path_params = {}

        query_params = {}
        if 'order' in params and params['order'] is not None:
            query_params['order'] = params['order']
        if 'begin_updated_at' in params and params['begin_updated_at'] is not None:
            query_params['begin_updated_at'] = params['begin_updated_at']
        if 'end_updated_at' in params and params['end_updated_at'] is not None:
            query_params['end_updated_at'] = params['end_updated_at']
        if 'begin_created_at' in params and params['begin_created_at'] is not None:
            query_params['begin_created_at'] = params['begin_created_at']
        if 'end_created_at' in params and params['end_created_at'] is not None:
            query_params['end_created_at'] = params['end_created_at']
        if 'status' in params and params['status'] is not None:
            query_params['status'] = params['status']
        if 'external_id' in params and params['external_id'] is not None:
            query_params['external_id'] = params['external_id']
        if 'limit' in params and params['limit'] is not None:
            query_params['limit'] = params['limit']
        if 'batch_token' in params and params['batch_token'] is not None:
            query_params['batch_token'] = params['batch_token']

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='list[V1Employee]',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def list_timecard_events(self, timecard_id, **kwargs):
        """
        ListTimecardEvents
        Provides summary information for all events associated with a particular timecard.  <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.list_timecard_events(timecard_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str timecard_id: The ID of the timecard to list events for. (required)
        :return: list[V1TimecardEvent]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['timecard_id']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_timecard_events" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'timecard_id' is set
        if ('timecard_id' not in params) or (params['timecard_id'] is None):
            raise ValueError("Missing the required parameter `timecard_id` when calling `list_timecard_events`")


        resource_path = '/v1/me/timecards/{timecard_id}/events'.replace('{format}', 'json')
        path_params = {}
        if 'timecard_id' in params:
            path_params['timecard_id'] = params['timecard_id']

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='list[V1TimecardEvent]',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def list_timecards(self, **kwargs):
        """
        ListTimecards
        Provides summary information for all of a business's employee timecards.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.list_timecards(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str order: The order in which timecards are listed in the response, based on their created_at field.
        :param str employee_id: If provided, the endpoint returns only timecards for the employee with the specified ID.
        :param str begin_clockin_time: If filtering results by their clockin_time field, the beginning of the requested reporting period, in ISO 8601 format.
        :param str end_clockin_time: If filtering results by their clockin_time field, the end of the requested reporting period, in ISO 8601 format.
        :param str begin_clockout_time: If filtering results by their clockout_time field, the beginning of the requested reporting period, in ISO 8601 format.
        :param str end_clockout_time: If filtering results by their clockout_time field, the end of the requested reporting period, in ISO 8601 format.
        :param str begin_updated_at: If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format.
        :param str end_updated_at: If filtering results by their updated_at field, the end of the requested reporting period, in ISO 8601 format.
        :param bool deleted: If true, only deleted timecards are returned. If false, only valid timecards are returned.If you don't provide this parameter, both valid and deleted timecards are returned.
        :param int limit: The maximum integer number of employee entities to return in a single response. Default 100, maximum 200.
        :param str batch_token: A pagination cursor to retrieve the next set of results for your original query to the endpoint.
        :return: list[V1Timecard]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['order', 'employee_id', 'begin_clockin_time', 'end_clockin_time', 'begin_clockout_time', 'end_clockout_time', 'begin_updated_at', 'end_updated_at', 'deleted', 'limit', 'batch_token']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_timecards" % key
                )
            params[key] = val
        del params['kwargs']



        resource_path = '/v1/me/timecards'.replace('{format}', 'json')
        path_params = {}

        query_params = {}
        if 'order' in params and params['order'] is not None:
            query_params['order'] = params['order']
        if 'employee_id' in params and params['employee_id'] is not None:
            query_params['employee_id'] = params['employee_id']
        if 'begin_clockin_time' in params and params['begin_clockin_time'] is not None:
            query_params['begin_clockin_time'] = params['begin_clockin_time']
        if 'end_clockin_time' in params and params['end_clockin_time'] is not None:
            query_params['end_clockin_time'] = params['end_clockin_time']
        if 'begin_clockout_time' in params and params['begin_clockout_time'] is not None:
            query_params['begin_clockout_time'] = params['begin_clockout_time']
        if 'end_clockout_time' in params and params['end_clockout_time'] is not None:
            query_params['end_clockout_time'] = params['end_clockout_time']
        if 'begin_updated_at' in params and params['begin_updated_at'] is not None:
            query_params['begin_updated_at'] = params['begin_updated_at']
        if 'end_updated_at' in params and params['end_updated_at'] is not None:
            query_params['end_updated_at'] = params['end_updated_at']
        if 'deleted' in params and params['deleted'] is not None:
            query_params['deleted'] = params['deleted']
        if 'limit' in params and params['limit'] is not None:
            query_params['limit'] = params['limit']
        if 'batch_token' in params and params['batch_token'] is not None:
            query_params['batch_token'] = params['batch_token']

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='list[V1Timecard]',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def retrieve_cash_drawer_shift(self, location_id, shift_id, **kwargs):
        """
        RetrieveCashDrawerShift
        Provides the details for a single cash drawer shift, including all events that occurred during the shift.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.retrieve_cash_drawer_shift(location_id, shift_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str location_id: The ID of the location to list cash drawer shifts for. (required)
        :param str shift_id: The shift's ID. (required)
        :return: V1CashDrawerShift
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['location_id', 'shift_id']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method retrieve_cash_drawer_shift" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'location_id' is set
        if ('location_id' not in params) or (params['location_id'] is None):
            raise ValueError("Missing the required parameter `location_id` when calling `retrieve_cash_drawer_shift`")
        # verify the required parameter 'shift_id' is set
        if ('shift_id' not in params) or (params['shift_id'] is None):
            raise ValueError("Missing the required parameter `shift_id` when calling `retrieve_cash_drawer_shift`")


        resource_path = '/v1/{location_id}/cash-drawer-shifts/{shift_id}'.replace('{format}', 'json')
        path_params = {}
        if 'location_id' in params:
            path_params['location_id'] = params['location_id']
        if 'shift_id' in params:
            path_params['shift_id'] = params['shift_id']

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='V1CashDrawerShift',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def retrieve_employee(self, employee_id, **kwargs):
        """
        RetrieveEmployee
        Provides the details for a single employee.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.retrieve_employee(employee_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str employee_id: The employee's ID. (required)
        :return: V1Employee
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['employee_id']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method retrieve_employee" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'employee_id' is set
        if ('employee_id' not in params) or (params['employee_id'] is None):
            raise ValueError("Missing the required parameter `employee_id` when calling `retrieve_employee`")


        resource_path = '/v1/me/employees/{employee_id}'.replace('{format}', 'json')
        path_params = {}
        if 'employee_id' in params:
            path_params['employee_id'] = params['employee_id']

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='V1Employee',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def retrieve_employee_role(self, role_id, **kwargs):
        """
        RetrieveEmployeeRole
        Provides the details for a single employee role.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.retrieve_employee_role(role_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str role_id: The role's ID. (required)
        :return: V1EmployeeRole
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_id']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method retrieve_employee_role" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'role_id' is set
        if ('role_id' not in params) or (params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `retrieve_employee_role`")


        resource_path = '/v1/me/roles/{role_id}'.replace('{format}', 'json')
        path_params = {}
        if 'role_id' in params:
            path_params['role_id'] = params['role_id']

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='V1EmployeeRole',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def retrieve_timecard(self, timecard_id, **kwargs):
        """
        RetrieveTimecard
        Provides the details for a single timecard. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.retrieve_timecard(timecard_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str timecard_id: The timecard's ID. (required)
        :return: V1Timecard
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['timecard_id']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method retrieve_timecard" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'timecard_id' is set
        if ('timecard_id' not in params) or (params['timecard_id'] is None):
            raise ValueError("Missing the required parameter `timecard_id` when calling `retrieve_timecard`")


        resource_path = '/v1/me/timecards/{timecard_id}'.replace('{format}', 'json')
        path_params = {}
        if 'timecard_id' in params:
            path_params['timecard_id'] = params['timecard_id']

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='V1Timecard',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def update_employee(self, employee_id, body, **kwargs):
        """
        UpdateEmployee
        

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.update_employee(employee_id, body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str employee_id: The ID of the role to modify. (required)
        :param V1Employee body: An object containing the fields to POST for the request.  See the corresponding object definition for field details. (required)
        :return: V1Employee
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['employee_id', 'body']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_employee" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'employee_id' is set
        if ('employee_id' not in params) or (params['employee_id'] is None):
            raise ValueError("Missing the required parameter `employee_id` when calling `update_employee`")
        # verify the required parameter 'body' is set
        if ('body' not in params) or (params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `update_employee`")


        resource_path = '/v1/me/employees/{employee_id}'.replace('{format}', 'json')
        path_params = {}
        if 'employee_id' in params:
            path_params['employee_id'] = params['employee_id']

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'PUT',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='V1Employee',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def update_employee_role(self, role_id, body, **kwargs):
        """
        UpdateEmployeeRole
        Modifies the details of an employee role.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.update_employee_role(role_id, body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str role_id: The ID of the role to modify. (required)
        :param V1EmployeeRole body: An object containing the fields to POST for the request.  See the corresponding object definition for field details. (required)
        :return: V1EmployeeRole
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_id', 'body']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_employee_role" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'role_id' is set
        if ('role_id' not in params) or (params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `update_employee_role`")
        # verify the required parameter 'body' is set
        if ('body' not in params) or (params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `update_employee_role`")


        resource_path = '/v1/me/roles/{role_id}'.replace('{format}', 'json')
        path_params = {}
        if 'role_id' in params:
            path_params['role_id'] = params['role_id']

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'PUT',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='V1EmployeeRole',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        

    def update_timecard(self, timecard_id, body, **kwargs):
        """
        UpdateTimecard
        Modifies the details of a timecard with an `API_EDIT` event for the timecard. Updating an active timecard with a `clockout_time` clocks the employee out.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.update_timecard(timecard_id, body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str timecard_id: TThe ID of the timecard to modify. (required)
        :param V1Timecard body: An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
        :return: V1Timecard
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['timecard_id', 'body']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_timecard" % key
                )
            params[key] = val
        del params['kwargs']

        # verify the required parameter 'timecard_id' is set
        if ('timecard_id' not in params) or (params['timecard_id'] is None):
            raise ValueError("Missing the required parameter `timecard_id` when calling `update_timecard`")
        # verify the required parameter 'body' is set
        if ('body' not in params) or (params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `update_timecard`")


        resource_path = '/v1/me/timecards/{timecard_id}'.replace('{format}', 'json')
        path_params = {}
        if 'timecard_id' in params:
            path_params['timecard_id'] = params['timecard_id']

        query_params = {}

        header_params = {}
        header_params['Square-Version'] = "2019-06-12"
        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2']

        return self.api_client.call_api(resource_path, 'PUT',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='V1Timecard',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        
