-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for SAUCE_VISUAL_BUILD_ID and SAUCE_VISUAL_CUSTOM_ID (#6)
- Loading branch information
Showing
13 changed files
with
242 additions
and
28 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,25 @@ | ||
using Newtonsoft.Json; | ||
using SauceLabs.Visual.Models; | ||
|
||
namespace SauceLabs.Visual.GraphQL | ||
{ | ||
internal class Build | ||
{ | ||
[JsonProperty("id")] | ||
public string Id { get; } | ||
[JsonProperty("name")] | ||
public string Name { get; } | ||
[JsonProperty("url")] | ||
public string Url { get; } | ||
[JsonProperty("mode")] | ||
public BuildMode Mode { get; } | ||
|
||
public Build(string id, string name, string url, BuildMode mode) | ||
{ | ||
Id = id; | ||
Name = name; | ||
Url = url; | ||
Mode = mode; | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
visual-dotnet/SauceLabs.Visual/GraphQL/BuildByCustomIdQuery.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,18 @@ | ||
namespace SauceLabs.Visual.GraphQL | ||
{ | ||
internal static class BuildByCustomIdQuery | ||
{ | ||
public const string OperationName = "buildByCustomId"; | ||
|
||
public const string OperationDocument = @" | ||
query buildByCustomId($input: String!) { | ||
result: buildByCustomId(customId: $input) { | ||
id, | ||
url, | ||
name, | ||
mode | ||
} | ||
} | ||
"; | ||
} | ||
} |
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,18 @@ | ||
namespace SauceLabs.Visual.GraphQL | ||
{ | ||
internal static class BuildQuery | ||
{ | ||
public const string OperationName = "build"; | ||
|
||
public const string OperationDocument = @" | ||
query build($input: UUID!) { | ||
result: build(id: $input) { | ||
id, | ||
url, | ||
name, | ||
mode | ||
} | ||
} | ||
"; | ||
} | ||
} |
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
15 changes: 0 additions & 15 deletions
15
visual-dotnet/SauceLabs.Visual/GraphQL/FinishBuildResponse.cs
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
namespace SauceLabs.Visual.Models | ||
{ | ||
public enum BuildMode | ||
{ | ||
Running, | ||
Completed | ||
} | ||
} |
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,12 @@ | ||
using System; | ||
|
||
namespace SauceLabs.Visual.Utils | ||
{ | ||
internal class EnvVars | ||
{ | ||
internal static string CustomId => Environment.GetEnvironmentVariable("SAUCE_VISUAL_CUSTOM_ID") ?? ""; | ||
internal static string BuildId => Environment.GetEnvironmentVariable("SAUCE_VISUAL_BUILD_ID") ?? ""; | ||
internal static string Username => Environment.GetEnvironmentVariable("SAUCE_USERNAME") ?? ""; | ||
internal static string AccessKey => Environment.GetEnvironmentVariable("SAUCE_ACCESS_KEY") ?? ""; | ||
} | ||
} |
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,15 @@ | ||
namespace SauceLabs.Visual.Utils | ||
{ | ||
public static class StringUtils | ||
{ | ||
/// <summary> | ||
/// <c>IsNullOrEmpty</c> checks that the string null, empty or contains only whitespaces. | ||
/// </summary> | ||
/// <param name="value">true if string is empty</param> | ||
/// <returns></returns> | ||
public static bool IsNullOrEmpty(string? value) | ||
{ | ||
return string.IsNullOrEmpty(value?.Trim()); | ||
} | ||
} | ||
} |
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
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