Skip to content

Commit 91a4516

Browse files
committed
feat: implement partially the region
1 parent 92061e6 commit 91a4516

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

Functions/InvokeFunctionOptions.cs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,64 @@ public class InvokeFunctionOptions
3737
/// </summary>
3838
public HttpMethod HttpMethod { get; set; } = HttpMethod.Post;
3939
}
40+
41+
/// <summary>
42+
/// Define the region for requests
43+
/// </summary>
44+
public class FunctionRegion : IEquatable<FunctionRegion>
45+
{
46+
private string _region;
47+
48+
/// <summary>
49+
/// Define the region for requests
50+
/// </summary>
51+
public FunctionRegion(string region)
52+
{
53+
_region = region;
54+
}
55+
56+
/// <summary>
57+
/// Check if the object is identical to the reference passed
58+
/// </summary>
59+
public override bool Equals(object obj)
60+
{
61+
return obj is FunctionRegion r && Equals(r);
62+
}
63+
64+
/// <summary>
65+
/// Generate Hash code
66+
/// </summary>
67+
public override int GetHashCode()
68+
{
69+
return _region.GetHashCode();
70+
}
71+
72+
/// <summary>
73+
/// Check if the object is identical to the reference passed
74+
/// </summary>
75+
public bool Equals(FunctionRegion other)
76+
{
77+
return _region == other._region;
78+
}
79+
80+
/// <summary>
81+
/// Overloading the operator ==
82+
/// </summary>
83+
public static bool operator ==(FunctionRegion left, FunctionRegion right) =>
84+
Equals(left, right);
85+
86+
/// <summary>
87+
/// Overloading the operator !=
88+
/// </summary>
89+
public static bool operator !=(FunctionRegion left, FunctionRegion right) =>
90+
!Equals(left, right);
91+
92+
public static explicit operator string(FunctionRegion region) => region.ToString();
93+
94+
public static explicit operator FunctionRegion(string region) =>
95+
new FunctionRegion(region);
96+
97+
public override string? ToString() => _region;
98+
}
4099
}
41100
}

0 commit comments

Comments
 (0)