-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Excluded from git ignore Debug folder
- Loading branch information
1 parent
76434f9
commit dfa5988
Showing
6 changed files
with
141 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
*.userprefs | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
#[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
|
48 changes: 48 additions & 0 deletions
48
src/GoogleMeasurementProtocol_NetStandard/Requests/Debug/DebugRequest.cs
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,48 @@ | ||
using System.Threading.Tasks; | ||
using GoogleMeasurementProtocol.Parameters.User; | ||
using Newtonsoft.Json; | ||
|
||
namespace GoogleMeasurementProtocol.Requests.Debug | ||
{ | ||
public class DebugRequest : IDebugRequest | ||
{ | ||
private readonly RequestBase _requestToDebug; | ||
|
||
public DebugRequest(RequestBase requestToDebug) | ||
{ | ||
_requestToDebug = requestToDebug; | ||
} | ||
|
||
public async Task<RequestValidationResponse> PostAsync(ClientId clientId) | ||
{ | ||
var response = | ||
await _requestToDebug.PostAsync(clientId, GoogleEndpointAddresses.DebugCollect); | ||
|
||
return JsonConvert.DeserializeObject<RequestValidationResponse>(response); | ||
} | ||
|
||
public async Task<RequestValidationResponse> PostAsync(UserId userId) | ||
{ | ||
var response = | ||
await _requestToDebug.PostAsync(userId, GoogleEndpointAddresses.DebugCollect); | ||
|
||
return JsonConvert.DeserializeObject<RequestValidationResponse>(response); | ||
} | ||
|
||
public async Task<RequestValidationResponse> GetAsync(ClientId clientId) | ||
{ | ||
var response = | ||
await _requestToDebug.GetAsync(clientId, GoogleEndpointAddresses.DebugCollect); | ||
|
||
return JsonConvert.DeserializeObject<RequestValidationResponse>(response); | ||
} | ||
|
||
public async Task<RequestValidationResponse> GetAsync(UserId userId) | ||
{ | ||
var response = | ||
await _requestToDebug.GetAsync(userId, GoogleEndpointAddresses.DebugCollect); | ||
|
||
return JsonConvert.DeserializeObject<RequestValidationResponse>(response); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/GoogleMeasurementProtocol_NetStandard/Requests/Debug/HitParsingResult.cs
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,17 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace GoogleMeasurementProtocol.Requests.Debug | ||
{ | ||
public class HitParsingResult | ||
{ | ||
[JsonProperty(PropertyName = "valid")] | ||
public bool Valid { get; set; } | ||
|
||
[JsonProperty(PropertyName = "hit")] | ||
public string Hit { get; set; } | ||
|
||
[JsonProperty(PropertyName = "parserMessage")] | ||
public List<ParserMessage> ParserMessages { get; set; } | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/GoogleMeasurementProtocol_NetStandard/Requests/Debug/IDebugRequest.cs
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,48 @@ | ||
using System.Threading.Tasks; | ||
using GoogleMeasurementProtocol.Parameters.User; | ||
|
||
namespace GoogleMeasurementProtocol.Requests.Debug | ||
{ | ||
public interface IDebugRequest | ||
{ | ||
/// <summary> | ||
/// Makes an async Post request to Google Analytics Hit Validation | ||
/// </summary> | ||
/// <param name="clientId">Anonymously identifies a particular user, device, or browser instance</param> | ||
/// <returns>The response root, hitParsingResult, is an array whose length will correspond to the number of hits sent in the original request. | ||
/// Each object in the array will contain the keys valid, hit, and parserMessage. | ||
/// If a hit is invalid, parserMessage will contain an array of objects describing the validation issues. | ||
/// If a hit is valid, parserMessage will be an empty array.</returns> | ||
Task<RequestValidationResponse> PostAsync(ClientId clientId); | ||
|
||
/// <summary> | ||
/// Makes an async Post request to Google Analytics | ||
/// </summary> | ||
/// <param name="userId">This is intended to be a known identifier for a user provided by the site owner/tracking library user</param> | ||
/// <returns>The response root, hitParsingResult, is an array whose length will correspond to the number of hits sent in the original request. | ||
/// Each object in the array will contain the keys valid, hit, and parserMessage. | ||
/// If a hit is invalid, parserMessage will contain an array of objects describing the validation issues. | ||
/// If a hit is valid, parserMessage will be an empty array.</returns> | ||
Task<RequestValidationResponse> PostAsync(UserId userId); | ||
|
||
/// <summary> | ||
/// Makes an async Get request to Google Analytics Hit Validation | ||
/// </summary> | ||
/// <param name="clientId">Anonymously identifies a particular user, device, or browser instance</param> | ||
/// <returns>The response root, hitParsingResult, is an array whose length will correspond to the number of hits sent in the original request. | ||
/// Each object in the array will contain the keys valid, hit, and parserMessage. | ||
/// If a hit is invalid, parserMessage will contain an array of objects describing the validation issues. | ||
/// If a hit is valid, parserMessage will be an empty array.</returns> | ||
Task<RequestValidationResponse> GetAsync(ClientId clientId); | ||
|
||
/// <summary> | ||
/// Makes an async Get request to Google Analytics Hit Validation | ||
/// </summary> | ||
/// <param name="userId">This is intended to be a known identifier for a user provided by the site owner/tracking library user</param> | ||
/// <returns>The response root, hitParsingResult, is an array whose length will correspond to the number of hits sent in the original request. | ||
/// Each object in the array will contain the keys valid, hit, and parserMessage. | ||
/// If a hit is invalid, parserMessage will contain an array of objects describing the validation issues. | ||
/// If a hit is valid, parserMessage will be an empty array.</returns> | ||
Task<RequestValidationResponse> GetAsync(UserId userId); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/GoogleMeasurementProtocol_NetStandard/Requests/Debug/ParserMessage.cs
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,16 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace GoogleMeasurementProtocol.Requests.Debug | ||
{ | ||
public class ParserMessage | ||
{ | ||
[JsonProperty(PropertyName = "messageType")] | ||
public string MessageType { get; set; } | ||
|
||
[JsonProperty(PropertyName = "description")] | ||
public string Description { get; set; } | ||
|
||
[JsonProperty(PropertyName = "parameter")] | ||
public string Parameter { get; set; } | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/GoogleMeasurementProtocol_NetStandard/Requests/Debug/RequestValidationResponse.cs
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,11 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace GoogleMeasurementProtocol.Requests.Debug | ||
{ | ||
public class RequestValidationResponse | ||
{ | ||
[JsonProperty("hitParsingResult")] | ||
public List<HitParsingResult> HitParsingResults { get; set; } | ||
} | ||
} |