func queryItems()

in FBSDKGamingServicesKit/FBSDKGamingServicesKit/Internal/ShareTournamentDialogURLBuilder.swift [33:55]


  func queryItems(for config: TournamentConfig, score: Int) -> [URLQueryItem] {
    var tournamentDictionary = [String: String]()
    tournamentDictionary[QueryKeys.score] = "\(score)"

    if let title = config.title {
      tournamentDictionary[QueryKeys.title] = title
    }
    if let endTime = config.endTime {
      tournamentDictionary[QueryKeys.endTime] = "\(Int(endTime))"
    }
    if let scoreType = config.scoreType?.rawValue {
      tournamentDictionary[QueryKeys.scoreFormat] = scoreType
    }
    if let sortOrder = config.sortOrder?.rawValue {
      tournamentDictionary[QueryKeys.sortOrder] = sortOrder
    }
    if let payload = config.payload {
      tournamentDictionary[QueryKeys.payload] = payload
    }
    return tournamentDictionary.map { queryName, value in
      URLQueryItem(name: queryName, value: value)
    }
  }