|
| 1 | +--- |
| 2 | +sidebar_position: 1 |
| 3 | +title: Design the Service |
| 4 | +description: Callgent is yet another AI programming tool besides Copilot, UI generator, and bug fixer, etc. |
| 5 | +keywords: [user as a service] |
| 6 | +--- |
| 7 | + |
| 8 | +Let's create a recruiting callgent service, to receive and process job applications. |
| 9 | + |
| 10 | +:::tip |
| 11 | +There are 2 benefits for using Callgent to create this service: |
| 12 | + |
| 13 | +1. We can build this service without any programming or coding, since requests are processed by real humans. |
| 14 | +2. The service can be integrated into any existing systems via API, pages, etc. |
| 15 | + |
| 16 | +::: |
| 17 | + |
| 18 | +## Design Service API |
| 19 | + |
| 20 | +Firstly, you may send the below prompt to some AI tools like [Mistral](https://chat.mistral.ai) to generate an OpenAPI document: |
| 21 | + |
| 22 | +```markdown |
| 23 | +Generate an OpenAPI documentation in json format for `Recruiting Service`, |
| 24 | +including the following functions: |
| 25 | + - `List/View job positions` |
| 26 | + - `Apply for a position` |
| 27 | +``` |
| 28 | + |
| 29 | +Then the `recruiting-service-api.json` is generated: |
| 30 | +<details> |
| 31 | +<summary>Click to view <i>recruiting-service-api.json</i></summary> |
| 32 | + |
| 33 | +```json {15-17,50-52,76-78} |
| 34 | +{ |
| 35 | + "openapi": "3.0.0", |
| 36 | + "info": { |
| 37 | + "title": "Recruiting Service API", |
| 38 | + "description": "API for managing job positions and applications.", |
| 39 | + "version": "1.0.0" |
| 40 | + }, |
| 41 | + "servers": [ |
| 42 | + { |
| 43 | + "url": "http://api.recruitingservice.com/v1", |
| 44 | + "description": "Production server" |
| 45 | + } |
| 46 | + ], |
| 47 | + "paths": { |
| 48 | + "/positions": { |
| 49 | + "get": { |
| 50 | + "summary": "List all job positions", |
| 51 | + "description": "Retrieve a list of all available job positions.", |
| 52 | + "operationId": "listPositions", |
| 53 | + "responses": { |
| 54 | + "200": { |
| 55 | + "description": "A list of job positions", |
| 56 | + "content": { |
| 57 | + "application/json": { |
| 58 | + "schema": { |
| 59 | + "type": "array", |
| 60 | + "items": { |
| 61 | + "$ref": "#/components/schemas/JobPosition" |
| 62 | + } |
| 63 | + } |
| 64 | + } |
| 65 | + } |
| 66 | + }, |
| 67 | + "500": { |
| 68 | + "description": "Internal Server Error" |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | + }, |
| 73 | + "/positions/{positionId}": { |
| 74 | + "get": { |
| 75 | + "summary": "View a specific job position", |
| 76 | + "description": "Retrieve details of a specific job position by its ID.", |
| 77 | + "operationId": "viewPosition", |
| 78 | + "parameters": [ |
| 79 | + { |
| 80 | + "name": "positionId", |
| 81 | + "in": "path", |
| 82 | + "required": true, |
| 83 | + "schema": { |
| 84 | + "type": "string" |
| 85 | + }, |
| 86 | + "description": "The ID of the job position to retrieve" |
| 87 | + } |
| 88 | + ], |
| 89 | + "responses": { |
| 90 | + "200": { |
| 91 | + "description": "Details of the job position", |
| 92 | + "content": { |
| 93 | + "application/json": { |
| 94 | + "schema": { |
| 95 | + "$ref": "#/components/schemas/JobPosition" |
| 96 | + } |
| 97 | + } |
| 98 | + } |
| 99 | + }, |
| 100 | + "404": { |
| 101 | + "description": "Job position not found" |
| 102 | + }, |
| 103 | + "500": { |
| 104 | + "description": "Internal Server Error" |
| 105 | + } |
| 106 | + } |
| 107 | + } |
| 108 | + }, |
| 109 | + "/positions/{positionId}/apply": { |
| 110 | + "post": { |
| 111 | + "summary": "Apply for a position", |
| 112 | + "description": "Submit an application for a specific job position.", |
| 113 | + "operationId": "applyForPosition", |
| 114 | + "parameters": [ |
| 115 | + { |
| 116 | + "name": "positionId", |
| 117 | + "in": "path", |
| 118 | + "required": true, |
| 119 | + "schema": { |
| 120 | + "type": "string" |
| 121 | + }, |
| 122 | + "description": "The ID of the job position to apply for" |
| 123 | + } |
| 124 | + ], |
| 125 | + "requestBody": { |
| 126 | + "required": true, |
| 127 | + "content": { |
| 128 | + "application/json": { |
| 129 | + "schema": { |
| 130 | + "$ref": "#/components/schemas/Application" |
| 131 | + } |
| 132 | + } |
| 133 | + } |
| 134 | + }, |
| 135 | + "responses": { |
| 136 | + "201": { |
| 137 | + "description": "Application submitted successfully" |
| 138 | + }, |
| 139 | + "400": { |
| 140 | + "description": "Invalid input" |
| 141 | + }, |
| 142 | + "404": { |
| 143 | + "description": "Job position not found" |
| 144 | + }, |
| 145 | + "500": { |
| 146 | + "description": "Internal Server Error" |
| 147 | + } |
| 148 | + } |
| 149 | + } |
| 150 | + } |
| 151 | + }, |
| 152 | + "components": { |
| 153 | + "schemas": { |
| 154 | + "JobPosition": { |
| 155 | + "type": "object", |
| 156 | + "properties": { |
| 157 | + "id": { |
| 158 | + "type": "string", |
| 159 | + "description": "Unique identifier for the job position" |
| 160 | + }, |
| 161 | + "title": { |
| 162 | + "type": "string", |
| 163 | + "description": "Title of the job position" |
| 164 | + }, |
| 165 | + "description": { |
| 166 | + "type": "string", |
| 167 | + "description": "Description of the job position" |
| 168 | + }, |
| 169 | + "location": { |
| 170 | + "type": "string", |
| 171 | + "description": "Location of the job position" |
| 172 | + }, |
| 173 | + "requirements": { |
| 174 | + "type": "array", |
| 175 | + "items": { |
| 176 | + "type": "string" |
| 177 | + }, |
| 178 | + "description": "List of requirements for the job position" |
| 179 | + }, |
| 180 | + "createdAt": { |
| 181 | + "type": "string", |
| 182 | + "format": "date-time", |
| 183 | + "description": "Timestamp when the job position was created" |
| 184 | + }, |
| 185 | + "updatedAt": { |
| 186 | + "type": "string", |
| 187 | + "format": "date-time", |
| 188 | + "description": "Timestamp when the job position was last updated" |
| 189 | + } |
| 190 | + } |
| 191 | + }, |
| 192 | + "Application": { |
| 193 | + "type": "object", |
| 194 | + "properties": { |
| 195 | + "applicantName": { |
| 196 | + "type": "string", |
| 197 | + "description": "Name of the applicant" |
| 198 | + }, |
| 199 | + "email": { |
| 200 | + "type": "string", |
| 201 | + "format": "email", |
| 202 | + "description": "Email address of the applicant" |
| 203 | + }, |
| 204 | + "resume": { |
| 205 | + "type": "string", |
| 206 | + "format": "binary", |
| 207 | + "description": "Resume of the applicant" |
| 208 | + }, |
| 209 | + "coverLetter": { |
| 210 | + "type": "string", |
| 211 | + "description": "Cover letter of the applicant" |
| 212 | + }, |
| 213 | + "appliedAt": { |
| 214 | + "type": "string", |
| 215 | + "format": "date-time", |
| 216 | + "description": "Timestamp when the application was submitted" |
| 217 | + } |
| 218 | + } |
| 219 | + } |
| 220 | + } |
| 221 | + } |
| 222 | +} |
| 223 | +``` |
| 224 | + |
| 225 | +</details> |
| 226 | + |
| 227 | +There are 3 APIs are designed in `recruiting-service-api.json`. |
| 228 | + |
| 229 | +Next we'll import this API definition into a new callgent, |
0 commit comments