Skip to content

Commit 361fd63

Browse files
committed
Fix dependency injection exception in AMI.Portable and AMI.CLI
1 parent 673ff87 commit 361fd63

File tree

6 files changed

+36
-4
lines changed

6 files changed

+36
-4
lines changed

src/AMI.API/wwwroot/specification.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"info": {
55
"title": "AMI API",
66
"description": "REST service for [Animated Medical Imaging](https://github.com/niklr/animated-medical-imaging) (AMI)\r\n\r\n## Introduction\r\nIntegrating this Application Programming Interface (API) is the easiest way to submit data to AMI. \r\nThe following documentation will help you to get full advantage of the API by understanding and implementing all endpoints. \r\nWith AMI API you will be able to upload files and submit tasks containing information needed for processing and receive the processed results. \r\nRequests with a body are sent in JavaScript Object Notation (JSON) format over HTTP(S), using the PUT or POST method.\r\n\r\nPlease, feel free to ask any questions, report bugs, suggest new features, and more on [GitHub](https://github.com/niklr/animated-medical-imaging/issues)\r\n\r\n## Authentication\r\nAuthentication of requests is accomplished by using JSON Web Tokens (JWT). Tokens can be obtained by providing your credentials to the tokens API endpoint.\r\nIf you don't have a registered account, you still can obtain tokens with the special API endpoint for anonymous users. \r\nThe response of the tokens API endpoint contains 3 different tokens: \r\n\r\n- **Access Token**: An authorization credential that can be used by the application to access the API.\r\n- **ID Token**: Contains user profile information (such as the user's name and email) which is represented in the form of claims.\r\n- **Refresh Token**: Contains the information required to obtain a new Access Token or ID Token.\r\n\r\nFor each API request you need to include the encoded JWT Access Token with a \"Bearer\" prefix.\r\n\r\n## Requests, Responses, and Errors\r\nStatus codes are issued by the API in response to a client's request made to the API.\r\n\r\n> A **successful** completion of a request returns one of three possible status codes.\r\n\r\nStatus code | Name | Description\r\n---- | ---- | ----\r\n200 | OK | The default status code for successful requests.\r\n201 | Created | Returned on successful POST requests when one or more new entities have been created.\r\n204 | No Content | Returned on successful DELETE requests.\r\n\r\n> An **unsuccessful** completion of a request returns one of the following status codes.\r\n\r\nStatus code | Name | Description\r\n---- | ---- | ----\r\n400 | Bad Request | The format of the URL and/or of values in the parameter list is not valid.\r\n401 | Unauthorized | Usually caused by using a wrong/expired access token or by not using one at all.\r\n403 | Forbidden | The request was valid, but insufficient permissions for the resource.\r\n404 | Not Found | The requested entity does not (or no longer) exist.\r\n409 | Conflict | Indicates a mismatch in the current state of the resource.\r\n429 | Too Many Requests | Indicates that the rate limit has been reached.\r\n500 | Internal Server Error | An exception occurred that has no adequate handling.\r\n\r\n## HTTP method definitions\r\nThe Hypertext Transfer Protocol (HTTP) defines a set of request methods to indicate the desired action to be performed for a given resource/endpoint. \r\nAlthough they can also be nouns, these request methods are sometimes referred as HTTP verbs.\r\nAn idempotent HTTP method can be called many times without different outcomes.\r\nAMI API makes use of the following HTTP methods:\r\n\r\nMethod | Description\r\n---- | ----\r\nGET | Getting a resource. (e.g. GET *https://localhost/objects/23* without body)\r\nPOST | Creating a resource. (e.g. POST *https://localhost/tasks* with a body containing JSON data)\r\nPUT | Updating a resource. (e.g. PUT *https://localhost/tasks/7* with a body containing JSON data)\r\nDELETE | Deleting a resource. (e.g. DELETE *https://localhost/objects/23* without body)\r\n\r\n## Rate Limits\r\nRequests are limited on a 60 seconds basis to provide equal access to the API for everyone.\r\nThe rate limit information is indicated in the header of the response e.g.\r\n\r\n- X-Rate-Limit-Limit: 1m\r\n- X-Rate-Limit-Remaining: 56\r\n- X-Rate-Limit-Reset: 2019-07-25T09:44:13.4658862Z\r\n\r\n## Pagination\r\nAll endpoints returning a list of entities are paginated by default.\r\nReturning a limited amount of entities is easier to handle, instead of hundreds or thousands.\r\n\r\nOption | Description\r\n---- | ---- \r\nlimit | Defines the limit to constrain the number of items. (Allowed values: 10, 25, 50)\r\npage | Defines the current page number. (Allowed values: 0, 1, 2, ...)\r\n\r\n## Date format\r\nAll dates are in UTC (Universal Time Coordinated) and represented in ISO 8601 format (International Organization for Standardization).\r\n\r\n> 2019-04-17T07:52:41.4700000Z\r\n\r\n## Webhooks\r\nAfter we process and complete your request you will be notified via webhook depending on the type of request.\r\nDedicated resources enable you to specify new webhooks, get missed webhooks and clear missed webhooks.\r\nFor testing purposes you can use a service like [hookbin.com](https://hookbin.com/).\r\n\r\n",
7-
"version": "0.0.18"
7+
"version": "0.0.19"
88
},
99
"paths": {
1010
"/api-options": {

src/AMI.CLI/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using AMI.Core.Mappers;
1818
using AMI.Core.Providers;
1919
using AMI.Core.Repositories;
20+
using AMI.Core.Services;
2021
using AMI.Domain.Enums;
2122
using AMI.Gif.Extensions.ServiceCollectionExtensions;
2223
using AMI.Infrastructure.Extensions.ServiceCollectionExtensions;
@@ -72,6 +73,7 @@ public Program()
7273
services.AddDefaultItk();
7374

7475
services.AddSingleton<IAmiUnitOfWork, MockUnitOfWork>();
76+
services.AddSingleton<IBackgroundService, MockBackgroundService>();
7577
services.AddSingleton<IApplicationConstants, ApplicationConstants>();
7678
services.AddSingleton<ICustomPrincipalProvider, MockPrincipalProvider>();
7779
services.AddSingleton<IFileExtensionMapper, FileExtensionMapper>();
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
3+
namespace AMI.Core.Services
4+
{
5+
/// <summary>
6+
/// A mock implementation of the background service.
7+
/// </summary>
8+
/// <seealso cref="IBackgroundService" />
9+
public class MockBackgroundService : IBackgroundService
10+
{
11+
/// <inheritdoc/>
12+
public string EnqueueTask(string id)
13+
{
14+
return string.Empty;
15+
}
16+
17+
/// <inheritdoc/>
18+
public string EnqueueWebhookEvent(string webhookId, string eventId)
19+
{
20+
return string.Empty;
21+
}
22+
23+
/// <inheritdoc/>
24+
public void ScheduleCleanup()
25+
{
26+
}
27+
}
28+
}

src/AMI.NetCore.Tests/Infrastructure/Services/ImageServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void ImageService_ProcessAsync_1()
9393
""combinedGif"": ""combined.gif"",
9494
""createdDate"": ""0001-01-01T00:00:00"",
9595
""modifiedDate"": ""0001-01-01T00:00:00"",
96-
""version"": ""0.0.18"",
96+
""version"": ""0.0.19"",
9797
""jsonFilename"": ""output.json"",
9898
""id"": null,
9999
""discriminator"": ""ProcessResultModel""

src/AMI.Portable/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using AMI.Core.Mappers;
1919
using AMI.Core.Providers;
2020
using AMI.Core.Repositories;
21+
using AMI.Core.Services;
2122
using AMI.Domain.Enums;
2223
using AMI.Gif.Extensions.ServiceCollectionExtensions;
2324
using AMI.Infrastructure.Extensions.ServiceCollectionExtensions;
@@ -67,6 +68,7 @@ public Program()
6768
services.AddDefaultItk();
6869

6970
services.AddSingleton<IAmiUnitOfWork, MockUnitOfWork>();
71+
services.AddSingleton<IBackgroundService, MockBackgroundService>();
7072
services.AddSingleton<IApplicationConstants, ApplicationConstants>();
7173
services.AddSingleton<ICustomPrincipalProvider, MockPrincipalProvider>();
7274
services.AddSingleton<IFileExtensionMapper, FileExtensionMapper>();

src/SharedAssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
// You can specify all the values or you can default the Build and Revision Numbers
2222
// by using the '*' as shown below:
2323
// [assembly: AssemblyVersion("1.0.*")]
24-
[assembly: AssemblyVersion("0.0.18.0")]
25-
[assembly: AssemblyFileVersion("0.0.18.0")]
24+
[assembly: AssemblyVersion("0.0.19.0")]
25+
[assembly: AssemblyFileVersion("0.0.19.0")]

0 commit comments

Comments
 (0)