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
String Id = '<Your-Device Id>'; | |
String endpoint = '<Your-public webservice URL>'; | |
String littleBitEvent = 'amplitude:delta:ignite'; | |
String accessToken = '<Device AccessToken>'; | |
Http h = new Http(); | |
HttpRequest req = new HttpRequest(); | |
req.setMethod('POST'); | |
req.setEndpoint('https://api-http.littlebitscloud.cc/subscriptions'); | |
req.setHeader('Authorization','Bearer ' + accessToken); | |
req.setHeader('Accept', 'application/vnd.littlebits.v2+json'); |
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
//Anonymous APEX REST Service that you can subscribe to with LittleBits Cloudbit | |
@RestResource(urlMapping='/subscriber') | |
global with sharing class LittleBitsSubscriber | |
{ | |
@HttpPost | |
global static String processSubscriptionEvent() | |
{ | |
String requestBody = RestContext.request.requestBody.toString(); | |
system.debug(requestBody); | |
Map<String, Object> littleBitsdata = (Map<String, Object>) JSON.deserializeUntyped(requestBody); |
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
<aura:component > | |
<aura:attribute name="page" type="integer"/> | |
<aura:attribute name="pages" type="integer"/> | |
<aura:attribute name="total" type="integer"/> | |
<ltng:require styles="/resource/SLDS080/assets/styles/salesforce-lightning-design-system-vf.css" /> | |
<div class="slds"> | |
<div class="slds-form-element"> | |
<button class="slds-button slds-button--brand" onclick="{!c.previousPage}" disabled="{!v.page <= 1}"> | |
Previous |
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
<aura:application > | |
<c:LightningTable object="Account" fields="Id,Name,Phone" pageSize="10" /> | |
</aura:application> |
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
<aura:event type="APPLICATION" description="Event template"> | |
<aura:attribute name="direction" type="String"/> | |
</aura:event> |
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
({ | |
previousPage : function(component, event, helper) { | |
var myEvent = $A.get("e.c:PageChange"); | |
myEvent.setParams({ "direction": "previous"}); | |
myEvent.fire(); | |
}, | |
nextPage : function(component, event, helper) { | |
var myEvent = $A.get("e.c:PageChange"); | |
myEvent.setParams({ "direction": "next"}); | |
myEvent.fire(); |
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
({ | |
action.setCallback(this,function(response){ | |
var state = response.getState(); | |
if(state === 'SUCCESS'){ | |
document.getElementById("data").innerHTML =''; | |
component.set("v.latestRecords",response.getReturnValue()); | |
component.set("v.page",page); | |
var retResponse = response.getReturnValue(); | |
component.set("v.total",retResponse.total); | |
component.set("v.pages",Math.ceil(retResponse.total/component.get("v.pageSize"))) |
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
component.set("v.latestRecords",response.getReturnValue()); | |
var retRecords = response.getReturnValue(); | |
retRecords.forEach(function(s) { | |
var tableRow = document.createElement('tr'); | |
fields.forEach(function(field){ | |
var tableData = document.createElement('td'); | |
var tableDataNode = document.createTextNode(s[field]); | |
tableData.appendChild(tableDataNode); | |
tableRow.appendChild(tableData); | |
}); |
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
doInit : function(component, event, helper) { | |
var action = component.get("c.getRecentRecords"); | |
var fields = component.get("v.fields"); | |
action.setParams({ | |
ObjectName : component.get("v.object"), | |
limits : component.get("v.limit"), | |
fieldstoget : fields.join() | |
}); | |
action.setCallback(this,function(response){ | |
// Logic to process the returned value |
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
<aura:component controller="RecentRecordsController" implements="force:appHostable,flexipage:availableForAllPageTypes"> | |
<ltng:require styles="/resource/SLDS080/assets/styles/salesforce-lightning-design-system-vf.css" /> | |
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<head> | |
</head> | |
<body> | |
<div class="slds"> | |
<div class="slds-card__header slds-grid"> | |
<div class="slds-media slds-media--center slds-has-flexi-truncate"> | |
<div class="slds-media__figure"> |