Skip to content

Commit 5f50cff

Browse files
committed
chore: rename InvocableScripts to InvokableScripts
for more info see influxdata/openapi#317
1 parent 755cfd5 commit 5f50cff

File tree

10 files changed

+35
-35
lines changed

10 files changed

+35
-35
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### Features
44
1. [#49](https://github.com/influxdata/influxdb-client-swift/pull/49): Add support `async/await` functions
5-
1. [#48](https://github.com/influxdata/influxdb-client-swift/pull/48): Add `InvocableScriptsApi` to create, update, list, delete and invoke scripts by seamless way
5+
1. [#48](https://github.com/influxdata/influxdb-client-swift/pull/48): Add `InvokableScriptsApi` to create, update, list, delete and invoke scripts by seamless way
66

77
### API
88
1. [#49](https://github.com/influxdata/influxdb-client-swift/pull/49): Update InfluxDB API to latest version [OpenAPI]

Examples/InvocableScripts/Package.swift renamed to Examples/InvokableScripts/Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
import PackageDescription
44

55
let package = Package(
6-
name: "InvocableScripts",
6+
name: "InvokableScripts",
77
platforms: [
88
.macOS(.v10_15)
99
],
1010
products: [
11-
.executable(name: "invocable-scripts", targets: ["InvocableScripts"])
11+
.executable(name: "invokable-scripts", targets: ["InvokableScripts"])
1212
],
1313
dependencies: [
1414
.package(name: "influxdb-client-swift", path: "../../"),
1515
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.1.2")
1616
],
1717
targets: [
18-
.executableTarget(name: "InvocableScripts", dependencies: [
18+
.executableTarget(name: "InvokableScripts", dependencies: [
1919
.product(name: "InfluxDBSwift", package: "influxdb-client-swift"),
2020
.product(name: "ArgumentParser", package: "swift-argument-parser")
2121
])

Examples/InvocableScripts/README.md renamed to Examples/InvokableScripts/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# InvocableScripts
1+
# InvokableScripts
22

3-
This is an example how to use Invocable scripts Cloud API to create custom endpoints that query data.
4-
> :warning: Invocable Scripts are supported only in InfluxDB Cloud, currently there is no support in InfluxDB OSS.
3+
This is an example how to use Invokable scripts Cloud API to create custom endpoints that query data.
4+
> :warning: Invokable Scripts are supported only in InfluxDB Cloud, currently there is no support in InfluxDB OSS.
55
66
## Prerequisites:
77
- Docker
88
- Cloned examples:
99
```bash
1010
git clone git@github.com:influxdata/influxdb-client-swift.git
11-
cd Examples/InvocableScripts
11+
cd Examples/InvokableScripts
1212
```
1313

1414
## Sources:
15-
- [Package.swift](/Examples/InvocableScripts/Package.swift)
16-
- [InvocableScripts.swift](/Examples/InvocableScripts/Sources/InvocableScripts/InvocableScripts.swift)
15+
- [Package.swift](/Examples/InvokableScripts/Package.swift)
16+
- [InvokableScripts.swift](/Examples/InvokableScripts/Sources/InvokableScripts/InvokableScripts.swift)
1717

1818
## How to test:
1919
1. Start SwiftCLI by:
@@ -23,12 +23,12 @@ This is an example how to use Invocable scripts Cloud API to create custom endpo
2323
--interactive \
2424
--tty \
2525
--volume $PWD/../..:/client \
26-
--workdir /client/Examples/InvocableScripts \
26+
--workdir /client/Examples/InvokableScripts \
2727
swift:5.6 /bin/bash
2828
```
2929
1. Run Example by:
3030
```bash
31-
swift run invocable-scripts --org my-org --bucket my-bucket --token my-token --url https://us-west-2-1.aws.cloud2.influxdata.com
31+
swift run invokable-scripts --org my-org --bucket my-bucket --token my-token --url https://us-west-2-1.aws.cloud2.influxdata.com
3232
```
3333

3434
## Expected output

Examples/InvocableScripts/Sources/InvocableScripts/InvocableScripts.swift renamed to Examples/InvokableScripts/Sources/InvokableScripts/InvokableScripts.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//
2-
// Warning: Invocable Scripts are supported only in InfluxDB Cloud, currently there is no support in InfluxDB OSS.
2+
// Warning: Invokable Scripts are supported only in InfluxDB Cloud, currently there is no support in InfluxDB OSS.
33
//
44

55
import ArgumentParser
66
import Foundation
77
import InfluxDBSwift
88

99
@main
10-
struct InvocableScriptsAPI: AsyncParsableCommand {
10+
struct InvokableScriptsAPI: AsyncParsableCommand {
1111
@Option(name: .shortAndLong, help: "The bucket to query. The name or id of the bucket destination.")
1212
private var bucket: String
1313

@@ -22,7 +22,7 @@ struct InvocableScriptsAPI: AsyncParsableCommand {
2222
private var url: String
2323
}
2424

25-
extension InvocableScriptsAPI {
25+
extension InvokableScriptsAPI {
2626
mutating func run() async throws {
2727
//
2828
// Initialize Client with default Organization
@@ -32,7 +32,7 @@ extension InvocableScriptsAPI {
3232
token: token,
3333
options: InfluxDBClient.InfluxDBOptions(bucket: self.bucket, org: self.org))
3434

35-
let invocableScriptsApi = client.invocableScriptsApi
35+
let invokableScriptsApi = client.invokableScriptsApi
3636

3737
//
3838
// Prepare Data
@@ -48,7 +48,7 @@ extension InvocableScriptsAPI {
4848
try await client.makeWriteAPI().write(points: [point1, point2])
4949

5050
//
51-
// Create Invocable Script
51+
// Create Invokable Script
5252
//
5353
print("------- Create -------\n")
5454
let scriptQuery = "from(bucket: params.bucket_name) |> range(start: -30d) |> limit(n:2)"
@@ -58,28 +58,28 @@ extension InvocableScriptsAPI {
5858
script: scriptQuery,
5959
language: ScriptLanguage.flux)
6060

61-
let createdScript = try await invocableScriptsApi.createScript(createRequest: createRequest)
61+
let createdScript = try await invokableScriptsApi.createScript(createRequest: createRequest)
6262
guard let createdScript = createdScript else {
6363
return
6464
}
6565
dump(createdScript)
6666

6767
//
68-
// Update Invocable Script
68+
// Update Invokable Script
6969
//
7070
print("\n------- Update -------\n")
7171
let updateRequest = ScriptUpdateRequest(description: "my updated description")
72-
let updatedScript = try await invocableScriptsApi.updateScript(scriptId: createdScript.id!, updateRequest: updateRequest)
72+
let updatedScript = try await invokableScriptsApi.updateScript(scriptId: createdScript.id!, updateRequest: updateRequest)
7373
guard let updatedScript = updatedScript else {
7474
return
7575
}
7676
dump(updatedScript)
7777

7878
//
79-
// List Invocable Scripts
79+
// List Invokable Scripts
8080
//
8181
print("\n------- List -------\n")
82-
let scripts = try await invocableScriptsApi.findScripts()
82+
let scripts = try await invokableScriptsApi.findScripts()
8383
print("Scripts:")
8484
scripts?.scripts?.forEach { print("\t\($0.id ?? ""): \($0.name): \($0.description ?? "")") }
8585

@@ -88,15 +88,15 @@ extension InvocableScriptsAPI {
8888
//
8989
// FluxRecords
9090
print("\n------- Invoke to FluxRecords -------\n")
91-
let records = try await invocableScriptsApi.invokeScript(
91+
let records = try await invokableScriptsApi.invokeScript(
9292
scriptId: updatedScript.id!,
9393
params: ["bucket_name": "\(self.bucket)"])
9494
try records.forEach { record in
9595
print("\t\(record.values["location"]!): \(record.values["_value"]!)")
9696
}
9797
// Raw
9898
print("\n------- Invoke to Raw -------\n")
99-
let raw = try await invocableScriptsApi.invokeScriptRaw(
99+
let raw = try await invokableScriptsApi.invokeScriptRaw(
100100
scriptId: updatedScript.id!,
101101
params: ["bucket_name": "\(self.bucket)"])
102102
print("RAW output:\n\n \(String(decoding: raw, as: UTF8.self))")
@@ -105,7 +105,7 @@ extension InvocableScriptsAPI {
105105
// Delete previously created Script
106106
//
107107
print("\n------- Delete -------\n")
108-
try await invocableScriptsApi.deleteScript(scriptId: updatedScript.id!)
108+
try await invokableScriptsApi.deleteScript(scriptId: updatedScript.id!)
109109
print("Successfully deleted script: '\(updatedScript.name)'")
110110

111111
client.close()

Examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
- [DeleteData](DeleteData#deletedata) - How to delete data with specified predicate
1616
- [AsyncAwait](AsyncAwait#asyncawait) - How to use `async/await` with the InfluxDB client.
1717
- [InfluxDBStatus](InfluxDBStatus#influxdbstatus) - This is an example how to check status of InfluxDB
18-
- [InvocableScripts](InvocableScripts#invocablescripts) - How to use Invocable scripts Cloud API to create custom endpoints that query data
18+
- [InvokableScripts](InvokableScripts#invokablescripts) - How to use Invokable scripts Cloud API to create custom endpoints that query data
1919

Sources/InfluxDBSwift/FluxCSVParser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ extension FluxCSVParser {
171171
enum ResponseMode {
172172
/// full information about types, default values and groups
173173
case full
174-
/// useful for Invocable scripts
174+
/// useful for Invokable scripts
175175
case onlyNames
176176
}
177177
}

Sources/InfluxDBSwift/InfluxDBClient.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public class InfluxDBClient {
4444
DeleteAPI(client: self)
4545
}()
4646

47-
/// Lazy initialized `InvocableScriptsApi`.
48-
public lazy var invocableScriptsApi: InvocableScriptsAPI = {
49-
InvocableScriptsAPI(client: self)
47+
/// Lazy initialized `InvokableScriptsApi`.
48+
public lazy var invokableScriptsApi: InvokableScriptsAPI = {
49+
InvokableScriptsAPI(client: self)
5050
}()
5151

5252
/// Create a new client for a InfluxDB.

Sources/InfluxDBSwift/InvocableScriptsAPI.swift renamed to Sources/InfluxDBSwift/InvokableScriptsAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import Foundation
88
///
99
/// API invokable scripts let you assign scripts to API endpoints and then execute them
1010
/// as standard REST operations in InfluxDB Cloud.
11-
public class InvocableScriptsAPI {
11+
public class InvokableScriptsAPI {
1212
/// Shared client.
1313
private let client: InfluxDBClient
1414

15-
/// Create a new InvocableScriptsApi for InfluxDB
15+
/// Create a new InvokableScriptsApi for InfluxDB
1616
///
1717
/// - Parameters
1818
/// - client: Client with shared configuration and http library.

Tests/InfluxDBSwiftTests/InvocableScriptsAPITests.swift renamed to Tests/InfluxDBSwiftTests/InvokableScriptsAPITests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Foundation
77
@testable import InfluxDBSwift
88
import XCTest
99

10-
final class InvocableScriptsAPITests: XCTestCase {
10+
final class InvokableScriptsAPITests: XCTestCase {
1111
private var client: InfluxDBClient!
1212

1313
override func setUp() {
@@ -22,7 +22,7 @@ final class InvocableScriptsAPITests: XCTestCase {
2222
client.close()
2323
}
2424

25-
func testGetInvocableScriptsApi() {
26-
XCTAssertNotNil(client.invocableScriptsApi)
25+
func testGetInvokableScriptsApi() {
26+
XCTAssertNotNil(client.invokableScriptsApi)
2727
}
2828
}

0 commit comments

Comments
 (0)