Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1387,32 +1387,3 @@ landing_getting_started_1: |-
case .failure(let error):
print(error)
}
tenant_token_guide_generate_sdk_1: |-
let apiKey = "B5KdX2MY2jV6EXfUs6scSfmC..."
let expiresAt = Date.distantFuture
let searchRules = SearchRulesGroup(SearchRules("patient_medical_records", filter: "user_id = 1"))

client.generateTenantToken(
searchRules,
apiKey: apiKey, // optional
expiresAt: expiresAt // optional
) { (result: Result<String, Error>) in
switch result {
case .success(let token):
print(token)
case .failure(let error):
print(error)
}
}
tenant_token_guide_search_sdk_1: |-
let frontEndClient = MeiliSearch(host: "http://localhost:7700", apiKey: token)

client.index("patient_medical_records")
.search(parameters) { (result: Result<SearchResult<Record>, Swift.Error>) in
switch result {
case .success(let searchResult):
print(searchResult)
case .failure(let error):
print(error)
}
}
13 changes: 2 additions & 11 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,18 @@ import PackageDescription

let package = Package(
name: "meilisearch-swift",
platforms: [
.iOS(.v12),
.tvOS(.v12),
.watchOS(.v5),
.macOS(.v10_15)
],
products: [
.library(name: "MeiliSearch", targets: ["MeiliSearch"])
],
dependencies: [
// Support for dependabot for swift packages in dependabot
// is in draft mode https://github.com/dependabot/dependabot-core/pull/3772
.package(url: "https://github.com/realm/SwiftLint.git", from: "0.43.1"),
.package(url: "https://github.com/vapor/jwt-kit.git", from: "4.0.0")
.package(url: "https://github.com/realm/SwiftLint.git", from: "0.43.1")
],
targets: [
.target(
name: "MeiliSearch",
dependencies: [
.product(name: "JWTKit", package: "jwt-kit")
]
dependencies: []
),
.testTarget(
name: "MeiliSearchUnitTests",
Expand Down
24 changes: 0 additions & 24 deletions Sources/MeiliSearch/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -270,30 +270,6 @@ public struct MeiliSearch {
)
}

/**
Generates a new tenant token.

- parameter searchRules: A `SearchRulesGroup` provides the rules enforced at search time.
- parameter apiKey: The API key that creates the token. If you leave it empty the client API Key will be used.
- parameter expiresAt: The `Date` at which the token will expire.
- parameter completion: The completion closure will returns a `Result` object that contains token `String` value.
If the token was created successfully or `Error` if a failure occured.
- [docs.meilisearch.com](https://docs.meilisearch.com/learn/security/tenant_tokens.html)
*/
public func generateTenantToken(
_ searchRules: SearchRulesGroup,
apiKey: String? = nil,
expiresAt: Date? = nil,
_ completion: @escaping (Result<String, Swift.Error>) -> Void
) {
TenantTokens.generateTenantToken(
searchRules,
apiKey: apiKey ?? self.config.apiKey ?? "",
expiresAt: expiresAt,
completion
)
}

// MARK: Stats

/**
Expand Down
61 changes: 0 additions & 61 deletions Sources/MeiliSearch/Model/SearchRules.swift

This file was deleted.

53 changes: 0 additions & 53 deletions Sources/MeiliSearch/Model/SearchRulesGroup.swift

This file was deleted.

21 changes: 0 additions & 21 deletions Sources/MeiliSearch/Model/TokenPayload.swift

This file was deleted.

19 changes: 0 additions & 19 deletions Sources/MeiliSearch/TenantTokenClaims/ApiKeyPrefixClaim.swift

This file was deleted.

10 changes: 0 additions & 10 deletions Sources/MeiliSearch/TenantTokenClaims/SearchRulesClaim.swift

This file was deleted.

55 changes: 0 additions & 55 deletions Sources/MeiliSearch/TenantTokens.swift

This file was deleted.

Loading