Skip to content

Commit

Permalink
Merge pull request #20 from Moesif/governance
Browse files Browse the repository at this point in the history
Add governance support
  • Loading branch information
praves77 authored Sep 13, 2022
2 parents beffc52 + 8e007ac commit c05a08e
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 3 deletions.
47 changes: 47 additions & 0 deletions Moesif.Api/Controllers/ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,53 @@ public async Task<HttpStringResponse> GetAppConfigAsync()
return _response;
}

/// <summary>
/// Get GovernanceRule
/// </summary>
/// <param name="">Required parameter: Example: </param>
/// <return>Returns the response from the API call</return>
public void GetGovernanceRule()
{
Task t = GetGovernanceRuleAsync();
Task.WaitAll(t);
}

/// <summary>
/// Get GoveranceRule
/// </summary>
/// <param name="">Required parameter: Example: </param>
/// <return>Returns the void response from the API call</return>
public async Task<HttpStringResponse> GetGovernanceRuleAsync()
{
//the base uri for api requestss
string _baseUri = Configuration.BaseUri;

//prepare query string for API call
StringBuilder _queryBuilder = new StringBuilder(_baseUri);
_queryBuilder.Append("/v1/rules");

//validate and preprocess url
string _queryUrl = ApiHelper.CleanUrl(_queryBuilder);

//append request with appropriate headers and parameters
var _headers = new Dictionary<string, string>()
{
{ "x-moesif-application-id", Configuration.ApplicationId }
};

//prepare the API call request to fetch the response
HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

//invoke request and get response
HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request);
HttpContext _context = new HttpContext(_request, _response);
//handle errors defined at the API level
base.ValidateResponse(_response, _context);

//return response
return _response;
}

/// <summary>
/// Update Single Company API Call
/// </summary>
Expand Down
15 changes: 15 additions & 0 deletions Moesif.Api/Models/EventModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class EventModel : INotifyPropertyChanged
private object metadata;
private string direction;
private int weight;
private string blockedBy;

/// <summary>
/// API request object
Expand Down Expand Up @@ -200,6 +201,20 @@ public int Weight
}
}

[JsonProperty("blocked_by")]
public string BlockedBy
{
get
{
return this.blockedBy;
}
set
{
this.blockedBy = value;
onPropertyChanged("BlockedBy");
}
}

/// <summary>
/// Property changed event for observer pattern
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Moesif.Api/Moesif.Api.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>Moesif.Api</id>
<version>2.0.3</version>
<version>2.0.4</version>
<title>MoesifApi</title>
<authors>Moesif</authors>
<owners>Moesif</owners>
Expand Down
4 changes: 2 additions & 2 deletions Moesif.Api/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.3")]
[assembly: AssemblyFileVersion("2.0.3")]
[assembly: AssemblyVersion("2.0.4")]
[assembly: AssemblyFileVersion("2.0.4")]

0 comments on commit c05a08e

Please sign in to comment.