lib/stack_one/lms.rb in stackone_client-0.2.46 vs lib/stack_one/lms.rb in stackone_client-0.3.0
- old
+ new
@@ -63,10 +63,56 @@
end
res
end
+ sig { params(lms_batch_upsert_course_request_dto: ::StackOne::Shared::LmsBatchUpsertCourseRequestDto, x_account_id: ::String).returns(::StackOne::Operations::LmsBatchUpsertCourseResponse) }
+ def batch_upsert_course(lms_batch_upsert_course_request_dto, x_account_id)
+ # batch_upsert_course - Batch Upsert Course
+ request = ::StackOne::Operations::LmsBatchUpsertCourseRequest.new(
+
+ lms_batch_upsert_course_request_dto: lms_batch_upsert_course_request_dto,
+ x_account_id: x_account_id
+ )
+ url, params = @sdk_configuration.get_server_details
+ base_url = Utils.template_url(url, params)
+ url = "#{base_url}/unified/lms/courses/batch"
+ headers = Utils.get_headers(request)
+ req_content_type, data, form = Utils.serialize_request_body(request, :lms_batch_upsert_course_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::LmsBatchUpsertCourseResponse.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(lms_create_content_request_dto: ::StackOne::Shared::LmsCreateContentRequestDto, x_account_id: ::String).returns(::StackOne::Operations::LmsCreateContentResponse) }
def create_content(lms_create_content_request_dto, x_account_id)
# create_content - Create Content
request = ::StackOne::Operations::LmsCreateContentRequest.new(
@@ -936,9 +982,55 @@
end
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
res = ::StackOne::Operations::LmsUpsertContentResponse.new(
+ status_code: r.status, content_type: content_type, raw_response: r
+ )
+ if r.status == 201
+ if Utils.match_content_type(content_type, 'application/json')
+ out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::CreateResult)
+ res.create_result = out
+ end
+ elsif [400, 403, 412, 429, 500, 501].include?(r.status)
+ end
+ res
+ end
+
+
+ sig { params(lms_upsert_course_request_dto: ::StackOne::Shared::LmsUpsertCourseRequestDto, x_account_id: ::String).returns(::StackOne::Operations::LmsUpsertCourseResponse) }
+ def upsert_course(lms_upsert_course_request_dto, x_account_id)
+ # upsert_course - Upsert Course
+ request = ::StackOne::Operations::LmsUpsertCourseRequest.new(
+
+ lms_upsert_course_request_dto: lms_upsert_course_request_dto,
+ x_account_id: x_account_id
+ )
+ url, params = @sdk_configuration.get_server_details
+ base_url = Utils.template_url(url, params)
+ url = "#{base_url}/unified/lms/courses"
+ headers = Utils.get_headers(request)
+ req_content_type, data, form = Utils.serialize_request_body(request, :lms_upsert_course_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.put(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::LmsUpsertCourseResponse.new(
status_code: r.status, content_type: content_type, raw_response: r
)
if r.status == 201
if Utils.match_content_type(content_type, 'application/json')
out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::CreateResult)