Skip to content

Commit

Permalink
declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuawright11 committed May 22, 2024
1 parent 0a424d9 commit 21acdcb
Show file tree
Hide file tree
Showing 18 changed files with 577 additions and 603 deletions.
6 changes: 4 additions & 2 deletions Example/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import Papyrus

@API
@Mock
@KeyMapping(.snakeCase)
@Authorization(.bearer("<my-auth-token>"))
protocol Sample {
@GET("/todos")
func getTodos() async throws -> [Todo]
Expand All @@ -30,6 +28,10 @@ public struct Todo: Codable {
// MARK: 1. Create a Provider with any custom configuration.

let provider = Provider(baseURL: "http://127.0.0.1:3000")
.modifyRequests {
$0.addAuthorization(.bearer("<my-auth-token>"))
$0.keyMapping = .snakeCase
}
.intercept { req, next in
let start = Date()
let res = try await next(req)
Expand Down
4 changes: 2 additions & 2 deletions PapyrusCore/Sources/Macros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import Foundation
// MARK: Protocol attributes

@attached(peer, names: suffixed(API))
public macro API(_ typeName: String? = nil) = #externalMacro(module: "PapyrusPlugin", type: "APIMacro")
public macro API() = #externalMacro(module: "PapyrusPlugin", type: "APIMacro")

@attached(peer, names: suffixed(Mock))
public macro Mock(_ typeName: String? = nil) = #externalMacro(module: "PapyrusPlugin", type: "MockMacro")
public macro Mock() = #externalMacro(module: "PapyrusPlugin", type: "MockMacro")

// MARK: Function or Protocol attributes

Expand Down
1 change: 0 additions & 1 deletion PapyrusCore/Sources/Request.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public protocol Request {
var body: Data? { get set }
}


public extension Request {
/// Create a cURL command from this instance
///
Expand Down

0 comments on commit 21acdcb

Please sign in to comment.