lib/stack_one/lms.rb in stackone_client-0.2.36 vs lib/stack_one/lms.rb in stackone_client-0.2.37
- old
+ new
@@ -17,21 +17,27 @@
def initialize(sdk_config)
@sdk_configuration = sdk_config
end
- sig { params(lms_create_completion_request_dto: ::StackOne::Shared::LmsCreateCompletionRequestDto, x_account_id: ::String).returns(::StackOne::Operations::LmsCreateCompletionResponse) }
- def create_completion(lms_create_completion_request_dto, x_account_id)
- # create_completion - Create Completion
+ sig { params(lms_create_completion_request_dto: ::StackOne::Shared::LmsCreateCompletionRequestDto, id: ::String, x_account_id: ::String).returns(::StackOne::Operations::LmsCreateCompletionResponse) }
+ def create_completion(lms_create_completion_request_dto, id, x_account_id)
+ # create_completion - Create User Completion
request = ::StackOne::Operations::LmsCreateCompletionRequest.new(
lms_create_completion_request_dto: lms_create_completion_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 = "#{base_url}/unified/lms/completions"
+ url = Utils.generate_url(
+ ::StackOne::Operations::LmsCreateCompletionRequest,
+ base_url,
+ '/unified/lms/users/{id}/completions',
+ request
+ )
headers = Utils.get_headers(request)
req_content_type, data, form = Utils.serialize_request_body(request, :lms_create_completion_request_dto, :json)
headers['content-type'] = req_content_type
raise StandardError, 'request body is required' if data.nil? && form.nil?
headers['Accept'] = 'application/json'
@@ -109,23 +115,23 @@
end
res
end
- sig { params(request: T.nilable(::StackOne::Operations::LmsGetCategoryRequest)).returns(::StackOne::Operations::LmsGetCategoryResponse) }
- def get_category(request)
- # get_category - Get Category
+ sig { params(request: T.nilable(::StackOne::Operations::LmsGetAssignmentRequest)).returns(::StackOne::Operations::LmsGetAssignmentResponse) }
+ def get_assignment(request)
+ # get_assignment - Get User Assignment
url, params = @sdk_configuration.get_server_details
base_url = Utils.template_url(url, params)
url = Utils.generate_url(
- ::StackOne::Operations::LmsGetCategoryRequest,
+ ::StackOne::Operations::LmsGetAssignmentRequest,
base_url,
- '/unified/lms/categories/{id}',
+ '/unified/lms/users/{id}/assignments/{subResourceId}',
request
)
headers = Utils.get_headers(request)
- query_params = Utils.get_query_params(::StackOne::Operations::LmsGetCategoryRequest, request)
+ query_params = Utils.get_query_params(::StackOne::Operations::LmsGetAssignmentRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = @sdk_configuration.user_agent
r = @sdk_configuration.client.get(url) do |req|
req.headers = headers
@@ -133,37 +139,37 @@
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
end
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
- res = ::StackOne::Operations::LmsGetCategoryResponse.new(
+ res = ::StackOne::Operations::LmsGetAssignmentResponse.new(
status_code: r.status, content_type: content_type, raw_response: r
)
if r.status == 200
if Utils.match_content_type(content_type, 'application/json')
- out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::CategoryResult)
- res.category_result = out
+ out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::AssignmentResult)
+ res.assignment_result = out
end
elsif [400, 403, 412, 429, 500, 501].include?(r.status)
end
res
end
- sig { params(request: T.nilable(::StackOne::Operations::LmsGetCompletionRequest)).returns(::StackOne::Operations::LmsGetCompletionResponse) }
- def get_completion(request)
- # get_completion - Get Completion
+ sig { params(request: T.nilable(::StackOne::Operations::LmsGetCategoryRequest)).returns(::StackOne::Operations::LmsGetCategoryResponse) }
+ def get_category(request)
+ # get_category - Get Category
url, params = @sdk_configuration.get_server_details
base_url = Utils.template_url(url, params)
url = Utils.generate_url(
- ::StackOne::Operations::LmsGetCompletionRequest,
+ ::StackOne::Operations::LmsGetCategoryRequest,
base_url,
- '/unified/lms/completions/{id}',
+ '/unified/lms/categories/{id}',
request
)
headers = Utils.get_headers(request)
- query_params = Utils.get_query_params(::StackOne::Operations::LmsGetCompletionRequest, request)
+ query_params = Utils.get_query_params(::StackOne::Operations::LmsGetCategoryRequest, request)
headers['Accept'] = 'application/json'
headers['user-agent'] = @sdk_configuration.user_agent
r = @sdk_configuration.client.get(url) do |req|
req.headers = headers
@@ -171,17 +177,17 @@
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
end
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
- res = ::StackOne::Operations::LmsGetCompletionResponse.new(
+ res = ::StackOne::Operations::LmsGetCategoryResponse.new(
status_code: r.status, content_type: content_type, raw_response: r
)
if r.status == 200
if Utils.match_content_type(content_type, 'application/json')
- out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::CompletionResult)
- res.completion_result = out
+ out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::CategoryResult)
+ res.category_result = out
end
elsif [400, 403, 412, 429, 500, 501].include?(r.status)
end
res
end
@@ -223,10 +229,48 @@
end
res
end
+ sig { params(request: T.nilable(::StackOne::Operations::LmsGetCourseRequest)).returns(::StackOne::Operations::LmsGetCourseResponse) }
+ def get_course(request)
+ # get_course - Get Course
+ url, params = @sdk_configuration.get_server_details
+ base_url = Utils.template_url(url, params)
+ url = Utils.generate_url(
+ ::StackOne::Operations::LmsGetCourseRequest,
+ base_url,
+ '/unified/lms/courses/{id}',
+ request
+ )
+ headers = Utils.get_headers(request)
+ query_params = Utils.get_query_params(::StackOne::Operations::LmsGetCourseRequest, request)
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = @sdk_configuration.user_agent
+
+ r = @sdk_configuration.client.get(url) do |req|
+ req.headers = headers
+ req.params = query_params
+ Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
+ end
+
+ content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
+
+ res = ::StackOne::Operations::LmsGetCourseResponse.new(
+ status_code: r.status, content_type: content_type, raw_response: r
+ )
+ if r.status == 200
+ if Utils.match_content_type(content_type, 'application/json')
+ out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::CourseResult)
+ res.course_result = out
+ end
+ elsif [400, 403, 412, 429, 500, 501].include?(r.status)
+ end
+ res
+ end
+
+
sig { params(request: T.nilable(::StackOne::Operations::LmsGetUserRequest)).returns(::StackOne::Operations::LmsGetUserResponse) }
def get_user(request)
# get_user - Get User
url, params = @sdk_configuration.get_server_details
base_url = Utils.template_url(url, params)
@@ -261,10 +305,48 @@
end
res
end
+ sig { params(request: T.nilable(::StackOne::Operations::LmsListAssignmentsRequest)).returns(::StackOne::Operations::LmsListAssignmentsResponse) }
+ def list_assignments(request)
+ # list_assignments - List User Assignments
+ url, params = @sdk_configuration.get_server_details
+ base_url = Utils.template_url(url, params)
+ url = Utils.generate_url(
+ ::StackOne::Operations::LmsListAssignmentsRequest,
+ base_url,
+ '/unified/lms/users/{id}/assignments',
+ request
+ )
+ headers = Utils.get_headers(request)
+ query_params = Utils.get_query_params(::StackOne::Operations::LmsListAssignmentsRequest, request)
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = @sdk_configuration.user_agent
+
+ r = @sdk_configuration.client.get(url) do |req|
+ req.headers = headers
+ req.params = query_params
+ Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
+ end
+
+ content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
+
+ res = ::StackOne::Operations::LmsListAssignmentsResponse.new(
+ status_code: r.status, content_type: content_type, raw_response: r
+ )
+ if r.status == 200
+ if Utils.match_content_type(content_type, 'application/json')
+ out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::AssignmentsPaginated)
+ res.assignments_paginated = out
+ end
+ elsif [400, 403, 412, 429, 500, 501].include?(r.status)
+ end
+ res
+ end
+
+
sig { params(request: T.nilable(::StackOne::Operations::LmsListCategoriesRequest)).returns(::StackOne::Operations::LmsListCategoriesResponse) }
def list_categories(request)
# list_categories - List Categories
url, params = @sdk_configuration.get_server_details
base_url = Utils.template_url(url, params)
@@ -294,10 +376,48 @@
end
res
end
+ sig { params(request: T.nilable(::StackOne::Operations::LmsListCompletionsRequest)).returns(::StackOne::Operations::LmsListCompletionsResponse) }
+ def list_completions(request)
+ # list_completions - List User Completions
+ url, params = @sdk_configuration.get_server_details
+ base_url = Utils.template_url(url, params)
+ url = Utils.generate_url(
+ ::StackOne::Operations::LmsListCompletionsRequest,
+ base_url,
+ '/unified/lms/users/{id}/completions',
+ request
+ )
+ headers = Utils.get_headers(request)
+ query_params = Utils.get_query_params(::StackOne::Operations::LmsListCompletionsRequest, request)
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = @sdk_configuration.user_agent
+
+ r = @sdk_configuration.client.get(url) do |req|
+ req.headers = headers
+ req.params = query_params
+ Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
+ end
+
+ content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
+
+ res = ::StackOne::Operations::LmsListCompletionsResponse.new(
+ status_code: r.status, content_type: content_type, raw_response: r
+ )
+ if r.status == 200
+ if Utils.match_content_type(content_type, 'application/json')
+ out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::CompletionsPaginated)
+ res.completions_paginated = out
+ end
+ elsif [400, 403, 412, 429, 500, 501].include?(r.status)
+ end
+ res
+ end
+
+
sig { params(request: T.nilable(::StackOne::Operations::LmsListContentRequest)).returns(::StackOne::Operations::LmsListContentResponse) }
def list_content(request)
# list_content - List Content
url, params = @sdk_configuration.get_server_details
base_url = Utils.template_url(url, params)
@@ -320,9 +440,42 @@
)
if r.status == 200
if Utils.match_content_type(content_type, 'application/json')
out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::ContentPaginated)
res.content_paginated = out
+ end
+ elsif [400, 403, 412, 429, 500, 501].include?(r.status)
+ end
+ res
+ end
+
+
+ sig { params(request: T.nilable(::StackOne::Operations::LmsListCoursesRequest)).returns(::StackOne::Operations::LmsListCoursesResponse) }
+ def list_courses(request)
+ # list_courses - List Courses
+ 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)
+ query_params = Utils.get_query_params(::StackOne::Operations::LmsListCoursesRequest, request)
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = @sdk_configuration.user_agent
+
+ r = @sdk_configuration.client.get(url) do |req|
+ req.headers = headers
+ req.params = query_params
+ Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
+ end
+
+ content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
+
+ res = ::StackOne::Operations::LmsListCoursesResponse.new(
+ status_code: r.status, content_type: content_type, raw_response: r
+ )
+ if r.status == 200
+ if Utils.match_content_type(content_type, 'application/json')
+ out = Utils.unmarshal_complex(r.env.response_body, ::StackOne::Shared::CoursePaginated)
+ res.course_paginated = out
end
elsif [400, 403, 412, 429, 500, 501].include?(r.status)
end
res
end