--- post: summary: Create a collection description: Create a collection with the given metadata requestBody: content: application/json: schema: $ref: '#/components/schemas/CollectionCreate' tags: - Collection
()
| 46 | |
| 47 | @blueprint.route("", methods=["POST", "PUT"]) |
| 48 | def create(): |
| 49 | """ |
| 50 | --- |
| 51 | post: |
| 52 | summary: Create a collection |
| 53 | description: Create a collection with the given metadata |
| 54 | requestBody: |
| 55 | content: |
| 56 | application/json: |
| 57 | schema: |
| 58 | $ref: '#/components/schemas/CollectionCreate' |
| 59 | tags: |
| 60 | - Collection |
| 61 | responses: |
| 62 | '200': |
| 63 | description: OK |
| 64 | content: |
| 65 | application/json: |
| 66 | schema: |
| 67 | $ref: '#/components/schemas/Collection' |
| 68 | """ |
| 69 | require(request.authz.session_write) |
| 70 | data = parse_request("CollectionCreate") |
| 71 | sync = get_flag("sync", True) |
| 72 | try: |
| 73 | collection = create_collection(data, request.authz, sync=sync) |
| 74 | except ValueError: |
| 75 | raise BadRequest() |
| 76 | return view(collection.get("id")) |
| 77 | |
| 78 | |
| 79 | @blueprint.route("/<int:collection_id>", methods=["GET"]) |
nothing calls this directly
no test coverage detected