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

import Foundation
import Get
import URLQueryEncoder

extension Paths.V2.External.Oauth {
    public var searchUserClips: SearchUserClips {
        SearchUserClips(path: path + "/search-user-clips")
    }

    public struct SearchUserClips {
        /// Path: `/api/v2/external/oauth/search-user-clips`
        public let path: String

        /// Search User Clips Via Oauth
        ///
        /// Retrieve clips by various criteria through OAuth with the 'read_music' scope.
        /// 
        /// Supports three filter modes:
        /// 1. N most recent songs (default)
        /// 2. N songs newer than a specific song (after_id)
        /// 3. N songs older than a specific song (before_id)
        public func get(parameters: GetParameters? = nil) -> Request<[GenAPI.ExternalClipSchema]> {
            Request(path: path, method: "GET", query: parameters?.asQuery, id: "studio_api_bots_external_api_search_user_clips_via_oauth")
        }

        public struct GetParameters {
            public var limit: Int?
            public var afterId: String?
            public var beforeId: String?

            public init(limit: Int? = nil, afterId: String? = nil, beforeId: String? = nil) {
                self.limit = limit
                self.afterId = afterId
                self.beforeId = beforeId
            }

            public var asQuery: [(String, String?)] {
                let encoder = URLQueryEncoder()
                encoder.encode(limit, forKey: "limit")
                encoder.encode(afterId, forKey: "after_id")
                encoder.encode(beforeId, forKey: "before_id")
                return encoder.items
            }
        }
    }
}
