Latest 0.0.4
Homepage https://github.com/LaryssaCastagnoli/LMGraphQL
License MIT
Platforms ios 10.0
Dependencies Alamofire, SwiftyJSON
Authors ,

Example

In AppDelegate.swift, just import LMGraphQL framework and config LMGraphQLPrivate and LMGraphQLPublic.

import LMGraphQL

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

      LMGraphQLPrivate.config(apiURL: "url private api")
      LMGraphQLPublic.config(clientId: "", clientSecret: "", apiURL: "url public api")

      return true
    }
}

To create a new query, you must create a file with the extension .query and put its query or mutation structure, only the text, example login.query

mutation login($input: LoginInput!){
login(input: $input){
token {
accessToken
}
errors
}
}

In the request, LMGraphQL requests some mandatory parameters: the response, which should inherit from LMResponse, the queryType which is a string, and in it you must pass the exact name of your .query file, in this case it will be "login", and the client which will contain the clientId and clientSecret and the url, remembering that these client items are already configured in the appDelegate. There are two parameters that are optional, the attributes and the variables.

func login(){
    LMGraphQLExpect<ResponseLogin>.with(queryType: "login", client: LMGraphQLPublic(), variables: [:]) { response in

    }
}

To pass the token in bearer, just pass the returned string, as the example below and in the next requests it will be sent.

LMGraphQLTokenBearer.saveToken(token: "")

And delete

LMGraphQLTokenBearer.deleteToken()

Requirements

Installation

LMGraphQL is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'LMGraphQL'

Authors

Laryssa Castagnoli, Millena Galvão

Latest podspec

{
    "name": "LMGraphQL",
    "version": "0.0.4",
    "summary": "LMGraphQL will help with your requests",
    "description": "With LMGraphQL making requests will be easier, it helps in the creation of queries and mutations made in LMGraphQL.",
    "homepage": "https://github.com/LaryssaCastagnoli/LMGraphQL",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Laryssa Castagnoli": "[email protected]",
        "Millena Galvu00e3o Matos": "[email protected]"
    },
    "source": {
        "git": "https://github.com/LaryssaCastagnoli/LMGraphQL.git",
        "tag": "v0.0.4"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "LMGraphQL/**/*",
    "exclude_files": "LMGraphQL/**/*.plist",
    "swift_version": "4.2",
    "dependencies": {
        "Alamofire": [],
        "SwiftyJSON": []
    }
}

Pin It on Pinterest

Share This