-
Notifications
You must be signed in to change notification settings - Fork 95
Refactor key types #1917
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
Open
flevi29
wants to merge
11
commits into
meilisearch:main
Choose a base branch
from
flevi29:improve-keys-types
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Refactor key types #1917
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d2cbc18
Refactor key types
flevi29 391e4fd
Fix test
flevi29 8cc208f
Remove accidentally added file
flevi29 e8d4aa7
Merge branch 'main' into improve-keys-types
flevi29 f787887
Merge branch 'main' into improve-keys-types
flevi29 0e45593
Merge branch 'main' into improve-keys-types
flevi29 77c00a6
Merge branch 'main' into improve-keys-types
flevi29 5a4e942
Refactor tests, add missing property
flevi29 6a01288
Test update method as well
flevi29 c2b875a
Merge with main
flevi29 79c88e6
Use randomUUID instead of fixed UUID
flevi29 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,3 +1,4 @@ | ||
export * from "./keys.js"; | ||
export * from "./task_and_batch.js"; | ||
export * from "./token.js"; | ||
export * from "./types.js"; |
This file contains hidden or 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,87 @@ | ||
type ALL = "*"; | ||
type GET = "get"; | ||
type CREATE = "create"; | ||
type UPDATE = "update"; | ||
type DELETE = "delete"; | ||
|
||
/** | ||
* {@link https://www.meilisearch.com/docs/reference/api/keys#actions} | ||
* | ||
* @see `meilisearch_types::keys::Action` | ||
*/ | ||
export type Action = | ||
| ALL | ||
| "search" | ||
| `documents.${ALL | "add" | GET | DELETE}` | ||
| `indexes.${ALL | CREATE | GET | UPDATE | DELETE | "swap"}` | ||
| `tasks.${ALL | "cancel" | DELETE | GET}` | ||
| `settings.${ALL | GET | UPDATE}` | ||
| `stats.${GET}` | ||
| `metrics.${GET}` | ||
| `dumps.${CREATE}` | ||
| `snapshots.${CREATE}` | ||
| "version" | ||
| `keys.${CREATE | GET | UPDATE | DELETE}` | ||
| `experimental.${GET | UPDATE}` | ||
| `network.${GET | UPDATE}`; | ||
|
||
/** | ||
* {@link https://www.meilisearch.com/docs/reference/api/keys#body} | ||
* | ||
* @see `meilisearch_types::keys::CreateApiKey` | ||
*/ | ||
export type CreateApiKey = { | ||
description?: string | null; | ||
name?: string | null; | ||
uid?: string; | ||
actions: Action[]; | ||
indexes: string[]; | ||
expiresAt: string | null; | ||
}; | ||
|
||
/** | ||
* {@link https://www.meilisearch.com/docs/reference/api/keys#key-object} | ||
* | ||
* @see `meilisearch::routes::api_key::KeyView` | ||
*/ | ||
export type KeyView = { | ||
name: string | null; | ||
description: string | null; | ||
key: string; | ||
uid: string; | ||
actions: Action[]; | ||
expiresAt: string | null; | ||
createdAt: string; | ||
updatedAt: string; | ||
}; | ||
|
||
/** | ||
* {@link https://www.meilisearch.com/docs/reference/api/keys#query-parameters} | ||
* | ||
* @see `meilisearch::routes::api_key::ListApiKeys` | ||
*/ | ||
export type ListApiKeys = { | ||
offset?: number; | ||
limit?: number; | ||
}; | ||
|
||
/** @see `meilisearch::routes::PaginationView` */ | ||
export type PaginationView<T> = { | ||
results: T[]; | ||
offset: number; | ||
limit: number; | ||
total: number; | ||
}; | ||
|
||
/** {@link https://www.meilisearch.com/docs/reference/api/keys#response} */ | ||
export type KeyViewList = PaginationView<KeyView>; | ||
|
||
/** | ||
* {@link https://www.meilisearch.com/docs/reference/api/keys#body-1} | ||
* | ||
* @see `meilisearch_types::keys::PatchApiKey` | ||
*/ | ||
export type PatchApiKey = { | ||
description?: string | null; | ||
name?: string | null; | ||
}; |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.