Google PageSpeed ββAPI dotnet.net
I have set up a basic C # application to run a PageSpeed ββtest on a website that I will point to using the GoogleApis.Pagespeedonline.v2 nuget package.
The setup is simple enough and I have a variable that I can point to the url which then went to the service
// Create the service.
var service = new PagespeedonlineService(new BaseClientService.Initializer
{
ApplicationName = "PageSpeed Sample",
ApiKey = "[API_KEY_HERE]"
});
var url = "URL_TO_TEST";
// Run the request.
var result = await service.Pagespeedapi.Runpagespeed(url).ExecuteAsync();
The problem is that the .Runpagespeed method ONLY accepts a URL. I need to specify at least the Mobile strategy so that I can earn points for desktop and mobile. I know this is possible in other libraries, but seems to be missing in .NET. Does anyone know how to do this using the .NET library? In reference documentation, this means that the method takes additional optional parameters, but it is not in the code.
source to share
Pagespeedapi: runpagespeed has an optional value called strategy
strategic line Analysis strategy to use
Valid values: "Desktop": fetch and parse URLs for desktop browsers
"mobile": fetch and parse URLs for mobile devices
Example:
var request = service.Pagespeedapi.Runpagespeed(url);
request.Strategy = Google.Apis.Pagespeedonline.v2.PagespeedapiResource.RunpagespeedRequest.StrategyEnum.Mobile;
var results = request.Execute();
source to share