-
Notifications
You must be signed in to change notification settings - Fork 26
Update keys api #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update keys api #252
Changes from all commits
b11cc41
e5cc747
16ebe3a
3245b68
6cff92e
d037c4b
d87d335
5bc9ddd
a960e23
6a113a9
4a98a0f
b3d7793
eaa54e3
8713d8b
a1f40fd
8750dbe
1c54692
344ab1f
2881a0a
482a750
e3703f6
ca1e35e
026ab54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
} |
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain this function for me (or send me some references about it), I didn't get what it will result, or how it is done (lack of swift expertise 😓) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default, the JSON encoder of Swift considers that if one of your field is |
||
try container.encode(actions, forKey: .actions) | ||
try container.encode(indexes, forKey: .indexes) | ||
try container.encode(expiresAt, forKey: .expiresAt) | ||
} | ||
|
||
// MARK: Properties | ||
} |
Uh oh!
There was an error while loading. Please reload this page.