From 0f9afeab38b3d589963254b879ff1b60ff66be59 Mon Sep 17 00:00:00 2001 From: Tommy Monk Date: Sat, 29 Sep 2018 09:45:07 +0100 Subject: [PATCH] Removed const used in JsonPropertyAttribute, removed debug change --- .../InputTests/InputTests.cs | 3 +- lib/PuppeteerSharp/BoundingBox.cs | 8 +- lib/PuppeteerSharp/Browser.cs | 2 +- lib/PuppeteerSharp/Constants.cs | 86 +------------------ lib/PuppeteerSharp/ContextPayload.cs | 4 +- lib/PuppeteerSharp/ContextPayloadAuxData.cs | 4 +- lib/PuppeteerSharp/CookieParam.cs | 20 ++--- .../EvaluateExceptionDetails.cs | 6 +- lib/PuppeteerSharp/EvaluateExceptionInfo.cs | 4 +- .../EvaluateExceptionStackTrace.cs | 2 +- .../EvaluationExceptionCallFrame.cs | 8 +- lib/PuppeteerSharp/FramePayload.cs | 8 +- lib/PuppeteerSharp/Media/Clip.cs | 10 +-- lib/PuppeteerSharp/Media/ScreenOrientation.cs | 4 +- .../Messaging/BasicFrameResponse.cs | 2 +- .../Messaging/BindingCalledResponse.cs | 10 +-- .../Messaging/BoxModelResponse.cs | 14 +-- .../CSSStopRuleUsageTrackingResponse.cs | 10 +-- .../Messaging/CSSStyleSheetAddedResponse.cs | 6 +- .../Messaging/CertificateErrorResponse.cs | 2 +- .../Messaging/CoverageResponseRange.cs | 8 +- .../Messaging/CreateBrowserContextResponse.cs | 2 +- .../Messaging/DebuggerScriptParsedResponse.cs | 4 +- .../Messaging/DomDescribeNodeResponse.cs | 4 +- .../Messaging/GetBrowserContextsResponse.cs | 2 +- .../Messaging/GetContentQuadsResponse.cs | 2 +- .../Messaging/GetLayoutMetricsResponse.cs | 6 +- .../Messaging/IOReadResponse.cs | 4 +- .../Messaging/LifecycleEventResponse.cs | 6 +- .../Messaging/LoadingFailedResponse.cs | 4 +- .../Messaging/LoadingFinishedResponse.cs | 2 +- .../Messaging/LogEntryAddedResponse.cs | 10 +-- .../NavigatedWithinDocumentResponse.cs | 4 +- .../NetworkGetResponseBodyResponse.cs | 4 +- .../Messaging/PageConsoleResponse.cs | 6 +- .../PageGetNavigationHistoryResponse.cs | 6 +- .../PageJavascriptDialogOpeningResponse.cs | 6 +- .../Messaging/PageNavigateResponse.cs | 4 +- .../PerformanceGetMetricsResponse.cs | 2 +- .../Messaging/PerformanceMetricsResponse.cs | 4 +- .../ProfilerTakePreciseCoverageResponse.cs | 8 +- .../Messaging/RequestInterceptedResponse.cs | 26 +++--- .../RequestServedFromCacheResponse.cs | 2 +- .../Messaging/RequestWillBeSentPayload.cs | 12 +-- .../Messaging/ResponsePayload.cs | 14 +-- .../Messaging/ResponseReceivedResponse.cs | 4 +- .../Messaging/TargetCreatedResponse.cs | 2 +- .../Messaging/TargetDestroyedResponse.cs | 2 +- lib/PuppeteerSharp/Metric.cs | 4 +- lib/PuppeteerSharp/Payload.cs | 52 +++++------ lib/PuppeteerSharp/ScreenshotOptions.cs | 10 +-- lib/PuppeteerSharp/SecurityDetails.cs | 10 +-- lib/PuppeteerSharp/TargetInfo.cs | 10 +-- 53 files changed, 188 insertions(+), 271 deletions(-) diff --git a/lib/PuppeteerSharp.Tests/InputTests/InputTests.cs b/lib/PuppeteerSharp.Tests/InputTests/InputTests.cs index a84873f98..76b6310d4 100644 --- a/lib/PuppeteerSharp.Tests/InputTests/InputTests.cs +++ b/lib/PuppeteerSharp.Tests/InputTests/InputTests.cs @@ -89,8 +89,7 @@ public async Task ShouldClickWrappedLinks() public async Task ShouldClickOnCheckboxInputAndToggle() { await Page.GoToAsync(TestConstants.ServerUrl + "/input/checkbox.html"); - var foo = await Page.EvaluateExpressionAsync("result.check"); - Assert.Null(foo); + Assert.Null(await Page.EvaluateExpressionAsync("result.check")); await Page.ClickAsync("input#agree"); Assert.True(await Page.EvaluateExpressionAsync("result.check")); Assert.Equal(new[] { diff --git a/lib/PuppeteerSharp/BoundingBox.cs b/lib/PuppeteerSharp/BoundingBox.cs index 259bdfa33..70b1baa40 100644 --- a/lib/PuppeteerSharp/BoundingBox.cs +++ b/lib/PuppeteerSharp/BoundingBox.cs @@ -13,25 +13,25 @@ public class BoundingBox : IEquatable /// The x coordinate of the element in pixels. /// /// The x. - [JsonProperty(Constants.X)] + [JsonProperty("x")] public decimal X { get; set; } /// /// The y coordinate of the element in pixels. /// /// The y. - [JsonProperty(Constants.Y)] + [JsonProperty("y")] public decimal Y { get; set; } /// /// The width of the element in pixels. /// /// The width. - [JsonProperty(Constants.WIDTH)] + [JsonProperty("width")] public decimal Width { get; set; } /// /// The height of the element in pixels. /// /// The height. - [JsonProperty(Constants.HEIGHT)] + [JsonProperty("height")] public decimal Height { get; set; } /// diff --git a/lib/PuppeteerSharp/Browser.cs b/lib/PuppeteerSharp/Browser.cs index 769b5a198..7b8af6b14 100644 --- a/lib/PuppeteerSharp/Browser.cs +++ b/lib/PuppeteerSharp/Browser.cs @@ -219,7 +219,7 @@ public async Task PagesAsync() /// public async Task GetVersionAsync() { - var version = await Connection.SendAsync("Browser.getVersion").ConfigureAwait(false); + var version = await Connection.SendAsync("Browser.getVersion").ConfigureAwait(false); return version[Constants.PRODUCT].AsString(); } diff --git a/lib/PuppeteerSharp/Constants.cs b/lib/PuppeteerSharp/Constants.cs index 3b104c08d..993ed6612 100644 --- a/lib/PuppeteerSharp/Constants.cs +++ b/lib/PuppeteerSharp/Constants.cs @@ -17,7 +17,6 @@ internal class Constants public const string CONTEXT = "context"; public const string REFERER = "referer"; public const string ACCEPT = "accept"; - public const string COOKIE = "cookie"; public const string COOKIES = "cookies"; public const string PROMPT_TEXT = "promptText"; public const string ENUMERABLE = "enumerable"; @@ -34,7 +33,6 @@ internal class Constants public const string UNSERIALIZABLE_VALUE = "unserializableValue"; public const string PRODUCT = "product"; public const string USER_AGENT = "userAgent"; - public const string NODE = "node"; public const string FRAME = "frame"; public const string PARENT_ID = "parentId"; public const string URL = "url"; @@ -44,98 +42,16 @@ internal class Constants public const string CONTENT_SIZE = "contentSize"; public const string WIDTH = "width"; public const string HEIGHT = "height"; - public const string X = "x"; - public const string Y = "y"; - public const string SCALE = "scale"; - public const string ANGLE = "angle"; public const string FRAME_ID = "frameId"; public const string EXECUTION_CONTEXT_ID = "executionContextId"; - public const string PAYLOAD = "payload"; public const string ARGS = "args"; - public const string SEQ = "seq"; - public const string MODEL = "model"; - public const string CONTENT = "content"; - public const string PADDING = "padding"; - public const string BORDER = "border"; - public const string MARGIN = "margin"; public const string EVENT_ID = "eventId"; - public const string START_OFFSET = "startOffset"; - public const string END_OFFSET = "endOffset"; - public const string COUNT = "count"; - public const string STYLE_SHEET_ID = "styleSheetId"; public const string BROWSER_CONTEXT_ID = "browserContextId"; - public const string BROWSER_CONTEXT_IDS = "browserContextIds"; - public const string RULE_USAGE = "ruleUsage"; - public const string USED = "used"; - public const string HEADER = "header"; - public const string SOURCE_URL = "sourceURL"; - public const string SCRIPT_ID = "scriptId"; - public const string QUADS = "quads"; - public const string LAYOUT_VIEWPORT = "layoutViewport"; - public const string PAGE_X = "pageX"; - public const string PAGE_Y = "pageY"; - public const string EOF = "eof"; - public const string LOADER_ID = "loaderId"; public const string REQUEST_ID = "requestId"; - public const string ERROR_TEXT = "errorText"; - public const string ENTRY = "entry"; - public const string SOURCE = "source"; - public const string LEVEL = "level"; - public const string BODY = "body"; - public const string BASE_64_ENCODED = "base64Encoded"; - public const string CURRENT_INDEX = "currentIndex"; - public const string ENTRIES = "entries"; - public const string DEFAULT_PROMPT = "defaultPrompt"; - public const string METRICS = "metrics"; - public const string TITLE = "title"; - public const string FUNCTIONS = "functions"; - public const string RANGES = "ranges"; public const string INTERCEPTION_ID = "interceptionId"; - public const string REQUEST = "request"; - public const string RESOURCE_TYPE = "resourceType"; - public const string IS_NAVIGATION_REQUEST = "isNavigationRequest"; - public const string RESPONSE_HEADERS = "responseHeaders"; - public const string RESPONSE_STATUS_CODE = "responseStatusCode"; - public const string REDIRECT_URL = "redirectURL"; - public const string AUTH_CHALLENGE = "authChallenge"; - public const string ORIGIN = "origin"; - public const string SCHEME = "scheme"; - public const string REALM = "realm"; - public const string REDIRECT_RESPONSE = "redirectResponse"; public const string HEADERS = "headers"; - public const string STATUS = "status"; - public const string SECURITY_DETAILS = "securityDetails"; - public const string FROM_DISK_CACHE = "fromDiskCache"; - public const string FROM_SERVICE_WORKER = "fromServiceWorker"; - public const string RESPONSE = "response"; public const string TARGET_INFO = "targetInfo"; - public const string AUX_DATA = "auxData"; - public const string IS_DEFAULT = "isDefault"; - public const string DOMAIN = "domain"; - public const string PATH = "path"; - public const string EXPIRES = "expires"; - public const string SIZE = "size"; - public const string HTTP_ONLY = "httpOnly"; - public const string SECURE = "secure"; - public const string SESSION = "session"; - public const string EXCEPTION = "exception"; - public const string STACK_TRACE = "stackTrace"; - public const string DESCRIPTION = "description"; - public const string CALL_FRAMES = "callFrames"; - public const string COLUMN_NUMBER = "columnNumber"; - public const string LINE_NUMBER = "lineNumber"; - public const string FUNCTION_NAME = "functionName"; public const string POST_DATA = "postData"; - public const string CLIP = "clip"; - public const string FULL_PAGE = "fullPage"; - public const string OMIT_BACKGROUND = "omitBackground"; - public const string QUALITY = "quality"; - public const string SUBJECT_NAME = "subjectName"; - public const string ISSUER = "issuer"; - public const string VALID_FROM = "validFrom"; - public const string VALID_TO = "validTo"; - public const string PROTOCOL = "protocol"; - public const string OPENER_ID = "openerId"; public const string MODIFIERS = "modifiers"; public const string WINDOWS_VIRTUAL_KEY_CODE = "windowsVirtualKeyCode"; public const string CODE = "code"; @@ -156,5 +72,7 @@ internal class Constants public const string ACTION = "action"; public const string RAW_RESPONSE = "rawResponse"; public const string ERROR_REASON = "errorReason"; + public const string X = "x"; + public const string Y = "y"; } } diff --git a/lib/PuppeteerSharp/ContextPayload.cs b/lib/PuppeteerSharp/ContextPayload.cs index 9e0ae4321..e3faa9c70 100644 --- a/lib/PuppeteerSharp/ContextPayload.cs +++ b/lib/PuppeteerSharp/ContextPayload.cs @@ -4,9 +4,9 @@ namespace PuppeteerSharp { internal class ContextPayload { - [JsonProperty(Constants.ID)] + [JsonProperty("id")] internal int Id { get; set; } - [JsonProperty(Constants.AUX_DATA)] + [JsonProperty("auxData")] internal ContextPayloadAuxData AuxData { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/ContextPayloadAuxData.cs b/lib/PuppeteerSharp/ContextPayloadAuxData.cs index 6f14ba318..04a276a0c 100644 --- a/lib/PuppeteerSharp/ContextPayloadAuxData.cs +++ b/lib/PuppeteerSharp/ContextPayloadAuxData.cs @@ -4,9 +4,9 @@ namespace PuppeteerSharp { internal class ContextPayloadAuxData { - [JsonProperty(Constants.FRAME_ID)] + [JsonProperty("frameId")] internal string FrameId { get; set; } - [JsonProperty(Constants.IS_DEFAULT)] + [JsonProperty("isDefault")] internal bool IsDefault { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/CookieParam.cs b/lib/PuppeteerSharp/CookieParam.cs index f8f354ac3..4043f45ca 100644 --- a/lib/PuppeteerSharp/CookieParam.cs +++ b/lib/PuppeteerSharp/CookieParam.cs @@ -14,61 +14,61 @@ public class CookieParam /// Gets or sets the name. /// /// The name. - [JsonProperty(Constants.NAME)] + [JsonProperty("name")] public string Name { get; set; } /// /// Gets or sets the value. /// /// The value. - [JsonProperty(Constants.VALUE)] + [JsonProperty("value")] public string Value { get; set; } /// /// Gets or sets the domain. /// /// The domain. - [JsonProperty(Constants.DOMAIN, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("domain", NullValueHandling = NullValueHandling.Ignore)] public string Domain { get; set; } /// /// Gets or sets the URL. /// /// The URL. - [JsonProperty(Constants.URL, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("url", NullValueHandling = NullValueHandling.Ignore)] public string Url { get; set; } /// /// Gets or sets the path. /// /// The path. - [JsonProperty(Constants.PATH, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("path", NullValueHandling = NullValueHandling.Ignore)] public string Path { get; set; } /// /// Gets or sets the expiration. /// /// Expiration. - [JsonProperty(Constants.EXPIRES, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("expires", NullValueHandling = NullValueHandling.Ignore)] public double? Expires { get; set; } /// /// Gets or sets the size. /// /// The size. - [JsonProperty(Constants.SIZE, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("size", NullValueHandling = NullValueHandling.Ignore)] public int? Size { get; set; } /// /// Gets or sets if it's HTTP only. /// /// Whether it's http only or not. - [JsonProperty(Constants.HTTP_ONLY, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("httpOnly", NullValueHandling = NullValueHandling.Ignore)] public bool? HttpOnly { get; set; } /// /// Gets or sets if it's secure. /// /// Whether it's secure or not. - [JsonProperty(Constants.SECURE, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("secure", NullValueHandling = NullValueHandling.Ignore)] public bool? Secure { get; set; } /// /// Gets or sets if it's session only. /// /// Whether it's session only or not. - [JsonProperty(Constants.SESSION, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("session", NullValueHandling = NullValueHandling.Ignore)] public bool? Session { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/EvaluateExceptionDetails.cs b/lib/PuppeteerSharp/EvaluateExceptionDetails.cs index 52ed9a6e8..44ec240f4 100644 --- a/lib/PuppeteerSharp/EvaluateExceptionDetails.cs +++ b/lib/PuppeteerSharp/EvaluateExceptionDetails.cs @@ -4,11 +4,11 @@ namespace PuppeteerSharp { internal class EvaluateExceptionDetails { - [JsonProperty(Constants.EXCEPTION)] + [JsonProperty("exception")] internal EvaluateExceptionInfo Exception { get; set; } - [JsonProperty(Constants.TEXT)] + [JsonProperty("text")] internal string Text { get; set; } - [JsonProperty(Constants.STACK_TRACE)] + [JsonProperty("stackTrace")] internal EvaluateExceptionStackTrace StackTrace { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/EvaluateExceptionInfo.cs b/lib/PuppeteerSharp/EvaluateExceptionInfo.cs index c8bd2c6d5..694ee3d46 100644 --- a/lib/PuppeteerSharp/EvaluateExceptionInfo.cs +++ b/lib/PuppeteerSharp/EvaluateExceptionInfo.cs @@ -4,10 +4,10 @@ namespace PuppeteerSharp { internal class EvaluateExceptionInfo { - [JsonProperty(Constants.DESCRIPTION)] + [JsonProperty("description")] internal string Description { get; set; } - [JsonProperty(Constants.VALUE)] + [JsonProperty("value")] internal string Value { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/EvaluateExceptionStackTrace.cs b/lib/PuppeteerSharp/EvaluateExceptionStackTrace.cs index 252725131..0ac84ba16 100644 --- a/lib/PuppeteerSharp/EvaluateExceptionStackTrace.cs +++ b/lib/PuppeteerSharp/EvaluateExceptionStackTrace.cs @@ -5,7 +5,7 @@ namespace PuppeteerSharp { internal class EvaluateExceptionStackTrace { - [JsonProperty(Constants.CALL_FRAMES)] + [JsonProperty("callFrames")] internal EvaluationExceptionCallFrame[] CallFrames { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/EvaluationExceptionCallFrame.cs b/lib/PuppeteerSharp/EvaluationExceptionCallFrame.cs index 9870c38cd..9d22621d1 100644 --- a/lib/PuppeteerSharp/EvaluationExceptionCallFrame.cs +++ b/lib/PuppeteerSharp/EvaluationExceptionCallFrame.cs @@ -4,13 +4,13 @@ namespace PuppeteerSharp { internal class EvaluationExceptionCallFrame { - [JsonProperty(Constants.COLUMN_NUMBER)] + [JsonProperty("columnNumber")] internal int ColumnNumber { get; set; } - [JsonProperty(Constants.LINE_NUMBER)] + [JsonProperty("lineNumber")] internal int LineNumber { get; set; } - [JsonProperty(Constants.URL)] + [JsonProperty("url")] internal string Url { get; set; } - [JsonProperty(Constants.FUNCTION_NAME)] + [JsonProperty("functionName")] internal string FunctionName { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/FramePayload.cs b/lib/PuppeteerSharp/FramePayload.cs index 95926fc0f..2ed6ad472 100644 --- a/lib/PuppeteerSharp/FramePayload.cs +++ b/lib/PuppeteerSharp/FramePayload.cs @@ -4,13 +4,13 @@ namespace PuppeteerSharp { internal class FramePayload { - [JsonProperty(Constants.ID)] + [JsonProperty("id")] internal string Id { get; set; } - [JsonProperty(Constants.PARENT_ID)] + [JsonProperty("parentId")] internal string ParentId { get; set; } - [JsonProperty(Constants.NAME)] + [JsonProperty("name")] internal string Name { get; set; } - [JsonProperty(Constants.URL)] + [JsonProperty("url")] internal string Url { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/Media/Clip.cs b/lib/PuppeteerSharp/Media/Clip.cs index 965821e6c..b95534bdc 100644 --- a/lib/PuppeteerSharp/Media/Clip.cs +++ b/lib/PuppeteerSharp/Media/Clip.cs @@ -14,31 +14,31 @@ public class Clip /// x-coordinate of top-left corner of clip area. /// /// The x. - [JsonProperty(Constants.X)] + [JsonProperty("x")] public decimal X { get; set; } /// /// y-coordinate of top-left corner of clip area. /// /// The y. - [JsonProperty(Constants.Y)] + [JsonProperty("y")] public decimal Y { get; set; } /// /// Width of clipping area. /// /// The width. - [JsonProperty(Constants.WIDTH)] + [JsonProperty("width")] public decimal Width { get; set; } /// /// Height of clipping area. /// /// The height. - [JsonProperty(Constants.HEIGHT)] + [JsonProperty("height")] public decimal Height { get; set; } /// /// Scale of the webpage rendering. Defaults to 1. /// /// The scale. - [JsonProperty(Constants.SCALE)] + [JsonProperty("scale")] public int Scale { get; internal set; } internal Clip Clone() diff --git a/lib/PuppeteerSharp/Media/ScreenOrientation.cs b/lib/PuppeteerSharp/Media/ScreenOrientation.cs index f201956c2..a793c8db7 100644 --- a/lib/PuppeteerSharp/Media/ScreenOrientation.cs +++ b/lib/PuppeteerSharp/Media/ScreenOrientation.cs @@ -4,9 +4,9 @@ namespace PuppeteerSharp.Media { internal class ScreenOrientation { - [JsonProperty(Constants.ANGLE)] + [JsonProperty("angle")] public int Angle { get; internal set; } - [JsonProperty(Constants.TYPE)] + [JsonProperty("type")] public string Type { get; internal set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/Messaging/BasicFrameResponse.cs b/lib/PuppeteerSharp/Messaging/BasicFrameResponse.cs index e61e4148a..da06fb0dc 100644 --- a/lib/PuppeteerSharp/Messaging/BasicFrameResponse.cs +++ b/lib/PuppeteerSharp/Messaging/BasicFrameResponse.cs @@ -4,7 +4,7 @@ namespace PuppeteerSharp.Messaging { internal class BasicFrameResponse { - [JsonProperty(Constants.FRAME_ID)] + [JsonProperty("frameId")] public string FrameId { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/Messaging/BindingCalledResponse.cs b/lib/PuppeteerSharp/Messaging/BindingCalledResponse.cs index ec3abfe65..63d33cc9c 100644 --- a/lib/PuppeteerSharp/Messaging/BindingCalledResponse.cs +++ b/lib/PuppeteerSharp/Messaging/BindingCalledResponse.cs @@ -8,10 +8,10 @@ internal class BindingCalledResponse { private string _payloadJson; - [JsonProperty(Constants.EXECUTION_CONTEXT_ID)] + [JsonProperty("executionContextId")] public int ExecutionContextId { get; set; } public BindingPayload Payload { get; set; } - [JsonProperty(Constants.PAYLOAD)] + [JsonProperty("payload")] public string PayloadJson { get => _payloadJson; @@ -26,11 +26,11 @@ public string PayloadJson public class BindingPayload { - [JsonProperty(Constants.NAME)] + [JsonProperty("name")] public string Name { get; set; } - [JsonProperty(Constants.ARGS)] + [JsonProperty("args")] public object[] Args { get; set; } - [JsonProperty(Constants.SEQ)] + [JsonProperty("seq")] public int Seq { get; set; } public JObject JsonObject { get; set; } diff --git a/lib/PuppeteerSharp/Messaging/BoxModelResponse.cs b/lib/PuppeteerSharp/Messaging/BoxModelResponse.cs index 2a1a55b7f..322552fea 100644 --- a/lib/PuppeteerSharp/Messaging/BoxModelResponse.cs +++ b/lib/PuppeteerSharp/Messaging/BoxModelResponse.cs @@ -4,27 +4,27 @@ namespace PuppeteerSharp.Messaging { internal class BoxModelResponse { - [JsonProperty(Constants.MODEL)] + [JsonProperty("model")] public BoxModelResponseModel Model { get; set; } public class BoxModelResponseModel { - [JsonProperty(Constants.CONTENT)] + [JsonProperty("content")] public decimal[] Content { get; set; } - [JsonProperty(Constants.PADDING)] + [JsonProperty("padding")] public decimal[] Padding { get; set; } - [JsonProperty(Constants.BORDER)] + [JsonProperty("border")] public decimal[] Border { get; set; } - [JsonProperty(Constants.MARGIN)] + [JsonProperty("margin")] public decimal[] Margin { get; set; } - [JsonProperty(Constants.WIDTH)] + [JsonProperty("width")] public int Width { get; set; } - [JsonProperty(Constants.HEIGHT)] + [JsonProperty("height")] public int Height { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/CSSStopRuleUsageTrackingResponse.cs b/lib/PuppeteerSharp/Messaging/CSSStopRuleUsageTrackingResponse.cs index fc11da534..fc38f993a 100644 --- a/lib/PuppeteerSharp/Messaging/CSSStopRuleUsageTrackingResponse.cs +++ b/lib/PuppeteerSharp/Messaging/CSSStopRuleUsageTrackingResponse.cs @@ -4,18 +4,18 @@ namespace PuppeteerSharp.Messaging { internal class CSSStopRuleUsageTrackingResponse { - [JsonProperty(Constants.RULE_USAGE)] + [JsonProperty("ruleUsage")] internal CSSStopRuleUsageTrackingRuleUsage[] RuleUsage { get; set; } internal class CSSStopRuleUsageTrackingRuleUsage { - [JsonProperty(Constants.STYLE_SHEET_ID)] + [JsonProperty("styleSheetId")] public string StyleSheetId { get; set; } - [JsonProperty(Constants.START_OFFSET)] + [JsonProperty("startOffset")] public int StartOffset { get; set; } - [JsonProperty(Constants.END_OFFSET)] + [JsonProperty("endOffset")] public int EndOffset { get; set; } - [JsonProperty(Constants.USED)] + [JsonProperty("used")] public bool Used { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/CSSStyleSheetAddedResponse.cs b/lib/PuppeteerSharp/Messaging/CSSStyleSheetAddedResponse.cs index 86fadc7a0..fbe040e91 100644 --- a/lib/PuppeteerSharp/Messaging/CSSStyleSheetAddedResponse.cs +++ b/lib/PuppeteerSharp/Messaging/CSSStyleSheetAddedResponse.cs @@ -5,14 +5,14 @@ namespace PuppeteerSharp.Messaging { internal class CSSStyleSheetAddedResponse { - [JsonProperty(Constants.HEADER)] + [JsonProperty("header")] public CSSStyleSheetAddedResponseHeader Header { get; set; } public class CSSStyleSheetAddedResponseHeader { - [JsonProperty(Constants.STYLE_SHEET_ID)] + [JsonProperty("styleSheetId")] public string StyleSheetId { get; set; } - [JsonProperty(Constants.SOURCE_URL)] + [JsonProperty("sourceURL")] public string SourceURL { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/CertificateErrorResponse.cs b/lib/PuppeteerSharp/Messaging/CertificateErrorResponse.cs index 737302579..d07c171ae 100644 --- a/lib/PuppeteerSharp/Messaging/CertificateErrorResponse.cs +++ b/lib/PuppeteerSharp/Messaging/CertificateErrorResponse.cs @@ -4,7 +4,7 @@ namespace PuppeteerSharp.Messaging { internal class CertificateErrorResponse { - [JsonProperty(Constants.EVENT_ID)] + [JsonProperty("eventId")] public int EventId { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/Messaging/CoverageResponseRange.cs b/lib/PuppeteerSharp/Messaging/CoverageResponseRange.cs index 3baa6581f..fbccc95ef 100644 --- a/lib/PuppeteerSharp/Messaging/CoverageResponseRange.cs +++ b/lib/PuppeteerSharp/Messaging/CoverageResponseRange.cs @@ -4,13 +4,13 @@ namespace PuppeteerSharp.Messaging { internal class CoverageResponseRange { - [JsonProperty(Constants.START_OFFSET)] + [JsonProperty("startOffset")] public int StartOffset { get; set; } - [JsonProperty(Constants.END_OFFSET)] + [JsonProperty("endOffset")] public int EndOffset { get; set; } - [JsonProperty(Constants.COUNT)] + [JsonProperty("count")] public int Count { get; set; } - [JsonProperty(Constants.STYLE_SHEET_ID)] + [JsonProperty("styleSheetId")] public string StyleSheetId { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/CreateBrowserContextResponse.cs b/lib/PuppeteerSharp/Messaging/CreateBrowserContextResponse.cs index 4c1668105..74907f44a 100644 --- a/lib/PuppeteerSharp/Messaging/CreateBrowserContextResponse.cs +++ b/lib/PuppeteerSharp/Messaging/CreateBrowserContextResponse.cs @@ -4,7 +4,7 @@ namespace PuppeteerSharp.Messaging { internal class CreateBrowserContextResponse { - [JsonProperty(Constants.BROWSER_CONTEXT_ID)] + [JsonProperty("browserContextId")] public string BrowserContextId { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/DebuggerScriptParsedResponse.cs b/lib/PuppeteerSharp/Messaging/DebuggerScriptParsedResponse.cs index cca4bd32a..bca981283 100644 --- a/lib/PuppeteerSharp/Messaging/DebuggerScriptParsedResponse.cs +++ b/lib/PuppeteerSharp/Messaging/DebuggerScriptParsedResponse.cs @@ -4,10 +4,10 @@ namespace PuppeteerSharp.Messaging { internal class DebuggerScriptParsedResponse { - [JsonProperty(Constants.URL)] + [JsonProperty("url")] public string Url { get; set; } - [JsonProperty(Constants.SCRIPT_ID)] + [JsonProperty("scriptId")] public string ScriptId { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/Messaging/DomDescribeNodeResponse.cs b/lib/PuppeteerSharp/Messaging/DomDescribeNodeResponse.cs index 1b58ea5ca..d9f6ef839 100644 --- a/lib/PuppeteerSharp/Messaging/DomDescribeNodeResponse.cs +++ b/lib/PuppeteerSharp/Messaging/DomDescribeNodeResponse.cs @@ -5,12 +5,12 @@ namespace PuppeteerSharp.Messaging { internal class DomDescribeNodeResponse { - [JsonProperty(Constants.NODE)] + [JsonProperty("node")] public DomNode Node { get; set; } internal class DomNode { - [JsonProperty(Constants.FRAME_ID)] + [JsonProperty("frameId")] public string FrameId { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/GetBrowserContextsResponse.cs b/lib/PuppeteerSharp/Messaging/GetBrowserContextsResponse.cs index c365ce007..1c3e2f455 100644 --- a/lib/PuppeteerSharp/Messaging/GetBrowserContextsResponse.cs +++ b/lib/PuppeteerSharp/Messaging/GetBrowserContextsResponse.cs @@ -4,7 +4,7 @@ namespace PuppeteerSharp.Messaging { internal class GetBrowserContextsResponse { - [JsonProperty(Constants.BROWSER_CONTEXT_IDS)] + [JsonProperty("browserContextIds")] public string[] BrowserContextIds { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/GetContentQuadsResponse.cs b/lib/PuppeteerSharp/Messaging/GetContentQuadsResponse.cs index e8c336fde..898bdf75f 100644 --- a/lib/PuppeteerSharp/Messaging/GetContentQuadsResponse.cs +++ b/lib/PuppeteerSharp/Messaging/GetContentQuadsResponse.cs @@ -5,7 +5,7 @@ namespace PuppeteerSharp.Messaging { internal class GetContentQuadsResponse { - [JsonProperty(Constants.QUADS)] + [JsonProperty("quads")] public decimal[][] Quads { get; internal set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/Messaging/GetLayoutMetricsResponse.cs b/lib/PuppeteerSharp/Messaging/GetLayoutMetricsResponse.cs index 105835570..24344443e 100644 --- a/lib/PuppeteerSharp/Messaging/GetLayoutMetricsResponse.cs +++ b/lib/PuppeteerSharp/Messaging/GetLayoutMetricsResponse.cs @@ -4,15 +4,15 @@ namespace PuppeteerSharp.Messaging { internal class GetLayoutMetricsResponse { - [JsonProperty(Constants.LAYOUT_VIEWPORT)] + [JsonProperty("layoutViewport")] public GetLayoutMetricsLayoutViewport LayoutViewport { get; set; } internal class GetLayoutMetricsLayoutViewport { - [JsonProperty(Constants.PAGE_X)] + [JsonProperty("pageX")] public decimal PageX { get; set; } - [JsonProperty(Constants.PAGE_Y)] + [JsonProperty("pageY")] public decimal PageY { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/IOReadResponse.cs b/lib/PuppeteerSharp/Messaging/IOReadResponse.cs index 141d20bb2..1915953d2 100644 --- a/lib/PuppeteerSharp/Messaging/IOReadResponse.cs +++ b/lib/PuppeteerSharp/Messaging/IOReadResponse.cs @@ -5,9 +5,9 @@ namespace PuppeteerSharp.Messaging { internal class IOReadResponse { - [JsonProperty(Constants.EOF)] + [JsonProperty("eof")] internal bool Eof { get; set; } - [JsonProperty(Constants.DATA)] + [JsonProperty("data")] internal string Data { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/LifecycleEventResponse.cs b/lib/PuppeteerSharp/Messaging/LifecycleEventResponse.cs index 9153d54e0..86439ed9e 100644 --- a/lib/PuppeteerSharp/Messaging/LifecycleEventResponse.cs +++ b/lib/PuppeteerSharp/Messaging/LifecycleEventResponse.cs @@ -4,13 +4,13 @@ namespace PuppeteerSharp.Messaging { internal class LifecycleEventResponse { - [JsonProperty(Constants.FRAME_ID)] + [JsonProperty("frameId")] public string FrameId { get; set; } - [JsonProperty(Constants.LOADER_ID)] + [JsonProperty("loaderId")] public string LoaderId { get; set; } - [JsonProperty(Constants.NAME)] + [JsonProperty("name")] public string Name { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/Messaging/LoadingFailedResponse.cs b/lib/PuppeteerSharp/Messaging/LoadingFailedResponse.cs index 8dab0aa72..0dde1ef5b 100644 --- a/lib/PuppeteerSharp/Messaging/LoadingFailedResponse.cs +++ b/lib/PuppeteerSharp/Messaging/LoadingFailedResponse.cs @@ -4,10 +4,10 @@ namespace PuppeteerSharp.Messaging { internal class LoadingFailedResponse { - [JsonProperty(Constants.REQUEST_ID)] + [JsonProperty("requestId")] public string RequestId { get; set; } - [JsonProperty(Constants.ERROR_TEXT)] + [JsonProperty("errorText")] public string ErrorText { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/LoadingFinishedResponse.cs b/lib/PuppeteerSharp/Messaging/LoadingFinishedResponse.cs index 5fd295840..681082525 100644 --- a/lib/PuppeteerSharp/Messaging/LoadingFinishedResponse.cs +++ b/lib/PuppeteerSharp/Messaging/LoadingFinishedResponse.cs @@ -4,7 +4,7 @@ namespace PuppeteerSharp.Messaging { internal class LoadingFinishedResponse { - [JsonProperty(Constants.REQUEST_ID)] + [JsonProperty("requestId")] public string RequestId { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/LogEntryAddedResponse.cs b/lib/PuppeteerSharp/Messaging/LogEntryAddedResponse.cs index 20c53ae4e..410e2acb1 100644 --- a/lib/PuppeteerSharp/Messaging/LogEntryAddedResponse.cs +++ b/lib/PuppeteerSharp/Messaging/LogEntryAddedResponse.cs @@ -6,18 +6,18 @@ namespace PuppeteerSharp.Messaging { internal class LogEntryAddedResponse { - [JsonProperty(Constants.ENTRY)] + [JsonProperty("entry")] internal LogEntry Entry { get; set; } internal class LogEntry { - [JsonProperty(Constants.SOURCE)] + [JsonProperty("source")] public TargetType Source { get; set; } - [JsonProperty(Constants.ARGS)] + [JsonProperty("args")] internal dynamic[] Args { get; set; } - [JsonProperty(Constants.LEVEL)] + [JsonProperty("level")] internal ConsoleType Level { get; set; } - [JsonProperty(Constants.TEXT)] + [JsonProperty("text")] internal string Text { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/NavigatedWithinDocumentResponse.cs b/lib/PuppeteerSharp/Messaging/NavigatedWithinDocumentResponse.cs index f0ff47a03..e03059a7b 100644 --- a/lib/PuppeteerSharp/Messaging/NavigatedWithinDocumentResponse.cs +++ b/lib/PuppeteerSharp/Messaging/NavigatedWithinDocumentResponse.cs @@ -4,10 +4,10 @@ namespace PuppeteerSharp.Messaging { internal class NavigatedWithinDocumentResponse { - [JsonProperty(Constants.FRAME_ID)] + [JsonProperty("frameId")] public string FrameId { get; set; } - [JsonProperty(Constants.URL)] + [JsonProperty("url")] public string Url { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/NetworkGetResponseBodyResponse.cs b/lib/PuppeteerSharp/Messaging/NetworkGetResponseBodyResponse.cs index aff10d782..deaf9a5fe 100644 --- a/lib/PuppeteerSharp/Messaging/NetworkGetResponseBodyResponse.cs +++ b/lib/PuppeteerSharp/Messaging/NetworkGetResponseBodyResponse.cs @@ -5,9 +5,9 @@ namespace PuppeteerSharp.Messaging { internal class NetworkGetResponseBodyResponse { - [JsonProperty(Constants.BODY)] + [JsonProperty("body")] public string Body { get; set; } - [JsonProperty(Constants.BASE_64_ENCODED)] + [JsonProperty("base64Encoded")] public bool Base64Encoded { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/PageConsoleResponse.cs b/lib/PuppeteerSharp/Messaging/PageConsoleResponse.cs index a962d3ce2..3d63490be 100644 --- a/lib/PuppeteerSharp/Messaging/PageConsoleResponse.cs +++ b/lib/PuppeteerSharp/Messaging/PageConsoleResponse.cs @@ -4,13 +4,13 @@ namespace PuppeteerSharp.Messaging { internal class PageConsoleResponse { - [JsonProperty(Constants.TYPE)] + [JsonProperty("type")] internal ConsoleType Type { get; set; } - [JsonProperty(Constants.ARGS)] + [JsonProperty("args")] internal dynamic[] Args { get; set; } - [JsonProperty(Constants.EXECUTION_CONTEXT_ID)] + [JsonProperty("executionContextId")] internal int ExecutionContextId { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/PageGetNavigationHistoryResponse.cs b/lib/PuppeteerSharp/Messaging/PageGetNavigationHistoryResponse.cs index b9c6eb7db..af86dbd95 100644 --- a/lib/PuppeteerSharp/Messaging/PageGetNavigationHistoryResponse.cs +++ b/lib/PuppeteerSharp/Messaging/PageGetNavigationHistoryResponse.cs @@ -6,14 +6,14 @@ namespace PuppeteerSharp.Messaging { internal class PageGetNavigationHistoryResponse { - [JsonProperty(Constants.CURRENT_INDEX)] + [JsonProperty("currentIndex")] public int CurrentIndex { get; set; } - [JsonProperty(Constants.ENTRIES)] + [JsonProperty("entries")] public List Entries { get; set; } internal class HistoryEntry { - [JsonProperty(Constants.ID)] + [JsonProperty("id")] internal int Id { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/PageJavascriptDialogOpeningResponse.cs b/lib/PuppeteerSharp/Messaging/PageJavascriptDialogOpeningResponse.cs index 2bfb297aa..31f27435e 100644 --- a/lib/PuppeteerSharp/Messaging/PageJavascriptDialogOpeningResponse.cs +++ b/lib/PuppeteerSharp/Messaging/PageJavascriptDialogOpeningResponse.cs @@ -4,13 +4,13 @@ namespace PuppeteerSharp.Messaging { internal class PageJavascriptDialogOpeningResponse { - [JsonProperty(Constants.TYPE)] + [JsonProperty("type")] internal DialogType Type { get; set; } - [JsonProperty(Constants.DEFAULT_PROMPT)] + [JsonProperty("defaultPrompt")] internal string DefaultPrompt { get; set; } - [JsonProperty(Constants.MESSAGE)] + [JsonProperty("message")] internal string Message { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/PageNavigateResponse.cs b/lib/PuppeteerSharp/Messaging/PageNavigateResponse.cs index dbe54a266..465158f54 100644 --- a/lib/PuppeteerSharp/Messaging/PageNavigateResponse.cs +++ b/lib/PuppeteerSharp/Messaging/PageNavigateResponse.cs @@ -5,10 +5,10 @@ namespace PuppeteerSharp.Messaging { internal class PageNavigateResponse { - [JsonProperty(Constants.ERROR_TEXT)] + [JsonProperty("errorText")] internal string ErrorText { get; set; } - [JsonProperty(Constants.LOADER_ID)] + [JsonProperty("loaderId")] internal string LoaderId { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/PerformanceGetMetricsResponse.cs b/lib/PuppeteerSharp/Messaging/PerformanceGetMetricsResponse.cs index a407118a6..794824285 100644 --- a/lib/PuppeteerSharp/Messaging/PerformanceGetMetricsResponse.cs +++ b/lib/PuppeteerSharp/Messaging/PerformanceGetMetricsResponse.cs @@ -6,7 +6,7 @@ namespace PuppeteerSharp.Messaging { internal class PerformanceGetMetricsResponse { - [JsonProperty(Constants.METRICS)] + [JsonProperty("metrics")] internal List Metrics { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/PerformanceMetricsResponse.cs b/lib/PuppeteerSharp/Messaging/PerformanceMetricsResponse.cs index 5c6c3c20a..6c256efd2 100644 --- a/lib/PuppeteerSharp/Messaging/PerformanceMetricsResponse.cs +++ b/lib/PuppeteerSharp/Messaging/PerformanceMetricsResponse.cs @@ -6,9 +6,9 @@ namespace PuppeteerSharp.Messaging { internal class PerformanceMetricsResponse { - [JsonProperty(Constants.TITLE)] + [JsonProperty("title")] internal string Title { get; set; } - [JsonProperty(Constants.METRICS)] + [JsonProperty("metrics")] internal List Metrics { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/ProfilerTakePreciseCoverageResponse.cs b/lib/PuppeteerSharp/Messaging/ProfilerTakePreciseCoverageResponse.cs index 53e312a30..8fa62d553 100644 --- a/lib/PuppeteerSharp/Messaging/ProfilerTakePreciseCoverageResponse.cs +++ b/lib/PuppeteerSharp/Messaging/ProfilerTakePreciseCoverageResponse.cs @@ -4,20 +4,20 @@ namespace PuppeteerSharp.Messaging { internal class ProfilerTakePreciseCoverageResponse { - [JsonProperty(Constants.RESULT)] + [JsonProperty("result")] public ProfilerTakePreciseCoverageResponseItem[] Result { get; set; } internal class ProfilerTakePreciseCoverageResponseItem { - [JsonProperty(Constants.SCRIPT_ID)] + [JsonProperty("scriptId")] public string ScriptId { get; set; } - [JsonProperty(Constants.FUNCTIONS)] + [JsonProperty("functions")] public ProfilerTakePreciseCoverageResponseFunction[] Functions { get; set; } } internal class ProfilerTakePreciseCoverageResponseFunction { - [JsonProperty(Constants.RANGES)] + [JsonProperty("ranges")] public CoverageResponseRange[] Ranges { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/RequestInterceptedResponse.cs b/lib/PuppeteerSharp/Messaging/RequestInterceptedResponse.cs index e9d9bf458..bcf521fde 100644 --- a/lib/PuppeteerSharp/Messaging/RequestInterceptedResponse.cs +++ b/lib/PuppeteerSharp/Messaging/RequestInterceptedResponse.cs @@ -6,45 +6,45 @@ namespace PuppeteerSharp.Messaging { internal class RequestInterceptedResponse { - [JsonProperty(Constants.INTERCEPTION_ID)] + [JsonProperty("interceptionId")] public string InterceptionId { get; set; } - [JsonProperty(Constants.REQUEST)] + [JsonProperty("request")] public Payload Request { get; set; } - [JsonProperty(Constants.FRAME_ID)] + [JsonProperty("frameId")] public string FrameId { get; set; } - [JsonProperty(Constants.RESOURCE_TYPE)] + [JsonProperty("resourceType")] public ResourceType ResourceType { get; set; } - [JsonProperty(Constants.IS_NAVIGATION_REQUEST)] + [JsonProperty("isNavigationRequest")] public bool IsNavigationRequest { get; set; } - [JsonProperty(Constants.RESPONSE_HEADERS, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("responseHeaders", NullValueHandling = NullValueHandling.Ignore)] public Dictionary ResponseHeaders { get; set; } - [JsonProperty(Constants.RESPONSE_STATUS_CODE, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("responseStatusCode", NullValueHandling = NullValueHandling.Ignore)] public HttpStatusCode ResponseStatusCode { get; set; } - [JsonProperty(Constants.REDIRECT_URL, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("redirectUrl", NullValueHandling = NullValueHandling.Ignore)] public string RedirectUrl { get; set; } - [JsonProperty(Constants.AUTH_CHALLENGE, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("authChallenge", NullValueHandling = NullValueHandling.Ignore)] public AuthChallengeData AuthChallenge { get; set; } internal class AuthChallengeData { - [JsonProperty(Constants.SOURCE, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("source", NullValueHandling = NullValueHandling.Ignore)] public string Source { get; set; } - [JsonProperty(Constants.ORIGIN)] + [JsonProperty("origin")] public string Origin { get; set; } - [JsonProperty(Constants.SCHEME)] + [JsonProperty("scheme")] public string Scheme { get; set; } - [JsonProperty(Constants.REALM)] + [JsonProperty("realm")] public string Realm { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/RequestServedFromCacheResponse.cs b/lib/PuppeteerSharp/Messaging/RequestServedFromCacheResponse.cs index 7e2683b29..8c5e94727 100644 --- a/lib/PuppeteerSharp/Messaging/RequestServedFromCacheResponse.cs +++ b/lib/PuppeteerSharp/Messaging/RequestServedFromCacheResponse.cs @@ -4,7 +4,7 @@ namespace PuppeteerSharp.Messaging { internal class RequestServedFromCacheResponse { - [JsonProperty(Constants.REQUEST_ID)] + [JsonProperty("requestId")] internal string RequestId { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/RequestWillBeSentPayload.cs b/lib/PuppeteerSharp/Messaging/RequestWillBeSentPayload.cs index 914521e83..bda298372 100644 --- a/lib/PuppeteerSharp/Messaging/RequestWillBeSentPayload.cs +++ b/lib/PuppeteerSharp/Messaging/RequestWillBeSentPayload.cs @@ -4,22 +4,22 @@ namespace PuppeteerSharp.Messaging { internal class RequestWillBeSentPayload { - [JsonProperty(Constants.REQUEST_ID)] + [JsonProperty("requestId")] public string RequestId { get; set; } - [JsonProperty(Constants.LOADER_ID)] + [JsonProperty("loaderId")] public string LoaderId { get; set; } - [JsonProperty(Constants.REQUEST)] + [JsonProperty("request")] public Payload Request { get; set; } - [JsonProperty(Constants.REDIRECT_RESPONSE, NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("redirectResponse", NullValueHandling = NullValueHandling.Ignore)] public ResponsePayload RedirectResponse { get; set; } - [JsonProperty(Constants.TYPE)] + [JsonProperty("type")] public ResourceType Type { get; set; } - [JsonProperty(Constants.FRAME_ID)] + [JsonProperty("frameId")] public string FrameId { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/ResponsePayload.cs b/lib/PuppeteerSharp/Messaging/ResponsePayload.cs index 921d526da..659aa2e8d 100644 --- a/lib/PuppeteerSharp/Messaging/ResponsePayload.cs +++ b/lib/PuppeteerSharp/Messaging/ResponsePayload.cs @@ -6,17 +6,17 @@ namespace PuppeteerSharp.Messaging { internal class ResponsePayload { - [JsonProperty(Constants.URL)] - public string Url { get; internal set; } - [JsonProperty(Constants.HEADERS)] + [JsonProperty("url")] + public string Url { get; set; } + [JsonProperty("headers")] public Dictionary Headers { get; set; } - [JsonProperty(Constants.STATUS)] + [JsonProperty("status")] public HttpStatusCode Status { get; set; } - [JsonProperty(Constants.SECURITY_DETAILS)] + [JsonProperty("securityDetails")] public SecurityDetails SecurityDetails { get; set; } - [JsonProperty(Constants.FROM_DISK_CACHE)] + [JsonProperty("fromDiskCache")] public bool FromDiskCache { get; set; } - [JsonProperty(Constants.FROM_SERVICE_WORKER)] + [JsonProperty("fromServiceWorker")] public bool FromServiceWorker { get; set; } [JsonProperty("statusText")] public string StatusText { get; set; } diff --git a/lib/PuppeteerSharp/Messaging/ResponseReceivedResponse.cs b/lib/PuppeteerSharp/Messaging/ResponseReceivedResponse.cs index 3a1f7a5a9..edcb75f46 100644 --- a/lib/PuppeteerSharp/Messaging/ResponseReceivedResponse.cs +++ b/lib/PuppeteerSharp/Messaging/ResponseReceivedResponse.cs @@ -4,10 +4,10 @@ namespace PuppeteerSharp.Messaging { internal class ResponseReceivedResponse { - [JsonProperty(Constants.REQUEST_ID)] + [JsonProperty("requestId")] public string RequestId { get; set; } - [JsonProperty(Constants.RESPONSE)] + [JsonProperty("response")] public ResponsePayload Response { get; set; } } } diff --git a/lib/PuppeteerSharp/Messaging/TargetCreatedResponse.cs b/lib/PuppeteerSharp/Messaging/TargetCreatedResponse.cs index 245326da2..a25e64491 100644 --- a/lib/PuppeteerSharp/Messaging/TargetCreatedResponse.cs +++ b/lib/PuppeteerSharp/Messaging/TargetCreatedResponse.cs @@ -4,7 +4,7 @@ namespace PuppeteerSharp.Messaging { internal class TargetCreatedResponse { - [JsonProperty(Constants.TARGET_INFO)] + [JsonProperty("targetInfo")] public TargetInfo TargetInfo { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/Messaging/TargetDestroyedResponse.cs b/lib/PuppeteerSharp/Messaging/TargetDestroyedResponse.cs index ad666d8d5..9a2481b1c 100644 --- a/lib/PuppeteerSharp/Messaging/TargetDestroyedResponse.cs +++ b/lib/PuppeteerSharp/Messaging/TargetDestroyedResponse.cs @@ -4,7 +4,7 @@ namespace PuppeteerSharp.Messaging { internal class TargetDestroyedResponse { - [JsonProperty(Constants.TARGET_ID)] + [JsonProperty("targetId")] public string TargetId { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/Metric.cs b/lib/PuppeteerSharp/Metric.cs index 96ad0b2a1..b97b1bc73 100644 --- a/lib/PuppeteerSharp/Metric.cs +++ b/lib/PuppeteerSharp/Metric.cs @@ -4,9 +4,9 @@ namespace PuppeteerSharp { internal struct Metric { - [JsonProperty(Constants.NAME)] + [JsonProperty("name")] internal string Name { get; set; } - [JsonProperty(Constants.VALUE)] + [JsonProperty("value")] internal decimal Value { get; set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/Payload.cs b/lib/PuppeteerSharp/Payload.cs index 59f2ed634..a7defeb8d 100644 --- a/lib/PuppeteerSharp/Payload.cs +++ b/lib/PuppeteerSharp/Payload.cs @@ -1,43 +1,43 @@ using System; -using System.Collections.Generic; -using System.Linq; +using System.Collections.Generic; +using System.Linq; using System.Net.Http; -using System.Web; -using Newtonsoft.Json; -using PuppeteerSharp.Helpers; - -namespace PuppeteerSharp +using System.Web; +using Newtonsoft.Json; +using PuppeteerSharp.Helpers; + +namespace PuppeteerSharp { /// /// Payload information. - /// - public class Payload + /// + public class Payload { /// /// Gets or sets the HTTP method. /// - /// HTTP method. - [JsonProperty(Constants.METHOD), JsonConverter(typeof(HttpMethodConverter))] + /// HTTP method. + [JsonProperty("method"), JsonConverter(typeof(HttpMethodConverter))] public HttpMethod Method { get; set; } /// /// Gets or sets the post data. /// - /// The post data. - [JsonProperty(Constants.POST_DATA)] + /// The post data. + [JsonProperty("postData")] public object PostData { get; set; } /// /// Gets or sets the HTTP headers. /// - /// HTTP headers. - [JsonProperty(Constants.HEADERS)] + /// HTTP headers. + [JsonProperty("headers")] public Dictionary Headers { get; set; } = new Dictionary(); /// /// Gets or sets the URL. /// - /// The URL. - [JsonProperty(Constants.URL)] - public string Url { get; set; } - + /// The URL. + [JsonProperty("url")] + public string Url { get; set; } + internal string Hash { get @@ -66,12 +66,12 @@ internal string Hash { foreach (var item in Headers.OrderBy(kv => kv.Key)) { - bool HeaderEquals(string name) => item.Key.Equals(name, StringComparison.OrdinalIgnoreCase); - - if (HeaderEquals(Constants.ACCEPT) - || HeaderEquals(Constants.REFERER) + bool HeaderEquals(string name) => item.Key.Equals(name, StringComparison.OrdinalIgnoreCase); + + if (HeaderEquals("accept") + || HeaderEquals("referer") || HeaderEquals("x-devtools-emulate-network-conditions-client-id") - || HeaderEquals(Constants.COOKIE)) + || HeaderEquals("cookie")) { continue; } @@ -81,6 +81,6 @@ internal string Hash return JsonConvert.SerializeObject(hash); } - } - } + } + } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/ScreenshotOptions.cs b/lib/PuppeteerSharp/ScreenshotOptions.cs index 6ac7947df..6ac8cdd9a 100644 --- a/lib/PuppeteerSharp/ScreenshotOptions.cs +++ b/lib/PuppeteerSharp/ScreenshotOptions.cs @@ -23,31 +23,31 @@ public class ScreenshotOptions /// Specifies clipping region of the page. /// /// The clip. - [JsonProperty(Constants.CLIP)] + [JsonProperty("clip")] public Clip Clip { get; set; } /// /// When true, takes a screenshot of the full scrollable page. Defaults to false. /// /// true if full page; otherwise, false. - [JsonProperty(Constants.FULL_PAGE)] + [JsonProperty("fullPage")] public bool FullPage { get; set; } /// /// Hides default white background and allows capturing screenshots with transparency. Defaults to false /// /// true if omit background; otherwise, false. - [JsonProperty(Constants.OMIT_BACKGROUND)] + [JsonProperty("omitBackground")] public bool OmitBackground { get; set; } /// /// Specify screenshot type, can be either jpeg or png. Defaults to 'png'. /// /// The type. - [JsonProperty(Constants.TYPE)] + [JsonProperty("type")] public ScreenshotType? Type { get; set; } /// /// The quality of the image, between 0-100. Not applicable to png images. /// /// The quality. - [JsonProperty(Constants.QUALITY)] + [JsonProperty("quality")] public int? Quality { get; set; } internal static ScreenshotType? GetScreenshotTypeFromFile(string file) diff --git a/lib/PuppeteerSharp/SecurityDetails.cs b/lib/PuppeteerSharp/SecurityDetails.cs index 7038ee20a..e3113e2f3 100644 --- a/lib/PuppeteerSharp/SecurityDetails.cs +++ b/lib/PuppeteerSharp/SecurityDetails.cs @@ -40,31 +40,31 @@ public SecurityDetails(string subjectName, string issuer, int validFrom, int val /// Gets the name of the subject. /// /// The name of the subject. - [JsonProperty(Constants.SUBJECT_NAME)] + [JsonProperty("subjectName")] public string SubjectName { get; internal set; } /// /// Gets the issuer. /// /// The issuer. - [JsonProperty(Constants.ISSUER)] + [JsonProperty("issuer")] public string Issuer { get; internal set; } /// /// Gets the valid from. /// /// The valid from. - [JsonProperty(Constants.VALID_FROM)] + [JsonProperty("validFrom")] public int ValidFrom { get; internal set; } /// /// Gets the valid to. /// /// The valid to. - [JsonProperty(Constants.VALID_TO)] + [JsonProperty("validTo")] public int ValidTo { get; internal set; } /// /// Gets the protocol. /// /// The protocol. - [JsonProperty(Constants.PROTOCOL)] + [JsonProperty("protocol")] public string Protocol { get; internal set; } } } \ No newline at end of file diff --git a/lib/PuppeteerSharp/TargetInfo.cs b/lib/PuppeteerSharp/TargetInfo.cs index 537ecbf87..a4c08f637 100644 --- a/lib/PuppeteerSharp/TargetInfo.cs +++ b/lib/PuppeteerSharp/TargetInfo.cs @@ -15,33 +15,33 @@ internal TargetInfo() /// Gets the type. /// /// The type. - [JsonProperty(Constants.TYPE)] + [JsonProperty("type")] public TargetType Type { get; internal set; } /// /// Gets the URL. /// /// The URL. - [JsonProperty(Constants.URL)] + [JsonProperty("url")] public string Url { get; internal set; } /// /// Gets the target identifier. /// /// The target identifier. - [JsonProperty(Constants.TARGET_ID)] + [JsonProperty("targetId")] public string TargetId { get; internal set; } /// /// Gets or sets the target browser contextId /// - [JsonProperty(Constants.BROWSER_CONTEXT_ID)] + [JsonProperty("browserContextId")] public string BrowserContextId { get; internal set; } /// /// Get the target that opened this target /// - [JsonProperty(Constants.OPENER_ID)] + [JsonProperty("openerId")] public string OpenerId { get; internal set; } } } \ No newline at end of file