  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  **/
 
-import FBSDKCoreKit
-import FBSDKShareKit
+import FacebookCore
+import FacebookShare
 
 struct Friend {
   let fbid: String

    }

    let path = type == .taggable ? "me/taggable_friends" : "me/friends"
    let request = FBSDKGraphRequest(graphPath: path, parameters: params)
    _ = request?.start {
      (_: FBSDKGraphRequestConnection?, result: Any?, error: Error?) in
        guard error == nil else {
          print("error executing GraphQL query: \(String(describing: error))")
          return
        }
        guard let deserialised = result as? [String:Any] else {
          print("unable to deserialise response \(String(describing: result))")
          return
        }

        if let data = deserialised["data"] as? [Any] {
          for serialised in data {
            guard
              let deserialised = serialised as? [String:Any],
              let friend = deserialiseFriend(deserialised)
            else {
              print("unable to deserialise friend \(serialised)")
              continue
            }

            handler(friend)
            retrieved += 1
          }
        }

        if let pagination = deserialised["paging"] as? [String:Any] {
          if let cursors = pagination["cursors"] as? [String:Any] {
            if let after = cursors["after"] as? String {
              switch limit {
              case .none:
                self.enumerateFriends(type: type, limit: .none, cursor: after,
                                      handler: handler)
                break
              case .count(let count):
                self.enumerateFriends(type: type,
                                      limit: .count(count - retrieved),
                                      cursor: after, handler: handler)
              }
            }
          }
        }
    }
  }


  }

  static func getRealName(completion: @escaping (_: String?) -> Void) {
    let request: GraphRequest =
        GraphRequest(graphPath: "me", parameters: ["fields" : "name"],
                     accessToken: AccessToken.current, httpMethod: .GET,
                     apiVersion: .defaultVersion)
    request.start { (response, result) in
      switch result {
      case .success(let response):
        if let deserialised = response.dictionaryValue {
          if let name = deserialised["name"] as? String {
            completion(name)
          }
        }
        break
      case .failed(let error):
        print("unable to execute GraphQL query \(String(describing: error))")
        break
      }
    }
  }

  static func getLocation(completion: @escaping (_: String?) -> Void) {
    let request: GraphRequest =
        GraphRequest(graphPath: "me", parameters: ["fields" : "location"],
                     accessToken: AccessToken.current, httpMethod: .GET,
                     apiVersion: .defaultVersion)
    request.start { (response, result) in
      switch result {
      case .success(let response):
        if let deserialised = response.dictionaryValue {
          if let location = deserialised["location"] as? [String:Any] {
            completion(location["name"] as? String)
          }
        }
        break
      case .failed(let error):
        print("unable to execute GraphQL query: \(String(describing: error))")
        break
      }
    }
  }

  static func invite(url: String, image: String? = nil) {
    var invite: AppInvite = AppInvite(appLink: URL(string: url)!)
    if let image = image {
      invite.previewImageURL = URL(string: image)!
    }

    let dialog: AppInvite.Dialog = AppInvite.Dialog(invite: invite)
    try? dialog.show()
  }

  static func profileImage(for fbid: String,
                           completion: @escaping (_: URL?) -> Void) {
    let request: GraphRequest =
        GraphRequest(graphPath: "/\(fbid)/picture?type=large&redirect=false",
                     parameters: ["fields" : ""],
                     accessToken: AccessToken.current, httpMethod: .GET,
                     apiVersion: .defaultVersion)
    request.start { (response, result) in
      switch result {
      case .success(let response):
        if let deserialised = response.dictionaryValue {
          if let data = deserialised["data"] as? [String:Any] {
            if let url = data["url"] as? String {
              completion(URL(string: url))
            }
          }
        }
        break
      case .failed(let error):
        print("unable to execute GraphQL query: \(String(describing: error))")
        break
      }
    }
  }
}
