lib/stack_one/lms.rb in stackone_client-0.2.44 vs lib/stack_one/lms.rb in stackone_client-0.2.45

- old
+ new

@@ -161,9 +161,50 @@ end res end + sig { params(id: ::String, x_account_id: ::String).returns(::StackOne::Operations::LmsDeleteContentResponse) } + def delete_content(id, x_account_id) + # delete_content - Delete Content + request = ::StackOne::Operations::LmsDeleteContentRequest.new( + + 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::LmsDeleteContentRequest, + base_url, + '/unified/lms/content/{id}', + request + ) + headers = Utils.get_headers(request) + headers['Accept'] = 'application/json' + headers['user-agent'] = @sdk_configuration.user_agent + + r = @sdk_configuration.client.delete(url) do |req| + req.headers = headers + 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::LmsDeleteContentResponse.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::DeleteResult) + res.delete_result = out + end + elsif [400, 403, 412, 429, 500, 501].include?(r.status) + end + res + end + + sig { params(request: T.nilable(::StackOne::Operations::LmsGetAssignmentRequest)).returns(::StackOne::Operations::LmsGetAssignmentResponse) } def get_assignment(request) # get_assignment - Get Assignment url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params)