{"id":16293591,"url":"https://github.com/badsyntax/mailinabox-api","last_synced_at":"2025-03-20T03:31:09.312Z","repository":{"id":37076129,"uuid":"275137553","full_name":"badsyntax/mailinabox-api","owner":"badsyntax","description":"HTTP client SDK's for the Mail-in-a-Box API.","archived":false,"fork":false,"pushed_at":"2023-06-12T19:58:00.000Z","size":624,"stargazers_count":6,"open_issues_count":10,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T22:55:16.348Z","etag":null,"topics":["client-sdk","mail-in-a-box","mailinabox","mailinabox-api","openapi"],"latest_commit_sha":null,"homepage":"","language":"Mustache","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/badsyntax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2020-06-26T11:14:22.000Z","updated_at":"2023-10-18T19:32:51.000Z","dependencies_parsed_at":"2024-10-27T21:44:38.921Z","dependency_job_id":"a0f83aef-c48a-4f21-89d3-30da68291cac","html_url":"https://github.com/badsyntax/mailinabox-api","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Fmailinabox-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Fmailinabox-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Fmailinabox-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Fmailinabox-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/badsyntax","download_url":"https://codeload.github.com/badsyntax/mailinabox-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244047647,"owners_count":20389206,"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":["client-sdk","mail-in-a-box","mailinabox","mailinabox-api","openapi"],"created_at":"2024-10-10T20:11:49.593Z","updated_at":"2025-03-20T03:31:08.882Z","avatar_url":"https://github.com/badsyntax.png","language":"Mustache","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mail-in-a-Box API\n\n[![Build \u0026 Publish](https://github.com/badsyntax/mailinabox-api/actions/workflows/main.yml/badge.svg)](https://github.com/badsyntax/mailinabox-api/actions/workflows/main.yml)\n\nClient SDK's for the Mail-in-a-Box API.\n\nCode is generated using the [openapi-generator](https://github.com/OpenAPITools/openapi-generator) and the [HTTP spec](https://github.com/mail-in-a-box/mailinabox/blob/master/api/mailinabox.yml).\n\n## HTTP specification\n\nInitially this project contained the API spec but I [submitted](https://github.com/mail-in-a-box/mailinabox/pull/1804) those changes upstream.\n\n- [View spec](https://github.com/mail-in-a-box/mailinabox/blob/master/api/mailinabox.yml)\n- [View API docs](https://mailinabox.email/api-docs.html)\n\n## Clients\n\n### typescript-fetch\n\n- https://github.com/badsyntax/mailinabox-api-ts\n- https://www.npmjs.com/package/mailinabox-api\n\n\u003cdetails\u003e\u003csummary\u003eTemplate changes\u003c/summary\u003e\n\n## Supporting oneOf response types\n\nThe [Response Body](https://swagger.io/docs/specification/describing-responses/#body) spec says:\n\n\u003e The schema keyword is used to describe the response body. A schema can define:\n\u003e\n\u003e - a primitive data type such as a number or string – used for plain text responses\n\nFor endpoints that return a single primitive data type, the default generator will build the client so that it returns a `string` type _even if response type is set to `application/json`_. This seems to conform to the spec.\n\nThe mailinabox API returns primitive data types (eg `boolean`) for `application/json` responses, and we want that type represented in TypeScript. The follow changes were made to support both `application/json` and `text/html` endpoints that return a primitive data type.\n\n```diff\n--- a/templates/typescript-fetch/apis.mustache\n+++ b/templates/typescript-fetch/apis.mustache\n@@ -287,7 +287,9 @@ export class {{classname}} extends runtime.BaseAPI {\n         return new runtime.JSONApiResponse\u003cany\u003e(response);\n         {{/isListContainer}}\n         {{#returnSimpleType}}\n-        return new runtime.TextApiResponse(response) as any;\n+        const contentType = response.headers.get('content-type');\n+        const isJson = contentType \u0026\u0026 contentType.includes('application/json');\n+        return new runtime[isJson ? 'JSONApiResponse' : 'TextApiResponse'](response) as any;\n         {{/returnSimpleType}}\n         {{/returnTypeIsPrimitive}}\n         {{^returnTypeIsPrimitive}}\n```\n\n## Support posting text/(plain|html) bodies\n\nPrevent quotes added to text/plain POST body. This seems like a bug in the generator, see https://github.com/OpenAPITools/openapi-generator/issues/7083.\n\n```diff\n--- a/templates/typescript-fetch/runtime.mustache\n+++ b/templates/typescript-fetch/runtime.mustache\n@@ -50,7 +50,7 @@ export class BaseAPI {\n             // do not handle correctly sometimes.\n             url += '?' + this.configuration.queryParamsStringify(context.query);\n         }\n-        const body = ((typeof FormData !== \"undefined\" \u0026\u0026 context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body))\n+        const body = ((typeof FormData !== \"undefined\" \u0026\u0026 context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) || context.headers['Content-Type'] !== 'application/json'\n            ? context.body\n            : JSON.stringify(context.body);\n```\n\n\u003c/details\u003e\n\n### php\n\n- https://github.com/badsyntax/mailinabox-api-php\n- https://packagist.org/packages/mailinabox/mailinabox-api\n\n### python\n\n- https://github.com/badsyntax/mailinabox-api-py\n- https://pypi.org/project/mailinabox-api\n\n## License\n\nSee [LICENSE.md](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadsyntax%2Fmailinabox-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadsyntax%2Fmailinabox-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadsyntax%2Fmailinabox-api/lists"}