feat: add list emails api (#167)

This commit is contained in:
KM Koushik
2025-06-01 10:07:57 +10:00
committed by GitHub
parent ae215abf1a
commit 4957ea822f
7 changed files with 401 additions and 14 deletions

View File

@@ -1,3 +1,3 @@
---
openapi: get /v1/contactBooks/{contactBookId}/contacts/
openapi: get /v1/contactBooks/{contactBookId}/contacts
---

View File

@@ -0,0 +1,3 @@
---
openapi: get /v1/emails
---

View File

@@ -484,6 +484,223 @@
}
},
"/v1/emails": {
"get": {
"parameters": [
{
"schema": {
"type": "string",
"default": "1",
"example": "1"
},
"required": false,
"name": "page",
"in": "query"
},
{
"schema": {
"type": "string",
"default": "50",
"example": "50"
},
"required": false,
"name": "limit",
"in": "query"
},
{
"schema": {
"type": "string",
"format": "date-time",
"example": "2024-01-01T00:00:00Z"
},
"required": false,
"name": "startDate",
"in": "query"
},
{
"schema": {
"type": "string",
"format": "date-time",
"example": "2024-01-31T23:59:59Z"
},
"required": false,
"name": "endDate",
"in": "query"
},
{
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"example": "123"
},
"required": false,
"name": "domainId",
"in": "query"
}
],
"responses": {
"200": {
"description": "Retrieve a list of emails",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"to": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"replyTo": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
},
{
"nullable": true
}
]
},
"cc": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
},
{
"nullable": true
}
]
},
"bcc": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
},
{
"nullable": true
}
]
},
"from": {
"type": "string"
},
"subject": {
"type": "string"
},
"html": {
"type": "string",
"nullable": true
},
"text": {
"type": "string",
"nullable": true
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"latestStatus": {
"type": "string",
"nullable": true,
"enum": [
"SCHEDULED",
"QUEUED",
"SENT",
"DELIVERY_DELAYED",
"BOUNCED",
"REJECTED",
"RENDERING_FAILURE",
"DELIVERED",
"OPENED",
"CLICKED",
"COMPLAINED",
"FAILED",
"CANCELLED"
]
},
"scheduledAt": {
"type": "string",
"nullable": true,
"format": "date-time"
},
"domainId": {
"type": "number",
"nullable": true
}
},
"required": [
"id",
"to",
"from",
"subject",
"html",
"text",
"createdAt",
"updatedAt",
"latestStatus",
"scheduledAt",
"domainId"
]
}
},
"count": {
"type": "number"
}
},
"required": [
"data",
"count"
]
}
}
}
}
}
},
"post": {
"requestBody": {
"required": true,
@@ -495,21 +712,18 @@
"to": {
"anyOf": [
{
"type": "string",
"format": "email"
"type": "string"
},
{
"type": "array",
"items": {
"type": "string",
"format": "email"
"type": "string"
}
}
]
},
"from": {
"type": "string",
"format": "email"
"type": "string"
},
"subject": {
"type": "string",
@@ -652,21 +866,18 @@
"to": {
"anyOf": [
{
"type": "string",
"format": "email"
"type": "string"
},
{
"type": "array",
"items": {
"type": "string",
"format": "email"
"type": "string"
}
}
]
},
"from": {
"type": "string",
"format": "email"
"type": "string"
},
"subject": {
"type": "string",