Skip to content

Commit a7db9e4

Browse files
authored
Merge pull request #22 from nextcloud-libraries/ref/share-type
feat: Add `ShareType` enum to replace `Type` with more JS native naming
2 parents e186677 + 3892f2e commit a7db9e4

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

lib/index.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
* SPDX-License-Identifier: CC0-1.0
44
*/
55
import { expect, test } from 'vitest'
6-
import { Type } from '.'
6+
import { ShareType } from '.'
77

88
test('ShareType', () => {
9-
for (const type of Object.values(Type)) {
9+
for (const type of Object.values(ShareType)) {
1010
if (typeof type === 'string') {
1111
// This should be the key of the enum, so we should be able to get the value
1212
// eslint-disable-next-line @typescript-eslint/no-explicit-any
13-
expect((Type as any)[type]).toBeTypeOf('number')
13+
expect((ShareType as any)[type]).toBeTypeOf('number')
1414
} else {
1515
expect(type).toBeTypeOf('number')
16-
expect(Type[type]).toBeTypeOf('string')
16+
expect(ShareType[type]).toBeTypeOf('string')
1717
}
1818
}
1919
})

lib/index.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: GPL-3.0-or-later
4+
*/
5+
6+
/** @deprecated will be removed with the next version use `ShareType` instead */
17
export enum Type {
28
SHARE_TYPE_USER = 0,
39
SHARE_TYPE_GROUP = 1,
@@ -14,3 +20,23 @@ export enum Type {
1420
*/
1521
SHARE_TYPE_FEDERATED_GROUP = 14,
1622
}
23+
24+
export enum ShareType {
25+
User = 0,
26+
Grup = 1,
27+
Link = 3,
28+
Email = 4,
29+
Remote = 6,
30+
/**
31+
* Was called `Circle` before Nextcloud 29
32+
*/
33+
Team = 7,
34+
Guest = 8,
35+
RemoteGroup = 9,
36+
Room = 10,
37+
Deck = 12,
38+
/**
39+
* @since 26.0.0
40+
*/
41+
FederatedGroup = 14,
42+
}

0 commit comments

Comments
 (0)