Modify Custom Object Type by Name

Use this API to partially update an existing object type by its name.

πŸ—’

Things to Know

  • This API only supports objects created via Object Manager, including Projects, Models, and Datasets.
Path Params
string
required

The name of the object type.

Body Params
string

The name of the object type.

string

The description of the object type.

moduleScopes
array of strings, unique
enum

The product scopes of the object type.

moduleScopes
settings
object

The settings details of the object type.

workflow
object

The details of the workflow.

Responses

400

Bad Request

401

Unauthorized

403

Forbidden

500

Internal Server Error

Language
Credentials
OAuth2
Missing 4 required scopes
URL
LoadingLoading…
Response
Choose an example:
application/json
*/*
// SCOPES LOGIC /* (function () { 'use strict'; let requiredScopes = []; let activeContextKey = null; let refreshTimer = null; let observedPageIdentity = ''; let requestGeneration = 0; console.log('[Scopes] Script loaded'); function normalizePath(value) { return (value || '') .split('?')[0] .replace(/\/+$/, '') || '/'; } function parseReadMeContext(sourceDocument) { const stateElement = sourceDocument.querySelector('#ssr-props'); if (!stateElement) return null; try { const state = JSON.parse(stateElement.textContent); const page = state?.document; const api = page?.api; const spec = api?.schema; if (!api || !spec) return null; const path = api.path; const method = api.method?.toLowerCase(); const operation = spec.paths?.[path]?.[method]; if (!path || !method || !operation) return null; return { spec, operation, path, method, sourceUri: api.uri, requestPath: normalizePath(state.reqUrl) }; } catch (error) { console.error('[Scopes] Failed to parse ReadMe state:', error); return null; } } async function getCurrentContext() { const inlineContext = parseReadMeContext(document); if ( inlineContext && (!inlineContext.requestPath || inlineContext.requestPath === normalizePath(window.location.pathname)) ) { return inlineContext; } console.log('[Scopes] Loading OpenAPI context for current page'); const response = await fetch(window.location.href, { credentials: 'same-origin', cache: 'no-store', headers: { Accept: 'text/html' } }); if (!response.ok) { throw new Error(`Failed to load current page: ${response.status}`); } const html = await response.text(); const parsedDocument = new DOMParser().parseFromString( html, 'text/html' ); const context = parseReadMeContext(parsedDocument); if (!context) { throw new Error('OpenAPI context was not found'); } return context; } function getRequiredScopes(spec, operation) { const securityRequirements = Object.prototype.hasOwnProperty.call(operation, 'security') ? operation.security : spec.security || []; if (!Array.isArray(securityRequirements)) { return []; } const securitySchemes = spec.components?.securitySchemes || {}; for (const requirement of securityRequirements) { const scopes = []; for (const [schemeName, scopeNames] of Object.entries( requirement || {} )) { const scheme = securitySchemes[schemeName]; if ( !['oauth2', 'openIdConnect'].includes(scheme?.type) || !Array.isArray(scopeNames) ) { continue; } const descriptions = {}; for (const flow of Object.values(scheme.flows || {})) { Object.assign(descriptions, flow?.scopes || {}); } for (const name of scopeNames) { if (!scopes.some(scope => scope.name === name)) { scopes.push({ name, description: descriptions[name] || `OAuth2 scope: ${name}` }); } } } if (scopes.length) { return scopes; } } return []; } function createScopesPills(scopes) { const container = document.createElement('div'); container.className = 'custom-scopes'; if (!scopes.length) { container.innerHTML = '
No scopes required
'; return container; } const label = document.createElement('div'); label.className = 'custom-scopes-label'; label.textContent = 'Required scopes'; container.appendChild(label); scopes.forEach(scope => { const pill = document.createElement('span'); pill.className = 'scope-pill'; pill.textContent = scope.name; pill.title = scope.description; container.appendChild(pill); }); return container; } function clickUseOwnToken() { const buttons = document.querySelectorAll( '.rm-APIAuth button' ); for (const button of buttons) { if (button.textContent.trim() === 'Use Your Own Token') { button.click(); console.log('[Scopes] Switched to bearer token mode'); return true; } } return false; } function injectScopesWhenReady(generation) { const startTime = Date.now(); const timeout = 5000; function attempt() { if (generation !== requestGeneration) return; const tokenRow = document.querySelector( '.InputGroup-oauth-flow-token' ); if (tokenRow) { document .querySelectorAll('.custom-scopes') .forEach(element => element.remove()); tokenRow.after(createScopesPills(requiredScopes)); console.log( '[Scopes] Injected required scopes:', requiredScopes.map(scope => scope.name) ); return; } if (Date.now() - startTime < timeout) { setTimeout(attempt, 100); } else { console.warn('[Scopes] Token flow did not appear'); } } attempt(); } async function refreshScopesForCurrentPage() { const generation = ++requestGeneration; try { const context = await getCurrentContext(); if (generation !== requestGeneration) return; const contextKey = [ context.requestPath, context.sourceUri, context.method, context.path ].join('|'); if ( contextKey === activeContextKey && document.querySelector('.custom-scopes') ) { return; } activeContextKey = contextKey; requiredScopes = getRequiredScopes( context.spec, context.operation ); console.log( `[Scopes] ${context.method.toUpperCase()} ${context.path}` ); console.log( '[Scopes] Required scopes:', requiredScopes.map(scope => scope.name) ); document .querySelectorAll('.custom-scopes') .forEach(element => element.remove()); clickUseOwnToken(); injectScopesWhenReady(generation); } catch (error) { console.error('[Scopes] Failed to refresh:', error); } } function scheduleRefresh(delay = 150) { clearTimeout(refreshTimer); refreshTimer = setTimeout(() => { refreshScopesForCurrentPage(); }, delay); } function getPageIdentity() { const apiMarker = document .querySelector('[data-raycast-oas]') ?.getAttribute('data-raycast-oas'); return [ window.location.pathname, apiMarker || '' ].join('|'); } function installNavigationObservers() { const originalPushState = history.pushState; const originalReplaceState = history.replaceState; history.pushState = function (...args) { const result = originalPushState.apply(this, args); scheduleRefresh(); return result; }; history.replaceState = function (...args) { const result = originalReplaceState.apply(this, args); scheduleRefresh(); return result; }; window.addEventListener('popstate', () => { scheduleRefresh(); }); document.addEventListener('click', event => { const link = event.target.closest?.('a[href]'); if ( link && link.origin === window.location.origin && link.pathname.includes('/reference/') ) { scheduleRefresh(300); } }); const observer = new MutationObserver(() => { const identity = getPageIdentity(); if (identity !== observedPageIdentity) { observedPageIdentity = identity; scheduleRefresh(); } }); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-raycast-oas'] }); if (window.jQuery) { $(window).on('pageLoad', () => { scheduleRefresh(); }); } } installNavigationObservers(); scheduleRefresh(0); })(); */ // END SCOPES LOGIC // Track the current URL path to detect changes var lastPath = window.location.pathname; // Simple banner display function function displayBanner() { // Get the container element var contentElement = document.getElementById('hub-search-results'); if (!contentElement) return; // Update lastPath for future comparisons lastPath = window.location.pathname; // Remove any existing banners first var existingRecipeCallout = contentElement.querySelector('.onetrust-custom-callout'); var existingCMPCallout = contentElement.querySelector('.onetrust-custom-callout-cmp'); var existingOASCallout = contentElement.querySelector('.onetrust-custom-callout-oas'); if (existingRecipeCallout && existingRecipeCallout.parentElement) { existingRecipeCallout.parentElement.removeChild(existingRecipeCallout); } if (existingCMPCallout && existingCMPCallout.parentElement) { existingCMPCallout.parentElement.removeChild(existingCMPCallout); } if (existingOASCallout && existingOASCallout.parentElement) { existingOASCallout.parentElement.removeChild(existingOASCallout); } // Get current path var path = window.location.pathname; // New element for banner var newElement = document.createElement('div'); newElement.className = 'rm-Markdown markdown-body'; newElement.setAttribute('data-testid', 'RDMD'); // Choose banner based on path if (path === '/onetrust/recipes') { //console.log('Displaying Recipe banner'); newElement.innerHTML = `

The code samples provided here are intended as starting points for various use cases. We encourage you to thoroughly test any code. Use of these samples is at your own risk. Please note that OneTrust does not offer implementation support for these Recipes but welcomes your feedback and suggestions for new Recipes. If you want to provide feedback, please leverage the Help widget in the bottom right corner of your screen.

`; contentElement.insertBefore(newElement, contentElement.firstChild); } else if (path.includes('/docs/')) { //console.log('Displaying CMP banner'); /* newElement.innerHTML = `

We strongly recommend all CMP users deploying Mobile & OTT/CTV SDKs to migrate to our next generation of CMP SDKs for a seamless experience and enhanced efficiency and scalability. For more information, see OneTrust Next Generation CMP SDKs.

`; contentElement.insertBefore(newElement, contentElement.firstChild); */ } else { //console.log('No banner needed for path: ' + path); } } // Check if URL has changed function checkURLChange() { var currentPath = window.location.pathname; if (currentPath !== lastPath) { //console.log('URL changed from', lastPath, 'to', currentPath); setTimeout(displayBanner, 500); } } // Hook into history API to detect client-side navigation function addHistoryChangeListener() { // Store references to original history methods var originalPushState = history.pushState; var originalReplaceState = history.replaceState; // Override history.pushState history.pushState = function() { originalPushState.apply(this, arguments); setTimeout(displayBanner, 500); }; // Override history.replaceState history.replaceState = function() { originalReplaceState.apply(this, arguments); setTimeout(displayBanner, 500); }; } // Set up periodic URL checking function startURLMonitoring() { // Check URL every 500ms setInterval(checkURLChange, 500); // Add listener for click events on anchor tags document.addEventListener('click', function(e) { if (e.target.tagName === 'A' || e.target.closest('a')) { // A link was clicked, check for URL change after a delay setTimeout(checkURLChange, 500); } }); } // Set up one-time event listeners document.addEventListener('DOMContentLoaded', function() { // First attempt when DOM is ready with 1000ms delay setTimeout(displayBanner, 1000); // Hook into history API addHistoryChangeListener(); // Start URL monitoring startURLMonitoring(); // Set up a single listener for popstate (browser back/forward) window.addEventListener('popstate', function() { // Add delay before showing banner after navigation setTimeout(displayBanner, 500); }); }); // Add banner when page load is complete (backup) window.addEventListener('load', function() { setTimeout(displayBanner, 1000); }); // Brave Shield Warning function isBraveShieldsUp() { if (window.navigator.brave != undefined) { if (window.navigator.brave.isBrave.name == "isBrave") { //if (!window.navigator.plugins[0][0].type){ document.getElementById("brave-warning").style.display = "block"; return true; // } } else { return false; } } else { return false; } } isBraveShieldsUp(); // start of x-onetrust // Creates x-onetrust Tags in UI // function createTags(tags, data, oasUrl, callback) { // /* // "x-onetrust": { // "highly-available": true, // "highly-available-link": "Helpful Link for HA", // "release-status": "Public Preview | Sunset Period | Deprecated", // "release-status-link": "link to changelog if needed", // "spec-label": "OpenAPI 3.1.0" // } // */ // const fragment = document.createDocumentFragment(); // const divTags = document.createElement("div"); // divTags.className = "ot-tags-container"; // divTags.id = "ot-tags-container"; // // Check if highly-available is true // if (tags && tags["highly-available"] === true) { // const haSpan = document.createElement("span"); // haSpan.className = "ot-tags ot-tags-ha"; // haSpan.onclick = function () { // window.open("https://developer-onetrust-com.proxy.sbu.usi.ch/onetrust/reference/consent-preference-management-api-service-level-objectives", "_blank"); // }; // haSpan.setAttribute("style", "float: right;margin-top: 10px;"); // haSpan.setAttribute("apimethod_version", ""); // haSpan.textContent = "Highly Available"; // divTags.appendChild(haSpan); // } // // Check if release-status exists // if (tags && tags["release-status"]) { // const rsSpan = document.createElement("span"); // rsSpan.className = "ot-tags ot-tags-rs"; // rsSpan.onclick = function () { // if (tags["release-status-link"]) { // window.open(tags["release-status-link"], "_blank"); // } // }; // rsSpan.setAttribute("style", "float: right;margin-top: 10px;"); // rsSpan.setAttribute("apimethod_version", ""); // rsSpan.textContent = tags["release-status"]; // divTags.appendChild(rsSpan); // // Add hover CSS // rsSpan.addEventListener('mouseenter', function () { // if (tags["release-status-link"]) { // rsSpan.style.background = "firebrick"; // rsSpan.style.cursor = "pointer"; // } // }); // rsSpan.addEventListener('mouseleave', function () { // if (tags["release-status-link"]) { // rsSpan.style.background = ""; // Reset to default // rsSpan.style.cursor = ""; // Reset to default // } // }); // } // // Check if spec version exists // if (data["x-onetrust"]["spec-label"]) { // const slSpan = document.createElement("span"); // slSpan.className = "ot-tags ot-tags-sl"; // slSpan.onclick = function () { // window.open(oasUrl, "_blank"); // Replace with the actual hyperlink // }; // slSpan.setAttribute("style", "float: right;margin-top: 10px;"); // slSpan.setAttribute("apimethod_version", ""); // slSpan.textContent = data["x-onetrust"]["spec-label"]; // divTags.appendChild(slSpan); // } // fragment.appendChild(divTags); // // Call the callback function with the created element // callback(fragment); // } // Creates Scopes Element in UI function createScopeElement(scopes, data, callback) { // Create a new div element to contain the scopes const newElement = document.createElement('div'); newElement.classList.add('Info-infoBadge3luOwOnjfNiR'); newElement.setAttribute('role', ''); // Create the heading for scopes const heading = document.createElement('div'); heading.classList.add('APISectionHeader-heading4MUMLbp4_nLs'); heading.textContent = 'SCOPES'; heading.title = 'The scope signifies the level of access granted to the API endpoint. It is recommended to always choose the scope with the least access to minimize security risks.'; newElement.appendChild(heading); // Create a container for badges const badgesContainer = document.createElement('div'); badgesContainer.classList.add('badges-container'); badgesContainer.style.paddingLeft = '3px'; // Create and append badge elements for each scope for (const scope of Object.values(scopes)) { const badge = document.createElement('span'); badge.classList.add('Badge', 'Badge_light', 'Badge_circular'); badge.style.marginLeft = '3px'; badge.textContent = scope; badge.title = data.components.securitySchemes.oauth2.flows.clientCredentials.scopes[scope]; badgesContainer.appendChild(badge); } newElement.appendChild(badgesContainer); // Call the callback function with the created element callback(newElement); } // Check for data-raycast-oas attribute and invoke tag/scope rendering // If data-raycast-oas is missing, "false", or "[object Object]", fetch ?json=on and use doc.api.apiSetting as fallback (async function resolveOasAndRender() { let oasValue = null; let operationId = null; // Check for data-raycast-oas const raycastOas = document.querySelector('[data-raycast-oas]'); const raycastOperationId = document.querySelector('[data-raycast-operation-id]'); if (raycastOas && raycastOas.dataset.raycastOas !== 'false' && raycastOas.dataset.raycastOas !== '[object Object]') { oasValue = raycastOas.dataset.raycastOas; operationId = raycastOperationId?.dataset.raycastOperationId; } // If no valid OAS value found, try to get it from the URL if (!oasValue) { const urlParams = new URLSearchParams(window.location.search); if (urlParams.has('json') && urlParams.get('json') === 'on') { try { const response = await fetch(window.location.href); const data = await response.json(); oasValue = data.api.apiSetting; operationId = urlParams.get('operationId'); } catch (error) { console.error('Error fetching JSON:', error); } } } if (oasValue) { const oasUrl = URLValidator.constructOasUrl(oasValue); await printScopesEnhanced(oasUrl, operationId); } })(); // Gets the Scopes from the OAS spec async function printScopesEnhanced(oasUrl, operationIdToFind) { try { const response = await fetch(oasUrl); if (!response.ok) { throw new Error('Failed to fetch OpenAPI spec'); } const data = await response.json(); const paths = data.paths; for (const [path, pathValue] of Object.entries(paths)) { for (const [method, methodValue] of Object.entries(pathValue)) { if (methodValue.operationId && methodValue.operationId.toLowerCase() === operationIdToFind.toLowerCase()) { if (methodValue.security && methodValue.security.length > 0) { for (const security of methodValue.security) { for (const [securityKey, scopes] of Object.entries(security)) { if (securityKey === 'oauth2' && scopes.length > 0) { await new Promise(r => setTimeout(r, 200)); createScopeElement(scopes, data, function (newElement) { const elementToReplace = document.querySelector('.Info-infoBadge3luOwOnjfNiR'); if (elementToReplace) { elementToReplace.parentNode.replaceChild(newElement, elementToReplace); } }); return; } } } } return; } } } } catch (error) { console.error('Error fetching or processing OpenAPI spec:', error); } } // end of x-onetrust // Scripts for Partner Page // Guard to ensure jQuery is loaded before running the UI enhancement block if (typeof window.jQuery !== 'undefined') { (function ($) { "use strict"; /* Page Loader active ========================================================*/ $('#preloader').fadeOut(); /* Screens Shot Slider =============================*/ var owl = $(".touch-slider"); owl.owlCarousel({ center: true, navigation: false, pagination: true, slideSpeed: 1000, stopOnHover: true, autoPlay: true, touchDrag: true, responsive: { 0: { items: 1 }, 480: { items: 2 }, 768: { items: 3 }, 992: { items: 4 }, 1199: { items: 5 } }, items: 5, itemsDesktopSmall: [1024, 3], itemsTablet: [600, 1], itemsMobile: [479, 1] }); // sticky menu $(window).on('scroll', function (event) { var scroll = $(window).scrollTop(); if (scroll < 20) { $(".navbar-area").removeClass("sticky menu-bg"); } else { $(".navbar-area").addClass("sticky menu-bg"); } }); // for menu scroll $('.page-scroll').click(function () { var hash = this.hash; var position = $(hash).offset().top - 60; $('html').animate({ scrollTop: position }, 900); }); //===== Section Menu Active var scrollLink = $('.page-scroll'); // Active link switching $(window).scroll(function () { var scrollbarLocation = $(this).scrollTop(); scrollLink.each(function () { var sectionOffset = $(this.hash).offset().top - 73; if (sectionOffset <= scrollbarLocation) { $(this).parent().addClass('active'); $(this).parent().siblings().removeClass('active'); } }); }); //===== close navbar-collapse when a clicked $(".navbar-nav a").on('click', function () { $(".navbar-collapse").removeClass("show"); }); $(".navbar-toggler").on('click', function () { $(this).toggleClass("active"); }); $(".navbar-nav a").on('click', function () { $(".navbar-toggler").removeClass('active'); }); /* Back Top Link ========================================================================== */ var offset = 200; var duration = 500; $(window).scroll(function () { if ($(this).scrollTop() > offset) { $('.back-to-top').fadeIn(400); } else { $('.back-to-top').fadeOut(400); } }); $('.back-to-top').on('click', function (event) { event.preventDefault(); $('html, body').animate({ scrollTop: 0 }, 600); return false; }) /* One Page Navigation & wow js ========================================================================== */ $(window).on('load', function () { $('body').scrollspy({ target: '.navbar-collapse', offset: 195 }); $(window).on('scroll', function () { if ($(window).scrollTop() > 100) { $('.fixed-top').addClass('menu-bg'); } else { $('.fixed-top').removeClass('menu-bg'); } }); }); /* Auto Close Responsive Navbar on Click ========================================================*/ function close_toggle() { if ($(window).width() <= 768) { $('.navbar-collapse a').on('click', function () { $('.navbar-collapse').collapse('hide'); }); } else { $('.navbar .navbar-inverse a').off('click'); } } close_toggle(); $(window).resize(close_toggle); /* Nivo Lightbox ========================================================*/ $('.lightbox').nivoLightbox({ effect: 'fadeScale', keyboardNav: true, }); }(window.jQuery)); } // end jQuery guard /* // Load Vue.js if not already loaded if (typeof Vue === 'undefined') { const script = document.createElement('script'); script.src = 'https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.10/vue.min.js'; script.onload = initVueComponents; document.head.appendChild(script); } else { initVueComponents(); } */ /* function initVueComponents() { Vue.component('boardal', { template: `
×
`, props: [ 'hasX', 'hasMask', 'canClickMask' ], methods: { clickX: function () { this.$emit('toggle') }, clickMask: function () { if (this.canClickMask) { this.$emit('toggle') } } } }) let vm = new Vue({ el: 'main', data: { modal: { isOpen: false, hasMask: true, canClickMask: false, hasX: false }, step: 1, max: 1, showDots: true, orientation: 'row', xray: 'hidden', currentSection: null, $sections: [] }, mounted() { // Initialize any mounted logic here this.$sections = this.$el.querySelectorAll('section'); this.max = this.$sections.length; this.setCssVars(); }, computed: { isFirstStep: function () { return (this.step === 1) }, isLastStep: function () { return (this.step === this.max) }, hasDots: function () { return (this.max > 1 && this.showDots) }, x_multiplier: function () { return (this.orientation === 'row' ? -1 : 0) }, y_multiplier: function () { return (this.orientation === 'row' ? 0 : -1) }, axis: function () { return (this.orientation === 'row' ? 'row' : 'column') }, axisReverse: function () { return (this.orientation === 'row' ? 'row-reverse' : 'column-reverse') }, cross: function () { return (this.orientation === 'row' ? 'column' : 'row') }, crossReverse: function () { return (this.orientation === 'row' ? 'column-reverse' : 'row-reverse') }, nextIcon: function () { return (this.orientation === 'row' ? 'fa-arrow-right' : 'fa-arrow-down') }, backIcon: function () { return (this.orientation === 'row' ? 'fa-arrow-left' : 'fa-arrow-up') }, }, watch: { orientation: 'setCssVars', }, methods: { toggleChecklistModal(step) { step = step || 1; this.modal.isOpen = !this.modal.isOpen; if (this.modal.isOpen) { let self = this; setTimeout(function () { self.$sections = self.$el.querySelectorAll('section'); self.max = self.$sections.length; self.goToStep(step); }, 1); } }, setCssVars() { this.$el.style.setProperty('--x', (((this.step * 100) - 100) * this.x_multiplier) + '%'); this.$el.style.setProperty('--y', (((this.step * 100) - 100) * this.y_multiplier) + '%'); this.$el.style.setProperty('--axis', this.axis); this.$el.style.setProperty('--axis-reverse', this.axisReverse); this.$el.style.setProperty('--cross', this.cross); this.$el.style.setProperty('--cross-reverse', this.crossReverse); }, goToStep(step) { this.step = step > this.max ? this.max : step < 1 ? 1 : step; this.currentSection = this.$sections[this.step - 1]; this.$sections.forEach(function (section) { section.classList.remove('current'); }); this.currentSection.classList.add('current'); this.currentSection.scrollTop = 0; this.setCssVars(); }, skip(step) { this.step += step; this.goToStep(this.step); }, resetChecklist() { this.goToStep(1); }, finish() { this.toggleChecklistModal(); return (this.max > 1 && this.showDots); } } }) } */ //Help Widget // Function to extract data-raycast-oas value from HTML async function getLinksfromSpec() { let oasValue = null; // Primary: try the data-raycast-oas attribute const headerElement = document.querySelector('[data-raycast-oas]'); if (headerElement) { const attr = headerElement.getAttribute('data-raycast-oas'); if (attr && attr !== 'false' && attr !== '[object Object]') { oasValue = attr.trim(); } } // Fallback: fetch the current page and get from URL params if (!oasValue) { const urlParams = new URLSearchParams(window.location.search); if (urlParams.has('json') && urlParams.get('json') === 'on') { try { const response = await fetch(window.location.href); const data = await response.json(); oasValue = data.api.apiSetting; } catch (error) { console.error('Error fetching JSON:', error); } } } if (oasValue) { const oasUrl = `https://developer-onetrust-com.proxy.sbu.usi.ch/onetrust/openapi/${oasValue}`; try { const response = await fetch(oasUrl); if (!response.ok) { throw new Error('Failed to fetch OpenAPI spec'); } const data = await response.json(); if (data.hasOwnProperty("x-onetrust")) { return data["x-onetrust"]["links"]; } } catch (error) { //console.error('Error fetching or processing OpenAPI spec:', error); return null; } } return null; } // Initialize the OneTrust container and help button function initHelpWidget() { console.log('Initializing help widget'); var container = document.getElementById('onetrust-container'); var helpButton = document.getElementById('helpButton'); if (container) { container.style.display = 'none'; } if (helpButton) { console.log('Adding click event to help button'); helpButton.onclick = toggleHelpContainer; } else { console.error('Help button not found'); } // Initialize rating feature buttons console.log('Setting up rating feature buttons'); // Rate your Experience button functionality var rateExperienceBtn = document.getElementById('rateExperienceBtn'); if (rateExperienceBtn) { console.log('Adding click event to rate experience button'); rateExperienceBtn.addEventListener('click', function () { document.getElementById('thumbsOptions').style.display = 'flex'; document.getElementById('rateExperienceBtn').style.display = 'none'; document.getElementById('voteNewFeatures').style.display = 'none'; }); } else { console.error('Rate experience button not found'); } // Thumbs Up button functionality var thumbsUpBtn = document.getElementById('thumbsUpBtn'); if (thumbsUpBtn) { thumbsUpBtn.addEventListener('click', function () { document.getElementById('commentInput').style.display = 'block'; document.getElementById('thumbsUpBtn').style.color = 'darkgreen'; document.getElementById('thumbsDownBtn').style.color = 'currentcolor'; document.getElementById('thumbsOptions').style.display = 'flex'; document.getElementById('submitButton').style.display = 'block'; }); } // Thumbs Down button functionality var thumbsDownBtn = document.getElementById('thumbsDownBtn'); if (thumbsDownBtn) { thumbsDownBtn.addEventListener('click', function () { document.getElementById('commentInput').style.display = 'block'; document.getElementById('thumbsUpBtn').style.color = 'currentcolor'; document.getElementById('thumbsDownBtn').style.color = 'darkred'; document.getElementById('thumbsOptions').style.display = 'flex'; document.getElementById('submitButton').style.display = 'block'; }); } // Submit button functionality var submitButton = document.getElementById('submitButton'); if (submitButton) { submitButton.addEventListener('click', async function () { var feedback = document.getElementById("feedbackTextarea").value; if (!feedback.trim()) { document.getElementById("commentError").style.display = "block"; return; } else { document.getElementById("commentError").style.display = "none"; } try { const scriptElement = document.getElementById("hub-me"); // Get the value of the data-json attribute const jsonData = scriptElement ? scriptElement.getAttribute("data-json") : null; // Parse the JSON data if available const parsedData = jsonData ? JSON.parse(jsonData) : {}; // Get email if available const emailElement = document.getElementById("feedbackEmail"); const email = emailElement ? emailElement.value.trim() || null : null; var feedbackData = { vote: document.getElementById("thumbsUpBtn").style.color === "darkgreen" ? 1 : 0, comments: document.getElementById("commentInput").querySelector('textarea').value, path: window.location.pathname, requestType: "pageQuality", type: "doc" }; // Adding the email to the comment since readme changed the api to not accept email if (email) { feedbackData.comments = email + ": " + feedbackData.comments; feedbackData.email = email; // Doesn't seem to be used anymore by readme via the API } // Show success message immediately document.getElementById('successMessage').style.display = 'block'; document.getElementById('commentInput').style.display = 'none'; document.getElementById('submitButton').style.display = 'none'; document.getElementById('thumbsOptions').style.display = 'none'; // Send feedback to API fetch('https://developer-onetrust-com.proxy.sbu.usi.ch/onetrust/api-next/v2/versions/1.0/metrics-proxy/create/thumb', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(feedbackData), }) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(data => { console.log('Feedback submitted successfully'); }) .catch(error => { console.error('Error submitting feedback:', error); }); // Reset after delay regardless of API response setTimeout(function () { resetRateExperience(); populateLinks(); }, 3000); } catch (error) { console.error('Error processing feedback:', error); resetRateExperience(); } }); } } // Function to toggle OneTrust container visibility function toggleHelpContainer() { console.log('Help button clicked'); var container = document.getElementById('onetrust-container'); if (!container) { console.error('Container not found'); return; } if (container.style.display === 'none') { fetchHighestComponentGroupStatus(); container.style.display = "block"; document.querySelector('.help-icon').innerHTML = ''; // Get the