lib/stack_one/hris.rb in stackone_client-0.2.37 vs lib/stack_one/hris.rb in stackone_client-0.2.38
- old
+ new
@@ -17,10 +17,62 @@
def initialize(sdk_config)
@sdk_configuration = sdk_config
end
+ sig { params(hris_batch_document_upload_request_dto: ::StackOne::Shared::HrisBatchDocumentUploadRequestDto, id: ::String, x_account_id: ::String).returns(::StackOne::Operations::HrisBatchUploadEmployeeDocumentResponse) }
+ def batch_upload_employee_document(hris_batch_document_upload_request_dto, id, x_account_id)
+ # batch_upload_employee_document - Batch Upload Employee Document
+ request = ::StackOne::Operations::HrisBatchUploadEmployeeDocumentRequest.new(
+
+ hris_batch_document_upload_request_dto: hris_batch_document_upload_request_dto,
+ id: id,
+ x_account_id: x_account_id
+ )
+ url, params = @sdk_configuration.get_server_details
+ base_url = Utils.template_url(url, params)
+ url = Utils.generate_url(
+ ::StackOne::Operations::HrisBatchUploadEmployeeDocumentRequest,
+ base_url,
+ '/unified/hris/employees/{id}/documents/upload/batch',
+ request
+ )
+ headers = Utils.get_headers(request)
+ req_content_type, data, form = Utils.serialize_request_body(request, :hris_batch_document_upload_request_dto, :json)
+ headers['content-type'] = req_content_type
+ raise StandardError, 'request body is required' if data.nil? && form.nil?
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = @sdk_configuration.user_agent
+
+ r = @sdk_configuration.client.post(url) do |req|
+ req.headers = headers
+ Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
+ if form
+ req.body = Utils.encode_form(form)
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
+ req.body = URI.encode_www_form(data)
+ else
+ req.body = data
+ end
+ end
+
+ content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
+
+ res = ::StackOne::Operations::HrisBatchUploadEmployeeDocumentResponse.new(
+ status_code: r.status, content_type: content_type, raw_response: r
+ )
+ if r.status == 202
+ if Utils.match_content_type(content_type, 'application/json')
+ out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::BatchResultApiModel)
+ res.batch_result_api_model = out
+ end
+ elsif [400, 403, 412, 429, 500, 501].include?(r.status)
+ end
+ res
+ end
+
+
sig { params(hris_create_employee_request_dto: ::StackOne::Shared::HrisCreateEmployeeRequestDto, x_account_id: ::String).returns(::StackOne::Operations::HrisCreateEmployeeResponse) }
def create_employee(hris_create_employee_request_dto, x_account_id)
# create_employee - Creates an employee
request = ::StackOne::Operations::HrisCreateEmployeeRequest.new(
@@ -1462,10 +1514,10 @@
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
res = ::StackOne::Operations::HrisUploadEmployeeDocumentResponse.new(
status_code: r.status, content_type: content_type, raw_response: r
)
- if r.status == 200
+ if r.status == 201
if Utils.match_content_type(content_type, 'application/json')
out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::WriteResultApiModel)
res.write_result_api_model = out
end
elsif [400, 403, 412, 429, 500, 501].include?(r.status)