-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from gabeaventh/user-agent
Add Random User Agent Generator
- Loading branch information
Showing
5 changed files
with
18,965 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/// data based on: https://github.com/skratchdot/random-useragent | ||
class UserAgents { | ||
List<UserAgent> userAgents; | ||
|
||
UserAgents({this.userAgents}); | ||
|
||
UserAgents.fromJson(Map<String, dynamic> json) { | ||
if (json['userAgents'] != null) { | ||
userAgents = new List<UserAgent>(); | ||
json['userAgents'].forEach((v) { | ||
userAgents.add(new UserAgent.fromJson(v)); | ||
}); | ||
} | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
if (this.userAgents != null) { | ||
data['userAgents'] = this.userAgents.map((v) => v.toJson()).toList(); | ||
} | ||
return data; | ||
} | ||
} | ||
|
||
class UserAgent { | ||
String folder; | ||
String description; | ||
String userAgent; | ||
String appCodename; | ||
String appName; | ||
String appVersion; | ||
String platform; | ||
String vendor; | ||
String vendorSub; | ||
String browserName; | ||
String browserMajor; | ||
String browserVersion; | ||
String deviceModel; | ||
String deviceType; | ||
String deviceVendor; | ||
String engineName; | ||
String engineVersion; | ||
String osName; | ||
String osVersion; | ||
String cpuArchitecture; | ||
|
||
UserAgent( | ||
{this.folder, | ||
this.description, | ||
this.userAgent, | ||
this.appCodename, | ||
this.appName, | ||
this.appVersion, | ||
this.platform, | ||
this.vendor, | ||
this.vendorSub, | ||
this.browserName, | ||
this.browserMajor, | ||
this.browserVersion, | ||
this.deviceModel, | ||
this.deviceType, | ||
this.deviceVendor, | ||
this.engineName, | ||
this.engineVersion, | ||
this.osName, | ||
this.osVersion, | ||
this.cpuArchitecture}); | ||
|
||
UserAgent.fromJson(Map<String, dynamic> json) { | ||
folder = json['folder']; | ||
description = json['description']; | ||
userAgent = json['userAgent']; | ||
appCodename = json['appCodename']; | ||
appName = json['appName']; | ||
appVersion = json['appVersion']; | ||
platform = json['platform']; | ||
vendor = json['vendor']; | ||
vendorSub = json['vendorSub']; | ||
browserName = json['browserName']; | ||
browserMajor = json['browserMajor']; | ||
browserVersion = json['browserVersion']; | ||
deviceModel = json['deviceModel']; | ||
deviceType = json['deviceType']; | ||
deviceVendor = json['deviceVendor']; | ||
engineName = json['engineName']; | ||
engineVersion = json['engineVersion']; | ||
osName = json['osName']; | ||
osVersion = json['osVersion']; | ||
cpuArchitecture = json['cpuArchitecture']; | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['folder'] = this.folder; | ||
data['description'] = this.description; | ||
data['userAgent'] = this.userAgent; | ||
data['appCodename'] = this.appCodename; | ||
data['appName'] = this.appName; | ||
data['appVersion'] = this.appVersion; | ||
data['platform'] = this.platform; | ||
data['vendor'] = this.vendor; | ||
data['vendorSub'] = this.vendorSub; | ||
data['browserName'] = this.browserName; | ||
data['browserMajor'] = this.browserMajor; | ||
data['browserVersion'] = this.browserVersion; | ||
data['deviceModel'] = this.deviceModel; | ||
data['deviceType'] = this.deviceType; | ||
data['deviceVendor'] = this.deviceVendor; | ||
data['engineName'] = this.engineName; | ||
data['engineVersion'] = this.engineVersion; | ||
data['osName'] = this.osName; | ||
data['osVersion'] = this.osVersion; | ||
data['cpuArchitecture'] = this.cpuArchitecture; | ||
return data; | ||
} | ||
} |
Oops, something went wrong.