Skip to content

Commit

Permalink
Add route to search for analytics by fleet to be used in EDC. (#94)
Browse files Browse the repository at this point in the history
Co-authored-by: Pedro Martínez <[email protected]>
  • Loading branch information
pedro-martinez-212788934 and Pedro Martínez authored Aug 20, 2024
1 parent 27e66e9 commit 47409b8
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Release 2.22.0
* Add routes to get analytic groups by fleet
# Release 2.23.0
* Add route to search for analytics by fleet.
34 changes: 34 additions & 0 deletions src/Client/V2/Access/AnalyticsAccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ public virtual Task<IEnumerable<AnalyticInfo>> SearchAsync( string text, string
return CallApiTask( api => api.GetAnalytics( text, groupId, maxResults, category, context ) );
}

public virtual Task<IEnumerable<AnalyticInfo>> SearchAsync( AnalyticContext analyticContext, string text, string groupId = null, int? maxResults = null, Category category = Category.Full, CallContext context = null )
{
return analyticContext.Type == AnalyticContextType.Flight
? CallApiTask( api => api.GetAnalyticsWithFlight( analyticContext.Id, text, groupId, maxResults, category, context ) )
: CallApiTask( api => api.GetAnalyticsWithFleet( analyticContext.Id, text, groupId, maxResults, category, context ) );
}

/// <summary>
/// Searches for analytics by name.
/// </summary>
Expand Down Expand Up @@ -115,6 +122,33 @@ public virtual IEnumerable<AnalyticInfo> Search( int flightId, string text, stri
return SafeAccessEnumerableTask( SearchAsync( flightId, text, groupId, maxResults, category, context ) );
}

/// <summary>
/// Searches for analytics by name for an context resolvable.
/// </summary>
/// <param name="analyticContext">The resolvable context to look into, can be a flight or a fleet.</param>
/// <param name="text">
/// The search terms used to find a list of analytics by name.
/// </param>
/// <param name="groupId">
/// An optional group ID to specify where to limit the search. If not specified, all groups are searched.
/// </param>
/// <param name="maxResults">
/// The optional maximum number of matching results to return. If not specified, a default value of 200
/// is used. Use 0 to return the maximum of 1000 results.
/// </param>
/// <param name="category">
/// The category of analytics to search, including "Full", "Physical" or "Logical". A null value specifies
/// the default analytic set, which represents the full set of values exposed by the backing EMS system.
/// </param>
/// <param name="context">
/// The optional call context to include.
/// </param>
/// <returns></returns>
public virtual IEnumerable<AnalyticInfo> Search( AnalyticContext analyticContext, string text, string groupId = null, int? maxResults = null, Category category = Category.Full, CallContext context = null )
{
return SafeAccessEnumerableTask( SearchAsync( analyticContext, text, groupId, maxResults, category, context ) );
}

/// <summary>
/// Retrieves metadata information associated with an analytic such as a description or units.
/// </summary>
Expand Down
16 changes: 16 additions & 0 deletions src/Client/V2/IEmsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,22 @@ public interface IEmsApi
[Get( "/v2/ems-systems/1/flights/{flightId}/analytics" )]
Task<IEnumerable<AnalyticInfo>> GetAnalyticsWithFlight( int flightId, string text, string group = null, int? maxResults = null, Category category = Category.Full, [Property] CallContext context = null );

/// <summary>
/// Searches for analytics by name for a specific fleet.
/// </summary>
/// <param name="emsSystemId">The unique identifier of the system containing the EMS data.</param>
/// <param name="fleetId">The integer ID of the fleet to use when searching analytics.</param>
/// <param name="text">The search terms used to find a list of analytics by name.</param>
/// <param name="group">An optional group ID to specify where to limit the search. If not specified, all groups are searched.</param>
/// <param name="maxResults">The optional maximum number of matching results to return. If not specified, a
/// default value of 200 is used. Use 0 to return all results.</param>
/// <param name="category">The category of analytics to search, including "Full", "Physical" or "Logical". A
/// null value specifies the default analytic set, which represents the full set of values exposed by the
/// backing EMS system.
/// </param>
[Get( "/v2/ems-systems/1/fleets/{fleetId}/analytics" )]
Task<IEnumerable<AnalyticInfo>> GetAnalyticsWithFleet( int fleetId, string text, string group = null, int? maxResults = null, Category category = Category.Full, [Property] CallContext context = null );

/// <summary>
/// Retrieves metadata information associated with an analytic such as a description or units.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>2.22.0</VersionPrefix>
<VersionPrefix>2.23.0</VersionPrefix>
<VersionSuffix>prerelease</VersionSuffix>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
Expand Down
92 changes: 91 additions & 1 deletion src/Dto/ems-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -3681,6 +3681,96 @@
"deprecated": false
}
},
"/v2/ems-systems/{emsSystemId}/fleets/{fleetId}/analytics": {
"get": {
"tags": [
"Analytic APIs"
],
"summary": "Searches for analytics by name for a specific fleet.",
"operationId": "Analytic_SearchForFleetAnalytics",
"consumes": [],
"produces": [
"application/json",
"text/json"
],
"parameters": [
{
"name": "emsSystemId",
"in": "path",
"description": "The unique identifier of the system containing the EMS data.",
"required": true,
"type": "integer",
"format": "int32"
},
{
"name": "fleetId",
"in": "path",
"description": "The integer ID of the fleet to use when searching analytics.",
"required": true,
"type": "integer",
"format": "int32"
},
{
"name": "text",
"in": "query",
"description": "The search terms used to find a list of analytics by name.",
"required": true,
"type": "string"
},
{
"name": "group",
"in": "query",
"description": "An optional group ID to specify where to limit the search. If not specified, all groups are searched.",
"required": false,
"type": "string"
},
{
"name": "maxResults",
"in": "query",
"description": "The optional maximum number of matching results to return. If not specified, a \r\n default value of 200 is used. Use 0 to return all results.",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "category",
"in": "query",
"description": "The category of analytics to search, including \"Full\", \"Physical\" or \"Logical\". A \r\n null value specifies the default analytic set, which represents the full set of values exposed by the \r\n backing EMS system.",
"required": false,
"type": "string",
"enum": [
"full",
"physical",
"logical"
]
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Adi.Ems.Web.Api.V2.Dto.AnalyticInfo"
}
}
},
"401": {
"description": "You do not have access to the requested resource.",
"schema": {
"$ref": "#/definitions/Adi.Ems.Web.Api.Model.Error"
}
},
"503": {
"description": "The maximum number of concurrent requests has been reached.",
"schema": {
"$ref": "#/definitions/Adi.Ems.Web.Api.Model.Error"
}
}
},
"deprecated": false
}
},
"/v2/ems-systems/{emsSystemId}/analytic-set-groups": {
"get": {
"tags": [
Expand Down Expand Up @@ -10832,7 +10922,7 @@
"type": "integer"
},
"type": {
"description": "Resolvable type from ResolvableType enum: FlightId, AircraftId or FleetId.",
"description": "Resolvable type from ResolvableType enum: FlightId or FleetId.",
"enum": [
"flight",
"fleet"
Expand Down

0 comments on commit 47409b8

Please sign in to comment.