From c31ad03231c2428ba82442109b5435c960117218 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Mon, 19 Aug 2024 11:42:21 -0300
Subject: [PATCH] Bug 37513: Allow embedding usage_count in record sources

---
 api/v1/swagger/definitions/record_source.yaml |  3 +++
 api/v1/swagger/paths/record_sources.yaml      | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/api/v1/swagger/definitions/record_source.yaml b/api/v1/swagger/definitions/record_source.yaml
index dcf7865f73e..4bd3f052652 100644
--- a/api/v1/swagger/definitions/record_source.yaml
+++ b/api/v1/swagger/definitions/record_source.yaml
@@ -11,6 +11,9 @@ properties:
   can_be_edited:
     description: If records from this source can be edited
     type: boolean
+  usage_count:
+    description: Record source usage count (x-koha-embed)
+    type: integer
 additionalProperties: false
 required:
   - name
diff --git a/api/v1/swagger/paths/record_sources.yaml b/api/v1/swagger/paths/record_sources.yaml
index 7dbbf589d8d..732368e2ae2 100644
--- a/api/v1/swagger/paths/record_sources.yaml
+++ b/api/v1/swagger/paths/record_sources.yaml
@@ -13,6 +13,16 @@
       - $ref: "../swagger.yaml#/parameters/q_param"
       - $ref: "../swagger.yaml#/parameters/q_body"
       - $ref: "../swagger.yaml#/parameters/request_id_header"
+      - name: x-koha-embed
+        in: header
+        required: false
+        description: Embed list sent as a request header
+        type: array
+        items:
+          type: string
+          enum:
+            - usage_count
+        collectionFormat: csv
     consumes:
       - application/json
     produces:
-- 
2.46.0