Skip to content

Commit c6d48f9

Browse files
committed
Merge branch release/1.0.2
2 parents 6e29cbc + e82cc11 commit c6d48f9

13 files changed

Lines changed: 55 additions & 18 deletions

File tree

Demo.playground/Pages/Advanced.xcplaygroundpage/Contents.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//: [Previous](@previous)
22

3+
import PlaygroundSupport
4+
35
import Foundation
46

57
import APIWrapper
@@ -36,7 +38,6 @@ extension API {
3638
enum AdvancedAPI {
3739
/// Finally, the new initialization method declared above is called on
3840
/// the property wrapper to complete the interface definition.
39-
4041
@GET("/api", verification: .normal)
4142
static var testAPI: APIParameterBuilder<()>? = nil
4243
}

Demo.playground/Pages/Basic.xcplaygroundpage/Contents.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import PlaygroundSupport
2+
13
import Foundation
24

35
import APIWrapper

Demo.playground/Pages/Combine.xcplaygroundpage/Contents.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//: [Previous](@previous)
22

3-
import Foundation
3+
import PlaygroundSupport
44

55
import Combine
6+
import Foundation
67
import ObjectiveC
78

89
import APIWrapper

Demo.playground/Sources/API+Request.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private extension API {
7575
}
7676

7777
let (data, response) = try await URLSession.shared.data(for: request)
78-
print("\(String(describing: response.url?.absoluteString)) End of request")
78+
print("\(response.url?.absoluteString ?? "nil") End of request")
7979

8080
return data
8181
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ static var tupleParamAPI: APIParameterBuilder<(id: Int, name: String?)>? = {
4040
@POST("/post")
4141
static var postWithModel: APIParameterBuilder<Arg>? = {
4242
// You can have your model follow the `APIParameterConvertible` protocol,
43-
// or use `AnyAPIHashableParameter` to wrap your model in an outer layer.
44-
AnyAPIHashableParameter($0)
43+
// or use `AnyAPIParameter` to wrap your model in an outer layer.
44+
AnyAPIParameter($0)
4545
}
4646
```
4747

README_CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ static var tupleParamAPI: APIParameterBuilder<(id: Int, name: String?)>? = {
3636

3737
@POST("/post")
3838
static var postWithModel: APIParameterBuilder<Arg>? = {
39-
// 您可以让您的模型遵循 `APIParameterConvertible` 协议,或者使用 `AnyAPIHashableParameter` 在外面包裹一层。
40-
AnyAPIHashableParameter($0)
39+
// 您可以让您的模型遵循 `APIParameterConvertible` 协议,或者使用 `AnyAPIParameter` 在外面包裹一层。
40+
AnyAPIParameter($0)
4141
}
4242
```
4343

RaAPIWrapper.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Pod::Spec.new do |s|
55

66
s.name = 'RaAPIWrapper'
77

8-
s.version = '1.0.1'
8+
s.version = '1.0.2'
99

1010
s.summary = 'Makes it easier to define a network request.'
1111

Sources/Core/RequestInfo/APIParameterConvertible.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// APIParameters.swift
2+
// APIParameterConvertible.swift
33
// RaAPIWrapper
44
//
55
// Created by Rakuyo on 2022/8/25.
@@ -8,9 +8,6 @@
88

99
import Foundation
1010

11-
/// Used to constrain what types can be used as api parameters.
12-
public typealias APIParametrizable = AnyAPIParameter.Input
13-
1411
/// Means that the type can be converted to an interface parameter for requesting an api.
1512
public protocol APIParameterConvertible {
1613
/// Converts the target to an Encodable-compliant type.
@@ -41,6 +38,10 @@ extension Double: APIParameterConvertible { }
4138

4239
extension Bool: APIParameterConvertible { }
4340

41+
// MARK: - Data
42+
43+
extension Data: APIParameterConvertible { }
44+
4445
// MARK: - Array
4546

4647
extension Array: APIParameterConvertible {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// APIParametrizable.swift
3+
// RaAPIWrapper
4+
//
5+
// Created by Rakuyo on 2023/01/13.
6+
// Copyright © 2022 Rakuyo. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
/// Used to constrain what types can be used as api parameters.
12+
public typealias APIParametrizable = AnyAPIHashableParameter.Input

Sources/Core/RequestInfo/AnyAPIHashable/AnyAPIHashableParameter.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
import Foundation
1010

11-
/// Represents an arbitrary api parameter.
12-
public typealias AnyAPIParameter = AnyAPIHashableParameter
13-
1411
/// Make `Encodable` follow `Hashable` protocol.
1512
public struct AnyAPIHashableParameter: AnyAPIHashable {
1613
public typealias Value = Encodable

0 commit comments

Comments
 (0)