diff --git a/packages/core/README.md b/packages/core/README.md index 4692e669..3dc5b080 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -1645,6 +1645,15 @@ import { Gitlab } from '@gitbeaker/core'; +ServiceAccounts + +🦊 + + +⌨️ + + + ServiceData 🦊 diff --git a/packages/core/src/resources/Gitlab.ts b/packages/core/src/resources/Gitlab.ts index d6ce9e2b..8c24a0c0 100644 --- a/packages/core/src/resources/Gitlab.ts +++ b/packages/core/src/resources/Gitlab.ts @@ -46,6 +46,7 @@ import { PyPI } from './PyPI'; import { RubyGems } from './RubyGems'; import { Search } from './Search'; import { SearchAdmin } from './SearchAdmin'; +import { ServiceAccounts } from './ServiceAccounts'; import { ServiceData } from './ServiceData'; import { SidekiqMetrics } from './SidekiqMetrics'; import { SidekiqQueues } from './SidekiqQueues'; @@ -237,6 +238,7 @@ export interface Gitlab extends BaseResource { RubyGems: RubyGems; Search: Search; SearchAdmin: SearchAdmin; + ServiceAccounts: ServiceAccounts; ServiceData: ServiceData; SidekiqMetrics: SidekiqMetrics; SidekiqQueues: SidekiqQueues; @@ -426,6 +428,7 @@ const resources = { RubyGems, Search, SearchAdmin, + ServiceAccounts, ServiceData, SidekiqMetrics, SidekiqQueues, diff --git a/packages/core/src/resources/GroupServiceAccounts.ts b/packages/core/src/resources/GroupServiceAccounts.ts index 645d9478..5627d5cb 100644 --- a/packages/core/src/resources/GroupServiceAccounts.ts +++ b/packages/core/src/resources/GroupServiceAccounts.ts @@ -3,7 +3,7 @@ import type { AccessTokenSchema } from '../templates/ResourceAccessTokens'; import { RequestHelper, endpoint } from '../infrastructure'; import type { GitlabAPIResponse, MappedOmit, ShowExpanded, Sudo } from '../infrastructure'; -export interface ServiceAccountSchema extends Record { +export interface GroupServiceAccountSchema extends Record { id: number; username: string; name: string; @@ -15,8 +15,8 @@ export class GroupServiceAccounts extends BaseResourc create( groupId: string | number, options?: Sudo & ShowExpanded, - ): Promise> { - return RequestHelper.post()( + ): Promise> { + return RequestHelper.post()( this, endpoint`groups/${groupId}/service_accounts`, options, diff --git a/packages/core/src/resources/ServiceAccounts.ts b/packages/core/src/resources/ServiceAccounts.ts new file mode 100644 index 00000000..a1d6251b --- /dev/null +++ b/packages/core/src/resources/ServiceAccounts.ts @@ -0,0 +1,21 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; +import { RequestHelper, endpoint } from '../infrastructure'; +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +export interface ServiceAccountSchema extends Record { + id: number; + name: string; + username: string; + state: string; + locked: boolean; + avatar_url: string; + web_url: string; +} + +export class ServiceAccounts extends BaseResource { + create( + options?: Sudo & ShowExpanded, + ): Promise> { + return RequestHelper.post()(this, endpoint`service_accounts`, options); + } +} diff --git a/packages/core/src/resources/index.ts b/packages/core/src/resources/index.ts index 437f3f4f..e2da9789 100644 --- a/packages/core/src/resources/index.ts +++ b/packages/core/src/resources/index.ts @@ -43,6 +43,7 @@ export * from './PyPI'; export * from './RubyGems'; export * from './Search'; export * from './SearchAdmin'; +export * from './ServiceAccounts'; export * from './ServiceData'; export * from './SidekiqMetrics'; export * from './SidekiqQueues'; diff --git a/packages/rest/src/index.ts b/packages/rest/src/index.ts index 01d69fcd..428ae1bf 100644 --- a/packages/rest/src/index.ts +++ b/packages/rest/src/index.ts @@ -53,6 +53,7 @@ export const { RubyGems, Search, SearchAdmin, + ServiceAccounts, ServiceData, SidekiqMetrics, SidekiqQueues,