// Generated by Create API
// https://github.com/CreateAPI/CreateAPI

import Foundation
import Get
import URLQueryEncoder

extension Paths.Gen.WithGenId {
    public var setMetadata: SetMetadata {
        SetMetadata(path: path + "/set_metadata")
    }

    public struct SetMetadata {
        /// Path: `/api/gen/{gen_id}/set_metadata`
        public let path: String

        /// Set Metadata
        ///
        /// Set the metadata of a GeneratedClip. User must own clip.
        public func post(_ body: GenAPI.ClipMetadataSpec) -> Request<PostResponse> {
            Request(path: path, method: "POST", body: body, id: "studio_api_bots_gen_api_set_metadata")
        }

        /// Response
        public struct PostResponse: Decodable, Equatable {
            public var clipMetadataSchema: GenAPI.ClipMetadataSchema?
            /// Represent an error arising from editing a title.
            public var metadataEditErrorSchema: GenAPI.MetadataEditErrorSchema?

            public init(clipMetadataSchema: GenAPI.ClipMetadataSchema? = nil, metadataEditErrorSchema: GenAPI.MetadataEditErrorSchema? = nil) {
                self.clipMetadataSchema = clipMetadataSchema
                self.metadataEditErrorSchema = metadataEditErrorSchema
            }

            public init(from decoder: Decoder) throws {
                let container = try decoder.singleValueContainer()
                self.clipMetadataSchema = try? container.decode(GenAPI.ClipMetadataSchema.self)
                self.metadataEditErrorSchema = try? container.decode(GenAPI.MetadataEditErrorSchema.self)
            }
        }
    }
}
