Created
October 2, 2019 13:15
-
-
Save dhaniksahni/8800e7f1f057958c0dc7d7c2b1c3d75a to your computer and use it in GitHub Desktop.
This file contains 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
public class StackExchangeAccess { | |
@AuraEnabled | |
public static StackExchangeUserWrapper getUsers(integer pageNumber,integer pageSize,string sortdirection, string sortName, string sitename) | |
{ | |
string url='page='+pageNumber+'&pagesize='+ pageSize+'&order='+sortdirection+'&sort='+sortName+'&site='+sitename; | |
Http http = new Http(); | |
HttpRequest request = new HttpRequest(); | |
request.setEndpoint('https://api.stackexchange.com/2.2/users?'+url); | |
request.setMethod('GET'); | |
HttpResponse response = http.send(request); | |
if (response.getStatusCode() == 200) { | |
StackExchangeUserWrapper wrapper=StackExchangeUserWrapper.parse(response.getBody()); | |
return wrapper; | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment