10 | #import "Connection.h"
11 |
12 | @interface Test_ObjectiveC : XCTestCase
13 |
14 | @end
15 |
16 | @implementation Test_ObjectiveC
17 |
18 | - (void)setUp {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown {
24 | // Put teardown code here. This method is called after the invocation of each test method in the class.
25 | [super tearDown];
26 | }
27 |
28 | - (void)testObjectiveC {
29 | [[[Connection alloc] init] open];
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/Test/Autobahn/.gitignore:
--------------------------------------------------------------------------------
1 | reports/
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/Test/Autobahn/autobahn.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | let baseURL = "ws://localhost:9001"
4 | let agent = "SwiftWebSocket"
5 | let debug = false
6 | let keepStatsUpdated = false
7 | let stopOnFailure = false
8 | let stopOnInfo = false
9 | let stopAfterOne = false
10 | let showDuration = false
11 |
12 | let startCase = 1
13 | let stopAtCase = 999
14 |
15 | private enum ErrCode : Int, CustomStringConvertible {
16 | case Protocoll = 1002, Payload = 1007, Undefined = -100, Codepoint = -101, Library = -102, Socket = -103
17 | var description : String {
18 | switch self {
19 | case .Protocoll: return "Protocol error"
20 | case .Payload: return "Invalid payload data"
21 | case .Codepoint: return "Invalid codepoint"
22 | case .Library: return "Library error"
23 | case .Undefined: return "Undefined error"
24 | case .Socket: return "Broken socket"
25 | }
26 | }
27 | }
28 |
29 | private func makeError(error : String, code: ErrCode) -> Error {
30 | return NSError(domain: "com.github.tidwall.WebSocketConn", code: code.rawValue, userInfo: [NSLocalizedDescriptionKey:"\(error)"])
31 | }
32 | private func makeError(error : Error, code: ErrCode) -> Error {
33 | let err = error as NSError
34 | return NSError(domain: err.domain, code: code.rawValue, userInfo: [NSLocalizedDescriptionKey:"\(err.localizedDescription)"])
35 | }
36 | private func makeError(error : String) -> Error {
37 | return makeError(error: error, code: ErrCode.Library)
38 | }
39 |
40 | private func jsonObject(text : String) throws -> [String: AnyObject] {
41 | if let data = text.data(using: String.Encoding.utf8, allowLossyConversion: false),
42 | let json = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.mutableContainers) as? [String : AnyObject] {
43 | return json
44 | }
45 | throw makeError(error: "not json")
46 | }
47 |
48 | // autobahn api
49 | func getCaseCount(block: @escaping(_ : Int, _ : Error?)->()){
50 | let ws = WebSocket(baseURL + "/getCaseCount")
51 | ws.event.message = { (msg) in
52 | if let text = msg as? String {
53 | ws.close()
54 | if let i = Int(text) {
55 | block(i, nil)
56 | } else {
57 | block(0, makeError(error: "invalid response"))
58 | }
59 | }
60 | }
61 | ws.event.error = { error in
62 | block(0, error)
63 | }
64 | }
65 |
66 | func getCaseInfo(caseIdx : Int, block : @escaping(_ : String, _ : String, _ : Error?)->()){
67 | let ws = WebSocket(baseURL + "/getCaseInfo?case=\(caseIdx+1)")
68 | ws.event.message = { (msg) in
69 | if let text = msg as? String {
70 | ws.close()
71 | do {
72 | let json = try jsonObject(text: text)
73 | if json["id"] == nil || json["description"] == nil {
74 | block("", "", makeError(error: "invalid response"))
75 | }
76 | block(json["id"] as! String, json["description"] as! String, nil)
77 | } catch {
78 | block("", "", error)
79 | }
80 | }
81 | }
82 | ws.event.error = { error in
83 | block("", "", error)
84 | }
85 | }
86 |
87 | func getCaseStatus(caseIdx : Int, block : @escaping(_ : Error?)->()){
88 | var responseText = ""
89 | let ws = WebSocket(baseURL + "/getCaseStatus?case=\(caseIdx+1)&agent=\(agent)")
90 | ws.event.error = { error in
91 | block(error)
92 | }
93 | ws.event.message = { (msg) in
94 | if let text = msg as? String {
95 | responseText = text
96 | ws.close()
97 | }
98 | }
99 | ws.event.close = { (code, reason, clean) in
100 | do {
101 | let json = try jsonObject(text: responseText)
102 | if let behavior = json["behavior"] as? String {
103 | if behavior == "OK" {
104 | block(nil)
105 | } else if behavior == "FAILED"{
106 | block(makeError(error: ""))
107 | } else {
108 | block(makeError(error: behavior))
109 | }
110 | return
111 | }
112 | } catch {
113 | block(error)
114 | }
115 | }
116 | }
117 |
118 | func updateReports(echo: Bool = false, block : @escaping()->()){
119 | var success = false
120 | let ws = WebSocket(baseURL + "/updateReports?agent=\(agent)")
121 | ws.event.close = { (code, reason, clean) in
122 | if echo {
123 | if !success{
124 | print("[ERR] reports failed to update")
125 | exit(1)
126 | }
127 | }
128 | block()
129 | }
130 | ws.event.open = {
131 | ws.close()
132 | success = true
133 | }
134 | }
135 |
136 | func runCase(caseIdx : Int, caseCount : Int, block : @escaping(_ : Error?)->()) {
137 | // var start = NSDate().timeIntervalSince1970
138 | // var evstart = NSTimeInterval(0)
139 | getCaseInfo(caseIdx: caseIdx, block: { (id, description, error) in
140 | if error != nil{
141 | print("[ERR] getCaseInfo failed: \(error!)\n")
142 | exit(1)
143 | }
144 |
145 | var next = { ()->() in }
146 |
147 |
148 | print("[CASE] #\(caseIdx+1)/\(caseCount): \(id): \(description)")
149 | let failed : (_ : String)->() = { (message) in
150 | let error = makeError(error: message)
151 | printFailure(error: error)
152 | if stopOnFailure {
153 | block(error)
154 | } else {
155 | next()
156 | }
157 | }
158 | let warn : (_ : String)->() = { (message) in
159 | printFailure(error: makeError(error: message))
160 | }
161 | next = { ()->() in
162 | // if showDuration {
163 | // let now = NSDate().timeIntervalSince1970
164 | // let recv = evstart == 0 ? 0 : (evstart - start) * 1000
165 | // let total = (now - start) * 1000
166 | // let send = total - recv
167 | // println("[DONE] %.0f ms (recv: %.0f ms, send: %.0f ms)", total, recv, send)
168 | // }
169 | getCaseStatus(caseIdx: caseIdx){ error in
170 | let f : ()->() = {
171 | if let error = error as? NSError {
172 | if error.localizedDescription == "INFORMATIONAL" {
173 | if stopOnInfo {
174 | failed(error.localizedDescription)
175 | return
176 | }
177 | } else if stopOnFailure {
178 | failed(error.localizedDescription)
179 | return
180 | }
181 | warn(error.localizedDescription)
182 | }
183 | if caseIdx+1 == caseCount || stopAfterOne || (caseIdx+1 == stopAtCase){
184 | block(nil)
185 | } else {
186 | runCase(caseIdx: caseIdx+1, caseCount: caseCount, block: block)
187 | }
188 | }
189 | if keepStatsUpdated || caseIdx % 10 == 0 {
190 | updateReports(echo: false, block: f)
191 | } else {
192 | f()
193 | }
194 | }
195 | }
196 | var responseError : Error?
197 | //print(baseURL + "/runCase?case=\(caseIdx+1)&agent=\(agent)")
198 | let ws = WebSocket(baseURL + "/runCase?case=\(caseIdx+1)&agent=\(agent)")
199 | ws.eventQueue = nil
200 | ws.binaryType = .uInt8UnsafeBufferPointer
201 |
202 | if id.hasPrefix("13.") || id.hasPrefix("12.") {
203 | ws.compression.on = true
204 | if id.hasPrefix("13.1"){
205 | ws.compression.noContextTakeover = false
206 | ws.compression.maxWindowBits = 0
207 | }
208 | if id.hasPrefix("13.2"){
209 | ws.compression.noContextTakeover = true
210 | ws.compression.maxWindowBits = 0
211 | }
212 | if id.hasPrefix("13.3"){
213 | ws.compression.noContextTakeover = false
214 | ws.compression.maxWindowBits = 8
215 | }
216 | if id.hasPrefix("13.4"){
217 | ws.compression.noContextTakeover = false
218 | ws.compression.maxWindowBits = 15
219 | }
220 | if id.hasPrefix("13.5"){
221 | ws.compression.noContextTakeover = true
222 | ws.compression.maxWindowBits = 8
223 | }
224 | if id.hasPrefix("13.6"){
225 | ws.compression.noContextTakeover = true
226 | ws.compression.maxWindowBits = 15
227 | }
228 | if id.hasPrefix("13.7"){
229 | ws.compression.noContextTakeover = true
230 | ws.compression.maxWindowBits = 8
231 | }
232 | }
233 | ws.event.end = { (code, reason, clean, error) in
234 | responseError = error
235 | if responseError == nil {
236 | next()
237 | } else {
238 | var message = ""
239 | if let error = responseError as? NSError {
240 | message += error.localizedDescription
241 | }
242 | if code != 0 {
243 | message += " with code '\(code)' and reason '\(reason)'"
244 | }
245 | failed(message)
246 | }
247 | }
248 | ws.event.message = { (msg) in
249 | // evstart = NSDate().timeIntervalSince1970
250 | ws.send(msg)
251 | }
252 | })
253 | }
254 | func printFailure(error : Error?){
255 | let error = error as? NSError
256 | if error == nil || error!.localizedDescription == "" {
257 | print("[ERR] FAILED")
258 | exit(1)
259 | } else {
260 | if error!.localizedDescription == "INFORMATIONAL" {
261 | //printinfo("INFORMATIONAL")
262 | } else {
263 | print("[ERR] FAILED: \(error!.localizedDescription)")
264 | }
265 | }
266 | }
267 |
268 | getCaseCount { (count, error) in
269 | if error != nil{
270 | print("[ERR] getCaseCount failed: \(error!)")
271 | exit(1)
272 | }
273 | runCase(caseIdx: startCase-1, caseCount: count){ (error) in
274 | if error == nil{
275 | updateReports(echo: true){
276 | exit(0)
277 | }
278 | } else {
279 | updateReports(echo: true){
280 | exit(1)
281 | }
282 | }
283 | }
284 | }
285 |
286 | RunLoop.main.run()
287 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/Test/Autobahn/fuzzingserver.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "url": "ws://127.0.0.1:9001",
4 | "outdir": "./reports/clients",
5 | "cases": ["*"],
6 | "exclude-cases": [],
7 | "exclude-agent-cases": {}
8 | }
9 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/Test/Autobahn/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"
4 |
5 | cd $(dirname "${BASH_SOURCE[0]}")
6 | WSTEST=$(ls $HOME/Library/Python/2.*/bin/wstest 2>/dev/null)
7 | set -e
8 | if [ ! -f "$WSTEST" ] || [ "$UPGRADE" == "1" ]; then
9 | pip install --user --upgrade unittest2
10 | pip install --user --upgrade autobahntestsuite
11 | WSTEST=$(ls $HOME/Library/Python/2.*/bin/wstest)
12 | fi
13 | if [ "$SERVER" == "1" ]; then
14 | $WSTEST -m fuzzingserver
15 | exit
16 | fi
17 | if [ "$CLIENT" != "1" ]; then
18 | $WSTEST -m fuzzingserver &
19 | WSTEST_PID=$!
20 | cleanup() {
21 | kill $WSTEST_PID
22 | if [ "$SUCCESS" == "1" ]; then
23 | cp -f res/passing.png reports/build.png
24 | printf "\033[0;32m[SUCCESS]\033[0m\n"
25 | else
26 | if [ -d "reports/clients/" ]; then
27 | cp -f res/failing.png reports/build.png
28 | printf "\033[0;31m[FAILURE]\033[0m\n"
29 | else
30 | printf "\033[0;31m[FAILURE]\033[0m Cancelled Early\n"
31 | exit
32 | fi
33 | fi
34 | printf "\033[0;33mDon't forget to run 'test/gh-pages.sh' to process the results.\033[0m\n"
35 | }
36 | trap cleanup EXIT
37 | sleep 1
38 | fi
39 | printf "\033[0;33m[BUILDING]\033[0m\n"
40 | rm -fr reports
41 | mkdir -p reports
42 | mkdir -p /tmp/SwiftWebSocket/tests
43 |
44 | cat ../../Source/WebSocket.swift > /tmp/SwiftWebSocket/tests/main.swift
45 | echo "" >> /tmp/SwiftWebSocket/tests/main.swift
46 | cat autobahn.swift >> /tmp/SwiftWebSocket/tests/main.swift
47 | #swift -Ounchecked /tmp/SwiftWebSocket/tests/main.swift
48 | swift /tmp/SwiftWebSocket/tests/main.swift
49 |
50 | SUCCESS=1
51 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/Test/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/Test/Test.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Test.swift
3 | // Test
4 | //
5 | // Created by Josh Baker on 10/23/15.
6 | // Copyright © 2015 ONcast, LLC. All rights reserved.
7 | //
8 |
9 | import XCTest
10 |
11 | class Test: XCTestCase {
12 | override func setUp() {
13 | super.setUp()
14 | }
15 |
16 | override func tearDown() {
17 | super.tearDown()
18 | }
19 |
20 | func test() {
21 | print("Run Autobahn test ./Test/Autobahn/run.sh")
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/docs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | cd $(dirname "${BASH_SOURCE[0]}")
5 | cd ..
6 | jazzy -g https://github.com/tidwall/SwiftWebSocket -o docsb --skip-undocumented -a "Josh Baker" -m "SwiftWebSocket" -u "http://github.com/tidwall"
7 |
8 | echo ".nav-group-name a[href=\"Extensions.html\"] { display: none; }" >> docsb/css/jazzy.css
9 | echo ".nav-group-name a[href=\"Extensions.html\"] ~ ul { display: none; }" >> docsb/css/jazzy.css
10 | printf "%s(\".nav-group-name a[href='Extensions.html']\").parent().hide()\n" "$" >> docsb/js/jazzy.js
11 | printf "%s(\".nav-group-name a[href='../Extensions.html']\").parent().hide()\n" "$" >> docsb/js/jazzy.js
12 | printf "%s(\"header .content-wrapper a[href='index.html']\").parent().html(\"SwiftWebSocket Docs \")\n" "$" >> docsb/js/jazzy.js
13 | printf "%s(\"header .content-wrapper a[href='../index.html']\").parent().html(\"SwiftWebSocket Docs \")\n" "$" >> docsb/js/jazzy.js
14 |
15 | git checkout gh-pages
16 | function cleanup {
17 | git reset
18 | git checkout master
19 | }
20 | trap cleanup EXIT
21 | rm -rf docs
22 | mv docsb docs
23 | git add docs/
24 | git commit -m "updated docs"
25 | echo "Make sure to push the gh-pages branch"
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/echo.html:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/gh-pages.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | cd $(dirname "${BASH_SOURCE[0]}")
6 |
7 | git checkout gh-pages
8 | cleanup() {
9 | git checkout master
10 | }
11 | trap cleanup EXIT
12 |
13 | if [ -f "reports/build.png" ]; then
14 | cp -rf reports/build.png ../build.png
15 | git add ../build.png
16 | fi
17 | if [ -d "reports/clients/" ]; then
18 | cp -rf reports/clients/ ../results/
19 | git add ../results/
20 | fi
21 | git commit -m 'updated result'
22 | git push
23 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/res/badge.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Carthage/Checkouts/SwiftWebSocket/tools/res/badge.psd
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/res/docs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Carthage/Checkouts/SwiftWebSocket/tools/res/docs.png
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/res/failing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Carthage/Checkouts/SwiftWebSocket/tools/res/failing.png
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/res/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Carthage/Checkouts/SwiftWebSocket/tools/res/logo.png
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/res/passing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Carthage/Checkouts/SwiftWebSocket/tools/res/passing.png
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/res/swift.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Carthage/Checkouts/SwiftWebSocket/tools/res/swift.png
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/res/swift.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Carthage/Checkouts/SwiftWebSocket/tools/res/swift.psd
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/run-objc-test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -o pipefail
4 |
5 | : ${BUILDTOOL:=xcodebuild} #Default
6 |
7 | # Xcode Build Command Line
8 | # https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html
9 | : ${PROJECT:="SwiftWebSocket.xcodeproj"}
10 | : ${SCHEME:="SwiftWebSocket-iOS"}
11 | : ${TARGET:="Test-ObjectiveC"}
12 | : ${SDK:="iphonesimulator"}
13 |
14 | echo "Started: $(date)"
15 |
16 | init() {
17 | # Launch the simulator before running the tests
18 | # Avoid "iPhoneSimulator: Timed out waiting"
19 | open -b com.apple.iphonesimulator
20 | }
21 |
22 | COMMAND="-project \"${PROJECT}\" -scheme \"${SCHEME}\" -sdk \"${SDK}\""
23 |
24 | case "${BUILDTOOL}" in
25 | xctool) echo "Selected build tool: xctool"
26 | init
27 | # Tests (Swift & Objective-C)
28 | case "${CLASS}" in
29 | "") echo "Testing all classes"
30 | COMMAND="xctool clean test "${COMMAND}
31 | ;;
32 | *) echo "Testing ${CLASS}"
33 | COMMAND="xctool clean test -only ${CLASS} "${COMMAND}
34 | ;;
35 | esac
36 | ;;
37 | xcodebuild-travis) echo "Selected tool: xcodebuild + xcpretty (format: travisci)"
38 | init
39 | # Use xcpretty together with tee to store the raw log in a file, and get the pretty output in the terminal
40 | COMMAND="xcodebuild clean test "${COMMAND}" | tee xcodebuild.log | xcpretty -f `xcpretty-travis-formatter`"
41 | ;;
42 | xcodebuild-pretty) echo "Selected tool: xcodebuild + xcpretty"
43 | init
44 | COMMAND="xcodebuild clean test "${COMMAND}" | xcpretty --test"
45 | ;;
46 | xcodebuild) echo "Selected tool: xcodebuild"
47 | init
48 | COMMAND="xcodebuild clean test "${COMMAND}
49 | ;;
50 | *) echo "No build tool especified" && exit 2
51 | esac
52 |
53 | set -x
54 | eval "${COMMAND}"
55 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/server/.gitignore:
--------------------------------------------------------------------------------
1 | ssl/server.*
2 | pkg/
3 | bin/
4 | src/
5 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/server/run-server.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | export GOPATH=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd)
4 | cd $GOPATH
5 |
6 | go get "github.com/gorilla/websocket"
7 | go run server.go $@
8 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/server/server.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "crypto/rand"
5 | "flag"
6 | "fmt"
7 | "io"
8 | "log"
9 | "net/http"
10 | "sync"
11 | "time"
12 |
13 | "github.com/gorilla/websocket"
14 | )
15 |
16 | const rapidSize = 250 * 1024
17 | const rapidFPS = 25
18 |
19 | var port int
20 | var crt, key string
21 | var host string
22 | var s string
23 | var ports string
24 | var _case string
25 |
26 | func main() {
27 |
28 | flag.StringVar(&crt, "crt", "", "ssl cert file")
29 | flag.StringVar(&key, "key", "", "ssl key file")
30 | flag.StringVar(&host, "host", "localhost", "listening server host")
31 | flag.StringVar(&_case, "case", "", "choose a specialized case, (hang,rapid,t44)")
32 | flag.IntVar(&port, "port", 6789, "listening server port")
33 | flag.Parse()
34 |
35 | if crt != "" || key != "" {
36 | s = "s"
37 | if port != 443 {
38 | ports = fmt.Sprintf(":%d", port)
39 | }
40 | } else if port != 80 {
41 | ports = fmt.Sprintf(":%d", port)
42 | }
43 | http.HandleFunc("/client", client)
44 | http.HandleFunc("/echo", socket)
45 | http.HandleFunc("/t44", socket)
46 | log.Printf("Running server on %s:%d\n", host, port)
47 | switch _case {
48 | default:
49 | log.Fatalf("case: %s is unknown", _case)
50 | case "":
51 | case "hang":
52 | log.Printf("case: %s (long connection hanging)\n", _case)
53 | case "rapid":
54 | log.Printf("case: %s (rapid (250 fps) large (2048 bytes) random text messages)\n", _case)
55 | case "t44":
56 | log.Printf("case: %s (send 5 messages per seconds forever. gh issue #44)\n", _case)
57 | }
58 | log.Printf("http%s://%s%s/client (javascript client)\n", s, host, ports)
59 | log.Printf("ws%s://%s%s/echo (echo socket)\n", s, host, ports)
60 | log.Printf("ws%s://%s%s/t44 (test issue 44 socket)\n", s, host, ports)
61 | var err error
62 | if crt != "" || key != "" {
63 | err = http.ListenAndServeTLS(fmt.Sprintf(":%d", port), crt, key, nil)
64 | } else {
65 | err = http.ListenAndServe(fmt.Sprintf(":%d", port), nil)
66 | }
67 | if err != nil {
68 | log.Fatal("ListenAndServe: ", err)
69 | }
70 | }
71 |
72 | func socket(w http.ResponseWriter, r *http.Request) {
73 | log.Print("connection established")
74 | t44 := _case == "t44"
75 | rapid := _case == "rapid"
76 | if _case == "hang" {
77 | hang := time.Minute
78 | log.Printf("hanging for %s\n", hang.String())
79 | time.Sleep(hang)
80 | }
81 | ws, err := websocket.Upgrade(w, r, nil, 1024, 1024)
82 | if err != nil {
83 | log.Print(err)
84 | return
85 | }
86 | defer func() {
87 | ws.Close()
88 | log.Print("connection closed")
89 | }()
90 | var mu sync.Mutex
91 | go func() {
92 | if t44 {
93 | defer ws.Close()
94 | var i int
95 | t := time.NewTicker(time.Second / 5)
96 | defer t.Stop()
97 | for range t.C {
98 | mu.Lock()
99 | if err := ws.WriteMessage(websocket.TextMessage, []byte(fmt.Sprintf("msg #%-5d %v", i, time.Now()))); err != nil {
100 | mu.Unlock()
101 | return
102 | }
103 | mu.Unlock()
104 | i++
105 | }
106 | } else if rapid {
107 | defer ws.Close()
108 | msg := make([]byte, rapidSize)
109 | b := make([]byte, 2048)
110 | for {
111 | time.Sleep(time.Second / rapidFPS)
112 | i := 0
113 | outer:
114 | for {
115 | rand.Read(b)
116 | for _, c := range b {
117 | if i == len(msg) {
118 | break outer
119 | }
120 | msg[i] = (c % (126 - 32)) + 32 // ascii #32-126
121 | i++
122 | }
123 | }
124 | copy(msg, []byte(time.Now().String()+"\n"))
125 | mu.Lock()
126 | if err := ws.WriteMessage(websocket.TextMessage, msg); err != nil {
127 | mu.Unlock()
128 | return
129 | }
130 | mu.Unlock()
131 | }
132 | }
133 | }()
134 | for {
135 | msgt, msg, err := ws.ReadMessage()
136 | if err != nil {
137 | log.Print(err)
138 | return
139 | }
140 | log.Print("rcvd: '" + string(msg) + "'")
141 | if !t44 {
142 | mu.Lock()
143 | ws.WriteMessage(msgt, msg)
144 | mu.Unlock()
145 | }
146 | }
147 | }
148 |
149 | func client(w http.ResponseWriter, r *http.Request) {
150 | log.Print("client request")
151 | w.Header().Set("Content-Type", "text/html")
152 | if _case != "" {
153 | fmt.Fprintf(w, "["+_case+"]
")
154 | }
155 | epoint := "echo"
156 | if _case == "t44" {
157 | epoint = "t44"
158 | }
159 | url := fmt.Sprintf("ws%s://%s%s/%s", s, host, ports, epoint)
160 |
161 | io.WriteString(w, `
162 |
163 | `)
224 |
225 | }
226 |
--------------------------------------------------------------------------------
/Carthage/Checkouts/SwiftWebSocket/tools/server/ssl/mkcert.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | cd $(dirname "${BASH_SOURCE[0]}")
5 |
6 | subj="$@"
7 | if [ "$opts" == "" ]; then
8 | subj="/C=US/ST=Arizona/L=Tempe/O=Tidwall/OU=IT/CN=mytestdomain.com"
9 | fi
10 | rm -rf server.*
11 | #openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -keyout server.key -out server.cer -subj "$subj"
12 | openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
13 | openssl rsa -passin pass:x -in server.pass.key -out server.key
14 | rm server.pass.key
15 | openssl req -new -key server.key -out server.csr -subj "/C=US/ST=Arizona/L=Tempe/O=Tidwall/CN=mytestdomain.com"
16 | openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.cer
--------------------------------------------------------------------------------
/Documentation/Classes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Classes Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
Docs (100% documented)
18 |
19 |
20 |
21 |
22 | Reference
23 |
24 | Classes Reference
25 |
26 |
27 |
28 |
63 |
64 |
65 |
66 | Classes
67 | The following classes are available globally.
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | Client
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
Entry point in the SwiftElasticSearch library
87 |
88 |
See more
89 |
90 |
91 |
Declaration
92 |
93 |
Swift
94 |
public class Client : NSObject
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | Errors
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
Class for handling different types of errors
119 |
120 |
See more
121 |
122 |
123 |
Declaration
124 |
125 |
Swift
126 |
public class Errors
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 | Request
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
Class to handle the GET, POST PUT and DELETE requests made from any class inside the library
151 |
152 |
See more
153 |
154 |
155 |
Declaration
156 |
157 |
Swift
158 |
public class Request
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 | Response
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
This class handles the responses that are received from the server when any request is made. It also handles any error while receiving the response.
183 |
184 |
See more
185 |
186 |
187 |
Declaration
188 |
189 |
Swift
190 |
public class Response
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
205 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/Documentation/badge.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | documentation
17 |
18 |
19 | documentation
20 |
21 |
22 | 100%
23 |
24 |
25 | 100%
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Documentation/css/highlight.css:
--------------------------------------------------------------------------------
1 | /* Credit to https://gist.github.com/wataru420/2048287 */
2 | .highlight {
3 | /* Comment */
4 | /* Error */
5 | /* Keyword */
6 | /* Operator */
7 | /* Comment.Multiline */
8 | /* Comment.Preproc */
9 | /* Comment.Single */
10 | /* Comment.Special */
11 | /* Generic.Deleted */
12 | /* Generic.Deleted.Specific */
13 | /* Generic.Emph */
14 | /* Generic.Error */
15 | /* Generic.Heading */
16 | /* Generic.Inserted */
17 | /* Generic.Inserted.Specific */
18 | /* Generic.Output */
19 | /* Generic.Prompt */
20 | /* Generic.Strong */
21 | /* Generic.Subheading */
22 | /* Generic.Traceback */
23 | /* Keyword.Constant */
24 | /* Keyword.Declaration */
25 | /* Keyword.Pseudo */
26 | /* Keyword.Reserved */
27 | /* Keyword.Type */
28 | /* Literal.Number */
29 | /* Literal.String */
30 | /* Name.Attribute */
31 | /* Name.Builtin */
32 | /* Name.Class */
33 | /* Name.Constant */
34 | /* Name.Entity */
35 | /* Name.Exception */
36 | /* Name.Function */
37 | /* Name.Namespace */
38 | /* Name.Tag */
39 | /* Name.Variable */
40 | /* Operator.Word */
41 | /* Text.Whitespace */
42 | /* Literal.Number.Float */
43 | /* Literal.Number.Hex */
44 | /* Literal.Number.Integer */
45 | /* Literal.Number.Oct */
46 | /* Literal.String.Backtick */
47 | /* Literal.String.Char */
48 | /* Literal.String.Doc */
49 | /* Literal.String.Double */
50 | /* Literal.String.Escape */
51 | /* Literal.String.Heredoc */
52 | /* Literal.String.Interpol */
53 | /* Literal.String.Other */
54 | /* Literal.String.Regex */
55 | /* Literal.String.Single */
56 | /* Literal.String.Symbol */
57 | /* Name.Builtin.Pseudo */
58 | /* Name.Variable.Class */
59 | /* Name.Variable.Global */
60 | /* Name.Variable.Instance */
61 | /* Literal.Number.Integer.Long */ }
62 | .highlight .c {
63 | color: #999988;
64 | font-style: italic; }
65 | .highlight .err {
66 | color: #a61717;
67 | background-color: #e3d2d2; }
68 | .highlight .k {
69 | color: #000000;
70 | font-weight: bold; }
71 | .highlight .o {
72 | color: #000000;
73 | font-weight: bold; }
74 | .highlight .cm {
75 | color: #999988;
76 | font-style: italic; }
77 | .highlight .cp {
78 | color: #999999;
79 | font-weight: bold; }
80 | .highlight .c1 {
81 | color: #999988;
82 | font-style: italic; }
83 | .highlight .cs {
84 | color: #999999;
85 | font-weight: bold;
86 | font-style: italic; }
87 | .highlight .gd {
88 | color: #000000;
89 | background-color: #ffdddd; }
90 | .highlight .gd .x {
91 | color: #000000;
92 | background-color: #ffaaaa; }
93 | .highlight .ge {
94 | color: #000000;
95 | font-style: italic; }
96 | .highlight .gr {
97 | color: #aa0000; }
98 | .highlight .gh {
99 | color: #999999; }
100 | .highlight .gi {
101 | color: #000000;
102 | background-color: #ddffdd; }
103 | .highlight .gi .x {
104 | color: #000000;
105 | background-color: #aaffaa; }
106 | .highlight .go {
107 | color: #888888; }
108 | .highlight .gp {
109 | color: #555555; }
110 | .highlight .gs {
111 | font-weight: bold; }
112 | .highlight .gu {
113 | color: #aaaaaa; }
114 | .highlight .gt {
115 | color: #aa0000; }
116 | .highlight .kc {
117 | color: #000000;
118 | font-weight: bold; }
119 | .highlight .kd {
120 | color: #000000;
121 | font-weight: bold; }
122 | .highlight .kp {
123 | color: #000000;
124 | font-weight: bold; }
125 | .highlight .kr {
126 | color: #000000;
127 | font-weight: bold; }
128 | .highlight .kt {
129 | color: #445588; }
130 | .highlight .m {
131 | color: #009999; }
132 | .highlight .s {
133 | color: #d14; }
134 | .highlight .na {
135 | color: #008080; }
136 | .highlight .nb {
137 | color: #0086B3; }
138 | .highlight .nc {
139 | color: #445588;
140 | font-weight: bold; }
141 | .highlight .no {
142 | color: #008080; }
143 | .highlight .ni {
144 | color: #800080; }
145 | .highlight .ne {
146 | color: #990000;
147 | font-weight: bold; }
148 | .highlight .nf {
149 | color: #990000; }
150 | .highlight .nn {
151 | color: #555555; }
152 | .highlight .nt {
153 | color: #000080; }
154 | .highlight .nv {
155 | color: #008080; }
156 | .highlight .ow {
157 | color: #000000;
158 | font-weight: bold; }
159 | .highlight .w {
160 | color: #bbbbbb; }
161 | .highlight .mf {
162 | color: #009999; }
163 | .highlight .mh {
164 | color: #009999; }
165 | .highlight .mi {
166 | color: #009999; }
167 | .highlight .mo {
168 | color: #009999; }
169 | .highlight .sb {
170 | color: #d14; }
171 | .highlight .sc {
172 | color: #d14; }
173 | .highlight .sd {
174 | color: #d14; }
175 | .highlight .s2 {
176 | color: #d14; }
177 | .highlight .se {
178 | color: #d14; }
179 | .highlight .sh {
180 | color: #d14; }
181 | .highlight .si {
182 | color: #d14; }
183 | .highlight .sx {
184 | color: #d14; }
185 | .highlight .sr {
186 | color: #009926; }
187 | .highlight .s1 {
188 | color: #d14; }
189 | .highlight .ss {
190 | color: #990073; }
191 | .highlight .bp {
192 | color: #999999; }
193 | .highlight .vc {
194 | color: #008080; }
195 | .highlight .vg {
196 | color: #008080; }
197 | .highlight .vi {
198 | color: #008080; }
199 | .highlight .il {
200 | color: #009999; }
201 |
--------------------------------------------------------------------------------
/Documentation/css/jazzy.css:
--------------------------------------------------------------------------------
1 | html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
2 | background: transparent;
3 | border: 0;
4 | margin: 0;
5 | outline: 0;
6 | padding: 0;
7 | vertical-align: baseline; }
8 |
9 | body {
10 | background-color: #f2f2f2;
11 | font-family: Helvetica, freesans, Arial, sans-serif;
12 | font-size: 14px;
13 | -webkit-font-smoothing: subpixel-antialiased;
14 | word-wrap: break-word; }
15 |
16 | h1, h2, h3 {
17 | margin-top: 0.8em;
18 | margin-bottom: 0.3em;
19 | font-weight: 100;
20 | color: black; }
21 |
22 | h1 {
23 | font-size: 2.5em; }
24 |
25 | h2 {
26 | font-size: 2em;
27 | border-bottom: 1px solid #e2e2e2; }
28 |
29 | h4 {
30 | font-size: 13px;
31 | line-height: 1.5;
32 | margin-top: 21px; }
33 |
34 | h5 {
35 | font-size: 1.1em; }
36 |
37 | h6 {
38 | font-size: 1.1em;
39 | color: #777; }
40 |
41 | .section-name {
42 | color: gray;
43 | display: block;
44 | font-family: Helvetica;
45 | font-size: 22px;
46 | font-weight: 100;
47 | margin-bottom: 15px; }
48 |
49 | pre, code {
50 | font: 0.95em Menlo, monospace;
51 | color: #777;
52 | word-wrap: normal; }
53 |
54 | p code, li code {
55 | background-color: #eee;
56 | padding: 2px 4px;
57 | border-radius: 4px; }
58 |
59 | a {
60 | color: #0088cc;
61 | text-decoration: none; }
62 |
63 | ul {
64 | padding-left: 15px; }
65 |
66 | li {
67 | line-height: 1.8em; }
68 |
69 | img {
70 | max-width: 100%; }
71 |
72 | blockquote {
73 | margin-left: 0;
74 | padding: 0 10px;
75 | border-left: 4px solid #ccc; }
76 |
77 | .content-wrapper {
78 | margin: 0 auto;
79 | width: 980px; }
80 |
81 | header {
82 | font-size: 0.85em;
83 | line-height: 26px;
84 | background-color: #414141;
85 | position: fixed;
86 | width: 100%;
87 | z-index: 1; }
88 | header img {
89 | padding-right: 6px;
90 | vertical-align: -4px;
91 | height: 16px; }
92 | header a {
93 | color: #fff; }
94 | header p {
95 | float: left;
96 | color: #999; }
97 | header .header-right {
98 | float: right;
99 | margin-left: 16px; }
100 |
101 | #breadcrumbs {
102 | background-color: #f2f2f2;
103 | height: 27px;
104 | padding-top: 17px;
105 | position: fixed;
106 | width: 100%;
107 | z-index: 1;
108 | margin-top: 26px; }
109 | #breadcrumbs #carat {
110 | height: 10px;
111 | margin: 0 5px; }
112 |
113 | .sidebar {
114 | background-color: #f9f9f9;
115 | border: 1px solid #e2e2e2;
116 | overflow-y: auto;
117 | overflow-x: hidden;
118 | position: fixed;
119 | top: 70px;
120 | bottom: 0;
121 | width: 230px;
122 | word-wrap: normal; }
123 |
124 | .nav-groups {
125 | list-style-type: none;
126 | background: #fff;
127 | padding-left: 0; }
128 |
129 | .nav-group-name {
130 | border-bottom: 1px solid #e2e2e2;
131 | font-size: 1.1em;
132 | font-weight: 100;
133 | padding: 15px 0 15px 20px; }
134 | .nav-group-name > a {
135 | color: #333; }
136 |
137 | .nav-group-tasks {
138 | margin-top: 5px; }
139 |
140 | .nav-group-task {
141 | font-size: 0.9em;
142 | list-style-type: none;
143 | white-space: nowrap; }
144 | .nav-group-task a {
145 | color: #888; }
146 |
147 | .main-content {
148 | background-color: #fff;
149 | border: 1px solid #e2e2e2;
150 | margin-left: 246px;
151 | position: absolute;
152 | overflow: hidden;
153 | padding-bottom: 60px;
154 | top: 70px;
155 | width: 734px; }
156 | .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
157 | margin-bottom: 1em; }
158 | .main-content p {
159 | line-height: 1.8em; }
160 | .main-content section .section:first-child {
161 | margin-top: 0;
162 | padding-top: 0; }
163 | .main-content section .task-group-section .task-group:first-of-type {
164 | padding-top: 10px; }
165 | .main-content section .task-group-section .task-group:first-of-type .section-name {
166 | padding-top: 15px; }
167 | .main-content section .heading:before {
168 | content: "";
169 | display: block;
170 | padding-top: 70px;
171 | margin: -70px 0 0; }
172 |
173 | .section {
174 | padding: 0 25px; }
175 |
176 | .highlight {
177 | background-color: #eee;
178 | padding: 10px 12px;
179 | border: 1px solid #e2e2e2;
180 | border-radius: 4px;
181 | overflow-x: auto; }
182 |
183 | .declaration .highlight {
184 | overflow-x: initial;
185 | padding: 0 40px 40px 0;
186 | margin-bottom: -25px;
187 | background-color: transparent;
188 | border: none; }
189 |
190 | .section-name {
191 | margin: 0;
192 | margin-left: 18px; }
193 |
194 | .task-group-section {
195 | padding-left: 6px;
196 | border-top: 1px solid #e2e2e2; }
197 |
198 | .task-group {
199 | padding-top: 0px; }
200 |
201 | .task-name-container a[name]:before {
202 | content: "";
203 | display: block;
204 | padding-top: 70px;
205 | margin: -70px 0 0; }
206 |
207 | .item {
208 | padding-top: 8px;
209 | width: 100%;
210 | list-style-type: none; }
211 | .item a[name]:before {
212 | content: "";
213 | display: block;
214 | padding-top: 70px;
215 | margin: -70px 0 0; }
216 | .item code {
217 | background-color: transparent;
218 | padding: 0; }
219 | .item .token {
220 | padding-left: 3px;
221 | margin-left: 15px;
222 | font-size: 11.9px; }
223 | .item .declaration-note {
224 | font-size: .85em;
225 | color: gray;
226 | font-style: italic; }
227 |
228 | .pointer-container {
229 | border-bottom: 1px solid #e2e2e2;
230 | left: -23px;
231 | padding-bottom: 13px;
232 | position: relative;
233 | width: 110%; }
234 |
235 | .pointer {
236 | background: #f9f9f9;
237 | border-left: 1px solid #e2e2e2;
238 | border-top: 1px solid #e2e2e2;
239 | height: 12px;
240 | left: 21px;
241 | top: -7px;
242 | -webkit-transform: rotate(45deg);
243 | -moz-transform: rotate(45deg);
244 | -o-transform: rotate(45deg);
245 | transform: rotate(45deg);
246 | position: absolute;
247 | width: 12px; }
248 |
249 | .height-container {
250 | display: none;
251 | left: -25px;
252 | padding: 0 25px;
253 | position: relative;
254 | width: 100%;
255 | overflow: hidden; }
256 | .height-container .section {
257 | background: #f9f9f9;
258 | border-bottom: 1px solid #e2e2e2;
259 | left: -25px;
260 | position: relative;
261 | width: 100%;
262 | padding-top: 10px;
263 | padding-bottom: 5px; }
264 |
265 | .aside, .language {
266 | padding: 6px 12px;
267 | margin: 12px 0;
268 | border-left: 5px solid #dddddd;
269 | overflow-y: hidden; }
270 | .aside .aside-title, .language .aside-title {
271 | font-size: 9px;
272 | letter-spacing: 2px;
273 | text-transform: uppercase;
274 | padding-bottom: 0;
275 | margin: 0;
276 | color: #aaa;
277 | -webkit-user-select: none; }
278 | .aside p:last-child, .language p:last-child {
279 | margin-bottom: 0; }
280 |
281 | .language {
282 | border-left: 5px solid #cde9f4; }
283 | .language .aside-title {
284 | color: #4b8afb; }
285 |
286 | .aside-warning {
287 | border-left: 5px solid #ff6666; }
288 | .aside-warning .aside-title {
289 | color: #ff0000; }
290 |
291 | .graybox {
292 | border-collapse: collapse;
293 | width: 100%; }
294 | .graybox p {
295 | margin: 0;
296 | word-break: break-word;
297 | min-width: 50px; }
298 | .graybox td {
299 | border: 1px solid #e2e2e2;
300 | padding: 5px 25px 5px 10px;
301 | vertical-align: middle; }
302 | .graybox tr td:first-of-type {
303 | text-align: right;
304 | padding: 7px;
305 | vertical-align: top;
306 | word-break: normal;
307 | width: 40px; }
308 |
309 | .slightly-smaller {
310 | font-size: 0.9em; }
311 |
312 | #footer {
313 | position: absolute;
314 | bottom: 10px;
315 | margin-left: 25px; }
316 | #footer p {
317 | margin: 0;
318 | color: #aaa;
319 | font-size: 0.8em; }
320 |
321 | html.dash header, html.dash #breadcrumbs, html.dash .sidebar {
322 | display: none; }
323 | html.dash .main-content {
324 | width: 980px;
325 | margin-left: 0;
326 | border: none;
327 | width: 100%;
328 | top: 0;
329 | padding-bottom: 0; }
330 | html.dash .height-container {
331 | display: block; }
332 | html.dash .item .token {
333 | margin-left: 0; }
334 | html.dash .content-wrapper {
335 | width: auto; }
336 | html.dash #footer {
337 | position: static; }
338 |
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleIdentifier
6 | com.jazzy.
7 | CFBundleName
8 |
9 | DocSetPlatformFamily
10 |
11 | isDashDocset
12 |
13 | dashIndexFilePath
14 | index.html
15 | isJavaScriptEnabled
16 |
17 | DashDocSetFamily
18 | dashtoc
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Resources/Documents/Classes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Classes Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
Docs (100% documented)
18 |
19 |
20 |
21 |
22 | Reference
23 |
24 | Classes Reference
25 |
26 |
27 |
28 |
63 |
64 |
65 |
66 | Classes
67 | The following classes are available globally.
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | Client
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
Entry point in the SwiftElasticSearch library
87 |
88 |
See more
89 |
90 |
91 |
Declaration
92 |
93 |
Swift
94 |
public class Client : NSObject
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | Errors
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
Class for handling different types of errors
119 |
120 |
See more
121 |
122 |
123 |
Declaration
124 |
125 |
Swift
126 |
public class Errors
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 | Request
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
Class to handle the GET, POST PUT and DELETE requests made from any class inside the library
151 |
152 |
See more
153 |
154 |
155 |
Declaration
156 |
157 |
Swift
158 |
public class Request
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 | Response
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
This class handles the responses that are received from the server when any request is made. It also handles any error while receiving the response.
183 |
184 |
See more
185 |
186 |
187 |
Declaration
188 |
189 |
Swift
190 |
public class Response
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
205 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Resources/Documents/badge.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | documentation
17 |
18 |
19 | documentation
20 |
21 |
22 | 100%
23 |
24 |
25 | 100%
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Resources/Documents/css/highlight.css:
--------------------------------------------------------------------------------
1 | /* Credit to https://gist.github.com/wataru420/2048287 */
2 | .highlight {
3 | /* Comment */
4 | /* Error */
5 | /* Keyword */
6 | /* Operator */
7 | /* Comment.Multiline */
8 | /* Comment.Preproc */
9 | /* Comment.Single */
10 | /* Comment.Special */
11 | /* Generic.Deleted */
12 | /* Generic.Deleted.Specific */
13 | /* Generic.Emph */
14 | /* Generic.Error */
15 | /* Generic.Heading */
16 | /* Generic.Inserted */
17 | /* Generic.Inserted.Specific */
18 | /* Generic.Output */
19 | /* Generic.Prompt */
20 | /* Generic.Strong */
21 | /* Generic.Subheading */
22 | /* Generic.Traceback */
23 | /* Keyword.Constant */
24 | /* Keyword.Declaration */
25 | /* Keyword.Pseudo */
26 | /* Keyword.Reserved */
27 | /* Keyword.Type */
28 | /* Literal.Number */
29 | /* Literal.String */
30 | /* Name.Attribute */
31 | /* Name.Builtin */
32 | /* Name.Class */
33 | /* Name.Constant */
34 | /* Name.Entity */
35 | /* Name.Exception */
36 | /* Name.Function */
37 | /* Name.Namespace */
38 | /* Name.Tag */
39 | /* Name.Variable */
40 | /* Operator.Word */
41 | /* Text.Whitespace */
42 | /* Literal.Number.Float */
43 | /* Literal.Number.Hex */
44 | /* Literal.Number.Integer */
45 | /* Literal.Number.Oct */
46 | /* Literal.String.Backtick */
47 | /* Literal.String.Char */
48 | /* Literal.String.Doc */
49 | /* Literal.String.Double */
50 | /* Literal.String.Escape */
51 | /* Literal.String.Heredoc */
52 | /* Literal.String.Interpol */
53 | /* Literal.String.Other */
54 | /* Literal.String.Regex */
55 | /* Literal.String.Single */
56 | /* Literal.String.Symbol */
57 | /* Name.Builtin.Pseudo */
58 | /* Name.Variable.Class */
59 | /* Name.Variable.Global */
60 | /* Name.Variable.Instance */
61 | /* Literal.Number.Integer.Long */ }
62 | .highlight .c {
63 | color: #999988;
64 | font-style: italic; }
65 | .highlight .err {
66 | color: #a61717;
67 | background-color: #e3d2d2; }
68 | .highlight .k {
69 | color: #000000;
70 | font-weight: bold; }
71 | .highlight .o {
72 | color: #000000;
73 | font-weight: bold; }
74 | .highlight .cm {
75 | color: #999988;
76 | font-style: italic; }
77 | .highlight .cp {
78 | color: #999999;
79 | font-weight: bold; }
80 | .highlight .c1 {
81 | color: #999988;
82 | font-style: italic; }
83 | .highlight .cs {
84 | color: #999999;
85 | font-weight: bold;
86 | font-style: italic; }
87 | .highlight .gd {
88 | color: #000000;
89 | background-color: #ffdddd; }
90 | .highlight .gd .x {
91 | color: #000000;
92 | background-color: #ffaaaa; }
93 | .highlight .ge {
94 | color: #000000;
95 | font-style: italic; }
96 | .highlight .gr {
97 | color: #aa0000; }
98 | .highlight .gh {
99 | color: #999999; }
100 | .highlight .gi {
101 | color: #000000;
102 | background-color: #ddffdd; }
103 | .highlight .gi .x {
104 | color: #000000;
105 | background-color: #aaffaa; }
106 | .highlight .go {
107 | color: #888888; }
108 | .highlight .gp {
109 | color: #555555; }
110 | .highlight .gs {
111 | font-weight: bold; }
112 | .highlight .gu {
113 | color: #aaaaaa; }
114 | .highlight .gt {
115 | color: #aa0000; }
116 | .highlight .kc {
117 | color: #000000;
118 | font-weight: bold; }
119 | .highlight .kd {
120 | color: #000000;
121 | font-weight: bold; }
122 | .highlight .kp {
123 | color: #000000;
124 | font-weight: bold; }
125 | .highlight .kr {
126 | color: #000000;
127 | font-weight: bold; }
128 | .highlight .kt {
129 | color: #445588; }
130 | .highlight .m {
131 | color: #009999; }
132 | .highlight .s {
133 | color: #d14; }
134 | .highlight .na {
135 | color: #008080; }
136 | .highlight .nb {
137 | color: #0086B3; }
138 | .highlight .nc {
139 | color: #445588;
140 | font-weight: bold; }
141 | .highlight .no {
142 | color: #008080; }
143 | .highlight .ni {
144 | color: #800080; }
145 | .highlight .ne {
146 | color: #990000;
147 | font-weight: bold; }
148 | .highlight .nf {
149 | color: #990000; }
150 | .highlight .nn {
151 | color: #555555; }
152 | .highlight .nt {
153 | color: #000080; }
154 | .highlight .nv {
155 | color: #008080; }
156 | .highlight .ow {
157 | color: #000000;
158 | font-weight: bold; }
159 | .highlight .w {
160 | color: #bbbbbb; }
161 | .highlight .mf {
162 | color: #009999; }
163 | .highlight .mh {
164 | color: #009999; }
165 | .highlight .mi {
166 | color: #009999; }
167 | .highlight .mo {
168 | color: #009999; }
169 | .highlight .sb {
170 | color: #d14; }
171 | .highlight .sc {
172 | color: #d14; }
173 | .highlight .sd {
174 | color: #d14; }
175 | .highlight .s2 {
176 | color: #d14; }
177 | .highlight .se {
178 | color: #d14; }
179 | .highlight .sh {
180 | color: #d14; }
181 | .highlight .si {
182 | color: #d14; }
183 | .highlight .sx {
184 | color: #d14; }
185 | .highlight .sr {
186 | color: #009926; }
187 | .highlight .s1 {
188 | color: #d14; }
189 | .highlight .ss {
190 | color: #990073; }
191 | .highlight .bp {
192 | color: #999999; }
193 | .highlight .vc {
194 | color: #008080; }
195 | .highlight .vg {
196 | color: #008080; }
197 | .highlight .vi {
198 | color: #008080; }
199 | .highlight .il {
200 | color: #009999; }
201 |
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Resources/Documents/css/jazzy.css:
--------------------------------------------------------------------------------
1 | html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
2 | background: transparent;
3 | border: 0;
4 | margin: 0;
5 | outline: 0;
6 | padding: 0;
7 | vertical-align: baseline; }
8 |
9 | body {
10 | background-color: #f2f2f2;
11 | font-family: Helvetica, freesans, Arial, sans-serif;
12 | font-size: 14px;
13 | -webkit-font-smoothing: subpixel-antialiased;
14 | word-wrap: break-word; }
15 |
16 | h1, h2, h3 {
17 | margin-top: 0.8em;
18 | margin-bottom: 0.3em;
19 | font-weight: 100;
20 | color: black; }
21 |
22 | h1 {
23 | font-size: 2.5em; }
24 |
25 | h2 {
26 | font-size: 2em;
27 | border-bottom: 1px solid #e2e2e2; }
28 |
29 | h4 {
30 | font-size: 13px;
31 | line-height: 1.5;
32 | margin-top: 21px; }
33 |
34 | h5 {
35 | font-size: 1.1em; }
36 |
37 | h6 {
38 | font-size: 1.1em;
39 | color: #777; }
40 |
41 | .section-name {
42 | color: gray;
43 | display: block;
44 | font-family: Helvetica;
45 | font-size: 22px;
46 | font-weight: 100;
47 | margin-bottom: 15px; }
48 |
49 | pre, code {
50 | font: 0.95em Menlo, monospace;
51 | color: #777;
52 | word-wrap: normal; }
53 |
54 | p code, li code {
55 | background-color: #eee;
56 | padding: 2px 4px;
57 | border-radius: 4px; }
58 |
59 | a {
60 | color: #0088cc;
61 | text-decoration: none; }
62 |
63 | ul {
64 | padding-left: 15px; }
65 |
66 | li {
67 | line-height: 1.8em; }
68 |
69 | img {
70 | max-width: 100%; }
71 |
72 | blockquote {
73 | margin-left: 0;
74 | padding: 0 10px;
75 | border-left: 4px solid #ccc; }
76 |
77 | .content-wrapper {
78 | margin: 0 auto;
79 | width: 980px; }
80 |
81 | header {
82 | font-size: 0.85em;
83 | line-height: 26px;
84 | background-color: #414141;
85 | position: fixed;
86 | width: 100%;
87 | z-index: 1; }
88 | header img {
89 | padding-right: 6px;
90 | vertical-align: -4px;
91 | height: 16px; }
92 | header a {
93 | color: #fff; }
94 | header p {
95 | float: left;
96 | color: #999; }
97 | header .header-right {
98 | float: right;
99 | margin-left: 16px; }
100 |
101 | #breadcrumbs {
102 | background-color: #f2f2f2;
103 | height: 27px;
104 | padding-top: 17px;
105 | position: fixed;
106 | width: 100%;
107 | z-index: 1;
108 | margin-top: 26px; }
109 | #breadcrumbs #carat {
110 | height: 10px;
111 | margin: 0 5px; }
112 |
113 | .sidebar {
114 | background-color: #f9f9f9;
115 | border: 1px solid #e2e2e2;
116 | overflow-y: auto;
117 | overflow-x: hidden;
118 | position: fixed;
119 | top: 70px;
120 | bottom: 0;
121 | width: 230px;
122 | word-wrap: normal; }
123 |
124 | .nav-groups {
125 | list-style-type: none;
126 | background: #fff;
127 | padding-left: 0; }
128 |
129 | .nav-group-name {
130 | border-bottom: 1px solid #e2e2e2;
131 | font-size: 1.1em;
132 | font-weight: 100;
133 | padding: 15px 0 15px 20px; }
134 | .nav-group-name > a {
135 | color: #333; }
136 |
137 | .nav-group-tasks {
138 | margin-top: 5px; }
139 |
140 | .nav-group-task {
141 | font-size: 0.9em;
142 | list-style-type: none;
143 | white-space: nowrap; }
144 | .nav-group-task a {
145 | color: #888; }
146 |
147 | .main-content {
148 | background-color: #fff;
149 | border: 1px solid #e2e2e2;
150 | margin-left: 246px;
151 | position: absolute;
152 | overflow: hidden;
153 | padding-bottom: 60px;
154 | top: 70px;
155 | width: 734px; }
156 | .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
157 | margin-bottom: 1em; }
158 | .main-content p {
159 | line-height: 1.8em; }
160 | .main-content section .section:first-child {
161 | margin-top: 0;
162 | padding-top: 0; }
163 | .main-content section .task-group-section .task-group:first-of-type {
164 | padding-top: 10px; }
165 | .main-content section .task-group-section .task-group:first-of-type .section-name {
166 | padding-top: 15px; }
167 | .main-content section .heading:before {
168 | content: "";
169 | display: block;
170 | padding-top: 70px;
171 | margin: -70px 0 0; }
172 |
173 | .section {
174 | padding: 0 25px; }
175 |
176 | .highlight {
177 | background-color: #eee;
178 | padding: 10px 12px;
179 | border: 1px solid #e2e2e2;
180 | border-radius: 4px;
181 | overflow-x: auto; }
182 |
183 | .declaration .highlight {
184 | overflow-x: initial;
185 | padding: 0 40px 40px 0;
186 | margin-bottom: -25px;
187 | background-color: transparent;
188 | border: none; }
189 |
190 | .section-name {
191 | margin: 0;
192 | margin-left: 18px; }
193 |
194 | .task-group-section {
195 | padding-left: 6px;
196 | border-top: 1px solid #e2e2e2; }
197 |
198 | .task-group {
199 | padding-top: 0px; }
200 |
201 | .task-name-container a[name]:before {
202 | content: "";
203 | display: block;
204 | padding-top: 70px;
205 | margin: -70px 0 0; }
206 |
207 | .item {
208 | padding-top: 8px;
209 | width: 100%;
210 | list-style-type: none; }
211 | .item a[name]:before {
212 | content: "";
213 | display: block;
214 | padding-top: 70px;
215 | margin: -70px 0 0; }
216 | .item code {
217 | background-color: transparent;
218 | padding: 0; }
219 | .item .token {
220 | padding-left: 3px;
221 | margin-left: 15px;
222 | font-size: 11.9px; }
223 | .item .declaration-note {
224 | font-size: .85em;
225 | color: gray;
226 | font-style: italic; }
227 |
228 | .pointer-container {
229 | border-bottom: 1px solid #e2e2e2;
230 | left: -23px;
231 | padding-bottom: 13px;
232 | position: relative;
233 | width: 110%; }
234 |
235 | .pointer {
236 | background: #f9f9f9;
237 | border-left: 1px solid #e2e2e2;
238 | border-top: 1px solid #e2e2e2;
239 | height: 12px;
240 | left: 21px;
241 | top: -7px;
242 | -webkit-transform: rotate(45deg);
243 | -moz-transform: rotate(45deg);
244 | -o-transform: rotate(45deg);
245 | transform: rotate(45deg);
246 | position: absolute;
247 | width: 12px; }
248 |
249 | .height-container {
250 | display: none;
251 | left: -25px;
252 | padding: 0 25px;
253 | position: relative;
254 | width: 100%;
255 | overflow: hidden; }
256 | .height-container .section {
257 | background: #f9f9f9;
258 | border-bottom: 1px solid #e2e2e2;
259 | left: -25px;
260 | position: relative;
261 | width: 100%;
262 | padding-top: 10px;
263 | padding-bottom: 5px; }
264 |
265 | .aside, .language {
266 | padding: 6px 12px;
267 | margin: 12px 0;
268 | border-left: 5px solid #dddddd;
269 | overflow-y: hidden; }
270 | .aside .aside-title, .language .aside-title {
271 | font-size: 9px;
272 | letter-spacing: 2px;
273 | text-transform: uppercase;
274 | padding-bottom: 0;
275 | margin: 0;
276 | color: #aaa;
277 | -webkit-user-select: none; }
278 | .aside p:last-child, .language p:last-child {
279 | margin-bottom: 0; }
280 |
281 | .language {
282 | border-left: 5px solid #cde9f4; }
283 | .language .aside-title {
284 | color: #4b8afb; }
285 |
286 | .aside-warning {
287 | border-left: 5px solid #ff6666; }
288 | .aside-warning .aside-title {
289 | color: #ff0000; }
290 |
291 | .graybox {
292 | border-collapse: collapse;
293 | width: 100%; }
294 | .graybox p {
295 | margin: 0;
296 | word-break: break-word;
297 | min-width: 50px; }
298 | .graybox td {
299 | border: 1px solid #e2e2e2;
300 | padding: 5px 25px 5px 10px;
301 | vertical-align: middle; }
302 | .graybox tr td:first-of-type {
303 | text-align: right;
304 | padding: 7px;
305 | vertical-align: top;
306 | word-break: normal;
307 | width: 40px; }
308 |
309 | .slightly-smaller {
310 | font-size: 0.9em; }
311 |
312 | #footer {
313 | position: absolute;
314 | bottom: 10px;
315 | margin-left: 25px; }
316 | #footer p {
317 | margin: 0;
318 | color: #aaa;
319 | font-size: 0.8em; }
320 |
321 | html.dash header, html.dash #breadcrumbs, html.dash .sidebar {
322 | display: none; }
323 | html.dash .main-content {
324 | width: 980px;
325 | margin-left: 0;
326 | border: none;
327 | width: 100%;
328 | top: 0;
329 | padding-bottom: 0; }
330 | html.dash .height-container {
331 | display: block; }
332 | html.dash .item .token {
333 | margin-left: 0; }
334 | html.dash .content-wrapper {
335 | width: auto; }
336 | html.dash #footer {
337 | position: static; }
338 |
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Resources/Documents/img/carat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Documentation/docsets/.docset/Contents/Resources/Documents/img/carat.png
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Resources/Documents/img/dash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Documentation/docsets/.docset/Contents/Resources/Documents/img/dash.png
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Resources/Documents/img/gh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Documentation/docsets/.docset/Contents/Resources/Documents/img/gh.png
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Resources/Documents/js/jazzy.js:
--------------------------------------------------------------------------------
1 | window.jazzy = {'docset': false}
2 | if (typeof window.dash != 'undefined') {
3 | document.documentElement.className += ' dash'
4 | window.jazzy.docset = true
5 | }
6 | if (navigator.userAgent.match(/xcode/i)) {
7 | document.documentElement.className += ' xcode'
8 | window.jazzy.docset = true
9 | }
10 |
11 | // On doc load, toggle the URL hash discussion if present
12 | $(document).ready(function() {
13 | if (!window.jazzy.docset) {
14 | var linkToHash = $('a[href="' + window.location.hash +'"]');
15 | linkToHash.trigger("click");
16 | }
17 | });
18 |
19 | // On token click, toggle its discussion and animate token.marginLeft
20 | $(".token").click(function(event) {
21 | if (window.jazzy.docset) {
22 | return;
23 | }
24 | var link = $(this);
25 | var animationDuration = 300;
26 | var tokenOffset = "15px";
27 | var original = link.css('marginLeft') == tokenOffset;
28 | link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration);
29 | $content = link.parent().parent().next();
30 | $content.slideToggle(animationDuration);
31 |
32 | // Keeps the document from jumping to the hash.
33 | var href = $(this).attr('href');
34 | if (history.pushState) {
35 | history.pushState({}, '', href);
36 | } else {
37 | location.hash = href;
38 | }
39 | event.preventDefault();
40 | });
41 |
42 | // Dumb down quotes within code blocks that delimit strings instead of quotations
43 | // https://github.com/realm/jazzy/issues/714
44 | $("code q").replaceWith(function () {
45 | return ["\"", $(this).contents(), "\""];
46 | });
47 |
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Resources/Documents/search.json:
--------------------------------------------------------------------------------
1 | {"Functions.html#/s:18SwiftElasticSearch9stringify4json13prettyPrintedSSyp_SbtF":{"name":"stringify(json:prettyPrinted:)","abstract":"Structures JSON query in String format
"},"Functions.html#/s:18SwiftElasticSearch13getStreamData3url11credentials3app4type2id7headers17completionHandlerySS_SSSgS3SSDyS2SGSgyypSgctF":{"name":"getStreamData(url:credentials:app:type:id:headers:completionHandler:)","abstract":"Get streaming updates to a document with the specified id
"},"Functions.html#/s:18SwiftElasticSearch03getC10StreamData3url11credentials3app4type4body7headers17completionHandlerySS_SSSgSSAJSDySSypGSDyS2SGSgyypSgctF":{"name":"getSearchStreamData(url:credentials:app:type:body:headers:completionHandler:)","abstract":"Get streaming updates to a search query provided in the request body
"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC4data10Foundation4DataVSgvp":{"name":"data","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC04httpD0So13NSURLResponseCSgvp":{"name":"httpResponse","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC5errors5Error_pSgvp":{"name":"error","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC4data04httpD05errorAC10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfc":{"name":"init(data:httpResponse:error:)","abstract":"Initialises the Response class by providing the parameters as received response from the server
","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC15getReceivedDataypSgyF":{"name":"getReceivedData()","abstract":"Returns the data that is received from the server
","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC13getStatusCodeSiyF":{"name":"getStatusCode()","abstract":"Returns the status code of the made request
","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC16getReceivedErrors0G0_pSgyF":{"name":"getReceivedError()","abstract":"Returns the received error if any from the server
","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC18isErrorEncounteredSbyF":{"name":"isErrorEncountered()","abstract":"Checks if any error is encountered from the server for the request made based on the status code
","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC25getReceivedStatusFromCodeSSyF":{"name":"getReceivedStatusFromCode()","abstract":"Returns the status of the request made from the status code
","parent_name":"Response"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC11credentialsSSSgvp":{"name":"credentials","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC11credentialsACSSSg_tcfc":{"name":"init(credentials:)","abstract":"Inititate parameters of a request that needs to be made
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC8postData3url3app4type2id4body7headers17completionHandlerySS_S3SSgSDySSypGSDyS2SGSgyypSg_ApLtctF":{"name":"postData(url:app:type:id:body:headers:completionHandler:)","abstract":"Initiate the POST request
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC7putData3url3app4type2id4body7headers17completionHandlerySS_S3SSgSDySSypGSDyS2SGSgyypSg_ApLtctF":{"name":"putData(url:app:type:id:body:headers:completionHandler:)","abstract":"Initiate the PUT request
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC7getData3url3app4type2id7headers17completionHandlerySS_S3SSDyS2SGSgyypSg_AMSSSgtctF":{"name":"getData(url:app:type:id:headers:completionHandler:)","abstract":"Initiate the GET request
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC10getMapping3url3app4type7headers17completionHandlerySS_S2SSgSDyS2SGSgyypSg_AmJtctF":{"name":"getMapping(url:app:type:headers:completionHandler:)","abstract":"Initiate the mapping request (GET Request)
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC10deleteData3url3app4type2id7headers17completionHandlerySS_S3SSDyS2SGSgyypSg_AMSSSgtctF":{"name":"deleteData(url:app:type:id:headers:completionHandler:)","abstract":"Initiate the DELETE request
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC8bulkData3url3app4type4body7headers17completionHandlerySS_S2SSaySDySSypGGSDyS2SGSgyypSg_AOSSSgtctF":{"name":"bulkData(url:app:type:body:headers:completionHandler:)","abstract":"Initiate the bulk POST request
","parent_name":"Request"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC10statusCodeSivp":{"name":"statusCode","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC10statusCodeACSi_tcfc":{"name":"init(statusCode:)","abstract":"Initialises the Error class
","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC9isSuccessSbyF":{"name":"isSuccess()","abstract":"Test whether a status code represents success
","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC13isClientErrorSbyF":{"name":"isClientError()","abstract":"Test whether a status code represents a client error
","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC13isServerErrorSbyF":{"name":"isServerError()","abstract":"Test whether a status code represents a server error
","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC15isBadCredentialSbyF":{"name":"isBadCredential()","abstract":"Test whether a status code represents bad credential
","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC10isNotFoundSbyF":{"name":"isNotFound()","abstract":"Test whether a status code represents page doesn’t exist
","parent_name":"Errors"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC3urlSSvp":{"name":"url","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC3appSSvp":{"name":"app","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC11credentialsSSSgvp":{"name":"credentials","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC3url3app11credentialsACSSSg_SSAGtcfc":{"name":"init(url:app:credentials:)","abstract":"Instantiates an ElasticSearch client object
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC5index4type2id4body7headers17completionHandlerySSSg_AJSDySSypGSDyS2SGSgyypSg_AnJtctF":{"name":"index(type:id:body:headers:completionHandler:)","abstract":"Adds a JSON document to the search index (via POST/PUT request)
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC3get4type2id7headers17completionHandlerySSSg_SSSDyS2SGSgyypSg_AlItctF":{"name":"get(type:id:headers:completionHandler:)","abstract":"Fetches a specified document from the search index (GET request)
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC6delete4type2id7headers17completionHandlerySSSg_SSSDyS2SGSgyypSg_AlItctF":{"name":"delete(type:id:headers:completionHandler:)","abstract":"Deletes a specified document from the search index (DELETE request)
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC6update4type2id4body7headers17completionHandlerySSSg_SSSDySSypGSDyS2SGSgyypSg_AnJtctF":{"name":"update(type:id:body:headers:completionHandler:)","abstract":"Partially update a specified document in the search index. (POST request)","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC4bulk4type4body7headers17completionHandlerySSSg_SaySDySSypGGSDyS2SGSgyypSg_AnItctF":{"name":"bulk(type:body:headers:completionHandler:)","abstract":"
Make bulk requests on the search index. Bulk requests can be any of index, update and delete requests.
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC6search4type4body7headers17completionHandlerySSSg_SDySSypGSDyS2SGSgyypSg_AmItctF":{"name":"search(type:body:headers:completionHandler:)","abstract":"Search across documents in the index. The request body is constructed using the Query DSL.
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC7msearch4type4body7headers17completionHandlerySSSg_SaySDySSypGGSDyS2SGSgyypSg_AnItctF":{"name":"msearch(type:body:headers:completionHandler:)","abstract":"Combine multiple search requests into a single request. The individual request bodies are constructed using the Query DSL.
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC9getStream4type2id7headers17completionHandlerySSSg_SSSDyS2SGSgyypSgctF":{"name":"getStream(type:id:headers:completionHandler:)","abstract":"Get streaming updates to a document with a specified id. The [stream = true] parameter informs the appbase.io service to keep the connection open, which is used to receive subsequent updates.
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC12searchStream4type4body7headers17completionHandlerySSSg_SDySSypGSDyS2SGSgyypSgctF":{"name":"searchStream(type:body:headers:completionHandler:)","abstract":"Get streaming updates to a search query provided in the request body. The [stream=true] parameter informs the appbase.io service to keep the connection open, which is used to receive subsequent updates.
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC10getMapping4type7headers17completionHandlerySSSg_SDyS2SGSgyypSg_AkHtctF":{"name":"getMapping(type:headers:completionHandler:)","abstract":"Get the data mapping for the search index
","parent_name":"Client"},"Classes/Client.html":{"name":"Client","abstract":"Entry point in the SwiftElasticSearch library
"},"Classes/Errors.html":{"name":"Errors","abstract":"Class for handling different types of errors
"},"Classes/Request.html":{"name":"Request","abstract":"Class to handle the GET, POST PUT and DELETE requests made from any class inside the library
"},"Classes/Response.html":{"name":"Response","abstract":"This class handles the responses that are received from the server when any request is made. It also handles any error while receiving the response.
"},"Classes.html":{"name":"Classes","abstract":"The following classes are available globally.
"},"Functions.html":{"name":"Functions","abstract":"The following functions are available globally.
"}}
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Resources/Documents/undocumented.json:
--------------------------------------------------------------------------------
1 | {
2 | "warnings": [
3 |
4 | ],
5 | "source_directory": "/Users/abhinavraj/Desktop/SwiftElasticSearch"
6 | }
--------------------------------------------------------------------------------
/Documentation/docsets/.docset/Contents/Resources/docSet.dsidx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Documentation/docsets/.docset/Contents/Resources/docSet.dsidx
--------------------------------------------------------------------------------
/Documentation/docsets/.tgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Documentation/docsets/.tgz
--------------------------------------------------------------------------------
/Documentation/img/carat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Documentation/img/carat.png
--------------------------------------------------------------------------------
/Documentation/img/dash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Documentation/img/dash.png
--------------------------------------------------------------------------------
/Documentation/img/gh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/Documentation/img/gh.png
--------------------------------------------------------------------------------
/Documentation/js/jazzy.js:
--------------------------------------------------------------------------------
1 | window.jazzy = {'docset': false}
2 | if (typeof window.dash != 'undefined') {
3 | document.documentElement.className += ' dash'
4 | window.jazzy.docset = true
5 | }
6 | if (navigator.userAgent.match(/xcode/i)) {
7 | document.documentElement.className += ' xcode'
8 | window.jazzy.docset = true
9 | }
10 |
11 | // On doc load, toggle the URL hash discussion if present
12 | $(document).ready(function() {
13 | if (!window.jazzy.docset) {
14 | var linkToHash = $('a[href="' + window.location.hash +'"]');
15 | linkToHash.trigger("click");
16 | }
17 | });
18 |
19 | // On token click, toggle its discussion and animate token.marginLeft
20 | $(".token").click(function(event) {
21 | if (window.jazzy.docset) {
22 | return;
23 | }
24 | var link = $(this);
25 | var animationDuration = 300;
26 | var tokenOffset = "15px";
27 | var original = link.css('marginLeft') == tokenOffset;
28 | link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration);
29 | $content = link.parent().parent().next();
30 | $content.slideToggle(animationDuration);
31 |
32 | // Keeps the document from jumping to the hash.
33 | var href = $(this).attr('href');
34 | if (history.pushState) {
35 | history.pushState({}, '', href);
36 | } else {
37 | location.hash = href;
38 | }
39 | event.preventDefault();
40 | });
41 |
42 | // Dumb down quotes within code blocks that delimit strings instead of quotations
43 | // https://github.com/realm/jazzy/issues/714
44 | $("code q").replaceWith(function () {
45 | return ["\"", $(this).contents(), "\""];
46 | });
47 |
--------------------------------------------------------------------------------
/Documentation/search.json:
--------------------------------------------------------------------------------
1 | {"Functions.html#/s:18SwiftElasticSearch9stringify4json13prettyPrintedSSyp_SbtF":{"name":"stringify(json:prettyPrinted:)","abstract":"Structures JSON query in String format
"},"Functions.html#/s:18SwiftElasticSearch13getStreamData3url11credentials3app4type2id7headers17completionHandlerySS_SSSgS3SSDyS2SGSgyypSgctF":{"name":"getStreamData(url:credentials:app:type:id:headers:completionHandler:)","abstract":"Get streaming updates to a document with the specified id
"},"Functions.html#/s:18SwiftElasticSearch03getC10StreamData3url11credentials3app4type4body7headers17completionHandlerySS_SSSgSSAJSDySSypGSDyS2SGSgyypSgctF":{"name":"getSearchStreamData(url:credentials:app:type:body:headers:completionHandler:)","abstract":"Get streaming updates to a search query provided in the request body
"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC4data10Foundation4DataVSgvp":{"name":"data","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC04httpD0So13NSURLResponseCSgvp":{"name":"httpResponse","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC5errors5Error_pSgvp":{"name":"error","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC4data04httpD05errorAC10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfc":{"name":"init(data:httpResponse:error:)","abstract":"Initialises the Response class by providing the parameters as received response from the server
","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC15getReceivedDataypSgyF":{"name":"getReceivedData()","abstract":"Returns the data that is received from the server
","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC13getStatusCodeSiyF":{"name":"getStatusCode()","abstract":"Returns the status code of the made request
","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC16getReceivedErrors0G0_pSgyF":{"name":"getReceivedError()","abstract":"Returns the received error if any from the server
","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC18isErrorEncounteredSbyF":{"name":"isErrorEncountered()","abstract":"Checks if any error is encountered from the server for the request made based on the status code
","parent_name":"Response"},"Classes/Response.html#/s:18SwiftElasticSearch8ResponseC25getReceivedStatusFromCodeSSyF":{"name":"getReceivedStatusFromCode()","abstract":"Returns the status of the request made from the status code
","parent_name":"Response"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC11credentialsSSSgvp":{"name":"credentials","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC11credentialsACSSSg_tcfc":{"name":"init(credentials:)","abstract":"Inititate parameters of a request that needs to be made
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC8postData3url3app4type2id4body7headers17completionHandlerySS_S3SSgSDySSypGSDyS2SGSgyypSg_ApLtctF":{"name":"postData(url:app:type:id:body:headers:completionHandler:)","abstract":"Initiate the POST request
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC7putData3url3app4type2id4body7headers17completionHandlerySS_S3SSgSDySSypGSDyS2SGSgyypSg_ApLtctF":{"name":"putData(url:app:type:id:body:headers:completionHandler:)","abstract":"Initiate the PUT request
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC7getData3url3app4type2id7headers17completionHandlerySS_S3SSDyS2SGSgyypSg_AMSSSgtctF":{"name":"getData(url:app:type:id:headers:completionHandler:)","abstract":"Initiate the GET request
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC10getMapping3url3app4type7headers17completionHandlerySS_S2SSgSDyS2SGSgyypSg_AmJtctF":{"name":"getMapping(url:app:type:headers:completionHandler:)","abstract":"Initiate the mapping request (GET Request)
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC10deleteData3url3app4type2id7headers17completionHandlerySS_S3SSDyS2SGSgyypSg_AMSSSgtctF":{"name":"deleteData(url:app:type:id:headers:completionHandler:)","abstract":"Initiate the DELETE request
","parent_name":"Request"},"Classes/Request.html#/s:18SwiftElasticSearch7RequestC8bulkData3url3app4type4body7headers17completionHandlerySS_S2SSaySDySSypGGSDyS2SGSgyypSg_AOSSSgtctF":{"name":"bulkData(url:app:type:body:headers:completionHandler:)","abstract":"Initiate the bulk POST request
","parent_name":"Request"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC10statusCodeSivp":{"name":"statusCode","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC10statusCodeACSi_tcfc":{"name":"init(statusCode:)","abstract":"Initialises the Error class
","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC9isSuccessSbyF":{"name":"isSuccess()","abstract":"Test whether a status code represents success
","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC13isClientErrorSbyF":{"name":"isClientError()","abstract":"Test whether a status code represents a client error
","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC13isServerErrorSbyF":{"name":"isServerError()","abstract":"Test whether a status code represents a server error
","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC15isBadCredentialSbyF":{"name":"isBadCredential()","abstract":"Test whether a status code represents bad credential
","parent_name":"Errors"},"Classes/Errors.html#/s:18SwiftElasticSearch6ErrorsC10isNotFoundSbyF":{"name":"isNotFound()","abstract":"Test whether a status code represents page doesn’t exist
","parent_name":"Errors"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC3urlSSvp":{"name":"url","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC3appSSvp":{"name":"app","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC11credentialsSSSgvp":{"name":"credentials","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC3url3app11credentialsACSSSg_SSAGtcfc":{"name":"init(url:app:credentials:)","abstract":"Instantiates an ElasticSearch client object
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC5index4type2id4body7headers17completionHandlerySSSg_AJSDySSypGSDyS2SGSgyypSg_AnJtctF":{"name":"index(type:id:body:headers:completionHandler:)","abstract":"Adds a JSON document to the search index (via POST/PUT request)
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC3get4type2id7headers17completionHandlerySSSg_SSSDyS2SGSgyypSg_AlItctF":{"name":"get(type:id:headers:completionHandler:)","abstract":"Fetches a specified document from the search index (GET request)
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC6delete4type2id7headers17completionHandlerySSSg_SSSDyS2SGSgyypSg_AlItctF":{"name":"delete(type:id:headers:completionHandler:)","abstract":"Deletes a specified document from the search index (DELETE request)
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC6update4type2id4body7headers17completionHandlerySSSg_SSSDySSypGSDyS2SGSgyypSg_AnJtctF":{"name":"update(type:id:body:headers:completionHandler:)","abstract":"Partially update a specified document in the search index. (POST request)","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC4bulk4type4body7headers17completionHandlerySSSg_SaySDySSypGGSDyS2SGSgyypSg_AnItctF":{"name":"bulk(type:body:headers:completionHandler:)","abstract":"
Make bulk requests on the search index. Bulk requests can be any of index, update and delete requests.
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC6search4type4body7headers17completionHandlerySSSg_SDySSypGSDyS2SGSgyypSg_AmItctF":{"name":"search(type:body:headers:completionHandler:)","abstract":"Search across documents in the index. The request body is constructed using the Query DSL.
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC7msearch4type4body7headers17completionHandlerySSSg_SaySDySSypGGSDyS2SGSgyypSg_AnItctF":{"name":"msearch(type:body:headers:completionHandler:)","abstract":"Combine multiple search requests into a single request. The individual request bodies are constructed using the Query DSL.
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC9getStream4type2id7headers17completionHandlerySSSg_SSSDyS2SGSgyypSgctF":{"name":"getStream(type:id:headers:completionHandler:)","abstract":"Get streaming updates to a document with a specified id. The [stream = true] parameter informs the appbase.io service to keep the connection open, which is used to receive subsequent updates.
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC12searchStream4type4body7headers17completionHandlerySSSg_SDySSypGSDyS2SGSgyypSgctF":{"name":"searchStream(type:body:headers:completionHandler:)","abstract":"Get streaming updates to a search query provided in the request body. The [stream=true] parameter informs the appbase.io service to keep the connection open, which is used to receive subsequent updates.
","parent_name":"Client"},"Classes/Client.html#/s:18SwiftElasticSearch6ClientC10getMapping4type7headers17completionHandlerySSSg_SDyS2SGSgyypSg_AkHtctF":{"name":"getMapping(type:headers:completionHandler:)","abstract":"Get the data mapping for the search index
","parent_name":"Client"},"Classes/Client.html":{"name":"Client","abstract":"Entry point in the SwiftElasticSearch library
"},"Classes/Errors.html":{"name":"Errors","abstract":"Class for handling different types of errors
"},"Classes/Request.html":{"name":"Request","abstract":"Class to handle the GET, POST PUT and DELETE requests made from any class inside the library
"},"Classes/Response.html":{"name":"Response","abstract":"This class handles the responses that are received from the server when any request is made. It also handles any error while receiving the response.
"},"Classes.html":{"name":"Classes","abstract":"The following classes are available globally.
"},"Functions.html":{"name":"Functions","abstract":"The following functions are available globally.
"}}
--------------------------------------------------------------------------------
/Documentation/undocumented.json:
--------------------------------------------------------------------------------
1 | {
2 | "warnings": [
3 |
4 | ],
5 | "source_directory": "/Users/abhinavraj/Desktop/SwiftElasticSearch"
6 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [2019] [Appbase Inc.]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Package.swift
3 | // SwiftSearch
4 | //
5 | // Created by Harsh Patel on 04/02/19.
6 | //
7 |
8 | import Foundation
9 | // swift-tools-version:4.0
10 | // The swift-tools-version declares the minimum version of Swift required to build this package.
11 | import PackageDescription
12 |
13 | let package = Package(
14 | name: "SwiftElasticSearch",
15 | products: [
16 | // Products define the executables and libraries produced by a package, and make them visible to other packages.
17 | .library(
18 | name: "SwiftElasticSearch",
19 | targets: ["SwiftElasticSearch iOS", "SwiftElasticSearch macOS"]),
20 | ],
21 | dependencies: [
22 | // Dependencies declare other packages that this package depends on.
23 | // .package(url: /* package url */, from: "1.0.0"),
24 | ],
25 | targets: [
26 | // Targets are the basic building blocks of a package. A target can define a module or a test suite.
27 | // Targets can depend on other targets in this package, and on products in packages which this package depends on.
28 | .target(
29 | name: "SwiftElasticSearch",
30 | dependencies: [])
31 | ]
32 | )
33 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Appbase-Swift
2 |
3 | A Swift Client Library for building search apps. Supports appbase.io and ElasticSearch.
4 |
5 | 
6 |
7 | ### Table of Contents
8 |
9 | 1. [About Project](#about-project)
10 | 2. [Installation](#installation)
11 | * [Dynamic Framework](#dynamic-framework-simplest-way)
12 | * [Carthage](#carthage)
13 | * [Swift Package Manager](#swift-package-manager)
14 | 3. [Quick Start](#quick-start)
15 | 4. [Docs](#docs)
16 |
17 | ### About Project
18 |
19 | This project aims to create fast responsive Swift Library, supported for IPhone and Mac apps which provides the functionality of Elastic Search to be integrated in the app.
20 |
21 | The library provides very high performance results i.e. it provides response to user queries in milliseconds of time including the elastic search processing time.
22 |
23 | ### Installation
24 |
25 | #### Dynamic Framework (Simplest way)
26 |
27 | * Download the latest release of [SwiftElasticSearch](https://github.com/harsh-2711/SwiftSearch/archive/v0.1.0.zip) from Github and extract the zip
28 |
29 | * Navigate to your Xcode's project `General` settings (Click on the the blue icon showing your project's workspace -> General)
30 |
31 | * Drag the `SwiftElasticSearch.xcodeproj` file from the extracted folder in the `Embedded Binaries` section and select the `Copy items if needed` checkbox in the prompted dialog box (if it appears) and click Finish
32 |
33 | * Go to `Linked Frameworks and Libraries` section and click on the `+` icon
34 |
35 | * Click on the `SwiftElasticSearch.framework` to add it to dependencies
36 |
37 | * Build the project
38 |
39 | Here is the GIF showing all the above steps in action -
40 |
41 | 
42 |
43 | #### Carthage
44 |
45 | [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds dependencies and provides binary frameworks for direct use.
46 |
47 | To install Carthage, use [Homebrew](https://brew.sh/) package manager and write the following commands :
48 |
49 | ```
50 | $ brew update
51 | $ brew install carthage
52 | ```
53 | To integrate SwiftElasticSearch in your Xcode project :
54 |
55 | * Switch to your project directory in terminal
56 |
57 | * Now make a Cartfile using command :
58 |
59 | ```
60 | touch Cartfile
61 | ```
62 | * Now open the Cartfile using command :
63 |
64 | ```
65 | open Cartfile
66 | ```
67 | * Add the following dependency in your Cartfile :
68 |
69 | ```
70 | github "appbaseio-apps/SwiftElasticSearch" ~>
71 | ```
72 | The current latest Release Version is 0.1.0
73 |
74 | * Run `carthage update` to build the framework
75 |
76 | * Drag the `SwiftElasticSearch.framework` file that is generated inside Build folder of Carthage to your Xcode project
77 |
78 | * Build the project
79 |
80 | #### Swift Package Manager
81 |
82 | The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but ElasticSwift does support its use on supported platforms.
83 |
84 | To add SwiftElasticSearch library as dependency, add the following line in the dependencies value of Package.swift :
85 |
86 | ```
87 | dependencies: [
88 | .Package(url: "https://github.com/harsh-2711/SwiftElasticSearch.git", "0.1.0")
89 | ]
90 | ```
91 |
92 | ### Quick Start
93 |
94 | Working code example. Please note that each step is dependent on previous step.
95 |
96 | #### Step 1: Import library and initiate the SwiftElasticSearch client
97 |
98 | ```swift
99 | import SwiftElasticSearch
100 |
101 | // app and authentication configurations
102 | let HOST_URL = "https://scalr.api.appbase.io"
103 | let APPNAME = "SwiftClientES"
104 | let CREDENTIALS = "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b"
105 |
106 | let client = Client.init(url: HOST_URL, app: APPNAME, credentials: CREDENTIALS)
107 | ```
108 |
109 | #### Step 2: Add some data into the app
110 |
111 | ```swift
112 | // Index some movie names
113 |
114 | client.index(type: "SwiftClientES", id: "movie1", body: ["title" : "Iron Man"]) { (json, response, error) in
115 | // json - provides recieved JSON body
116 | // response - provides the received response from the server
117 | // error - provides the error encountered if any
118 |
119 | print(json!)
120 | }
121 | ```
122 |
123 | **Console Output**
124 |
125 | ```swift
126 | {
127 | "_id" = movie1;
128 | "_index" = SwiftClientES;
129 | "_shards" = {
130 | failed = 0;
131 | successful = 2;
132 | total = 2;
133 | };
134 | "_type" = SwiftClientES;
135 | "_version" = 2;
136 | created = 0;
137 | result = updated;
138 | }
139 | ```
140 |
141 | #### Step 3: Get the posted data
142 |
143 | ```swift
144 |
145 | client.get(type: "SwiftClientES", id: "movie1") { (json, response, error) in
146 | print(json!)
147 | }
148 | ```
149 |
150 | **Console output**
151 |
152 | ```swift
153 | {
154 | "_id" = movie1;
155 | "_index" = SwiftClientES;
156 | "_source" = {
157 | title = "Iron Man";
158 | };
159 | "_type" = SwiftClientES;
160 | "_version" = 2;
161 | found = 1;
162 | }
163 | ```
164 |
165 | * For more examples, refer to the tests file [SwiftElasticSearchTests.swift](https://github.com/appbaseio-apps/SwiftElasticSearch/blob/master/SwiftElasticSearchTests/SwiftElasticSearchTests.swift)
166 |
167 | * For a fully working example app, refer to the GitHub repository [SwiftElasticSearchDemo](https://github.com/harsh-2711/SwiftElasticSearchDemo)
168 |
169 | ### Docs
170 |
171 | The documentation of SwiftElasticSearch library is made with the help of [Jazzy](https://github.com/realm/jazzy) library. For contributing to the documentation of this library, follow the given steps:
172 |
173 | * Make the necessary changes in the inline code comments
174 | * If you haven't, install jazzy library by typing the following command in the terminal:
175 | ```
176 | [sudo] gem install jazzy
177 | ```
178 | * After installing, navigate to the project directory and type the following to generate the docs.
179 | ```
180 | jazzy
181 | ```
182 | For more functionalities like skipping specific files or folders, refer to documentation of the [Jazzy](https://github.com/realm/jazzy) library:
183 | * Now add and commit the changes and then submit a pull request :-)
184 |
185 | **Hosted docs of SwiftElasticSearch library are available at https://swift-elasticsearch.netlify.com**
186 |
--------------------------------------------------------------------------------
/Sources/Errors.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Errors.swift
3 | // SwiftElasticSearch
4 | //
5 | // Created by Harsh Patel on 04/11/18.
6 | // Copyright © 2018 Harsh Patel. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | /// Class for handling different types of errors
12 | ///
13 | public class Errors {
14 |
15 | // MARK: - Properties
16 |
17 | /// - The status code of the request that is received from the server
18 | public let statusCode : Int
19 |
20 |
21 | // MARK: Initializer
22 |
23 | /// Initialises the Error class
24 | ///
25 | /// - parameter statusCode: The status code of the request that is received from the server
26 | ///
27 | public init(statusCode : Int) {
28 | self.statusCode = statusCode
29 | }
30 |
31 |
32 | // MARK: Operators
33 |
34 | func getErrorFromCode() -> String {
35 |
36 | switch statusCode {
37 |
38 | /// Success
39 | case 200:
40 | return "OK"
41 |
42 | /// Invalid parameters / Invalid Credentials
43 | case 400:
44 | return "Bad Request"
45 |
46 | /// Invalid authentication.
47 | case 401:
48 | return "Unauthorized"
49 |
50 | /// Operation unauthorized with the provided credentials.
51 | case 403:
52 | return "Forbidden"
53 |
54 | /// The targeted resource does not exist.
55 | case 404:
56 | return "Not Found"
57 |
58 | /// The server has encountered a fatal internal error.
59 | case 500:
60 | return "Internal Server Error"
61 |
62 | /// The server is temporarily down.
63 | case 503:
64 | return "Service Unavailable"
65 |
66 | /// Unknown Error occured
67 | default:
68 | return "Unknown Error"
69 | }
70 | }
71 |
72 | /// Test whether a status code represents success
73 | ///
74 | /// - returns: Boolean value for the condition if the request made is a success or not
75 | ///
76 | public func isSuccess() -> Bool {
77 | return statusCode >= 200 && statusCode < 300
78 | }
79 |
80 | /// Test whether a status code represents a client error
81 | ///
82 | /// - returns: Boolean value for the condition if there is a client side error
83 | ///
84 | public func isClientError() -> Bool {
85 | return statusCode >= 400 && statusCode < 500
86 | }
87 |
88 | /// Test whether a status code represents a server error
89 | ///
90 | /// - returns: Boolean value for the condition if there is any server side error
91 | ///
92 | public func isServerError() -> Bool {
93 | return statusCode >= 500 && statusCode < 600
94 | }
95 |
96 | /// Test whether a status code represents bad credential
97 | ///
98 | /// - returns: Boolean value for the condition if the request made has bad credentials
99 | ///
100 | public func isBadCredential() -> Bool {
101 | return statusCode == 401
102 | }
103 |
104 | /// Test whether a status code represents page doesn't exist
105 | ///
106 | /// - returns: Boolean value for the condition if the requested page exists or not
107 | ///
108 | public func isNotFound() -> Bool {
109 | return statusCode == 404
110 | }
111 |
112 | /// Common Errors like Serialization Errors etc.
113 | ///
114 | enum CommonError: String {
115 |
116 | /// JSON body parsing error
117 | case jsonSerialization = "Couldn't parse to/from json object."
118 |
119 | /// Network Connection error
120 | case networkConnection = "Network error."
121 |
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/Sources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Sources/JSONParsing.swift:
--------------------------------------------------------------------------------
1 | //
2 | // JSONParsing.swift
3 | // SwiftElasticSearch
4 | //
5 | // Created by Harsh Patel on 06/11/18.
6 | // Copyright © 2018 Harsh Patel. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | extension String{
12 |
13 | /// Parses the string to JSON object
14 | ///
15 | /// - returns: JSON object in string.
16 | ///
17 | var parseJSONString : Any? {
18 | let data = self.data(using: String.Encoding.utf8, allowLossyConversion: false)
19 | if let jsonData = data {
20 | do {
21 | return try JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)
22 | } catch {
23 | return nil
24 | }
25 | }
26 | return nil
27 | }
28 | }
29 |
30 |
31 | /// Structures JSON query in String format
32 | ///
33 | /// - parameter json: JSON query which needs to be converted into String format
34 | /// - parameter prettyPrinted: If this option is not true, the most compact possible JSON representation is generated
35 | ///
36 | public func stringify(json: Any, prettyPrinted: Bool = false) -> String {
37 | var options: JSONSerialization.WritingOptions = []
38 |
39 | if prettyPrinted {
40 | options = JSONSerialization.WritingOptions.prettyPrinted
41 | }
42 |
43 | do {
44 | let data = try JSONSerialization.data(withJSONObject: json, options: options)
45 | if let string = String(data: data, encoding: String.Encoding.utf8) {
46 | return string
47 | }
48 | } catch {
49 | print(error)
50 | }
51 |
52 | return ""
53 | }
54 |
--------------------------------------------------------------------------------
/Sources/Response.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Response.swift
3 | // SwiftElasticSearch
4 | //
5 | // Created by Harsh Patel and Abhinav Raj on 04/11/18.
6 | // Copyright © 2018 Harsh Patel. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | /// This class handles the responses that are received from the server when any request is made. It also handles any error while receiving the response.
12 | ///
13 | public class Response {
14 |
15 | // MARK: - Properties
16 |
17 | /// - Data that is received for the request made
18 | public let data: Data?
19 | /// - Response received from the server
20 | public let httpResponse: URLResponse?
21 | /// - Error(if any) that is encountered
22 | public let error: Error?
23 |
24 |
25 | // MARK: - Initializer
26 |
27 | /// Initialises the Response class by providing the parameters as received response from the server
28 | ///
29 | /// - parameter data: Data that is received for the request made
30 | /// - parameter httpResponse: Response received from the server
31 | /// - parameter error: Error(if any) that is encountered
32 | ///
33 | public init(data: Data? ,httpResponse: URLResponse?, error: Error?) {
34 | self.data = data
35 | self.httpResponse = httpResponse
36 | self.error = error
37 | }
38 |
39 |
40 | // MARK: - Operations
41 |
42 | /// Returns the data that is received from the server
43 | ///
44 | /// - returns: JSON response received from the server
45 | ///
46 | public func getReceivedData() -> Any? {
47 |
48 | if let data = data {
49 |
50 | do {
51 | let json = try JSONSerialization.jsonObject(with: data, options: [])
52 | return json
53 | } catch {
54 | // Handle error
55 | }
56 | }
57 |
58 | return nil
59 | }
60 |
61 |
62 | /// Returns the status code of the made request
63 | ///
64 | /// - returns: Received status code in integer format
65 | ///
66 | public func getStatusCode() -> Int {
67 |
68 | let response = self.httpResponse as! HTTPURLResponse
69 | let statusCode = response.statusCode
70 |
71 | return statusCode
72 | }
73 |
74 |
75 | /// Returns the received error if any from the server
76 | ///
77 | /// - returns: Encountered error by the server for the request made
78 | ///
79 | public func getReceivedError() -> Error? {
80 | return error
81 | }
82 |
83 |
84 | /// Checks if any error is encountered from the server for the request made based on the status code
85 | ///
86 | /// - returns: Boolean value for the condition if error is occured or not
87 | ///
88 | public func isErrorEncountered() -> Bool {
89 |
90 | let response = self.httpResponse as! HTTPURLResponse
91 | let statusCode = response.statusCode
92 |
93 | let status = Errors.init(statusCode: statusCode)
94 |
95 | return !status.isSuccess()
96 | }
97 |
98 |
99 | /// Returns the status of the request made from the status code
100 | ///
101 | /// - returns: Status of the request in String format for the provided status code
102 | ///
103 | public func getReceivedStatusFromCode() -> String {
104 |
105 | let response = self.httpResponse as! HTTPURLResponse
106 | let statusCode = response.statusCode
107 |
108 | let error = Errors.init(statusCode: statusCode)
109 |
110 | return error.getErrorFromCode()
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/Sources/SwiftSearch.h:
--------------------------------------------------------------------------------
1 | //
2 | // SwiftSearch.h
3 | // SwiftSearch iOS
4 | //
5 | // Created by Harsh Patel on 04/02/19.
6 | //
7 |
8 | #import
9 |
10 | //! Project version number for SwiftSearch.
11 | FOUNDATION_EXPORT double SwiftSearchVersionNumber;
12 |
13 | //! Project version string for SwiftSearch.
14 | FOUNDATION_EXPORT const unsigned char SwiftSearchVersionString[];
15 |
16 | // In this header, you should import all the public headers of your framework using statements like #import
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Sources/WebSockets.swift:
--------------------------------------------------------------------------------
1 | //
2 | // WebSockets.swift
3 | // SwiftElasticSearch
4 | //
5 | // Created by Harsh Patel and Abhinav Raj on 01/01/19.
6 | // Copyright © 2019 Harsh Patel. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import SwiftWebSocket
11 |
12 | /// Get streaming updates to a document with the specified id
13 | ///
14 | /// - parameter url: URL of the ElasticSearch host server (If application is hosted on appbase.io, url should be https://scalr.api.appbase.io)
15 | /// - parameter credentials: Basic Auth `username:password` formatted credentials for authentication (Read Key)
16 | /// - parameter app: Name of the app (aka search index)
17 | /// - parameter type: Type of the doc
18 | /// - parameter id: ID of the doc on which getStream has to be made.
19 | /// - parameter headers: Additional headers to be passed along with the request.
20 | ///
21 | /// - returns: Received message in JSON format until the connection is closed
22 | ///
23 | public func getStreamData(url: String, credentials: String? = nil, app: String, type: String, id: String, headers: [String: String]? = nil, completionHandler: @escaping (Any?) -> ()) {
24 |
25 | let seperatedURL = url.split(separator: "/")
26 | let finalURL = "wss://" + seperatedURL[1] + "/" + app
27 |
28 | let requestURL = URL(string : finalURL)
29 | var request = URLRequest(url: requestURL!)
30 |
31 | request.httpMethod = "GET"
32 | request.addValue("application/json", forHTTPHeaderField: "Content-Type")
33 |
34 | if headers != nil {
35 | for (key, value) in headers! {
36 | request.addValue(value, forHTTPHeaderField: key)
37 | }
38 | }
39 |
40 | let query = ",\"path\" : \"" + app + "/" + type + "/" + id + "?stream=true\"}"
41 |
42 | let request2 : [String : Any] = [
43 | "id" : "17f1f527-325a-48f7-a12d-3f16107190cc",
44 | "method" : "GET",
45 | "body" : [],
46 | ]
47 |
48 | let ws = WebSocket(url: requestURL!)
49 | var jsonRequest = stringify(json: request2 as AnyObject)
50 | jsonRequest.removeLast()
51 | if credentials != nil {
52 | let tempCredentials = (credentials)!.data(using: String.Encoding.utf8)
53 | let credentials64 = tempCredentials!.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
54 | request.addValue("Basic " + credentials64, forHTTPHeaderField: "Authorization")
55 | let authorization = ",\"authorization\" : \"Basic " + credentials64 + "\""
56 | jsonRequest = jsonRequest + authorization
57 | }
58 |
59 | ws.send(jsonRequest + query)
60 |
61 | // Socket Opened
62 | ws.event.open = {
63 | NSLog("Socket Opened");
64 | }
65 |
66 | // Socket Closed
67 | ws.event.close = { code, reason, clean in
68 | NSLog("Socket Closed");
69 | NSLog("Reason: \(reason)");
70 | NSLog("Clean: \(clean)");
71 | }
72 |
73 | // Error
74 | ws.event.error = { error in
75 | NSLog("Error: \(error)");
76 | }
77 |
78 | // Data obtained
79 | ws.event.message = { message in
80 |
81 | let str = message as? String ?? ""
82 |
83 | do {
84 |
85 | if let json = str.data(using: String.Encoding.utf8) {
86 |
87 | if let jsonData = try JSONSerialization.jsonObject(with: json, options: .allowFragments) as? [String:AnyObject] {
88 | completionHandler(jsonData["body"])
89 | }
90 | }
91 |
92 | } catch {
93 | print(error.localizedDescription)
94 | completionHandler(message)
95 | }
96 | }
97 |
98 | }
99 |
100 |
101 | /// Get streaming updates to a search query provided in the request body
102 | ///
103 | /// - parameter url: URL of the ElasticSearch host server (If application is hosted on appbase.io, url should be https://scalr.api.appbase.io)
104 | /// - parameter credentials: Basic Auth `username:password` formatted credentials for authentication (Read Key)
105 | /// - parameter app: Name of the app (aka search index)
106 | /// - parameter type: Type of the doc
107 | /// - parameter body: Search query of the streaming
108 | /// - parameter headers: Additional headers to be passed along with the request.
109 | ///
110 | /// - returns: Received message in JSON format until the connection is closed
111 | ///
112 | public func getSearchStreamData(url: String, credentials: String? = nil, app: String, type: String? = nil, body: [String : Any], headers: [String: String]? = nil, completionHandler: @escaping (Any?) -> ()) {
113 |
114 | let seperatedURL = url.split(separator: "/")
115 | let finalURL = "wss://" + seperatedURL[1] + "/" + app
116 |
117 | let requestURL = URL(string : finalURL)
118 | var request = URLRequest(url: requestURL!)
119 |
120 | do {
121 | request.httpMethod = "POST"
122 | let httpBody = try JSONSerialization.data(withJSONObject: body, options: [])
123 | request.httpBody = httpBody
124 | request.addValue("application/json", forHTTPHeaderField: "Content-Type")
125 |
126 | if headers != nil {
127 | for (key, value) in headers! {
128 | request.addValue(value, forHTTPHeaderField: key)
129 | }
130 | }
131 |
132 | let query:String
133 | if type != nil {
134 | query = ",\"path\" : \"" + app + "/" + type! + "/_search?stream=true\"}"
135 | } else {
136 | query = ",\"path\" : \"" + app + "/_search?stream=true\"}"
137 | }
138 |
139 | let request2 : [String : Any] = [
140 | "id" : "17f1f527-325a-48f7-a12d-3f16107190cc",
141 | "method" : "POST",
142 | "body" : [],
143 | ]
144 |
145 | let ws = WebSocket(url: requestURL!)
146 | var jsonRequest = stringify(json: request2 as AnyObject)
147 | jsonRequest.removeLast()
148 | if credentials != nil {
149 | let tempCredentials = (credentials)!.data(using: String.Encoding.utf8)
150 | let credentials64 = tempCredentials!.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
151 | request.addValue("Basic " + credentials64, forHTTPHeaderField: "Authorization")
152 | let authorization = ",\"authorization\" : \"Basic " + credentials64 + "\""
153 | jsonRequest = jsonRequest + authorization
154 | }
155 |
156 | ws.send(jsonRequest + query)
157 |
158 | // Socket Opened
159 | ws.event.open = {
160 | NSLog("Socket Opened");
161 | }
162 |
163 | // Socket Closed
164 | ws.event.close = { code, reason, clean in
165 | NSLog("Socket Closed");
166 | NSLog("Reason: \(reason)");
167 | NSLog("Clean: \(clean)");
168 | }
169 |
170 | // Error
171 | ws.event.error = { error in
172 | NSLog("Error: \(error)");
173 | }
174 |
175 | // Data obtained
176 | ws.event.message = { message in
177 |
178 | let str = message as? String ?? ""
179 |
180 | do {
181 |
182 | if let json = str.data(using: String.Encoding.utf8) {
183 |
184 | if let jsonData = try JSONSerialization.jsonObject(with: json, options: .allowFragments) as? [String:AnyObject] {
185 | completionHandler(jsonData["body"])
186 | }
187 | }
188 |
189 | } catch {
190 | print(error.localizedDescription)
191 | completionHandler(message)
192 | }
193 | }
194 |
195 | }
196 | catch let err {
197 | print("Data Parsing Error: ", err)
198 | }
199 | }
200 |
--------------------------------------------------------------------------------
/SwiftElasticSearch iOSTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/SwiftElasticSearch iOSTests/SwiftSearch_iOSTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SwiftElasticSearchTests.swift
3 | // SwiftElasticSearchTests
4 | //
5 | // Created by Harsh Patel And Abhinav Raj on 04/11/18.
6 | // Copyright © 2018 Harsh Patel. All rights reserved.
7 | //
8 |
9 | import XCTest
10 | @testable import SwiftElasticSearch
11 |
12 | class SwiftElasticSearchTests: XCTestCase {
13 |
14 | override func setUp() {
15 | // Put setup code here. This method is called before the invocation of each test method in the class.
16 | super.setUp()
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 |
23 | }
24 |
25 | func test_index_is_created() {
26 |
27 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
28 |
29 | let group = DispatchGroup()
30 | group.enter()
31 |
32 | DispatchQueue.global().async {
33 |
34 | client.index(type: "SwiftClientES", id: "testID", body: ["title" : "movie"]) { (json, response, error) in
35 |
36 | let httpResponse = response as! HTTPURLResponse
37 | let statusCode = httpResponse.statusCode
38 | XCTAssert(statusCode == 201)
39 |
40 | group.leave()
41 | }
42 |
43 | }
44 |
45 | group.wait()
46 |
47 | }
48 |
49 | func test_get_is_true() {
50 |
51 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
52 |
53 | let group = DispatchGroup()
54 | group.enter()
55 |
56 | DispatchQueue.global().async {
57 |
58 | client.get(type: "SwiftClientES", id: "testID", completionHandler: { (json, response, error) in
59 |
60 | let httpResponse = response as! HTTPURLResponse
61 | let statusCode = httpResponse.statusCode
62 | XCTAssert(statusCode == 200)
63 |
64 | group.leave()
65 | })
66 |
67 | }
68 |
69 | group.wait()
70 | }
71 |
72 | func test_delete_is_deleted() {
73 |
74 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
75 |
76 | let group = DispatchGroup()
77 | group.enter()
78 |
79 | DispatchQueue.global().async {
80 |
81 | client.delete(type: "SwiftClientES", id: "testID", completionHandler: { (json, response, error) in
82 |
83 | let httpResponse = response as! HTTPURLResponse
84 | let statusCode = httpResponse.statusCode
85 | XCTAssert(statusCode == 200)
86 |
87 | group.leave()
88 | })
89 |
90 | }
91 |
92 | group.wait()
93 | }
94 |
95 | func test_update_is_updated() {
96 |
97 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
98 |
99 | let group = DispatchGroup()
100 | group.enter()
101 |
102 | DispatchQueue.global().async {
103 |
104 | let updateParameters:[String:Any] = [
105 | "doc": [
106 | "year": 2018
107 | ]
108 | ]
109 |
110 | client.update(type: "SwiftClientES", id: "testID", body: updateParameters, completionHandler: { (json, response, error) in
111 |
112 | let httpResponse = response as! HTTPURLResponse
113 | let statusCode = httpResponse.statusCode
114 | XCTAssert(statusCode == 200)
115 |
116 | group.leave()
117 | })
118 |
119 | }
120 |
121 | group.wait()
122 | }
123 |
124 | func test_bulk_is_posted() {
125 |
126 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
127 |
128 | let group = DispatchGroup()
129 | group.enter()
130 |
131 | DispatchQueue.global().async {
132 |
133 | let bulkParameters: [[String:Any]] = [[ "index": [ "_type": "SwiftClientES"] ], [ "Title" : "New Movie 4" , "Year" : "2016"],
134 | [ "delete" : ["_id": "testID"]]]
135 |
136 | client.bulk(type: "SwiftClientES", body: bulkParameters, completionHandler: { (json, response, error) in
137 |
138 | let httpResponse = response as! HTTPURLResponse
139 | let statusCode = httpResponse.statusCode
140 | XCTAssert(statusCode == 200)
141 |
142 | group.leave()
143 | })
144 |
145 | }
146 |
147 | group.wait()
148 | }
149 |
150 | func test_search_is_Searched() {
151 |
152 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
153 |
154 | let group = DispatchGroup()
155 | group.enter()
156 |
157 | DispatchQueue.global().async {
158 |
159 | let body:[String:Any] = [
160 | "query": [
161 | "match": [
162 | "title": "The Young Messiah"
163 | ]
164 | ]
165 | ]
166 |
167 | client.search(type: "SwiftClientES", body: body,completionHandler: { (json, response, error) in
168 |
169 | let httpResponse = response as! HTTPURLResponse
170 | let statusCode = httpResponse.statusCode
171 | XCTAssert(statusCode == 200)
172 |
173 | group.leave()
174 | })
175 | }
176 | group.wait()
177 | }
178 |
179 | func test_msearch_is_Searched() {
180 |
181 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
182 |
183 | let group = DispatchGroup()
184 | group.enter()
185 |
186 | DispatchQueue.global().async {
187 |
188 | let body:[[String:Any]] = [
189 | [
190 | "query": [
191 | "match": [
192 | "title": "The Young Messiah"
193 | ]
194 | ]
195 | ],
196 | [
197 | "query": [
198 | "match": [
199 | "title": "ABCD"
200 | ]
201 | ]
202 | ]
203 | ]
204 |
205 | client.msearch(type: "SwiftClientES", body: body,completionHandler: { (json, response, error) in
206 |
207 | let httpResponse = response as! HTTPURLResponse
208 | let statusCode = httpResponse.statusCode
209 | XCTAssert(statusCode == 200)
210 |
211 | group.leave()
212 | })
213 | }
214 | group.wait()
215 | }
216 |
217 | func test_getStream_is_working() {
218 |
219 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
220 |
221 | let group = DispatchGroup()
222 | group.enter()
223 |
224 | DispatchQueue.global().async {
225 |
226 | client.getStream(type: "SwiftClientES", id: "testID",completionHandler: { (message) in
227 |
228 | let httpResponse = message as! HTTPURLResponse
229 | let statusCode = httpResponse.statusCode
230 | XCTAssert(statusCode == 200)
231 |
232 | group.leave()
233 | })
234 | }
235 | group.wait()
236 | }
237 |
238 | func test_searchStream_is_working() {
239 |
240 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
241 |
242 | let group = DispatchGroup()
243 | group.enter()
244 |
245 | DispatchQueue.global().async {
246 |
247 | let body:[String:Any] = [
248 | "query": [
249 | "match": [
250 | "title": "The Young Messiah"
251 | ]
252 | ]
253 | ]
254 |
255 | client.searchStream(type: "SwiftClientES", body:body,completionHandler: { (message) in
256 |
257 | let httpResponse = message as! HTTPURLResponse
258 | let statusCode = httpResponse.statusCode
259 | XCTAssert(statusCode == 200)
260 |
261 | group.leave()
262 | })
263 | }
264 | group.wait()
265 | }
266 |
267 | func test_getMapping_is_working() {
268 |
269 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
270 |
271 | let group = DispatchGroup()
272 | group.enter()
273 |
274 | DispatchQueue.global().async {
275 |
276 | client.getMapping(type: "SwiftClientES",completionHandler: { (json, response, error) in
277 |
278 | let httpResponse = response as! HTTPURLResponse
279 | let statusCode = httpResponse.statusCode
280 | XCTAssert(statusCode == 200)
281 |
282 | group.leave()
283 | })
284 | }
285 | group.wait()
286 | }
287 | }
288 |
--------------------------------------------------------------------------------
/SwiftElasticSearch macOSTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/SwiftElasticSearch macOSTests/SwiftSearch_macOSTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SwiftSearch_macOSTests.swift
3 | // SwiftSearch macOSTests
4 | //
5 | // Created by Harsh Patel on 04/02/19.
6 | //
7 |
8 | import XCTest
9 |
10 | class SwiftSearch_macOSTests: XCTestCase {
11 |
12 | override func setUp() {
13 | // Put setup code here. This method is called before the invocation of each test method in the class.
14 | super.setUp()
15 | }
16 |
17 | override func tearDown() {
18 | // Put teardown code here. This method is called after the invocation of each test method in the class.
19 | super.tearDown()
20 |
21 | }
22 |
23 | func test_index_is_created() {
24 |
25 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
26 |
27 | let group = DispatchGroup()
28 | group.enter()
29 |
30 | DispatchQueue.global().async {
31 |
32 | client.index(type: "SwiftClientES", id: "testID", body: ["title" : "movie"]) { (json, response, error) in
33 |
34 | let httpResponse = response as! HTTPURLResponse
35 | let statusCode = httpResponse.statusCode
36 | XCTAssert(statusCode == 201)
37 |
38 | group.leave()
39 | }
40 |
41 | }
42 |
43 | group.wait()
44 |
45 | }
46 |
47 | func test_get_is_true() {
48 |
49 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
50 |
51 | let group = DispatchGroup()
52 | group.enter()
53 |
54 | DispatchQueue.global().async {
55 |
56 | client.get(type: "SwiftClientES", id: "testID", completionHandler: { (json, response, error) in
57 |
58 | let httpResponse = response as! HTTPURLResponse
59 | let statusCode = httpResponse.statusCode
60 | XCTAssert(statusCode == 200)
61 |
62 | group.leave()
63 | })
64 |
65 | }
66 |
67 | group.wait()
68 | }
69 |
70 | func test_delete_is_deleted() {
71 |
72 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
73 |
74 | let group = DispatchGroup()
75 | group.enter()
76 |
77 | DispatchQueue.global().async {
78 |
79 | client.delete(type: "SwiftClientES", id: "testID", completionHandler: { (json, response, error) in
80 |
81 | let httpResponse = response as! HTTPURLResponse
82 | let statusCode = httpResponse.statusCode
83 | XCTAssert(statusCode == 200)
84 |
85 | group.leave()
86 | })
87 |
88 | }
89 |
90 | group.wait()
91 | }
92 |
93 | func test_update_is_updated() {
94 |
95 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
96 |
97 | let group = DispatchGroup()
98 | group.enter()
99 |
100 | DispatchQueue.global().async {
101 |
102 | let updateParameters:[String:Any] = [
103 | "doc": [
104 | "year": 2018
105 | ]
106 | ]
107 |
108 | client.update(type: "SwiftClientES", id: "testID", body: updateParameters, completionHandler: { (json, response, error) in
109 |
110 | let httpResponse = response as! HTTPURLResponse
111 | let statusCode = httpResponse.statusCode
112 | XCTAssert(statusCode == 200)
113 |
114 | group.leave()
115 | })
116 |
117 | }
118 |
119 | group.wait()
120 | }
121 |
122 | func test_bulk_is_posted() {
123 |
124 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
125 |
126 | let group = DispatchGroup()
127 | group.enter()
128 |
129 | DispatchQueue.global().async {
130 |
131 | let bulkParameters: [[String:Any]] = [[ "index": [ "_type": "SwiftClientES"] ], [ "Title" : "New Movie 4" , "Year" : "2016"],
132 | [ "delete" : ["_id": "testID"]]]
133 |
134 | client.bulk(type: "SwiftClientES", body: bulkParameters, completionHandler: { (json, response, error) in
135 |
136 | let httpResponse = response as! HTTPURLResponse
137 | let statusCode = httpResponse.statusCode
138 | XCTAssert(statusCode == 200)
139 |
140 | group.leave()
141 | })
142 |
143 | }
144 |
145 | group.wait()
146 | }
147 |
148 | func test_search_is_Searched() {
149 |
150 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
151 |
152 | let group = DispatchGroup()
153 | group.enter()
154 |
155 | DispatchQueue.global().async {
156 |
157 | let body:[String:Any] = [
158 | "query": [
159 | "match": [
160 | "title": "The Young Messiah"
161 | ]
162 | ]
163 | ]
164 |
165 | client.search(type: "SwiftClientES", body: body,completionHandler: { (json, response, error) in
166 |
167 | let httpResponse = response as! HTTPURLResponse
168 | let statusCode = httpResponse.statusCode
169 | XCTAssert(statusCode == 200)
170 |
171 | group.leave()
172 | })
173 | }
174 | group.wait()
175 | }
176 |
177 | func test_msearch_is_Searched() {
178 |
179 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
180 |
181 | let group = DispatchGroup()
182 | group.enter()
183 |
184 | DispatchQueue.global().async {
185 |
186 | let body:[[String:Any]] = [
187 | [
188 | "query": [
189 | "match": [
190 | "title": "The Young Messiah"
191 | ]
192 | ]
193 | ],
194 | [
195 | "query": [
196 | "match": [
197 | "title": "ABCD"
198 | ]
199 | ]
200 | ]
201 | ]
202 |
203 | client.msearch(type: "SwiftClientES", body: body,completionHandler: { (json, response, error) in
204 |
205 | let httpResponse = response as! HTTPURLResponse
206 | let statusCode = httpResponse.statusCode
207 | XCTAssert(statusCode == 200)
208 |
209 | group.leave()
210 | })
211 | }
212 | group.wait()
213 | }
214 |
215 | func test_getStream_is_working() {
216 |
217 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
218 |
219 | let group = DispatchGroup()
220 | group.enter()
221 |
222 | DispatchQueue.global().async {
223 |
224 | client.getStream(type: "SwiftClientES", id: "testID",completionHandler: { (message) in
225 |
226 | let httpResponse = message as! HTTPURLResponse
227 | let statusCode = httpResponse.statusCode
228 | XCTAssert(statusCode == 200)
229 |
230 | group.leave()
231 | })
232 | }
233 | group.wait()
234 | }
235 |
236 | func test_searchStream_is_working() {
237 |
238 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
239 |
240 | let group = DispatchGroup()
241 | group.enter()
242 |
243 | DispatchQueue.global().async {
244 |
245 | let body:[String:Any] = [
246 | "query": [
247 | "match": [
248 | "title": "The Young Messiah"
249 | ]
250 | ]
251 | ]
252 |
253 | client.searchStream(type: "SwiftClientES", body:body,completionHandler: { (message) in
254 |
255 | let httpResponse = message as! HTTPURLResponse
256 | let statusCode = httpResponse.statusCode
257 | XCTAssert(statusCode == 200)
258 |
259 | group.leave()
260 | })
261 | }
262 | group.wait()
263 | }
264 |
265 | func test_getMapping_is_working() {
266 |
267 | let client = Client.init(url: "https://scalr.api.appbase.io", app: "SwiftClientES", credentials: "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b")
268 |
269 | let group = DispatchGroup()
270 | group.enter()
271 |
272 | DispatchQueue.global().async {
273 |
274 | client.getMapping(type: "SwiftClientES",completionHandler: { (json, response, error) in
275 |
276 | let httpResponse = response as! HTTPURLResponse
277 | let statusCode = httpResponse.statusCode
278 | XCTAssert(statusCode == 200)
279 |
280 | group.leave()
281 | })
282 | }
283 | group.wait()
284 | }
285 | }
286 |
--------------------------------------------------------------------------------
/SwiftElasticSearch.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SwiftElasticSearch.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SwiftElasticSearch.xcodeproj/project.xcworkspace/xcuserdata/harshpatel.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/SwiftElasticSearch.xcodeproj/project.xcworkspace/xcuserdata/harshpatel.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/SwiftElasticSearch.xcodeproj/xcuserdata/harshpatel.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | SwiftSearch iOS.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 5
11 |
12 | SwiftSearch iOSTests.xcscheme_^#shared#^_
13 |
14 | orderHint
15 | 0
16 |
17 | SwiftSearch macOS.xcscheme_^#shared#^_
18 |
19 | orderHint
20 | 6
21 |
22 | SwiftSearch macOSTests.xcscheme_^#shared#^_
23 |
24 | orderHint
25 | 3
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/SwiftSearch.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SwiftSearch.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SwiftSearch.xcworkspace/xcuserdata/harshpatel.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appbaseio/appbase-swift/ae6cb7eac1671dd2deeaf3dc4fb70db06b3f5e27/SwiftSearch.xcworkspace/xcuserdata/harshpatel.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------