All files / src/web/routes gmailTransactionsRoutes.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 0/0
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 1177x 7x   7x                                                                                                               7x                                                                                                           7x   7x  
import express from "express";
import * as gmailTransactionsController from "../controllers/gmailTransactionsController";
 
const router = express.Router();
 
/**
 * @swagger
 * /transactions/gmail/ids/last/{last}:
 *   get:
 *     tags:
 *       - Transactions
 *       - Gmail
 *     description: "Get the IDs of the requested number of latest Gmail transactions.\n\n*[Optional]* Skip persisted entries\n\n*[Optional]* Constrain the result to a number of consecutively skipped entries"
 *     security:
 *       - Google:
 *         - https://www.googleapis.com/auth/userinfo.profile
 *         - https://www.googleapis.com/auth/userinfo.email
 *         - https://www.googleapis.com/auth/gmail.readonly
 *     produces:
 *       - application/json
 *     parameters:
 *       - name: last
 *         in: path
 *         required: true
 *         type: integer
 *       - name: skip_saved
 *         in: query
 *         required: false
 *         type: boolean
 *         default: false
 *       - name: skip_depth
 *         in: query
 *         required: false
 *         type: integer
 *       - name: X-Refresh-Token
 *         in: header
 *         required: false
 *         type: string
 *     responses:
 *       200:
 *         description: Array of Gmail Message IDs (transaction IDs)
 *         content:
 *           application/json:
 *             schema:
 *               type: array
 *               items:
 *                 type: string
 *                 example: 1773e8e6b4cff981
 *       400:
 *         description: Bad request
 *       401:
 *         description: Unauthorized
 *       403:
 *         description: Forbidden
 *       500:
 *         description: Transaction processing error
 *       503:
 *         description: Service error
 */
router.route('/ids/last/:last').get(gmailTransactionsController.getLast);
 
/**
 * @swagger
 * /transactions/gmail/resolve:
 *   post:
 *     tags:
 *       - Transactions
 *       - Gmail
 *     description: Resolve Gmail transactions by their respective transaction IDs
 *     security:
 *       - Google:
 *         - https://www.googleapis.com/auth/userinfo.profile
 *         - https://www.googleapis.com/auth/userinfo.email
 *         - https://www.googleapis.com/auth/gmail.readonly
 *     produces:
 *       - application/json
 *     parameters:
 *       - name: X-Refresh-Token
 *         in: header
 *         required: false
 *         type: string
 *     requestBody:
 *       description: Array of transaction IDs to resolve.
 *       required: true
 *       content:
 *         application/json:
 *           schema:
 *             type: array
 *             items:
 *               type: string
 *               example: 1773e8e6b4cff981
 *     responses:
 *       200:
 *         description: Array of Gmail transaction data objects
 *         content:
 *           application/json:
 *             schema:
 *               type: array
 *               items:
 *                 oneOf:
 *                   - $ref: '#/components/schemas/cardOperationTransaction'
 *                   - $ref: '#/components/schemas/standardTransferTransaction'
 *       400:
 *         description: Bad request
 *       401:
 *         description: Unauthorized
 *       403:
 *         description: Forbidden
 *       500:
 *         description: Transaction processing error
 *       503:
 *         description: Service error
 */
router.route('/resolve').post(gmailTransactionsController.resolve);
 
export { router };