{"id":21623040,"url":"https://github.com/pandatecham/be-lib-service-response","last_synced_at":"2026-05-04T21:33:48.625Z","repository":{"id":162063102,"uuid":"601786092","full_name":"PandaTechAM/be-lib-service-response","owner":"PandaTechAM","description":"This is micro library developed by PandaTech to standardize API responses.","archived":false,"fork":false,"pushed_at":"2024-11-23T07:14:13.000Z","size":247,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"development","last_synced_at":"2025-03-18T19:30:30.176Z","etag":null,"topics":["api","pandatech"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PandaTechAM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-14T20:19:49.000Z","updated_at":"2024-11-23T07:13:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"da79eda1-7022-4c58-986f-102b6336114a","html_url":"https://github.com/PandaTechAM/be-lib-service-response","commit_stats":null,"previous_names":["pandatecham/be-lib-service-response"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PandaTechAM/be-lib-service-response","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PandaTechAM%2Fbe-lib-service-response","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PandaTechAM%2Fbe-lib-service-response/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PandaTechAM%2Fbe-lib-service-response/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PandaTechAM%2Fbe-lib-service-response/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PandaTechAM","download_url":"https://codeload.github.com/PandaTechAM/be-lib-service-response/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PandaTechAM%2Fbe-lib-service-response/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260598829,"owners_count":23034386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","pandatech"],"created_at":"2024-11-25T00:11:22.234Z","updated_at":"2026-05-04T21:33:43.603Z","avatar_url":"https://github.com/PandaTechAM.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ServiceResponse\n\n## Intro\n\nThis is service response template for .Net 6+ web api projects. This template is based on the best practices and\nhas goal to harmonize all API I/O operations. The benefit of this template over other templates is that it totally\nintegrates with OpenAPI and Swagger. So, IActionResults and other services,\nresponse will be visible in Swagger UI and loads of other features are and is going to be included.\n\nThis Template is designed by PandaTech LLC.\nWe build software with the greatest quality!\nOur website: www.pandatech.it :)\n\n ---\n\n## Example\n\n### Model\n\n ```cs\npublic class Blog\n    {\n        public int BlogId { get; set; }\n        public string BlogName { get; set; }\n        public string BlogDescription { get; set; }\n    }\n\n    public class Post\n    {\n        public int PostId { get; set; }\n        public string PostName { get; set; }\n        public string PostDescription { get; set; }\n        public int BlogId { get; set; }\n    }\n```\n\n### Program.cs extract\n\n ```cs\nbuilder.Services.AddTransient\u003cIService, Services\u003e();\n\n#if DEBUG\n    builder.Services.AddTransient\u003cIExceptionHandler, DebugExceptionHandler\u003e();\n#else\n    builder.Services.AddTransient\u003cIExceptionHandler, PublicExceptionHandler\u003e();\n#endif\n```\n\n### Service\n\n ```cs\npublic class Services : IService\n{\n    public ServiceResponse DeletePost(int postId)\n    {\n        var serviceResponse = new ServiceResponse();\n\n        if (postId == 0) // just for example, cannot be in real case\n        {\n            serviceResponse.ResponseStatus = ServiceResponseStatus.NotFound;\n            serviceResponse.Message = $\"Post with id {postId} not found\";\n            serviceResponse.Success = false;\n        }\n        else\n        {\n            serviceResponse.Message = $\"Post with id {postId} deleted\";\n            serviceResponse.ResponseStatus = ServiceResponseStatus.Ok;\n        }\n\n        return serviceResponse;\n    }\n\n    public ServiceResponse\u003cPost\u003e GetPost(int postId)\n    {\n        var serviceResponse = new ServiceResponse\u003cPost\u003e();\n\n\n        serviceResponse.Data = new Post\n        {\n            PostId = postId,\n            PostName = \"Your post name\",\n            PostDescription = \"Post Description\",\n        };\n\n        return serviceResponse;\n    }\n\n    public ServiceResponsePaged\u003cList\u003cBlog\u003e\u003e GetAllBlogs(int page, int pageSize)\n    {\n        var serviceResponse = new ServiceResponsePaged\u003cList\u003cBlog\u003e\u003e();\n\n        serviceResponse.Page = page;\n        serviceResponse.PageSize = pageSize;\n        serviceResponse.TotalCount = 1; // just for example\n\n        serviceResponse.Data = new List\u003cBlog\u003e\n        {\n            new Blog\n            {\n                BlogId = 1,\n                BlogName = \"Your blog name\",\n                BlogDescription = \"Blog Description\",\n            }\n        };\n\n        return serviceResponse;\n    }\n}\n```\n\n### Controller\n\n ```cs\n[ApiController]\n[Route(\"[controller]\")]\npublic class DemoController : ExtendedController\n{\n    private IService _service;\n\n    public DemoController(IExceptionHandler exceptionHandler, IService service) : base(exceptionHandler)\n    {\n        _service = service;\n    }\n\n    [HttpDelete(\"Post\")]\n    public ServiceResponse DeletePost(int postId)\n    {\n        try\n        {\n            return _service.DeletePost(postId);\n        }\n        catch (Exception e)\n        {\n            return ExceptionHandler.Handle(new ServiceResponse(), e);\n        }\n    }\n\n    [HttpGet(\"Post\")]\n    public ServiceResponse\u003cPost\u003e GetPost(int postId)\n    {\n        try\n        {\n            return _service.GetPost(int postId);\n        }\n        catch (Exception e)\n        {\n            return ExceptionHandler.Handle(new ServiceResponse\u003cPost\u003e(), e);\n        }\n    }\n\n    [HttpGet(\"Blogs\")]\n    public ServiceResponsePaged\u003cList\u003cBlog\u003e\u003e GetAllBlogs(int page, int pageSize)\n    {\n        try\n        {\n            return _service.GetAllBlogs(page,pageSize);\n        }\n        catch (Exception e)\n        {\n            return ExceptionHandler.Handle(new ServiceResponsePaged\u003cBlog\u003e(), e);\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpandatecham%2Fbe-lib-service-response","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpandatecham%2Fbe-lib-service-response","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpandatecham%2Fbe-lib-service-response/lists"}