1 /**
2 * @oas [post] /admin/collections/{id}
3 * operationId: PostCollectionsId
4 * summary: Update a Collection
5 * description: Update a collection's details.
6 * x-authenticated: true
7 * parameters:
8 * - name: id
9 * in: path
10 * description: The collection's ID.
11 * required: true
12 * schema:
13 * type: string
14 * - name: fields
15 * in: query
16 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
17 * fields. without prefix it will replace the entire default fields.
18 * required: false
19 * schema:
20 * type: string
21 * title: fields
22 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
23 * fields. without prefix it will replace the entire default fields.
24 * externalDocs:
25 * url: "#select-fields-and-relations"
26 * security:
27 * - api_token: []
28 * - cookie_auth: []
29 * - jwt_token: []
30 * requestBody:
31 * content:
32 * application/json:
33 * schema:
34 * allOf:
35 * - type: object
36 * description: The details to update in a collection.
37 * properties:
38 * title:
39 * type: string
40 * title: title
41 * description: The collection's title.
42 * handle:
43 * type: string
44 * title: handle
45 * description: The collection's handle.
46 * metadata:
47 * type: object
48 * description: The collection's metadata.
49 * - type: object
50 * description: The details to update in a collection.
51 * properties:
52 * additional_data:
53 * type: object
54 * description: Pass additional custom data to the API route. This data is passed to the underlying workflow under the `additional_data` parameter.
55 * description: The details to update in a collection.
56 * x-codeSamples:
57 * - lang: JavaScript
58 * label: JS SDK
59 * source: |-
60 * import Medusa from "@medusajs/js-sdk"
61 *
62 * export const sdk = new Medusa({
63 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
64 * debug: import.meta.env.DEV,
65 * auth: {
66 * type: "session",
67 * },
68 * })
69 *
70 * sdk.admin.productCollection.update("pcol_123", {
71 * title: "Summer Collection"
72 * })
73 * .then(({ collection }) => {
74 * console.log(collection)
75 * })
76 * - lang: Shell
77 * label: cURL
78 * source: |-
79 * curl -X POST '{backend_url}/admin/collections/{id}' \
80 * -H 'Authorization: Bearer {jwt_token}' \
81 * -H 'Content-Type: application/json' \
82 * --data-raw '{
83 * "metadata": {}
84 * }'
85 * tags:
86 * - Collections
87 * responses:
88 * "200":
89 * description: OK
90 * content:
91 * application/json:
92 * schema:
93 * $ref: "#/components/schemas/AdminCollectionResponse"
94 * "400":
95 * $ref: "#/components/responses/400_error"
96 * "401":
97 * $ref: "#/components/responses/unauthorized"
98 * "404":
99 * $ref: "#/components/responses/not_found_error"
100 * "409":
101 * $ref: "#/components/responses/invalid_state_error"
102 * "422":
103 * $ref: "#/components/responses/invalid_request_error"
104 * "500":
105 * $ref: "#/components/responses/500_error"
106 * x-workflow: updateCollectionsWorkflow
107 * x-events:
108 * - name: product-collection.updated
109 * payload: |-
110 * ```ts
111 * {
112 * id, // The ID of the product collection
113 * }
114 * ```
115 * description: Emitted when product collections are updated.
116 * deprecated: false
117 *
118 */
119