-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
252: Update keys api r=bidoubiwa a=bidoubiwa Keys API changes! ## Breaking - `client.getkeys` now returns a `Results<Key>` object see [specification](https://github.com/meilisearch/specifications/blob/main/text/0085-api-keys.md#as-anna--i-want-to-list-the-api-keys) ## New - `client.getKey` returns a `Key` object of a specific key - `client.createKey` returns a `Key` object created with a `KeyParams` object - `client.updateKey` returns a `Key` object with the updated key - `client.deleteKey` returns void as the chosen key has been deleted Co-authored-by: Charlotte Vermandel <[email protected]> Co-authored-by: cvermand <[email protected]>
- Loading branch information
Showing
8 changed files
with
563 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
import Foundation | ||
|
||
/** | ||
Each instance of MeiliSearch has three keys: a master, a private, and a public. | ||
Each key has a given set of permissions on the API routes. | ||
*/ | ||
public struct Key: Codable, Equatable { | ||
// MARK: Properties | ||
|
||
/// Private key used to access a determined set of API routes. | ||
public let `private`: String | ||
|
||
/// Public key used to access a determined set of API routes. | ||
public let `public`: String | ||
public let description: String | ||
public let key: String | ||
public let actions: [String] | ||
public let indexes: [String] | ||
public let expiresAt: String? | ||
public let createdAt: String | ||
public let updatedAt: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Foundation | ||
|
||
/** | ||
`KeyParams` contains all the parameters to create an API key. | ||
*/ | ||
public struct KeyParams: Codable, Equatable { | ||
public let description: String | ||
public let actions: [String] | ||
public let indexes: [String] | ||
public let expiresAt: String? | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encode(description, forKey: .description) | ||
try container.encode(actions, forKey: .actions) | ||
try container.encode(indexes, forKey: .indexes) | ||
try container.encode(expiresAt, forKey: .expiresAt) | ||
} | ||
|
||
// MARK: Properties | ||
} |
Oops, something went wrong.