moya-gen

1.0.1 • Public • Published

moya_generator

Install

npm install -g moya-gen

Usage

moya-gen -c "<your-curl>"

Example

 moya-gen -c "curl --location --request GET 'http://localhost:8002/v1/api/search'"

Output

COPY THIS CODE INTO YOUR PROJECT:==========================


public enum YOUR_ENUM {
    case your_api
}

extension YOUR_ENUM: TargetType {
    public var baseURL: URL { URL(string: "http://localhost:8002")! }
    public var path: String {
        switch self {
        case .your_api:
            return "/v1/api/search"
        }
    }
    public var method: Moya.Method { .get }

    public var task: Task {
        switch self {
        default:
            return .requestPlain
        }
    }
    public var sampleData: Data {
        return Data()
    }
    public var headers: [String: String]? { nil }

} 

Dependents (0)

Package Sidebar

Install

npm i moya-gen

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

3.85 kB

Total Files

7

Last publish

Collaborators

  • bany