Created
November 18, 2022 17:40
-
-
Save sfboss/9ecf188d383b7ab06b961645d5b5470f to your computer and use it in GitHub Desktop.
Wrapper for pagespeed data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| //Generated by AdminBooster | |
| // | |
| public class GoogleAPI_PageSpeedInsights_resp{ | |
| @AuraEnabled public String analysisUTCTimestamp; | |
| @AuraEnabled public String captchaResult; | |
| @AuraEnabled public String id; | |
| @AuraEnabled public String kind; | |
| @AuraEnabled public Map<String,Object> audits; | |
| @AuraEnabled public Map<String,Object> categories; | |
| @AuraEnabled public Map<String,Object> categoryGroups; | |
| @AuraEnabled public Map<String,Object> configSettings; | |
| @AuraEnabled public Map<String,Object> environment; | |
| @AuraEnabled public Map<String,Object> lighthouseResult; | |
| @AuraEnabled public Map<String,Object> loadingExperience; | |
| @AuraEnabled public DateTime fetchTime; | |
| @AuraEnabled public String finalUrl; | |
| @AuraEnabled public String lighthouseVersion; | |
| @AuraEnabled public String requestedUrl; | |
| @AuraEnabled public String runWarnings; | |
| @AuraEnabled public List<Map<String,Object>> stackPacks; | |
| @AuraEnabled public Map<String,Object> timing; | |
| @AuraEnabled public String userAgent; | |
| public class Audit { | |
| @AuraEnabled public String id; | |
| @AuraEnabled public String title; | |
| @AuraEnabled public String description; | |
| @AuraEnabled public String score; | |
| @AuraEnabled public String scoreDisplayMode; | |
| @AuraEnabled public String displayValue; | |
| @AuraEnabled public String numericValue; | |
| @AuraEnabled public String numericUnit; | |
| @AuraEnabled public Map<String,Object> details; | |
| } | |
| public class Loadingexperience { | |
| @AuraEnabled public String initial_url; | |
| } | |
| @AuraEnabled public static GoogleAPI_PageSpeedInsights_resp parse(String json) { | |
| Map<String,Object> theMap = (Map<String,Object>)System.JSON.deserializeUntyped(json); | |
| //system.debug(theMap.keySet()); | |
| GoogleAPI_PageSpeedInsights_resp fs = new GoogleAPI_PageSpeedInsights_resp(); | |
| fs.analysisUTCTimestamp = String.valueOf(theMap.get('analysisUTCTimestamp')); | |
| fs.captchaResult = String.valueOf(theMap.get('captchaResult')); | |
| fs.id = String.valueOf(theMap.get('id')); | |
| fs.lighthouseResult = (Map<String,Object>)theMap.get('lighthouseResult'); | |
| fs.loadingExperience =(Map<String,Object>) theMap.get('loadingExperience'); | |
| Map<String,Object> theMaplighthouseResult = fs.lighthouseResult; | |
| Map<String,Object> theMaploadingExperience = fs.loadingExperience; | |
| //system.debug(theMaplighthouseResult.keySet()); | |
| //system.debug(theMaploadingExperience.keySet()); | |
| Map<String,Object> audits = (Map<String,Object> )theMaplighthouseResult.get('audits'); | |
| Map<String,Object> auditMap = new Map<String,Object>(); | |
| for(String s : audits.keyset()) { | |
| auditMap.put(s,audits.get(s)); | |
| } | |
| fs.audits = auditMap; | |
| return fs; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment