feat: add contactBooks to sdk, add delete campaign public endpoint (#352)
* feat: add contactBooks to sdk, add delete campaign public endpoint * fix: pr review notes * refactor: pr feedback * feat: bulk delete/create contacts * refactor: rename a few methods for consistency * refactor: update openapi docs based on pr feedback * refactor: update open api docs, based on pr feedback * fix: delete campaign security issue * refactor: delete campaign requires team id (from context) * fix: enums
This commit is contained in:
@@ -1585,6 +1585,163 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/contactBooks/{contactBookId}/contacts/bulk": {
|
||||
"delete": {
|
||||
"parameters": [
|
||||
{
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"minLength": 3,
|
||||
"example": "cuiwqdj74rygf74"
|
||||
},
|
||||
"required": true,
|
||||
"name": "contactBookId",
|
||||
"in": "path"
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"contactIds": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"minItems": 1,
|
||||
"maxItems": 1000
|
||||
}
|
||||
},
|
||||
"required": ["contactIds"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Bulk delete contacts from a contact book",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": { "type": "boolean" },
|
||||
"count": { "type": "number" }
|
||||
},
|
||||
"required": ["success", "count"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden - API key doesn't have access",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": { "error": { "type": "string" } },
|
||||
"required": ["error"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Contact book not found",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": { "error": { "type": "string" } },
|
||||
"required": ["error"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"parameters": [
|
||||
{
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"minLength": 3,
|
||||
"example": "cuiwqdj74rygf74"
|
||||
},
|
||||
"required": true,
|
||||
"name": "contactBookId",
|
||||
"in": "path"
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": { "type": "string" },
|
||||
"firstName": { "type": "string" },
|
||||
"lastName": { "type": "string" },
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": { "type": "string" }
|
||||
},
|
||||
"subscribed": { "type": "boolean" }
|
||||
},
|
||||
"required": ["email"]
|
||||
},
|
||||
"minItems": 1,
|
||||
"maxItems": 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Bulk add contacts to a contact book",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"message": { "type": "string" },
|
||||
"count": { "type": "number" }
|
||||
},
|
||||
"required": ["message", "count"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden - API key doesn't have access",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": { "error": { "type": "string" } },
|
||||
"required": ["error"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Contact book not found",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": { "error": { "type": "string" } },
|
||||
"required": ["error"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/contactBooks/{contactBookId}/contacts/{contactId}": {
|
||||
"patch": {
|
||||
"parameters": [
|
||||
@@ -1790,10 +1947,9 @@
|
||||
"enum": [
|
||||
"DRAFT",
|
||||
"SCHEDULED",
|
||||
"IN_PROGRESS",
|
||||
"RUNNING",
|
||||
"PAUSED",
|
||||
"COMPLETED",
|
||||
"CANCELLED"
|
||||
"SENT"
|
||||
],
|
||||
"example": "DRAFT"
|
||||
},
|
||||
@@ -1829,7 +1985,7 @@
|
||||
"subject": { "type": "string" },
|
||||
"createdAt": { "type": "string", "format": "date-time" },
|
||||
"updatedAt": { "type": "string", "format": "date-time" },
|
||||
"status": { "type": "string" },
|
||||
"status": { "type": "string", "enum": ["DRAFT", "SCHEDULED", "RUNNING", "PAUSED", "SENT"] },
|
||||
"scheduledAt": { "type": "string", "nullable": true, "format": "date-time" },
|
||||
"total": { "type": "integer" },
|
||||
"sent": { "type": "integer" },
|
||||
@@ -1935,7 +2091,7 @@
|
||||
"contactBookId": { "type": "string", "nullable": true },
|
||||
"html": { "type": "string", "nullable": true },
|
||||
"content": { "type": "string", "nullable": true },
|
||||
"status": { "type": "string" },
|
||||
"status": { "type": "string", "enum": ["DRAFT", "SCHEDULED", "RUNNING", "PAUSED", "SENT"] },
|
||||
"scheduledAt": {
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
@@ -1997,19 +2153,19 @@
|
||||
}
|
||||
},
|
||||
"/v1/campaigns/{campaignId}": {
|
||||
"parameters": [
|
||||
{
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"example": "cmp_123"
|
||||
},
|
||||
"required": true,
|
||||
"name": "campaignId",
|
||||
"in": "path"
|
||||
}
|
||||
],
|
||||
"get": {
|
||||
"parameters": [
|
||||
{
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"example": "cmp_123"
|
||||
},
|
||||
"required": true,
|
||||
"name": "campaignId",
|
||||
"in": "path"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Get campaign details",
|
||||
@@ -2026,7 +2182,84 @@
|
||||
"contactBookId": { "type": "string", "nullable": true },
|
||||
"html": { "type": "string", "nullable": true },
|
||||
"content": { "type": "string", "nullable": true },
|
||||
"status": { "type": "string" },
|
||||
"status": { "type": "string", "enum": ["DRAFT", "SCHEDULED", "RUNNING", "PAUSED", "SENT"] },
|
||||
"scheduledAt": {
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
"format": "date-time"
|
||||
},
|
||||
"batchSize": { "type": "integer" },
|
||||
"batchWindowMinutes": { "type": "integer" },
|
||||
"total": { "type": "integer" },
|
||||
"sent": { "type": "integer" },
|
||||
"delivered": { "type": "integer" },
|
||||
"opened": { "type": "integer" },
|
||||
"clicked": { "type": "integer" },
|
||||
"unsubscribed": { "type": "integer" },
|
||||
"bounced": { "type": "integer" },
|
||||
"hardBounced": { "type": "integer" },
|
||||
"complained": { "type": "integer" },
|
||||
"replyTo": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"cc": { "type": "array", "items": { "type": "string" } },
|
||||
"bcc": { "type": "array", "items": { "type": "string" } },
|
||||
"createdAt": { "type": "string", "format": "date-time" },
|
||||
"updatedAt": { "type": "string", "format": "date-time" }
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"name",
|
||||
"from",
|
||||
"subject",
|
||||
"previewText",
|
||||
"contactBookId",
|
||||
"html",
|
||||
"content",
|
||||
"status",
|
||||
"scheduledAt",
|
||||
"batchSize",
|
||||
"batchWindowMinutes",
|
||||
"total",
|
||||
"sent",
|
||||
"delivered",
|
||||
"opened",
|
||||
"clicked",
|
||||
"unsubscribed",
|
||||
"bounced",
|
||||
"hardBounced",
|
||||
"complained",
|
||||
"replyTo",
|
||||
"cc",
|
||||
"bcc",
|
||||
"createdAt",
|
||||
"updatedAt"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Delete campaign",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": { "type": "string" },
|
||||
"name": { "type": "string" },
|
||||
"from": { "type": "string" },
|
||||
"subject": { "type": "string" },
|
||||
"previewText": { "type": "string", "nullable": true },
|
||||
"contactBookId": { "type": "string", "nullable": true },
|
||||
"html": { "type": "string", "nullable": true },
|
||||
"content": { "type": "string", "nullable": true },
|
||||
"status": { "type": "string", "enum": ["DRAFT", "SCHEDULED", "RUNNING", "PAUSED", "SENT"] },
|
||||
"scheduledAt": {
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
|
||||
Reference in New Issue
Block a user