mirror of
https://github.com/unraid/api.git
synced 2026-02-09 01:18:58 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a full-featured API key management UI, including creation, listing, and deletion of API keys with customizable roles and permissions. - Introduced a new page for API key management. - Accordion UI components are now available for enhanced interface interactions. - API now provides queries for possible API key roles and permissions. - **Improvements** - API key-related mutations are now grouped under a single field, improving organization and usability. - Permissions can be assigned directly to API keys, not just roles. - **Bug Fixes** - Validation updated to require at least one role or permission when creating an API key. - **Documentation** - Updated and added rules and configuration documentation for code generation and testing. - **Tests** - Added and updated tests for new API key mutation logic; removed obsolete tests for deprecated mutations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
56 lines
948 B
TypeScript
56 lines
948 B
TypeScript
import { graphql } from '~/composables/gql/gql';
|
|
|
|
|
|
export const GET_API_KEYS = graphql(/* GraphQL */ `
|
|
query ApiKeys {
|
|
apiKeys {
|
|
id
|
|
name
|
|
description
|
|
createdAt
|
|
roles
|
|
permissions {
|
|
resource
|
|
actions
|
|
}
|
|
}
|
|
}
|
|
`);
|
|
|
|
export const CREATE_API_KEY = graphql(/* GraphQL */ `
|
|
mutation CreateApiKey($input: CreateApiKeyInput!) {
|
|
apiKey {
|
|
create(input: $input) {
|
|
id
|
|
key
|
|
name
|
|
description
|
|
createdAt
|
|
roles
|
|
permissions {
|
|
resource
|
|
actions
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`);
|
|
|
|
export const DELETE_API_KEY = graphql(/* GraphQL */ `
|
|
mutation DeleteApiKey($input: DeleteApiKeyInput!) {
|
|
apiKey {
|
|
delete(input: $input)
|
|
}
|
|
}
|
|
`);
|
|
|
|
export const GET_API_KEY_META = graphql(/* GraphQL */ `
|
|
query ApiKeyMeta {
|
|
apiKeyPossibleRoles
|
|
apiKeyPossiblePermissions {
|
|
resource
|
|
actions
|
|
}
|
|
}
|
|
`);
|