Edits history of script submission #15242 for ' Create private space (confluence)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Confluence = {
    	email: string
    	apiToken: string
    	domain: string
    }
    /**
     * Create private space
     * Creates a new space that is only visible to the creator. This method is
    the same as the [Create space](#api-space-post) method with permissions
    set to the current user only. Note, currently you cannot set space
    labels when creating a space.
    
    **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
    'Create Space(s)' global permission.
     */
    export async function main(
    	auth: Confluence,
    	body: {
    		name: string
    		key?: string
    		alias?: string
    		description?: { plain: { value?: string; representation?: string } }
    		permissions?: {
    			subjects?: {
    				user?: {
    					results: {
    						type: 'known' | 'unknown' | 'anonymous' | 'user'
    						username?: string
    						userKey?: string
    						accountId?: string
    						accountType?: '' | 'atlassian' | 'app'
    						email?: string
    						publicName?: string
    						profilePicture?: {
    							path: string
    							width: number
    							height: number
    							isDefault: false | true
    						}
    						displayName?: string
    						timeZone?: string
    						externalCollaborator?: false | true
    						isExternalCollaborator?: false | true
    						isGuest?: false | true
    						operations?: {
    							operation:
    								| 'administer'
    								| 'archive'
    								| 'clear_permissions'
    								| 'copy'
    								| 'create'
    								| 'create_space'
    								| 'delete'
    								| 'export'
    								| 'move'
    								| 'purge'
    								| 'purge_version'
    								| 'read'
    								| 'restore'
    								| 'restrict_content'
    								| 'update'
    								| 'use'
    							targetType: string
    						}[]
    						details?: {
    							business?: {
    								position?: string
    								department?: string
    								location?: string
    							}
    							personal?: {
    								phone?: string
    								im?: string
    								website?: string
    								email?: string
    							}
    						}
    						personalSpace?: {
    							id?: number
    							key: string
    							alias?: string
    							name: string
    							icon?: {
    								path: string
    								width: number
    								height: number
    								isDefault: false | true
    							}
    							description?: {
    								plain?: {
    									value: string
    									representation: 'plain' | 'view'
    									embeddedContent: {}[]
    								}
    								view?: {
    									value: string
    									representation: 'plain' | 'view'
    									embeddedContent: {}[]
    								}
    								_expandable?: { view?: string; plain?: string }
    							}
    							homepage?: {
    								id?: string
    								type: string
    								status: string
    								title?: string
    								space?: {}
    								history?: {
    									latest: false | true
    									createdBy?: {}
    									ownedBy?: {}
    									lastOwnedBy?: {}
    									createdDate?: string
    									lastUpdated?: {
    										by?: {}
    										when: string
    										friendlyWhen?: string
    										message?: string
    										number: number
    										minorEdit: false | true
    										content?: {}
    										collaborators?: {
    											users?: {}[]
    											userKeys?: string[]
    											_links?: {}
    										}
    										_expandable?: { content?: string; collaborators?: string }
    										_links?: {}
    										contentTypeModified?: false | true
    										confRev?: string
    										syncRev?: string
    										syncRevSource?: string
    									}
    									previousVersion?: {
    										by?: {}
    										when: string
    										friendlyWhen?: string
    										message?: string
    										number: number
    										minorEdit: false | true
    										content?: {}
    										collaborators?: {
    											users?: {}[]
    											userKeys?: string[]
    											_links?: {}
    										}
    										_expandable?: { content?: string; collaborators?: string }
    										_links?: {}
    										contentTypeModified?: false | true
    										confRev?: string
    										syncRev?: string
    										syncRevSource?: string
    									}
    									contributors?: {
    										publishers?: {
    											users?: {}[]
    											userKeys?: string[]
    											_links?: {}
    										}
    									}
    									nextVersion?: {
    										by?: {}
    										when: string
    										friendlyWhen?: string
    										message?: string
    										number: number
    										minorEdit: false | true
    										content?: {}
    										collaborators?: {
    											users?: {}[]
    											userKeys?: string[]
    											_links?: {}
    										}
    										_expandable?: { content?: string; collaborators?: string }
    										_links?: {}
    										contentTypeModified?: false | true
    										confRev?: string
    										syncRev?: string
    										syncRevSource?: string
    									}
    									_expandable?: {
    										lastUpdated?: string
    										previousVersion?: string
    										contributors?: string
    										nextVersion?: string
    										ownedBy?: string
    										lastOwnedBy?: string
    									}
    									_links?: {}
    								}
    								version?: {
    									by?: {}
    									when: string
    									friendlyWhen?: string
    									message?: string
    									number: number
    									minorEdit: false | true
    									content?: {}
    									collaborators?: {
    										users?: {}[]
    										userKeys?: string[]
    										_links?: {}
    									}
    									_expandable?: { content?: string; collaborators?: string }
    									_links?: {}
    									contentTypeModified?: false | true
    									confRev?: string
    									syncRev?: string
    									syncRevSource?: string
    								}
    								ancestors?: {}[]
    								operations?: {
    									operation:
    										| 'administer'
    										| 'archive'
    										| 'clear_permissions'
    										| 'copy'
    										| 'create'
    										| 'create_space'
    										| 'delete'
    										| 'export'
    										| 'move'
    										| 'purge'
    										| 'purge_version'
    										| 'read'
    										| 'restore'
    										| 'restrict_content'
    										| 'update'
    										| 'use'
    									targetType: string
    								}[]
    								children?: {
    									attachment?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									comment?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									page?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									whiteboard?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									database?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									embed?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									folder?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									_expandable?: {
    										attachment?: string
    										comment?: string
    										page?: string
    										whiteboard?: string
    										database?: string
    										embed?: string
    										folder?: string
    									}
    									_links?: {}
    								}
    								childTypes?: {
    									attachment?: { value: false | true; _links: {} }
    									comment?: { value: false | true; _links: {} }
    									page?: { value: false | true; _links: {} }
    									_expandable?: {
    										all?: string
    										attachment?: string
    										comment?: string
    										page?: string
    										whiteboard?: string
    										database?: string
    										embed?: string
    										folder?: string
    									}
    								}
    								descendants?: {
    									attachment?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									comment?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									page?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									whiteboard?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									database?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									embed?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									folder?: {
    										results: {}[]
    										start?: number
    										limit?: number
    										size: number
    										_links: {}
    									}
    									_expandable?: {
    										attachment?: string
    										comment?: string
    										page?: string
    										whiteboard?: string
    										database?: string
    										embed?: string
    										folder?: string
    									}
    									_links?: {}
    								}
    								container?: {}
    								body?: {
    									view?: {
    										value: string
    										representation:
    											| 'view'
    											| 'export_view'
    											| 'styled_view'
    											| 'storage'
    											| 'editor'
    											| 'editor2'
    											| 'anonymous_export_view'
    											| 'wiki'
    											| 'atlas_doc_format'
    											| 'raw'
    										embeddedContent?: {
    											entityId?: number
    											entityType?: string
    											entity?: {}
    										}[]
    										webresource?: {
    											_expandable?: { uris?: string | {} }
    											keys?: string[]
    											contexts?: string[]
    											uris?: {
    												all?: string | string[]
    												css?: string | string[]
    												js?: string | string[]
    												_expandable?: {
    													css?: string | string[]
    													js?: string | string[]
    												}
    											}
    											tags?: {
    												all?: string
    												css?: string
    												data?: string
    												js?: string
    												_expandable?: {}
    											}
    											superbatch?: {
    												uris?: {
    													all?: string | string[]
    													css?: string | string[]
    													js?: string | string[]
    												}
    												tags?: {
    													all?: string
    													css?: string
    													data?: string
    													js?: string
    												}
    												metatags?: string
    												_expandable?: {}
    											}
    										}
    										mediaToken?: {
    											collectionIds?: string[]
    											contentId?: string
    											expiryDateTime?: string
    											fileIds?: string[]
    											token?: string
    										}
    										_expandable?: {
    											content?: string
    											embeddedContent?: string
    											webresource?: string
    											mediaToken?: string
    										}
    										_links?: {}
    									}
    									export_view?: {
    										value: string
    										representation:
    											| 'view'
    											| 'export_view'
    											| 'styled_view'
    											| 'storage'
    											| 'editor'
    											| 'editor2'
    											| 'anonymous_export_view'
    											| 'wiki'
    											| 'atlas_doc_format'
    											| 'raw'
    										embeddedContent?: {
    											entityId?: number
    											entityType?: string
    											entity?: {}
    										}[]
    										webresource?: {
    											_expandable?: { uris?: string | {} }
    											keys?: string[]
    											contexts?: string[]
    											uris?: {
    												all?: string | string[]
    												css?: string | string[]
    												js?: string | string[]
    												_expandable?: {
    													css?: string | string[]
    													js?: string | string[]
    												}
    											}
    											tags?: {
    												all?: string
    												css?: string
    												data?: string
    												js?: string
    												_expandable?: {}
    											}
    											superbatch?: {
    												uris?: {
    													all?: string | string[]
    													css?: string | string[]
    													js?: string | string[]
    												}
    												tags?: {
    													all?: string
    													css?: string
    													data?: string
    													js?: string
    												}
    												metatags?: string
    												_expandable?: {}
    											}
    										}
    										mediaToken?: {
    											collectionIds?: string[]
    											contentId?: string
    											expiryDateTime?: string
    											fileIds?: string[]
    											token?: string
    										}
    										_expandable?: {
    											content?: string
    											embeddedContent?: string
    											webresource?: string
    											mediaToken?: string
    										}
    										_links?: {}
    									}
    									styled_view?: {
    										value: string
    										representation:
    											| 'view'
    											| 'export_view'
    											| 'styled_view'
    											| 'storage'
    											| 'editor'
    											| 'editor2'
    											| 'anonymous_export_view'
    											| 'wiki'
    											| 'atlas_doc_format'
    											| 'raw'
    										embeddedContent?: {
    											entityId?: number
    											entityType?: string
    											entity?: {}
    										}[]
    										webresource?: {
    											_expandable?: { uris?: string | {} }
    											keys?: string[]
    											contexts?: string[]
    											uris?: {
    												all?: string | string[]
    												css?: string | string[]
    												js?: string | string[]
    												_expandable?: {
    													css?: string | string[]
    													js?: string | string[]
    												}
    											}
    											tags?: {
    												all?: string
    												css?: string
    												data?: string
    												js?: string
    												_expandable?: {}
    											}
    											superbatch?: {
    												uris?: {
    													all?: string | string[]
    													css?: string | string[]
    													js?: string | string[]
    												}
    												tags?: {
    													all?: string
    													css?: string
    													data?: string
    													js?: string
    												}
    												metatags?: string
    												_expandable?: {}
    											}
    										}
    										mediaToken?: {
    											collectionIds?: string[]
    											contentId?: string
    											expiryDateTime?: string
    											fileIds?: string[]
    											token?: string
    										}
    										_expandable?: {
    											content?: string
    											embeddedContent?: string
    											webresource?: string
    											mediaToken?: string
    										}
    										_links?: {}
    									}
    									storage?: {
    										value: string
    										representation:
    											| 'view'
    											| 'export_view'
    											| 'styled_view'
    											| 'storage'
    											| 'editor'
    											| 'editor2'
    											| 'anonymous_export_view'
    											| 'wiki'
    											| 'atlas_doc_format'
    											| 'raw'
    										embeddedContent?: {
    											entityId?: number
    											entityType?: string
    											entity?: {}
    										}[]
    										webresource?: {
    											_expandable?: { uris?: string | {} }
    											keys?: string[]
    											contexts?: string[]
    											uris?: {
    												all?: string | string[]
    												css?: string | string[]
    												js?: string | string[]
    												_expandable?: {
    													css?: string | string[]
    													js?: string | string[]
    												}
    											}
    											tags?: {
    												all?: string
    												css?: string
    												data?: string
    												js?: string
    												_expandable?: {}
    											}
    											superbatch?: {
    												uris?: {
    													all?: string | string[]
    													css?: string | string[]
    													js?: string | string[]
    												}
    												tags?: {
    													all?: string
    													css?: string
    													data?: string
    													js?: string
    												}
    												metatags?: string
    												_expandable?: {}
    											}
    										}
    										mediaToken?: {
    											collectionIds?: string[]
    											contentId?: string
    											expiryDateTime?: string
    											fileIds?: string[]
    											token?: string
    										}
    										_expandable?: {
    											content?: string
    											embeddedContent?: string
    											webresource?: string
    											mediaToken?: string
    										}
    										_links?: {}
    									}
    									wiki?: {
    										value: string
    										representation:
    											| 'view'
    											| 'export_view'
    											| 'styled_view'
    											| 'storage'
    											| 'editor'
    											| 'editor2'
    											| 'anonymous_export_view'
    											| 'wiki'
    											| 'atlas_doc_format'
    											| 'raw'
    										embeddedContent?: {
    											entityId?: number
    											entityType?: string
    											entity?: {}
    										}[]
    										webresource?: {
    											_expandable?: { uris?: string | {} }
    											keys?: string[]
    											contexts?: string[]
    											uris?: {
    												all?: string | string[]
    												css?: string | string[]
    												js?: string | string[]
    												_expandable?: {
    													css?: string | string[]
    													js?: string | string[]
    												}
    											}
    											tags?: {
    												all?: string
    												css?: string
    												data?: string
    												js?: string
    												_expandable?: {}
    											}
    											superbatch?: {
    												uris?: {
    													all?: string | string[]
    													css?: string | string[]
    													js?: string | string[]
    												}
    												tags?: {
    													all?: string
    													css?: string
    													data?: string
    													js?: string
    												}
    												metatags?: string
    												_expandable?: {}
    											}
    										}
    										mediaToken?: {
    											collectionIds?: string[]
    											contentId?: string
    											expiryDateTime?: string
    											fileIds?: string[]
    											token?: string
    										}
    										_expandable?: {
    											content?: string
    											embeddedContent?: string
    											webresource?: string
    											mediaToken?: string
    										}
    										_links?: {}
    									}
    									editor?: {
    										value: string
    										representation:
    											| 'view'
    											| 'export_view'
    											| 'styled_view'
    											| 'storage'
    											| 'editor'
    											| 'editor2'
    											| 'anonymous_export_view'
    											| 'wiki'
    											| 'atlas_doc_format'
    											| 'raw'
    										embeddedContent?: {
    											entityId?: number
    											entityType?: string
    											entity?: {}
    										}[]
    										webresource?: {
    											_expandable?: { uris?: string | {} }
    											keys?: string[]
    											contexts?: string[]
    											uris?: {
    												all?: string | string[]
    												css?: string | string[]
    												js?: string | string[]
    												_expandable?: {
    													css?: string | string[]
    													js?: string | string[]
    												}
    											}
    											tags?: {
    												all?: string
    												css?: string
    												data?: string
    												js?: string
    												_expandable?: {}
    											}
    											superbatch?: {
    												uris?: {
    													all?: string | string[]
    													css?: string | string[]
    													js?: string | string[]
    												}
    												tags?: {
    													all?: string
    													css?: string
    													data?: string
    													js?: string
    												}
    												metatags?: string
    												_expandable?: {}
    											}
    										}
    										mediaToken?: {
    											collectionIds?: string[]
    											contentId?: string
    											expiryDateTime?: string
    											fileIds?: string[]
    											token?: string
    										}
    										_expandable?: {
    											content?: string
    											embeddedContent?: string
    											webresource?: string
    											mediaToken?: string
    										}
    										_links?: {}
    									}
    									editor2?: {
    										value: string
    										representation:
    											| 'view'
    											| 'export_view'
    											| 'styled_view'
    											| 'storage'
    											| 'editor'
    											| 'editor2'
    											| 'anonymous_export_view'
    											| 'wiki'
    											| 'atlas_doc_format'
    											| 'raw'
    										embeddedContent?: {
    											entityId?: number
    											entityType?: string
    											entity?: {}
    										}[]
    										webresource?: {
    											_expandable?: { uris?: string | {} }
    											keys?: string[]
    											contexts?: string[]
    											uris?: {
    												all?: string | string[]
    												css?: string | string[]
    												js?: string | string[]
    												_expandable?: {
    													css?: string | string[]
    													js?: string | string[]
    												}
    											}
    											tags?: {
    												all?: string
    												css?: string
    												data?: string
    												js?: string
    												_expandable?: {}
    											}
    											superbatch?: {
    												uris?: {
    													all?: string | string[]
    													css?: string | string[]
    													js?: string | string[]
    												}
    												tags?: {
    													all?: string
    													css?: string
    													data?: string
    													js?: string
    												}
    												metatags?: string
    												_expandable?: {}
    											}
    										}
    										mediaToken?: {
    											collectionIds?: string[]
    											contentId?: string
    											expiryDateTime?: string
    											fileIds?: string[]
    											token?: string
    										}
    										_expandable?: {
    											content?: string
    											embeddedContent?: string
    											webresource?: string
    											mediaToken?: string
    										}
    										_links?: {}
    									}
    									anonymous_export_view?: {
    										value: string
    										representation:
    											| 'view'
    											| 'export_view'
    											| 'styled_view'
    											| 'storage'
    											| 'editor'
    											| 'editor2'
    											| 'anonymous_export_view'
    											| 'wiki'
    											| 'atlas_doc_format'
    											| 'raw'
    										embeddedContent?: {
    											entityId?: number
    											entityType?: string
    											entity?: {}
    										}[]
    										webresource?: {
    											_expandable?: { uris?: string | {} }
    											keys?: string[]
    											contexts?: string[]
    											uris?: {
    												all?: string | string[]
    												css?: string | string[]
    												js?: string | string[]
    												_expandable?: {
    													css?: string | string[]
    													js?: string | string[]
    												}
    											}
    											tags?: {
    												all?: string
    												css?: string
    												data?: string
    												js?: string
    												_expandable?: {}
    											}
    											superbatch?: {
    												uris?: {
    													all?: string | string[]
    													css?: string | string[]
    													js?: string | string[]
    												}
    												tags?: {
    													all?: string
    													css?: string
    													data?: string
    													js?: string
    												}
    												metatags?: string
    												_expandable?: {}
    											}
    										}
    										mediaToken?: {
    											collectionIds?: string[]
    											contentId?: string
    											expiryDateTime?: string
    											fileIds?: string[]
    											token?: string
    										}
    										_expandable?: {
    											content?: string
    											embeddedContent?: string
    											webresource?: string
    											mediaToken?: string
    										}
    										_links?: {}
    									}
    									atlas_doc_format?: {
    										value: string
    										representation:
    											| 'view'
    											| 'export_view'
    											| 'styled_view'
    											| 'storage'
    											| 'editor'
    											| 'editor2'
    											| 'anonymous_export_view'
    											| 'wiki'
    											| 'atlas_doc_format'
    											| 'raw'
    										embeddedContent?: {
    											entityId?: number
    											entityType?: string
    											entity?: {}
    										}[]
    										webresource?: {
    											_expandable?: { uris?: string | {} }
    											keys?: string[]
    											contexts?: string[]
    											uris?: {
    												all?: string | string[]
    												css?: string | string[]
    												js?: string | string[]
    												_expandable?: {
    													css?: string | string[]
    													js?: string | string[]
    												}
    											}
    											tags?: {
    												all?: string
    												css?: string
    												data?: string
    												js?: string
    												_expandable?: {}
    											}
    											superbatch?: {
    												uris?: {
    													all?: string | string[]
    													css?: string | string[]
    													js?: string | string[]
    												}
    												tags?: {
    													all?: string
    													css?: string
    													data?: string
    													js?: string
    												}
    												metatags?: string
    												_expandable?: {}
    											}
    										}
    										mediaToken?: {
    											collectionIds?: string[]
    											contentId?: string
    											expiryDateTime?: string
    											fileIds?: string[]
    											token?: string
    										}
    										_expandable?: {
    											content?: string
    											embeddedContent?: string
    											webresource?: string
    											mediaToken?: string
    										}
    										_links?: {}
    									}
    									dynamic?: {
    										value: string
    										representation:
    											| 'view'
    											| 'export_view'
    											| 'styled_view'
    											| 'storage'
    											| 'editor'
    											| 'editor2'
    											| 'anonymous_export_view'
    											| 'wiki'
    											| 'atlas_doc_format'
    											| 'raw'
    										embeddedContent?: {
    											entityId?: number
    											entityType?: string
    											entity?: {}
    										}[]
    										webresource?: {
    											_expandable?: { uris?: string | {} }
    											keys?: string[]
    											contexts?: string[]
    											uris?: {
    												all?: string | string[]
    												css?: string | string[]
    												js?: string | string[]
    												_expandable?: {
    													css?: string | string[]
    													js?: string | string[]
    												}
    											}
    											tags?: {
    												all?: string
    												css?: string
    												data?: string
    												js?: string
    												_expandable?: {}
    											}
    											superbatch?: {
    												uris?: {
    													all?: string | string[]
    													css?: string | string[]
    													js?: string | string[]
    												}
    												tags?: {
    													all?: string
    													css?: string
    													data?: string
    													js?: string
    												}
    												metatags?: string
    												_expandable?: {}
    											}
    										}
    										mediaToken?: {
    											collectionIds?: string[]
    											contentId?: string
    											expiryDateTime?: string
    											fileIds?: string[]
    											token?: string
    										}
    										_expandable?: {
    											content?: string
    											embeddedContent?: string
    											webresource?: string
    											mediaToken?: string
    										}
    										_links?: {}
    									}
    									raw?: {
    										value: string
    										representation:
    											| 'view'
    											| 'export_view'
    											| 'styled_view'
    											| 'storage'
    											| 'editor'
    											| 'editor2'
    											| 'anonymous_export_view'
    											| 'wiki'
    											| 'atlas_doc_format'
    											| 'raw'
    										embeddedContent?: {
    											entityId?: number
    											entityType?: string
    											entity?: {}
    										}[]
    										webresource?: {
    											_expandable?: { uris?: string | {} }
    											keys?: string[]
    											contexts?: string[]
    											uris?: {
    												all?: string | string[]
    												css?: string | string[]
    												js?: string | string[]
    												_expandable?: {
    													css?: string | string[]
    													js?: string | string[]
    												}
    											}
    											tags?: {
    												all?: string
    												css?: string
    												data?: string
    												js?: string
    												_expandable?: {}
    											}
    											superbatch?: {
    												uris?: {
    													all?: string | string[]
    													css?: string | string[]
    													js?: string | string[]
    												}
    												tags?: {
    													all?: string
    													css?: string
    													data?: string
    													js?: string
    												}
    												metatags?: string
    												_expandable?: {}
    											}
    										}
    										mediaToken?: {
    											collectionIds?: string[]
    											contentId?: string
    											expiryDateTime?: string
    											fileIds?: string[]
    											token?: string
    										}
    										_expandable?: {
    											content?: string
    											embeddedContent?: string
    											webresource?: string
    											mediaToken?: string
    										}
    										_links?: {}
    									}
    									_expandable?: {
    										editor?: string
    										view?: string
    										export_view?: string
    										styled_view?: string
    										storage?: string
    										editor2?: string
    										anonymous_export_view?: string
    										atlas_doc_format?: string
    										wiki?: string
    										dynamic?: string
    										raw?: string
    									}
    								}
    								restrictions?: {
    									read?: {
    										operation:
    											| 'administer'
    											| 'copy'
    											| 'create'
    											| 'delete'
    											| 'export'
    											| 'move'
    											| 'purge'
    											| 'purge_version'
    											| 'read'
    											| 'restore'
    											| 'update'
    											| 'use'
    										restrictions?: {
    											user?: {
    												results: {}[]
    												start?: number
    												limit?: number
    												size?: number
    												totalSize?: number
    												_links?: {}
    											}
    											group?: {
    												results: {
    													type: 'group'
    													name: string
    													id: string
    													_links?: {}
    												}[]
    												start: number
    												limit: number
    												size: number
    											}
    											_expandable?: { user?: string; group?: string }
    										}
    										content?: {}
    										_expandable: { restrictions?: string; content?: string }
    										_links: {}
    									}
    									update?: {
    										operation:
    											| 'administer'
    											| 'copy'
    											| 'create'
    											| 'delete'
    											| 'export'
    											| 'move'
    											| 'purge'
    											| 'purge_version'
    											| 'read'
    											| 'restore'
    											| 'update'
    											| 'use'
    										restrictions?: {
    											user?: {
    												results: {}[]
    												start?: number
    												limit?: number
    												size?: number
    												totalSize?: number
    												_links?: {}
    											}
    											group?: {
    												results: {
    													type: 'group'
    													name: string
    													id: string
    													_links?: {}
    												}[]
    												start: number
    												limit: number
    												size: number
    											}
    											_expandable?: { user?: string; group?: string }
    										}
    										content?: {}
    										_expandable: { restrictions?: string; content?: string }
    										_links: {}
    									}
    									_expandable?: { read?: string; update?: string }
    									_links?: {}
    								}
    								metadata?: {
    									currentuser?: {
    										favourited?: {
    											isFavourite?: false | true
    											favouritedDate?: string
    										}
    										lastmodified?: {
    											version?: {
    												by?: {}
    												when: string
    												friendlyWhen?: string
    												message?: string
    												number: number
    												minorEdit: false | true
    												content?: {}
    												collaborators?: {
    													users?: {}[]
    													userKeys?: string[]
    													_links?: {}
    												}
    												_expandable?: {
    													content?: string
    													collaborators?: string
    												}
    												_links?: {}
    												contentTypeModified?: false | true
    												confRev?: string
    												syncRev?: string
    												syncRevSource?: string
    											}
    											friendlyLastModified?: string
    										}
    										lastcontributed?: { status?: string; when?: string }
    										viewed?: { lastSeen?: string; friendlyLastSeen?: string }
    										scheduled?: {}
    										_expandable?: {
    											favourited?: string
    											lastmodified?: string
    											lastcontributed?: string
    											viewed?: string
    											scheduled?: string
    										}
    									}
    									properties?: {}
    									frontend?: {}
    									labels?:
    										| {
    												results: {
    													prefix: string
    													name: string
    													id: string
    													label: string
    												}[]
    												start?: number
    												limit?: number
    												size: number
    												_links?: {}
    										  }
    										| {
    												prefix: string
    												name: string
    												id: string
    												label: string
    										  }[]
    								}
    								macroRenderedOutput?: {}
    								extensions?: {}
    								_expandable?: {
    									childTypes?: string
    									container?: string
    									metadata?: string
    									operations?: string
    									children?: string
    									restrictions?: string
    									history?: string
    									ancestors?: string
    									body?: string
    									version?: string
    									descendants?: string
    									space?: string
    									extensions?: string
    									schedulePublishDate?: string
    									schedulePublishInfo?: string
    									macroRenderedOutput?: string
    								}
    								_links?: {}
    							}
    							type: string
    							metadata?: {
    								labels?: {
    									results: {
    										prefix: string
    										name: string
    										id: string
    										label: string
    									}[]
    									start?: number
    									limit?: number
    									size: number
    									_links?: {}
    								}
    								_expandable?: {}
    							}
    							operations?: {
    								operation:
    									| 'administer'
    									| 'archive'
    									| 'clear_permissions'
    									| 'copy'
    									| 'create'
    									| 'create_space'
    									| 'delete'
    									| 'export'
    									| 'move'
    									| 'purge'
    									| 'purge_version'
    									| 'read'
    									| 'restore'
    									| 'restrict_content'
    									| 'update'
    									| 'use'
    								targetType: string
    							}[]
    							permissions?: {
    								id?: number
    								subjects?: {
    									user?: {
    										results: {}[]
    										size: number
    										start?: number
    										limit?: number
    									}
    									group?: {
    										results: {
    											type: 'group'
    											name: string
    											id: string
    											_links?: {}
    										}[]
    										size: number
    										start?: number
    										limit?: number
    									}
    									_expandable?: { user?: string; group?: string }
    								}
    								operation: {
    									operation:
    										| 'administer'
    										| 'archive'
    										| 'clear_permissions'
    										| 'copy'
    										| 'create'
    										| 'create_space'
    										| 'delete'
    										| 'export'
    										| 'move'
    										| 'purge'
    										| 'purge_version'
    										| 'read'
    										| 'restore'
    										| 'restrict_content'
    										| 'update'
    										| 'use'
    									targetType: string
    								}
    								anonymousAccess: false | true
    								unlicensedAccess: false | true
    							}[]
    							status: string
    							settings?: {
    								routeOverrideEnabled: false | true
    								editor?: { page: string; blogpost: string; default: string }
    								spaceKey?: string
    								_links: {}
    							}
    							theme?: {
    								themeKey: string
    								name?: string
    								description?: string
    								icon?: {
    									path: string
    									width: number
    									height: number
    									isDefault: false | true
    								}
    								_links?: {}
    							}
    							lookAndFeel?: {
    								headings: { color: string }
    								links: { color: string }
    								menus: {
    									hoverOrFocus: { backgroundColor: string }
    									color: string
    								}
    								header: {
    									backgroundColor: string
    									button: { backgroundColor: string; color: string }
    									primaryNavigation: {
    										color: string
    										highlightColor?: string
    										hoverOrFocus: { backgroundColor: string; color: string }
    									}
    									secondaryNavigation: {
    										color: string
    										highlightColor?: string
    										hoverOrFocus: { backgroundColor: string; color: string }
    									}
    									search: { backgroundColor: string; color: string }
    								}
    								horizontalHeader?: {
    									backgroundColor: string
    									button?: { backgroundColor: string; color: string }
    									primaryNavigation: {
    										color?: string
    										highlightColor: string
    										hoverOrFocus?: { backgroundColor?: string; color?: string }
    									}
    									secondaryNavigation?: {
    										color: string
    										highlightColor?: string
    										hoverOrFocus: { backgroundColor: string; color: string }
    									}
    									search?: { backgroundColor: string; color: string }
    								}
    								content: {
    									screen?: {
    										background: string
    										backgroundAttachment?: string
    										backgroundBlendMode?: string
    										backgroundClip?: string
    										backgroundColor?: string
    										backgroundImage?: string
    										backgroundOrigin?: string
    										backgroundPosition?: string
    										backgroundRepeat?: string
    										backgroundSize?: string
    										layer?: { width?: string; height?: string }
    										gutterTop?: string
    										gutterRight?: string
    										gutterBottom?: string
    										gutterLeft?: string
    									}
    									container?: {
    										background: string
    										backgroundAttachment?: string
    										backgroundBlendMode?: string
    										backgroundClip?: string
    										backgroundColor: string
    										backgroundImage: string
    										backgroundOrigin?: string
    										backgroundPosition?: string
    										backgroundRepeat?: string
    										backgroundSize: string
    										padding: string
    										borderRadius: string
    									}
    									header?: {
    										background: string
    										backgroundAttachment?: string
    										backgroundBlendMode?: string
    										backgroundClip?: string
    										backgroundColor: string
    										backgroundImage: string
    										backgroundOrigin?: string
    										backgroundPosition?: string
    										backgroundRepeat?: string
    										backgroundSize: string
    										padding: string
    										borderRadius: string
    									}
    									body?: {
    										background: string
    										backgroundAttachment?: string
    										backgroundBlendMode?: string
    										backgroundClip?: string
    										backgroundColor: string
    										backgroundImage: string
    										backgroundOrigin?: string
    										backgroundPosition?: string
    										backgroundRepeat?: string
    										backgroundSize: string
    										padding: string
    										borderRadius: string
    									}
    								}
    								bordersAndDividers: { color: string }
    								spaceReference?: {}
    							}
    							history?: { createdDate: string; createdBy?: {} }
    							_expandable: {
    								settings?: string
    								metadata?: string
    								operations?: string
    								lookAndFeel?: string
    								permissions?: string
    								icon?: string
    								description?: string
    								theme?: string
    								history?: string
    								homepage?: string
    								identifiers?: string
    							}
    							_links: {}
    						}
    						_expandable?: {
    							operations?: string
    							details?: string
    							personalSpace?: string
    						}
    						_links?: {}
    					}[]
    					size: number
    				}
    				group?: { results: { type: 'group'; id?: string }[]; size: number }
    			}
    			operation: {
    				operation:
    					| 'administer'
    					| 'archive'
    					| 'clear_permissions'
    					| 'copy'
    					| 'create'
    					| 'create_space'
    					| 'delete'
    					| 'export'
    					| 'move'
    					| 'purge'
    					| 'purge_version'
    					| 'read'
    					| 'restore'
    					| 'restrict_content'
    					| 'update'
    					| 'use'
    				targetType: string
    			}
    			anonymousAccess: false | true
    			unlicensedAccess: false | true
    		}[]
    	}
    ) {
    	const url = new URL(`https://${auth.domain}/wiki/rest/api/space/_private`)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			'Content-Type': 'application/json',
    			Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
    		},
    		body: JSON.stringify(body)
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    

    Submitted by hugo697 235 days ago