basePath: / definitions: handler.APIError: properties: code: description: Error code type: integer details: description: Additional error details type: string field: description: Field name if applicable example: name type: string message: description: Human-readable error message type: string type: object handler.APIResponse: properties: data: description: The response data errors: description: List of errors if any occurred items: $ref: '#/definitions/handler.APIError' type: array message: description: Optional message type: string success: description: Indicates if the request was successful type: boolean type: object models.Contact: properties: company: description: Company the contact works for type: string id: description: ID is the unique identifier for the contact type: integer name: description: Name of the contact type: string phone: description: Phone number in international format type: string type: object host: localhost:8080 info: contact: email: support@yourapp.com name: API Support description: A simple Contacts CRUD API license: name: MIT url: https://opensource.org/licenses/MIT termsOfService: http://swagger.io/terms/ title: Contacts API version: "1.0" paths: /contacts: get: consumes: - application/json description: Get a list of all contacts produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/handler.APIResponse' - properties: data: items: $ref: '#/definitions/models.Contact' type: array type: object "500": description: Internal Server Error schema: $ref: '#/definitions/handler.APIResponse' summary: Get all contacts tags: - contacts post: consumes: - application/json description: Create a new contact with the provided data parameters: - description: Contact object in: body name: contact required: true schema: $ref: '#/definitions/models.Contact' produces: - application/json responses: "201": description: Created schema: allOf: - $ref: '#/definitions/handler.APIResponse' - properties: data: $ref: '#/definitions/models.Contact' type: object "400": description: Bad Request schema: $ref: '#/definitions/handler.APIResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/handler.APIResponse' summary: Create a new contact tags: - contacts /contacts/{id}: delete: consumes: - application/json description: Delete a contact by ID parameters: - description: Contact ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handler.APIResponse' "400": description: Bad Request schema: $ref: '#/definitions/handler.APIResponse' "404": description: Not Found schema: $ref: '#/definitions/handler.APIResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/handler.APIResponse' summary: Delete a contact tags: - contacts get: consumes: - application/json description: Get a single contact by its ID parameters: - description: Contact ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/handler.APIResponse' - properties: data: $ref: '#/definitions/models.Contact' type: object "400": description: Bad Request schema: $ref: '#/definitions/handler.APIResponse' "404": description: Not Found schema: $ref: '#/definitions/handler.APIResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/handler.APIResponse' summary: Get a contact by ID tags: - contacts put: consumes: - application/json description: Update an existing contact by ID parameters: - description: Contact ID in: path name: id required: true type: integer - description: Contact object in: body name: contact required: true schema: $ref: '#/definitions/models.Contact' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handler.APIResponse' "400": description: Bad Request schema: $ref: '#/definitions/handler.APIResponse' "404": description: Not Found schema: $ref: '#/definitions/handler.APIResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/handler.APIResponse' summary: Update a contact tags: - contacts swagger: "2.0"