{"id":32763421,"url":"https://github.com/aruncs31s/responsehelper","last_synced_at":"2026-05-18T10:06:39.839Z","repository":{"id":319145087,"uuid":"1077750009","full_name":"aruncs31s/responsehelper","owner":"aruncs31s","description":"This is a go pakage to help minimize the struggle to find exact http response code message etc . It just wraps everthing inside a beautiful interface","archived":false,"fork":false,"pushed_at":"2025-11-29T14:05:16.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-01T16:30:42.543Z","etag":null,"topics":["api","gin","go","gorm","module","rest-api","restfu"],"latest_commit_sha":null,"homepage":"","language":"Go","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/aruncs31s.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-16T17:24:23.000Z","updated_at":"2025-11-29T14:05:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"c8c91b3d-0d64-46ae-98af-0918c477f8a8","html_url":"https://github.com/aruncs31s/responsehelper","commit_stats":null,"previous_names":["aruncs31s/responsehelper"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/aruncs31s/responsehelper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aruncs31s%2Fresponsehelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aruncs31s%2Fresponsehelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aruncs31s%2Fresponsehelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aruncs31s%2Fresponsehelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aruncs31s","download_url":"https://codeload.github.com/aruncs31s/responsehelper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aruncs31s%2Fresponsehelper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33174091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","gin","go","gorm","module","rest-api","restfu"],"created_at":"2025-11-04T05:00:50.809Z","updated_at":"2026-05-18T10:06:39.833Z","avatar_url":"https://github.com/aruncs31s.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Response Helper\nThis is a simple utility that helps to standardize api responses across the application.\n\n\n## Installation\n\n```bash\ngo get github.com/aruncs31s/responsehelper\n``` \n\n```go\nimport \"github.com/aruncs31s/responsehelper\"\n``` \n\n### Usage\nI suggest you that you include this in your handler constructor like the following\n\n```go\ntype Handler struct {\n    responseHelper responsehelper.ResponseHelper\n}\nfunc NewHandler() *Handler {\n    return \u0026Handler{\n        responseHelper: responsehelper.NewResponseHelper(),\n    }\n}\n```\n\nThen you can use it in your handler methods like the following\n```go\nh.responseHelper.Success(c, data)\n```\n\n\n```json\n{\n    \"success\": true,\n    \"data\": {\n    // response data here\n    },\n    \"meta\": \"2025-10-01T00:00:00Z\"\n}\n```\n\n### Example used with Gin framework\n```go\nfunc (h *userHandler) Login(c *gin.Context) {\n\tvar loginData dto.LoginRequest\n\tif err := c.ShouldBindJSON(\u0026loginData); err != nil {\n\t\th.responseHelper.BadRequest(c, utils.ErrBadRequest.Error(), utils.ErrDetailBadRequestJSONPayload.Error())\n\t\treturn\n\t}\n\n\ttoken, err := h.userService.Login(loginData.Email, loginData.Password)\n\tif err != nil {\n\t\treaction := utils.NewReaction(err)\n\t\tif strings.Contains(err.Error(), utils.ErrNotFound.Error()) {\n\t\t\th.responseHelper.Unauthorized(c, utils.ErrEmailorPasswordEmpty.Error())\n\t\t\treturn\n\t\t}\n\t\th.responseHelper.InternalError(c, reaction.Reaction(), err)\n\t\treturn\n\t}\n\tdata := map[string]string{\"token\": token}\n\t\n\th.responseHelper.Success(c, data)\n```\n\n## Features\n\nComes with intellisense support for VSCode and other IDEs.\n\n### Available Response Methods\n\n#### `Success(c *gin.Context, data interface{})`\nSends a 200 OK response with the provided data.\n\n#### `SuccessWithPagination(c *gin.Context, data interface{}, meta interface{})`\nSends a 200 OK response with data and pagination metadata.\n\n#### `BadRequest(c *gin.Context, message string, details string)`\nSends a 400 Bad Request response with custom error message and details.\n\n#### `Unauthorized(c *gin.Context, message string)`\nSends a 401 Unauthorized response.\n\n#### `NotFound(c *gin.Context, message string)`\nSends a 404 Not Found response.\n\n#### `Conflict(c *gin.Context, message string, err error)`\nSends a 409 Conflict response for resource conflicts.\n\n```go\nh.responseHelper.Conflict(c, \"Resource conflict\", err)\n```\n\nResponse:\n```json\n{\n    \"success\": false,\n    \"error\": {\n        \"code\": 409,\n        \"status\": \"CONFLICT\",\n        \"message\": \"Resource conflict\",\n        \"details\": \"Error details here\"\n    }\n}\n```\n\n#### `AlreadyExists(c *gin.Context, resource string, err error)`\nSends a 409 Conflict response indicating that a resource already exists. This is a convenience method for the common case where a resource creation fails because the resource already exists.\n\n```go\nh.responseHelper.AlreadyExists(c, \"User\", err)\n```\n\nResponse:\n```json\n{\n    \"success\": false,\n    \"error\": {\n        \"code\": 409,\n        \"status\": \"CONFLICT\",\n        \"message\": \"User already exists\",\n        \"details\": \"Error details here\"\n    }\n}\n```\n\n#### `InternalError(c *gin.Context, message string, err error)`\nSends a 500 Internal Server Error response.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faruncs31s%2Fresponsehelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faruncs31s%2Fresponsehelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faruncs31s%2Fresponsehelper/lists"}