Add Client.listResourceTemplates method (#125)

* adds listResourceTemplates to client for #124

* add pagination to resources/templates/list

from @mattt

Co-authored-by: Mattt <mattt@loopwork.com>

* adds cursor functionality to ListResourceTemplates

* updates the client method to use the updated signature

---------

Co-authored-by: Mattt <mattt@loopwork.com>
This commit is contained in:
Carl Peaslee 2025-05-30 12:35:34 -07:00 • committed by GitHub
commit 609cdc709b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -149,17 +149,30 @@ public enum ReadResource: Method {
public enum ListResourceTemplates: Method {
public static let name: String = "resources/templates/list"
public typealias Parameters = Empty
public struct Parameters: NotRequired, Hashable, Codable, Sendable {
public let cursor: String?
public init() {
self.cursor = nil
}
public init(cursor: String) {
self.cursor = cursor
}
}
public struct Result: Hashable, Codable, Sendable {
public let templates: [Resource.Template]
public let nextCursor: String?
public init(templates: [Resource.Template]) {
public init(templates: [Resource.Template], nextCursor: String? = nil) {
self.templates = templates
self.nextCursor = nextCursor
}
private enum CodingKeys: String, CodingKey {
case templates = "resourceTemplates"
case nextCursor
}
}
}