[full-ci] chore: [OCISDEV-1412] remove the readOnly workaround from the libre-graph client generation (#12956)
* chore: [OCISDEV-1412] remove the readOnly workaround from the libre-graph client generation The client generation stripped every `readOnly: true` line from the spec before running the generator, because the typescript-fetch templates leave read-only fields out of the serializers they emit and a few fields oCIS does accept on write were annotated read-only. Stripping them all also unmarked the fields that genuinely are response-only. The annotations are corrected upstream now, so the generator runs on the spec as published. Everything oCIS writes is still serialized: the drive quota total, the drive type, a space image and readme, the hidden flag and remote item of a drive item, and the fields of a sharing permission. Response-only fields such as the computed quota values are now typed read-only, which the handful of places that assigned to them had to be adjusted for. * chore: [OCISDEV-1412] regenerate the libre-graph client after the driveType split drive now declares its own writable driveType while driveUpdate marks it readOnly, so updateDrive no longer accepts a value the server rejects. * fix: [OCISDEV-1412] keep the special folder id in the drive update body Setting a space image or readme patches the drive with the id of an existing item under special. driveItem.id was marked readOnly in the spec, so the generated serializer dropped it and the server skipped the entry: the request returned 200 and did nothing, which the e2e space image test caught as a timeout waiting for the image to load. The annotation is gone from the spec, and updateDrive now has tests asserting the serialized body, since neither type checking nor a mocked call notices a field that quietly disappears. * fix: [OCISDEV-1412] regenerate after splitting the drive special folder schema An update to a drive assigns its special folders by referencing existing items by id. Upstream now models that with a dedicated schema instead of reusing the response-only drive item, so the update body keeps the id while the drive item itself is read-only again. The wrapper around the generated client typed the update body as a drive rather than a drive update, which no longer holds now that the two differ in how they describe the special folders.
This commit is contained in:
1 parent
1ba86e6437
commit
e1a0f3a1b2
46 files changed
+295
-208
No files matched your search
@@ -150,7 +150,12 @@ const eventBus = useEventBus()
|
||||
const { showErrorMessage } = useMessages()
|
||||
const { $gettext } = useGettext()
|
||||
|
||||
let editUser: MaybeRef<User> = ref()
|
||||
// A local draft of the user the form edits. Properties the graph API only ever returns,
|
||||
// such as `memberOf`, are still editable here: the dialog diffs the draft against the
|
||||
// user on confirm and applies those changes through their own endpoints.
|
||||
type UserDraft = { -readonly [K in keyof User]: User[K] }
|
||||
|
||||
let editUser: MaybeRef<UserDraft> = ref()
|
||||
const formData = ref({
|
||||
displayName: {
|
||||
errorMessage: '',
|
||||
|
||||
@@ -3,14 +3,13 @@ set -eu
|
||||
|
||||
# Regenerates the libre-graph client under src/graph/generated.
|
||||
#
|
||||
# The spec marks many fields `readOnly: true`, including every field of `Quota` and the
|
||||
# `parentReference` identifiers. The typescript-fetch templates take that literally: they
|
||||
# emit `readonly` modifiers and, more importantly, omit those fields from the generated
|
||||
# `*ToJSON` serializers, so a PATCH body such as `{ quota: { total: 500 } }` would go out
|
||||
# as `{ quota: {} }`. oCIS does accept these fields on write, so the annotation is stripped
|
||||
# from the spec before generating.
|
||||
# `readOnly: true` in the spec is load-bearing here: the typescript-fetch templates omit
|
||||
# those fields from the generated `*ToJSON` serializers, so a field that oCIS does accept
|
||||
# on write but that the spec marks read-only is silently dropped from the request body.
|
||||
# Note that a `readOnly` next to a `$ref` has no effect (OpenAPI 3.0 ignores siblings of
|
||||
# `$ref`) — what propagates is the annotation on the referenced schema itself.
|
||||
#
|
||||
# oCIS also returns a field the spec does not declare: `attributes` on users, added by
|
||||
# oCIS returns a field the spec does not declare: `attributes` on users, added by
|
||||
# `UserWithAttributes` in services/graph and filled from
|
||||
# OCIS_USER_SEARCH_DISPLAYED_ATTRIBUTES. The typescript-fetch templates rebuild every
|
||||
# response from the declared fields only, so an undeclared field is dropped during decoding.
|
||||
@@ -31,7 +30,6 @@ trap cleanup EXIT
|
||||
|
||||
rm -rf "$GRAPH_DIR/generated"
|
||||
curl -sSfL "$SPEC_URL" \
|
||||
| sed '/^ *readOnly: true$/d' \
|
||||
| awk -v anchor="$USER_ALL_OF_LINE" '
|
||||
{ print }
|
||||
$0 == anchor {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ShareRole, SpaceResource } from '../../helpers'
|
||||
import type { Drive } from '../generated'
|
||||
import type { Drive, DriveUpdate } from '../generated'
|
||||
import type { GraphRequestOptions } from '../types'
|
||||
|
||||
export interface GraphDrives {
|
||||
@@ -15,7 +15,7 @@ export interface GraphDrives {
|
||||
) => Promise<SpaceResource>
|
||||
updateDrive: (
|
||||
id: string,
|
||||
data: Drive,
|
||||
data: DriveUpdate,
|
||||
graphRoles: Record<string, ShareRole>,
|
||||
requestOptions?: GraphRequestOptions
|
||||
) => Promise<SpaceResource>
|
||||
|
||||
@@ -112,6 +112,7 @@ docs/SharingLink.md
|
||||
docs/SharingLinkPassword.md
|
||||
docs/SharingLinkType.md
|
||||
docs/SignInActivity.md
|
||||
docs/SpecialDriveItemUpdate.md
|
||||
docs/SpecialFolder.md
|
||||
docs/TagAssignment.md
|
||||
docs/TagUnassignment.md
|
||||
@@ -196,6 +197,7 @@ models/SharingLink.ts
|
||||
models/SharingLinkPassword.ts
|
||||
models/SharingLinkType.ts
|
||||
models/SignInActivity.ts
|
||||
models/SpecialDriveItemUpdate.ts
|
||||
models/SpecialFolder.ts
|
||||
models/TagAssignment.ts
|
||||
models/TagUnassignment.ts
|
||||
|
||||
@@ -58,7 +58,7 @@ export interface UpdateDriveItemRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
driveItem: DriveItem;
|
||||
driveItem: Omit<DriveItem, 'id'|'createdDateTime'|'eTag'|'lastModifiedDateTime'|'webUrl'|'cTag'|'size'|'webDavUrl'|'children'|'permissions'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -87,7 +87,7 @@ export interface UpdateDriveRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
driveUpdate: DriveUpdate;
|
||||
driveUpdate: Omit<DriveUpdate, 'id'|'createdDateTime'|'eTag'|'lastModifiedDateTime'|'webUrl'|'driveType'|'items'>;
|
||||
}
|
||||
|
||||
export interface UpdateDriveBetaRequest {
|
||||
@@ -98,7 +98,7 @@ export interface UpdateDriveBetaRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
driveUpdate: DriveUpdate;
|
||||
driveUpdate: Omit<DriveUpdate, 'id'|'createdDateTime'|'eTag'|'lastModifiedDateTime'|'webUrl'|'driveType'|'items'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -163,7 +163,7 @@ export interface UpdatePermissionRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
permission: Permission;
|
||||
permission: Omit<Permission, 'id'|'hasPassword'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,7 +62,7 @@ export interface CreateDriveItemRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
driveItem?: DriveItem;
|
||||
driveItem?: Omit<DriveItem, 'id'|'createdDateTime'|'eTag'|'lastModifiedDateTime'|'webUrl'|'cTag'|'size'|'webDavUrl'|'children'|'permissions'>;
|
||||
}
|
||||
|
||||
export interface CreateLinkSpaceRootRequest {
|
||||
@@ -158,7 +158,7 @@ export interface UpdatePermissionSpaceRootRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
permission: Permission;
|
||||
permission: Omit<Permission, 'id'|'hasPassword'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,7 +54,7 @@ export interface CreateClassRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
educationClass: EducationClass;
|
||||
educationClass: Omit<EducationClass, 'id'>;
|
||||
}
|
||||
|
||||
export interface DeleteClassRequest {
|
||||
@@ -97,7 +97,7 @@ export interface UpdateClassRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
educationClass: EducationClass;
|
||||
educationClass: Omit<EducationClass, 'id'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,7 +75,7 @@ export interface CreateSchoolRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
educationSchool: EducationSchool;
|
||||
educationSchool: Omit<EducationSchool, 'id'>;
|
||||
}
|
||||
|
||||
export interface DeleteClassFromSchoolRequest {
|
||||
@@ -136,7 +136,7 @@ export interface UpdateSchoolRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
educationSchool: EducationSchool;
|
||||
educationSchool: Omit<EducationSchool, 'id'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,7 @@ export interface CreateEducationUserRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
educationUser: EducationUser;
|
||||
educationUser: Omit<EducationUser, 'id'|'drives'>;
|
||||
}
|
||||
|
||||
export interface DeleteEducationUserRequest {
|
||||
@@ -73,7 +73,7 @@ export interface UpdateEducationUserRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
educationUser: EducationUser;
|
||||
educationUser: Omit<EducationUser, 'id'|'drives'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,7 +101,7 @@ export interface UpdateGroupRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
group: Group;
|
||||
group: Omit<Group, 'id'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,7 @@ export interface CreateGroupRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
group: Group;
|
||||
group: Omit<Group, 'id'>;
|
||||
}
|
||||
|
||||
export interface ListGroupsRequest {
|
||||
|
||||
@@ -40,7 +40,7 @@ export interface UpdateOwnUserRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
userUpdate?: UserUpdate;
|
||||
userUpdate?: Omit<UserUpdate, 'id'|'appRoleAssignments'|'drives'|'memberOf'|'userType'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,7 +79,7 @@ export interface UpdateUserRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
userUpdate: UserUpdate;
|
||||
userUpdate: Omit<UserUpdate, 'id'|'appRoleAssignments'|'drives'|'memberOf'|'userType'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,7 @@ export interface UserCreateAppRoleAssignmentsRequest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
appRoleAssignment: AppRoleAssignment;
|
||||
appRoleAssignment: Omit<AppRoleAssignment, 'id'>;
|
||||
}
|
||||
|
||||
export interface UserDeleteAppRoleAssignmentsRequest {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
# DriveItem
|
||||
|
||||
Represents a resource inside a drive. Read-only.
|
||||
Represents a resource inside a drive. Most properties are read-only, but the schema is also used as a request body, see the individual properties.
|
||||
|
||||
## Properties
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Name | Type
|
||||
`quota` | [Quota](Quota.md)
|
||||
`items` | [Array<DriveItem>](DriveItem.md)
|
||||
`root` | [DriveItem](DriveItem.md)
|
||||
`special` | [Array<DriveItem>](DriveItem.md)
|
||||
`special` | [Array<SpecialDriveItemUpdate>](SpecialDriveItemUpdate.md)
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
# Quota
|
||||
|
||||
Optional. Information about the drive\'s storage space quota. Read-only.
|
||||
Optional. Information about the drive\'s storage space quota. Only `total` is writable, the other properties are computed by the server and read-only.
|
||||
|
||||
## Properties
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
# SpecialDriveItemUpdate
|
||||
|
||||
References an existing item inside a drive to be assigned as one of the drive\'s special resources, such as its image or readme.
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type
|
||||
------------ | -------------
|
||||
`id` | string
|
||||
`specialFolder` | [SpecialFolder](SpecialFolder.md)
|
||||
|
||||
## Example
|
||||
|
||||
```typescript
|
||||
import type { SpecialDriveItemUpdate } from ''
|
||||
|
||||
// TODO: Update the object below with actual values
|
||||
const example = {
|
||||
"id": null,
|
||||
"specialFolder": null,
|
||||
} satisfies SpecialDriveItemUpdate
|
||||
|
||||
console.log(example)
|
||||
|
||||
// Convert the instance to a JSON string
|
||||
const exampleJSON: string = JSON.stringify(example)
|
||||
console.log(exampleJSON)
|
||||
|
||||
// Parse the JSON string back to an object
|
||||
const exampleParsed = JSON.parse(exampleJSON) as SpecialDriveItemUpdate
|
||||
console.log(exampleParsed)
|
||||
```
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
# SpecialFolder
|
||||
|
||||
If the current item is also available as a special folder, this facet is returned. Read-only
|
||||
If the current item is also available as a special folder, this facet is returned.
|
||||
|
||||
## Properties
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ export interface AppRoleAssignment {
|
||||
/**
|
||||
* The unique identifier for the object. 12345678-9abc-def0-1234-56789abcde. The value of the ID property is often, but not exclusively, in the form of a GUID. The value should be treated as an opaque identifier and not based in being a GUID. Null values are not allowed. Read-only.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -93,14 +93,13 @@ export function AppRoleAssignmentToJSON(json: any): AppRoleAssignment {
|
||||
return AppRoleAssignmentToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function AppRoleAssignmentToJSONTyped(value?: AppRoleAssignment | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function AppRoleAssignmentToJSONTyped(value?: Omit<AppRoleAssignment, 'id'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'deletedDateTime': value['deletedDateTime'],
|
||||
'appRoleId': value['appRoleId'],
|
||||
'createdDateTime': value['createdDateTime'],
|
||||
|
||||
@@ -30,7 +30,7 @@ export interface Application {
|
||||
/**
|
||||
* The unique identifier for the object. 12345678-9abc-def0-1234-56789abcde. The value of the ID property is often, but not exclusively, in the form of a GUID. The value should be treated as an opaque identifier and not based in being a GUID. Null values are not allowed. Read-only.
|
||||
*/
|
||||
id: string;
|
||||
readonly id: string;
|
||||
/**
|
||||
* The collection of roles defined for the application. With app role assignments, these roles can be assigned to users, groups, or service principals associated with other applications. Not nullable.
|
||||
*/
|
||||
@@ -69,14 +69,13 @@ export function ApplicationToJSON(json: any): Application {
|
||||
return ApplicationToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function ApplicationToJSONTyped(value?: Application | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function ApplicationToJSONTyped(value?: Omit<Application, 'id'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'appRoles': value['appRoles'] == null ? undefined : ((value['appRoles'] as Array<any>).map(AppRoleToJSON)),
|
||||
'displayName': value['displayName'],
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@ export interface Drive {
|
||||
/**
|
||||
* The unique identifier for this drive.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ export interface Drive {
|
||||
/**
|
||||
* Date and time of item creation. Read-only.
|
||||
*/
|
||||
createdDateTime?: string;
|
||||
readonly createdDateTime?: string;
|
||||
/**
|
||||
* Provides a user-visible description of the item. Optional.
|
||||
*/
|
||||
@@ -67,7 +67,7 @@ export interface Drive {
|
||||
/**
|
||||
* ETag for the item. Read-only.
|
||||
*/
|
||||
eTag?: string;
|
||||
readonly eTag?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -75,7 +75,7 @@ export interface Drive {
|
||||
/**
|
||||
* Date and time the item was last modified. Read-only.
|
||||
*/
|
||||
lastModifiedDateTime?: string;
|
||||
readonly lastModifiedDateTime?: string;
|
||||
/**
|
||||
* The name of the item. Read-write.
|
||||
*/
|
||||
@@ -87,9 +87,9 @@ export interface Drive {
|
||||
/**
|
||||
* URL that displays the resource in the browser. Read-only.
|
||||
*/
|
||||
webUrl?: string;
|
||||
readonly webUrl?: string;
|
||||
/**
|
||||
* Describes the type of drive represented by this resource. Values are "personal" for users home spaces, "project", "virtual" or "share". Read-only.
|
||||
* Describes the type of drive represented by this resource. Values are "personal" for users home spaces, "project", "virtual" or "share". Read-write on create, read-only afterwards, see the `driveUpdate` schema.
|
||||
*/
|
||||
driveType?: string;
|
||||
/**
|
||||
@@ -107,15 +107,15 @@ export interface Drive {
|
||||
/**
|
||||
* All items contained in the drive. Read-only. Nullable.
|
||||
*/
|
||||
items?: Array<DriveItem>;
|
||||
readonly items?: Array<DriveItem>;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
root?: DriveItem;
|
||||
/**
|
||||
* A collection of special drive resources.
|
||||
* A collection of special drive resources. Read-only, see the `driveUpdate` schema for assigning them.
|
||||
*/
|
||||
special?: Array<DriveItem>;
|
||||
readonly special?: Array<DriveItem>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,30 +160,23 @@ export function DriveToJSON(json: any): Drive {
|
||||
return DriveToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function DriveToJSONTyped(value?: Drive | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function DriveToJSONTyped(value?: Omit<Drive, 'id'|'createdDateTime'|'eTag'|'lastModifiedDateTime'|'webUrl'|'items'|'special'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'createdBy': IdentitySetToJSON(value['createdBy']),
|
||||
'createdDateTime': value['createdDateTime'],
|
||||
'description': value['description'],
|
||||
'eTag': value['eTag'],
|
||||
'lastModifiedBy': IdentitySetToJSON(value['lastModifiedBy']),
|
||||
'lastModifiedDateTime': value['lastModifiedDateTime'],
|
||||
'name': value['name'],
|
||||
'parentReference': ItemReferenceToJSON(value['parentReference']),
|
||||
'webUrl': value['webUrl'],
|
||||
'driveType': value['driveType'],
|
||||
'driveAlias': value['driveAlias'],
|
||||
'owner': IdentitySetToJSON(value['owner']),
|
||||
'quota': QuotaToJSON(value['quota']),
|
||||
'items': value['items'] == null ? undefined : ((value['items'] as Array<any>).map(DriveItemToJSON)),
|
||||
'root': DriveItemToJSON(value['root']),
|
||||
'special': value['special'] == null ? undefined : ((value['special'] as Array<any>).map(DriveItemToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ import {
|
||||
} from './SpecialFolder';
|
||||
|
||||
/**
|
||||
* Represents a resource inside a drive. Read-only.
|
||||
* Represents a resource inside a drive. Most properties are read-only, but the schema is also used as a request body, see the individual properties.
|
||||
* @export
|
||||
* @interface DriveItem
|
||||
*/
|
||||
@@ -135,7 +135,7 @@ export interface DriveItem {
|
||||
/**
|
||||
* Read-only.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -143,7 +143,7 @@ export interface DriveItem {
|
||||
/**
|
||||
* Date and time of item creation. Read-only.
|
||||
*/
|
||||
createdDateTime?: string;
|
||||
readonly createdDateTime?: string;
|
||||
/**
|
||||
* Provides a user-visible description of the item. Optional.
|
||||
*/
|
||||
@@ -151,7 +151,7 @@ export interface DriveItem {
|
||||
/**
|
||||
* ETag for the item. Read-only.
|
||||
*/
|
||||
eTag?: string;
|
||||
readonly eTag?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -159,7 +159,7 @@ export interface DriveItem {
|
||||
/**
|
||||
* Date and time the item was last modified. Read-only.
|
||||
*/
|
||||
lastModifiedDateTime?: string;
|
||||
readonly lastModifiedDateTime?: string;
|
||||
/**
|
||||
* The name of the item. Read-write.
|
||||
*/
|
||||
@@ -171,7 +171,7 @@ export interface DriveItem {
|
||||
/**
|
||||
* URL that displays the resource in the browser. Read-only.
|
||||
*/
|
||||
webUrl?: string;
|
||||
readonly webUrl?: string;
|
||||
/**
|
||||
* The content stream, if the item represents a file.
|
||||
*/
|
||||
@@ -179,7 +179,7 @@ export interface DriveItem {
|
||||
/**
|
||||
* An eTag for the content of the item. This eTag is not changed if only the metadata is changed. Note This property is not returned if the item is a folder. Read-only.
|
||||
*/
|
||||
cTag?: string;
|
||||
readonly cTag?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -231,19 +231,19 @@ export interface DriveItem {
|
||||
/**
|
||||
* Size of the item in bytes. Read-only.
|
||||
*/
|
||||
size?: number;
|
||||
readonly size?: number;
|
||||
/**
|
||||
* WebDAV compatible URL for the item. Read-only.
|
||||
*/
|
||||
webDavUrl?: string;
|
||||
readonly webDavUrl?: string;
|
||||
/**
|
||||
* Collection containing Item objects for the immediate children of Item. Only items representing folders have children. Read-only. Nullable.
|
||||
*/
|
||||
children?: Array<DriveItem>;
|
||||
readonly children?: Array<DriveItem>;
|
||||
/**
|
||||
* The set of permissions for the item. Read-only. Nullable.
|
||||
*/
|
||||
permissions?: Array<Permission>;
|
||||
readonly permissions?: Array<Permission>;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -318,25 +318,19 @@ export function DriveItemToJSON(json: any): DriveItem {
|
||||
return DriveItemToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function DriveItemToJSONTyped(value?: DriveItem | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function DriveItemToJSONTyped(value?: Omit<DriveItem, 'id'|'createdDateTime'|'eTag'|'lastModifiedDateTime'|'webUrl'|'cTag'|'size'|'webDavUrl'|'children'|'permissions'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'createdBy': IdentitySetToJSON(value['createdBy']),
|
||||
'createdDateTime': value['createdDateTime'],
|
||||
'description': value['description'],
|
||||
'eTag': value['eTag'],
|
||||
'lastModifiedBy': IdentitySetToJSON(value['lastModifiedBy']),
|
||||
'lastModifiedDateTime': value['lastModifiedDateTime'],
|
||||
'name': value['name'],
|
||||
'parentReference': ItemReferenceToJSON(value['parentReference']),
|
||||
'webUrl': value['webUrl'],
|
||||
'content': value['content'],
|
||||
'cTag': value['cTag'],
|
||||
'deleted': DeletedToJSON(value['deleted']),
|
||||
'file': OpenGraphFileToJSON(value['file']),
|
||||
'fileSystemInfo': FileSystemInfoToJSON(value['fileSystemInfo']),
|
||||
@@ -349,10 +343,6 @@ export function DriveItemToJSONTyped(value?: DriveItem | null, ignoreDiscriminat
|
||||
'trash': TrashToJSON(value['trash']),
|
||||
'specialFolder': SpecialFolderToJSON(value['specialFolder']),
|
||||
'remoteItem': RemoteItemToJSON(value['remoteItem']),
|
||||
'size': value['size'],
|
||||
'webDavUrl': value['webDavUrl'],
|
||||
'children': value['children'] == null ? undefined : ((value['children'] as Array<any>).map(DriveItemToJSON)),
|
||||
'permissions': value['permissions'] == null ? undefined : ((value['permissions'] as Array<any>).map(PermissionToJSON)),
|
||||
'audio': AudioToJSON(value['audio']),
|
||||
'video': VideoToJSON(value['video']),
|
||||
'@client.synchronize': value['atClientSynchronize'],
|
||||
|
||||
@@ -20,6 +20,13 @@ import {
|
||||
ItemReferenceToJSON,
|
||||
ItemReferenceToJSONTyped,
|
||||
} from './ItemReference';
|
||||
import type { SpecialDriveItemUpdate } from './SpecialDriveItemUpdate';
|
||||
import {
|
||||
SpecialDriveItemUpdateFromJSON,
|
||||
SpecialDriveItemUpdateFromJSONTyped,
|
||||
SpecialDriveItemUpdateToJSON,
|
||||
SpecialDriveItemUpdateToJSONTyped,
|
||||
} from './SpecialDriveItemUpdate';
|
||||
import type { DriveItem } from './DriveItem';
|
||||
import {
|
||||
DriveItemFromJSON,
|
||||
@@ -51,7 +58,7 @@ export interface DriveUpdate {
|
||||
/**
|
||||
* The unique identifier for this drive.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -59,7 +66,7 @@ export interface DriveUpdate {
|
||||
/**
|
||||
* Date and time of item creation. Read-only.
|
||||
*/
|
||||
createdDateTime?: string;
|
||||
readonly createdDateTime?: string;
|
||||
/**
|
||||
* Provides a user-visible description of the item. Optional.
|
||||
*/
|
||||
@@ -67,7 +74,7 @@ export interface DriveUpdate {
|
||||
/**
|
||||
* ETag for the item. Read-only.
|
||||
*/
|
||||
eTag?: string;
|
||||
readonly eTag?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -75,7 +82,7 @@ export interface DriveUpdate {
|
||||
/**
|
||||
* Date and time the item was last modified. Read-only.
|
||||
*/
|
||||
lastModifiedDateTime?: string;
|
||||
readonly lastModifiedDateTime?: string;
|
||||
/**
|
||||
* The name of the item. Read-write.
|
||||
*/
|
||||
@@ -87,11 +94,11 @@ export interface DriveUpdate {
|
||||
/**
|
||||
* URL that displays the resource in the browser. Read-only.
|
||||
*/
|
||||
webUrl?: string;
|
||||
readonly webUrl?: string;
|
||||
/**
|
||||
* Describes the type of drive represented by this resource. Values are "personal" for users home spaces, "project", "virtual" or "share". Read-only.
|
||||
* Describes the type of drive represented by this resource. Values are "personal" for users home spaces, "project", "virtual" or "share". Read-only, see the `drive` schema for creating a drive.
|
||||
*/
|
||||
driveType?: string;
|
||||
readonly driveType?: string;
|
||||
/**
|
||||
* The drive alias can be used in clients to make the urls user friendly. Example: 'personal/einstein'. This will be used to resolve to the correct driveID.
|
||||
*/
|
||||
@@ -107,15 +114,15 @@ export interface DriveUpdate {
|
||||
/**
|
||||
* All items contained in the drive. Read-only. Nullable.
|
||||
*/
|
||||
items?: Array<DriveItem>;
|
||||
readonly items?: Array<DriveItem>;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
root?: DriveItem;
|
||||
/**
|
||||
* A collection of special drive resources.
|
||||
* A collection of special drive resources. See the `drive` schema for the resources returned by the server.
|
||||
*/
|
||||
special?: Array<DriveItem>;
|
||||
special?: Array<SpecialDriveItemUpdate>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +158,7 @@ export function DriveUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean
|
||||
'quota': json['quota'] == null ? undefined : QuotaFromJSON(json['quota']),
|
||||
'items': json['items'] == null ? undefined : ((json['items'] as Array<any>).map(DriveItemFromJSON)),
|
||||
'root': json['root'] == null ? undefined : DriveItemFromJSON(json['root']),
|
||||
'special': json['special'] == null ? undefined : ((json['special'] as Array<any>).map(DriveItemFromJSON)),
|
||||
'special': json['special'] == null ? undefined : ((json['special'] as Array<any>).map(SpecialDriveItemUpdateFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -159,30 +166,23 @@ export function DriveUpdateToJSON(json: any): DriveUpdate {
|
||||
return DriveUpdateToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function DriveUpdateToJSONTyped(value?: DriveUpdate | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function DriveUpdateToJSONTyped(value?: Omit<DriveUpdate, 'id'|'createdDateTime'|'eTag'|'lastModifiedDateTime'|'webUrl'|'driveType'|'items'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'createdBy': IdentitySetToJSON(value['createdBy']),
|
||||
'createdDateTime': value['createdDateTime'],
|
||||
'description': value['description'],
|
||||
'eTag': value['eTag'],
|
||||
'lastModifiedBy': IdentitySetToJSON(value['lastModifiedBy']),
|
||||
'lastModifiedDateTime': value['lastModifiedDateTime'],
|
||||
'name': value['name'],
|
||||
'parentReference': ItemReferenceToJSON(value['parentReference']),
|
||||
'webUrl': value['webUrl'],
|
||||
'driveType': value['driveType'],
|
||||
'driveAlias': value['driveAlias'],
|
||||
'owner': IdentitySetToJSON(value['owner']),
|
||||
'quota': QuotaToJSON(value['quota']),
|
||||
'items': value['items'] == null ? undefined : ((value['items'] as Array<any>).map(DriveItemToJSON)),
|
||||
'root': DriveItemToJSON(value['root']),
|
||||
'special': value['special'] == null ? undefined : ((value['special'] as Array<any>).map(DriveItemToJSON)),
|
||||
'special': value['special'] == null ? undefined : ((value['special'] as Array<any>).map(SpecialDriveItemUpdateToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export interface EducationClass {
|
||||
/**
|
||||
* Read-only.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
* An optional description for the group. Returned by default.
|
||||
*/
|
||||
@@ -99,14 +99,13 @@ export function EducationClassToJSON(json: any): EducationClass {
|
||||
return EducationClassToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function EducationClassToJSONTyped(value?: EducationClass | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function EducationClassToJSONTyped(value?: Omit<EducationClass, 'id'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'description': value['description'],
|
||||
'displayName': value['displayName'],
|
||||
'members': value['members'] == null ? undefined : ((value['members'] as Array<any>).map(UserToJSON)),
|
||||
|
||||
@@ -22,7 +22,7 @@ export interface EducationSchool {
|
||||
/**
|
||||
* The unique identifier for an entity. Read-only.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
* The organization name
|
||||
*/
|
||||
@@ -65,14 +65,13 @@ export function EducationSchoolToJSON(json: any): EducationSchool {
|
||||
return EducationSchoolToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function EducationSchoolToJSONTyped(value?: EducationSchool | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function EducationSchoolToJSONTyped(value?: Omit<EducationSchool, 'id'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'displayName': value['displayName'],
|
||||
'schoolNumber': value['schoolNumber'],
|
||||
'terminationDate': value['terminationDate'],
|
||||
|
||||
@@ -51,7 +51,7 @@ export interface EducationUser {
|
||||
/**
|
||||
* Read-only.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
* Set to "true" when the account is enabled.
|
||||
*/
|
||||
@@ -63,7 +63,7 @@ export interface EducationUser {
|
||||
/**
|
||||
* A collection of drives available for this user. Read-only.
|
||||
*/
|
||||
drives?: Array<Drive>;
|
||||
readonly drives?: Array<Drive>;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -149,17 +149,15 @@ export function EducationUserToJSON(json: any): EducationUser {
|
||||
return EducationUserToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function EducationUserToJSONTyped(value?: EducationUser | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function EducationUserToJSONTyped(value?: Omit<EducationUser, 'id'|'drives'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'accountEnabled': value['accountEnabled'],
|
||||
'displayName': value['displayName'],
|
||||
'drives': value['drives'] == null ? undefined : ((value['drives'] as Array<any>).map(DriveToJSON)),
|
||||
'drive': DriveToJSON(value['drive']),
|
||||
'identities': value['identities'] == null ? undefined : ((value['identities'] as Array<any>).map(ObjectIdentityToJSON)),
|
||||
'mail': value['mail'],
|
||||
|
||||
@@ -30,7 +30,7 @@ export interface Group {
|
||||
/**
|
||||
* Read-only.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
* An optional description for the group. Returned by default.
|
||||
*/
|
||||
@@ -83,14 +83,13 @@ export function GroupToJSON(json: any): Group {
|
||||
return GroupToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function GroupToJSONTyped(value?: Group | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function GroupToJSONTyped(value?: Omit<Group, 'id'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'description': value['description'],
|
||||
'displayName': value['displayName'],
|
||||
'groupTypes': value['groupTypes'],
|
||||
|
||||
@@ -22,11 +22,11 @@ export interface Image {
|
||||
/**
|
||||
* Optional. Height of the image, in pixels. Read-only.
|
||||
*/
|
||||
height?: number;
|
||||
readonly height?: number;
|
||||
/**
|
||||
* Optional. Width of the image, in pixels. Read-only.
|
||||
*/
|
||||
width?: number;
|
||||
readonly width?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,15 +55,13 @@ export function ImageToJSON(json: any): Image {
|
||||
return ImageToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function ImageToJSONTyped(value?: Image | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function ImageToJSONTyped(value?: Omit<Image, 'height'|'width'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'height': value['height'],
|
||||
'width': value['width'],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -22,23 +22,23 @@ export interface ItemReference {
|
||||
/**
|
||||
* Unique identifier of the drive instance that contains the item. Read-only.
|
||||
*/
|
||||
driveId?: string;
|
||||
readonly driveId?: string;
|
||||
/**
|
||||
* Identifies the type of drive. See [drive][] resource for values. Read-only.
|
||||
*/
|
||||
driveType?: string;
|
||||
readonly driveType?: string;
|
||||
/**
|
||||
* Unique identifier of the item in the drive. Read-only.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
* The name of the item being referenced. Read-only.
|
||||
*/
|
||||
name?: string;
|
||||
readonly name?: string;
|
||||
/**
|
||||
* Path that can be used to navigate to the item. Read-only.
|
||||
*/
|
||||
path?: string;
|
||||
readonly path?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,18 +70,13 @@ export function ItemReferenceToJSON(json: any): ItemReference {
|
||||
return ItemReferenceToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function ItemReferenceToJSONTyped(value?: ItemReference | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function ItemReferenceToJSONTyped(value?: Omit<ItemReference, 'driveId'|'driveType'|'id'|'name'|'path'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'driveId': value['driveId'],
|
||||
'driveType': value['driveType'],
|
||||
'id': value['id'],
|
||||
'name': value['name'],
|
||||
'path': value['path'],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export interface OpenGraphFile {
|
||||
/**
|
||||
* The MIME type for the file. This is determined by logic on the server and might not be the value provided when the file was uploaded. Read-only.
|
||||
*/
|
||||
mimeType?: string;
|
||||
readonly mimeType?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -68,7 +68,7 @@ export function OpenGraphFileToJSON(json: any): OpenGraphFile {
|
||||
return OpenGraphFileToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function OpenGraphFileToJSONTyped(value?: OpenGraphFile | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function OpenGraphFileToJSONTyped(value?: Omit<OpenGraphFile, 'mimeType'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
@@ -76,7 +76,6 @@ export function OpenGraphFileToJSONTyped(value?: OpenGraphFile | null, ignoreDis
|
||||
return {
|
||||
|
||||
'hashes': HashesToJSON(value['hashes']),
|
||||
'mimeType': value['mimeType'],
|
||||
'processingMetadata': value['processingMetadata'],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -60,13 +60,13 @@ export interface Permission {
|
||||
/**
|
||||
* The unique identifier of the permission among all permissions on the item. Read-only.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
* Indicates whether the password is set for this permission. This property only
|
||||
* appears in the response. Optional. Read-only.
|
||||
*
|
||||
*/
|
||||
hasPassword?: boolean;
|
||||
readonly hasPassword?: boolean;
|
||||
/**
|
||||
* An optional expiration date which limits the permission in time.
|
||||
*/
|
||||
@@ -136,15 +136,13 @@ export function PermissionToJSON(json: any): Permission {
|
||||
return PermissionToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PermissionToJSONTyped(value?: Permission | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function PermissionToJSONTyped(value?: Omit<Permission, 'id'|'hasPassword'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'hasPassword': value['hasPassword'],
|
||||
'expirationDateTime': value['expirationDateTime'],
|
||||
'createdDateTime': value['createdDateTime'],
|
||||
'grantedToV2': SharePointIdentitySetToJSON(value['grantedToV2']),
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* Optional. Information about the drive's storage space quota. Read-only.
|
||||
* Optional. Information about the drive's storage space quota. Only `total` is writable, the other properties are computed by the server and read-only.
|
||||
* @export
|
||||
* @interface Quota
|
||||
*/
|
||||
@@ -22,23 +22,23 @@ export interface Quota {
|
||||
/**
|
||||
* Total space consumed by files in the recycle bin, in bytes. Read-only.
|
||||
*/
|
||||
deleted?: number;
|
||||
readonly deleted?: number;
|
||||
/**
|
||||
* Total space remaining before reaching the quota limit, in bytes. Read-only.
|
||||
*/
|
||||
remaining?: number;
|
||||
readonly remaining?: number;
|
||||
/**
|
||||
* Enumeration value that indicates the state of the storage space. Either "normal", "nearing", "critical" or "exceeded". Read-only.
|
||||
*/
|
||||
state?: string;
|
||||
readonly state?: string;
|
||||
/**
|
||||
* Total allowed storage space, in bytes. Read-only.
|
||||
* Total allowed storage space, in bytes. Read-write.
|
||||
*/
|
||||
total?: number;
|
||||
/**
|
||||
* Total space used, in bytes. Read-only.
|
||||
*/
|
||||
used?: number;
|
||||
readonly used?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,18 +70,14 @@ export function QuotaToJSON(json: any): Quota {
|
||||
return QuotaToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function QuotaToJSONTyped(value?: Quota | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function QuotaToJSONTyped(value?: Omit<Quota, 'deleted'|'remaining'|'state'|'used'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'deleted': value['deleted'],
|
||||
'remaining': value['remaining'],
|
||||
'state': value['state'],
|
||||
'total': value['total'],
|
||||
'used': value['used'],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -131,11 +131,11 @@ export interface RemoteItem {
|
||||
/**
|
||||
* ETag for the item. Read-only.
|
||||
*/
|
||||
eTag?: string;
|
||||
readonly eTag?: string;
|
||||
/**
|
||||
* An eTag for the content of the item. This eTag is not changed if only the metadata is changed. Note This property is not returned if the item is a folder. Read-only.
|
||||
*/
|
||||
cTag?: string;
|
||||
readonly cTag?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -143,7 +143,7 @@ export interface RemoteItem {
|
||||
/**
|
||||
* The set of permissions for the item. Read-only. Nullable.
|
||||
*/
|
||||
permissions?: Array<Permission>;
|
||||
readonly permissions?: Array<Permission>;
|
||||
/**
|
||||
* Size of the remote item. Read-only.
|
||||
*/
|
||||
@@ -212,7 +212,7 @@ export function RemoteItemToJSON(json: any): RemoteItem {
|
||||
return RemoteItemToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function RemoteItemToJSONTyped(value?: RemoteItem | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function RemoteItemToJSONTyped(value?: Omit<RemoteItem, 'eTag'|'cTag'|'permissions'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
@@ -232,10 +232,7 @@ export function RemoteItemToJSONTyped(value?: RemoteItem | null, ignoreDiscrimin
|
||||
'lastModifiedBy': IdentitySetToJSON(value['lastModifiedBy']),
|
||||
'lastModifiedDateTime': value['lastModifiedDateTime'],
|
||||
'name': value['name'],
|
||||
'eTag': value['eTag'],
|
||||
'cTag': value['cTag'],
|
||||
'parentReference': ItemReferenceToJSON(value['parentReference']),
|
||||
'permissions': value['permissions'] == null ? undefined : ((value['permissions'] as Array<any>).map(PermissionToJSON)),
|
||||
'size': value['size'],
|
||||
'specialFolder': SpecialFolderToJSON(value['specialFolder']),
|
||||
'webDavUrl': value['webDavUrl'],
|
||||
|
||||
@@ -37,11 +37,11 @@ export interface SharingLink {
|
||||
/**
|
||||
* If `true` then the user can only use this link to view the item on the web, and cannot use it to download the contents of the item.
|
||||
*/
|
||||
preventsDownload?: boolean;
|
||||
readonly preventsDownload?: boolean;
|
||||
/**
|
||||
* A URL that opens the item in the browser on the website.
|
||||
*/
|
||||
webUrl?: string;
|
||||
readonly webUrl?: string;
|
||||
/**
|
||||
* Provides a user-visible display name of the link. Optional. Libregraph only.
|
||||
*/
|
||||
@@ -83,7 +83,7 @@ export function SharingLinkToJSON(json: any): SharingLink {
|
||||
return SharingLinkToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function SharingLinkToJSONTyped(value?: SharingLink | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function SharingLinkToJSONTyped(value?: Omit<SharingLink, 'preventsDownload'|'webUrl'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
@@ -91,8 +91,6 @@ export function SharingLinkToJSONTyped(value?: SharingLink | null, ignoreDiscrim
|
||||
return {
|
||||
|
||||
'type': SharingLinkTypeToJSON(value['type']),
|
||||
'preventsDownload': value['preventsDownload'],
|
||||
'webUrl': value['webUrl'],
|
||||
'@libre.graph.displayName': value['atLibreGraphDisplayName'],
|
||||
'@libre.graph.quickLink': value['atLibreGraphQuickLink'],
|
||||
};
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Libre Graph API
|
||||
* Libre Graph is a free API for cloud collaboration inspired by the MS Graph API.
|
||||
*
|
||||
* The version of the OpenAPI document: v1.0.4
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { mapValues } from '../runtime';
|
||||
import type { SpecialFolder } from './SpecialFolder';
|
||||
import {
|
||||
SpecialFolderFromJSON,
|
||||
SpecialFolderFromJSONTyped,
|
||||
SpecialFolderToJSON,
|
||||
SpecialFolderToJSONTyped,
|
||||
} from './SpecialFolder';
|
||||
|
||||
/**
|
||||
* References an existing item inside a drive to be assigned as one of the drive's special resources, such as its image or readme.
|
||||
* @export
|
||||
* @interface SpecialDriveItemUpdate
|
||||
*/
|
||||
export interface SpecialDriveItemUpdate {
|
||||
/**
|
||||
* The unique identifier of the item to assign. Read-write.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
specialFolder?: SpecialFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the SpecialDriveItemUpdate interface.
|
||||
*/
|
||||
export function instanceOfSpecialDriveItemUpdate(value: object): value is SpecialDriveItemUpdate {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function SpecialDriveItemUpdateFromJSON(json: any): SpecialDriveItemUpdate {
|
||||
return SpecialDriveItemUpdateFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function SpecialDriveItemUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): SpecialDriveItemUpdate {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'specialFolder': json['specialFolder'] == null ? undefined : SpecialFolderFromJSON(json['specialFolder']),
|
||||
};
|
||||
}
|
||||
|
||||
export function SpecialDriveItemUpdateToJSON(json: any): SpecialDriveItemUpdate {
|
||||
return SpecialDriveItemUpdateToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function SpecialDriveItemUpdateToJSONTyped(value?: SpecialDriveItemUpdate | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'specialFolder': SpecialFolderToJSON(value['specialFolder']),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* If the current item is also available as a special folder, this facet is returned. Read-only
|
||||
* If the current item is also available as a special folder, this facet is returned.
|
||||
* @export
|
||||
* @interface SpecialFolder
|
||||
*/
|
||||
|
||||
@@ -72,7 +72,7 @@ export interface User {
|
||||
/**
|
||||
* Read-only.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
* Set to "true" when the account is enabled.
|
||||
*/
|
||||
@@ -80,7 +80,7 @@ export interface User {
|
||||
/**
|
||||
* The apps and app roles which this user has been assigned.
|
||||
*/
|
||||
appRoleAssignments?: Array<AppRoleAssignment>;
|
||||
readonly appRoleAssignments?: Array<AppRoleAssignment>;
|
||||
/**
|
||||
* The name displayed in the address book for the user. This value is usually the combination of the user's first name, middle initial, and last name. This property is required when a user is created and it cannot be cleared during updates. Returned by default. Supports $orderby.
|
||||
*/
|
||||
@@ -88,7 +88,7 @@ export interface User {
|
||||
/**
|
||||
* A collection of drives available for this user. Read-only.
|
||||
*/
|
||||
drives?: Array<Drive>;
|
||||
readonly drives?: Array<Drive>;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -104,7 +104,7 @@ export interface User {
|
||||
/**
|
||||
* Groups that this user is a member of. HTTP Methods: GET (supported for all groups). Read-only. Nullable. Supports $expand.
|
||||
*/
|
||||
memberOf?: Array<Group>;
|
||||
readonly memberOf?: Array<Group>;
|
||||
/**
|
||||
* Contains the on-premises SAM account name synchronized from the on-premises directory.
|
||||
*/
|
||||
@@ -124,7 +124,7 @@ export interface User {
|
||||
/**
|
||||
* The user`s type. This can be either "Member" for regular user, "Guest" for guest users or "Federated" for users imported from a federated instance.
|
||||
*/
|
||||
userType?: string;
|
||||
readonly userType?: string;
|
||||
/**
|
||||
* Represents the users language setting, ISO-639-1 Code
|
||||
*/
|
||||
@@ -197,27 +197,22 @@ export function UserToJSON(json: any): User {
|
||||
return UserToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function UserToJSONTyped(value?: Omit<User, 'id'|'appRoleAssignments'|'drives'|'memberOf'|'userType'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'accountEnabled': value['accountEnabled'],
|
||||
'appRoleAssignments': value['appRoleAssignments'] == null ? undefined : ((value['appRoleAssignments'] as Array<any>).map(AppRoleAssignmentToJSON)),
|
||||
'displayName': value['displayName'],
|
||||
'drives': value['drives'] == null ? undefined : ((value['drives'] as Array<any>).map(DriveToJSON)),
|
||||
'drive': DriveToJSON(value['drive']),
|
||||
'identities': value['identities'] == null ? undefined : ((value['identities'] as Array<any>).map(ObjectIdentityToJSON)),
|
||||
'mail': value['mail'],
|
||||
'memberOf': value['memberOf'] == null ? undefined : ((value['memberOf'] as Array<any>).map(GroupToJSON)),
|
||||
'onPremisesSamAccountName': value['onPremisesSamAccountName'],
|
||||
'passwordProfile': PasswordProfileToJSON(value['passwordProfile']),
|
||||
'surname': value['surname'],
|
||||
'givenName': value['givenName'],
|
||||
'userType': value['userType'],
|
||||
'preferredLanguage': value['preferredLanguage'],
|
||||
'signInActivity': SignInActivityToJSON(value['signInActivity']),
|
||||
'externalID': value['externalID'],
|
||||
|
||||
@@ -72,7 +72,7 @@ export interface UserUpdate {
|
||||
/**
|
||||
* Read-only.
|
||||
*/
|
||||
id?: string;
|
||||
readonly id?: string;
|
||||
/**
|
||||
* Set to "true" when the account is enabled.
|
||||
*/
|
||||
@@ -80,7 +80,7 @@ export interface UserUpdate {
|
||||
/**
|
||||
* The apps and app roles which this user has been assigned.
|
||||
*/
|
||||
appRoleAssignments?: Array<AppRoleAssignment>;
|
||||
readonly appRoleAssignments?: Array<AppRoleAssignment>;
|
||||
/**
|
||||
* The name displayed in the address book for the user. This value is usually the combination of the user's first name, middle initial, and last name. This property is required when a user is created and it cannot be cleared during updates. Returned by default. Supports $orderby.
|
||||
*/
|
||||
@@ -88,7 +88,7 @@ export interface UserUpdate {
|
||||
/**
|
||||
* A collection of drives available for this user. Read-only.
|
||||
*/
|
||||
drives?: Array<Drive>;
|
||||
readonly drives?: Array<Drive>;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -104,7 +104,7 @@ export interface UserUpdate {
|
||||
/**
|
||||
* Groups that this user is a member of. HTTP Methods: GET (supported for all groups). Read-only. Nullable. Supports $expand.
|
||||
*/
|
||||
memberOf?: Array<Group>;
|
||||
readonly memberOf?: Array<Group>;
|
||||
/**
|
||||
* Contains the on-premises SAM account name synchronized from the on-premises directory.
|
||||
*/
|
||||
@@ -124,7 +124,7 @@ export interface UserUpdate {
|
||||
/**
|
||||
* The user`s type. This can be either "Member" for regular user, "Guest" for guest users or "Federated" for users imported from a federated instance.
|
||||
*/
|
||||
userType?: string;
|
||||
readonly userType?: string;
|
||||
/**
|
||||
* Represents the users language setting, ISO-639-1 Code
|
||||
*/
|
||||
@@ -190,27 +190,22 @@ export function UserUpdateToJSON(json: any): UserUpdate {
|
||||
return UserUpdateToJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function UserUpdateToJSONTyped(value?: UserUpdate | null, ignoreDiscriminator: boolean = false): any {
|
||||
export function UserUpdateToJSONTyped(value?: Omit<UserUpdate, 'id'|'appRoleAssignments'|'drives'|'memberOf'|'userType'> | null, ignoreDiscriminator: boolean = false): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
'id': value['id'],
|
||||
'accountEnabled': value['accountEnabled'],
|
||||
'appRoleAssignments': value['appRoleAssignments'] == null ? undefined : ((value['appRoleAssignments'] as Array<any>).map(AppRoleAssignmentToJSON)),
|
||||
'displayName': value['displayName'],
|
||||
'drives': value['drives'] == null ? undefined : ((value['drives'] as Array<any>).map(DriveToJSON)),
|
||||
'drive': DriveToJSON(value['drive']),
|
||||
'identities': value['identities'] == null ? undefined : ((value['identities'] as Array<any>).map(ObjectIdentityToJSON)),
|
||||
'mail': value['mail'],
|
||||
'memberOf': value['memberOf'] == null ? undefined : ((value['memberOf'] as Array<any>).map(GroupToJSON)),
|
||||
'onPremisesSamAccountName': value['onPremisesSamAccountName'],
|
||||
'passwordProfile': PasswordProfileToJSON(value['passwordProfile']),
|
||||
'surname': value['surname'],
|
||||
'givenName': value['givenName'],
|
||||
'userType': value['userType'],
|
||||
'preferredLanguage': value['preferredLanguage'],
|
||||
'signInActivity': SignInActivityToJSON(value['signInActivity']),
|
||||
'externalID': value['externalID'],
|
||||
|
||||
@@ -68,6 +68,7 @@ export * from './SharingLink';
|
||||
export * from './SharingLinkPassword';
|
||||
export * from './SharingLinkType';
|
||||
export * from './SignInActivity';
|
||||
export * from './SpecialDriveItemUpdate';
|
||||
export * from './SpecialFolder';
|
||||
export * from './TagAssignment';
|
||||
export * from './TagUnassignment';
|
||||
|
||||
@@ -145,11 +145,11 @@ export function buildSpace(
|
||||
spaceReadmeData = data.special.find((el) => el.specialFolder.name === 'readme')
|
||||
|
||||
if (spaceImageData) {
|
||||
spaceImageData.webDavUrl = decodeURI(spaceImageData.webDavUrl)
|
||||
spaceImageData = { ...spaceImageData, webDavUrl: decodeURI(spaceImageData.webDavUrl) }
|
||||
}
|
||||
|
||||
if (spaceReadmeData) {
|
||||
spaceReadmeData.webDavUrl = decodeURI(spaceReadmeData.webDavUrl)
|
||||
spaceReadmeData = { ...spaceReadmeData, webDavUrl: decodeURI(spaceReadmeData.webDavUrl) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,10 @@ describe('graph drives', () => {
|
||||
|
||||
describe('updateDrive', () => {
|
||||
/**
|
||||
* The spec marks every `Quota` field read-only, which the generator honours by omitting
|
||||
* them from its serializers. Without stripping the annotation before generating, the
|
||||
* quota would silently leave as `{}` and the drive would keep its old limit.
|
||||
* A `readOnly: true` in the spec makes the generator omit the field from its serializers,
|
||||
* so a field oCIS does read on write but that the spec marks read-only leaves as `{}` or
|
||||
* disappears entirely — the request still succeeds, it just does nothing. Type checking
|
||||
* cannot catch that, hence these tests assert on the serialized body.
|
||||
*/
|
||||
it('sends the quota in the request body', async () => {
|
||||
await graph('https://host', new FetchClient()).drives.updateDrive(
|
||||
@@ -38,6 +39,17 @@ describe('graph drives', () => {
|
||||
expect(body.quota).toEqual({ total: 500 })
|
||||
})
|
||||
|
||||
it.each(['image', 'readme'])('sends the id of the %s special folder', async (name) => {
|
||||
await graph('https://host', new FetchClient()).drives.updateDrive(
|
||||
drive.id,
|
||||
{ name: drive.name, special: [{ specialFolder: { name }, id: 'file-id' }] },
|
||||
{}
|
||||
)
|
||||
|
||||
const body = JSON.parse(fetchMock.mock.calls[0][1].body)
|
||||
expect(body.special).toEqual([{ specialFolder: { name }, id: 'file-id' }])
|
||||
})
|
||||
|
||||
it('returns the updated quota on the space', async () => {
|
||||
const space = await graph('https://host', new FetchClient()).drives.updateDrive(
|
||||
drive.id,
|
||||
|
||||
@@ -76,7 +76,9 @@ describe('share helper functions', () => {
|
||||
describe('getShareResourceRoles', () => {
|
||||
it("returns all roles from a drive item's permissions that are also included in the graphRoles", () => {
|
||||
const driveItem = mockDeep<DriveItem>()
|
||||
driveItem.remoteItem.permissions = [{ roles: ['1', '2'] }, { roles: ['1', '3'] }]
|
||||
Object.assign(driveItem.remoteItem, {
|
||||
permissions: [{ roles: ['1', '2'] }, { roles: ['1', '3'] }]
|
||||
})
|
||||
const graphRoles = { '1': mock<ShareRole>({ id: '1' }), '4': mock<ShareRole>({ id: '4' }) }
|
||||
|
||||
const result = getShareResourceRoles({ driveItem, graphRoles })
|
||||
@@ -101,10 +103,12 @@ describe('share helper functions', () => {
|
||||
it('returns permissions based on a drive item if no graph share roles given', () => {
|
||||
const permissions = ['view', 'edit']
|
||||
const driveItem = mockDeep<DriveItem>()
|
||||
driveItem.remoteItem.permissions = [
|
||||
{ atLibreGraphPermissionsActions: [permissions[0]] },
|
||||
{ atLibreGraphPermissionsActions: [permissions[1]] }
|
||||
]
|
||||
Object.assign(driveItem.remoteItem, {
|
||||
permissions: [
|
||||
{ atLibreGraphPermissionsActions: [permissions[0]] },
|
||||
{ atLibreGraphPermissionsActions: [permissions[1]] }
|
||||
]
|
||||
})
|
||||
|
||||
const result = getShareResourcePermissions({ driveItem, shareRoles: [] })
|
||||
|
||||
@@ -116,13 +120,15 @@ describe('share helper functions', () => {
|
||||
const driveItem = mockDeep<DriveItem>({ id: 'driveItemId', name: 'driveItemName' })
|
||||
const sharedBy = { id: '1', displayName: 'user1' } as Identity
|
||||
const sharedWith = { id: '2', displayName: 'user2' } as Identity
|
||||
driveItem.remoteItem.permissions = [
|
||||
{
|
||||
roles: ['1', '2'],
|
||||
invitation: { invitedBy: { user: sharedBy } },
|
||||
grantedToV2: { user: sharedWith }
|
||||
}
|
||||
]
|
||||
Object.assign(driveItem.remoteItem, {
|
||||
permissions: [
|
||||
{
|
||||
roles: ['1', '2'],
|
||||
invitation: { invitedBy: { user: sharedBy } },
|
||||
grantedToV2: { user: sharedWith }
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const graphRoles = {
|
||||
'1': mock<ShareRole>({ id: '1', rolePermissions: [{ allowedResourceActions: ['view'] }] }),
|
||||
@@ -167,16 +173,18 @@ describe('share helper functions', () => {
|
||||
|
||||
describe('buildOutgoingShareResource', () => {
|
||||
const driveItem = mockDeep<DriveItem>({ id: 'driveItemId', name: 'driveItemName' })
|
||||
driveItem.parentReference.path = ''
|
||||
Object.assign(driveItem.parentReference, { path: '' })
|
||||
const sharedBy = { id: '1', displayName: 'user1' } as Identity
|
||||
const sharedWith = { id: '2', displayName: 'user2' } as Identity
|
||||
driveItem.permissions = [
|
||||
{
|
||||
roles: ['1', '2'],
|
||||
invitation: { invitedBy: { user: sharedBy } },
|
||||
grantedToV2: { user: sharedWith }
|
||||
}
|
||||
]
|
||||
Object.assign(driveItem, {
|
||||
permissions: [
|
||||
{
|
||||
roles: ['1', '2'],
|
||||
invitation: { invitedBy: { user: sharedBy } },
|
||||
grantedToV2: { user: sharedWith }
|
||||
}
|
||||
]
|
||||
})
|
||||
const user = { id: '1', displayName: 'user1' } as User
|
||||
|
||||
it('sets ids based on the drive item, its first permission and parent reference', () => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useAbility } from '../../ability'
|
||||
import { useClientService } from '../../clientService'
|
||||
import { useLoadingService } from '../../loadingService'
|
||||
import { isProjectSpaceResource } from '@ownclouders/web-client'
|
||||
import { Drive } from '@ownclouders/web-client/graph/generated'
|
||||
import { DriveUpdate } from '@ownclouders/web-client/graph/generated'
|
||||
import { resolveFileNameDuplicate } from '../../../helpers/resource/conflictHandling'
|
||||
import PQueue from 'p-queue'
|
||||
import { useRouter } from '../../router'
|
||||
@@ -70,7 +70,7 @@ export const useSpaceActionsDuplicate = () => {
|
||||
if (existingSpace.spaceReadmeData || existingSpace.spaceImageData) {
|
||||
const specialRequestData = {
|
||||
special: []
|
||||
} as Drive
|
||||
} as DriveUpdate
|
||||
|
||||
if (existingSpace.spaceReadmeData) {
|
||||
const newSpaceReadmeFile = await clientService.webdav.getFileInfo(duplicatedSpace, {
|
||||
|
||||
Reference in new issue
Block a user