/// <summary>
        /// UpdateEmployee
        /// </summary>
        /// <param name="employeeId">Required parameter: The ID of the role to modify.</param>
        /// <param name="body">Required parameter: An object containing the fields to POST for the request.  See the corresponding object definition for field details.</param>
        /// <return>Returns the Models.V1Employee response from the API call</return>
        public Models.V1Employee UpdateEmployee(string employeeId, Models.V1Employee body)
        {
            Task <Models.V1Employee> t = UpdateEmployeeAsync(employeeId, body);

            ApiHelper.RunTaskSynchronously(t);
            return(t.Result);
        }
        /// <summary>
        ///  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.
        /// Employee entities cannot be deleted. To disable employee profiles,
        /// set the employee's status to <code>INACTIVE</code>
        /// </summary>
        /// <param name="body">Required parameter: An object containing the fields to POST for the request.  See the corresponding object definition for field details.</param>
        /// <return>Returns the Models.V1Employee response from the API call</return>
        public Models.V1Employee CreateEmployee(Models.V1Employee body)
        {
            Task <Models.V1Employee> t = CreateEmployeeAsync(body);

            ApiHelper.RunTaskSynchronously(t);
            return(t.Result);
        }
        /// <summary>
        /// UpdateEmployee.
        /// </summary>
        /// <param name="employeeId">Required parameter: The ID of the role to modify..</param>
        /// <param name="body">Required parameter: An object containing the fields to POST for the request.  See the corresponding object definition for field details..</param>
        /// <param name="cancellationToken"> cancellationToken. </param>
        /// <returns>Returns the Models.V1Employee response from the API call.</returns>
        public async Task <Models.V1Employee> UpdateEmployeeAsync(
            string employeeId,
            Models.V1Employee body,
            CancellationToken cancellationToken = default)
        {
            // the base uri for api requests.
            string baseUri = this.Config.GetBaseUri();

            // prepare query string for API call.
            StringBuilder queryBuilder = new StringBuilder(baseUri);

            queryBuilder.Append("/v1/me/employees/{employee_id}");

            // process optional template parameters.
            ApiHelper.AppendUrlWithTemplateParameters(queryBuilder, new Dictionary <string, object>()
            {
                { "employee_id", employeeId },
            });

            // append request with appropriate headers and parameters
            var headers = new Dictionary <string, string>()
            {
                { "user-agent", this.UserAgent },
                { "accept", "application/json" },
                { "content-type", "application/json; charset=utf-8" },
                { "Square-Version", this.Config.SquareVersion },
            };

            // append body params.
            var bodyText = ApiHelper.JsonSerialize(body);

            // prepare the API call request to fetch the response.
            HttpRequest httpRequest = this.GetClientInstance().PutBody(queryBuilder.ToString(), headers, bodyText);

            if (this.HttpCallBack != null)
            {
                this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
            }

            httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);

            // invoke request and get response.
            HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken).ConfigureAwait(false);

            HttpContext context = new HttpContext(httpRequest, response);

            if (this.HttpCallBack != null)
            {
                this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
            }

            // handle errors defined at the API level.
            this.ValidateResponse(response, context);

            var responseModel = ApiHelper.JsonDeserialize <Models.V1Employee>(response.Body);

            responseModel.Context = context;
            return(responseModel);
        }
        /// <summary>
        ///  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.
        /// Employee entities cannot be deleted. To disable employee profiles,
        /// set the employee's status to <code>INACTIVE</code>
        /// </summary>
        /// <param name="body">Required parameter: An object containing the fields to POST for the request.  See the corresponding object definition for field details.</param>
        /// <return>Returns the Models.V1Employee response from the API call</return>
        public async Task <Models.V1Employee> CreateEmployeeAsync(Models.V1Employee body, CancellationToken cancellationToken = default)
        {
            //the base uri for api requests
            string _baseUri = config.GetBaseUri();

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/v1/me/employees");

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", userAgent },
                { "accept", "application/json" },
                { "content-type", "application/json; charset=utf-8" },
                { "Square-Version", config.SquareVersion }
            };

            //append body params
            var _body = ApiHelper.JsonSerialize(body);

            //prepare the API call request to fetch the response
            HttpRequest _request = GetClientInstance().PostBody(_queryBuilder.ToString(), _headers, _body);

            if (HttpCallBack != null)
            {
                HttpCallBack.OnBeforeHttpRequestEventHandler(GetClientInstance(), _request);
            }

            _request = await authManagers["global"].ApplyAsync(_request).ConfigureAwait(false);

            //invoke request and get response
            HttpStringResponse _response = await GetClientInstance().ExecuteAsStringAsync(_request, cancellationToken).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            if (HttpCallBack != null)
            {
                HttpCallBack.OnAfterHttpResponseEventHandler(GetClientInstance(), _response);
            }

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            var _responseModel = ApiHelper.JsonDeserialize <Models.V1Employee>(_response.Body);

            _responseModel.Context = _context;
            return(_responseModel);
        }
 public Builder Body(Models.V1Employee body)
 {
     this.body = body;
     return(this);
 }
 public Builder(Models.V1Employee body)
 {
     this.body = body;
 }
 public V1UpdateEmployeeRequest(Models.V1Employee body)
 {
     Body = body;
 }
 public Builder Body(Models.V1Employee value)
 {
     body = value;
     return(this);
 }