feat: add session creation endpoint (#18295)
This commit is contained in:
@@ -5618,6 +5618,46 @@
|
||||
"tags": [
|
||||
"Sessions"
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"operationId": "createSession",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SessionCreateDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SessionCreateResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Sessions"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/sessions/{id}": {
|
||||
@@ -11052,6 +11092,7 @@
|
||||
"person.statistics",
|
||||
"person.merge",
|
||||
"person.reassign",
|
||||
"session.create",
|
||||
"session.read",
|
||||
"session.update",
|
||||
"session.delete",
|
||||
@@ -12038,6 +12079,57 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SessionCreateDto": {
|
||||
"properties": {
|
||||
"deviceOS": {
|
||||
"type": "string"
|
||||
},
|
||||
"deviceType": {
|
||||
"type": "string"
|
||||
},
|
||||
"duration": {
|
||||
"description": "session duration, in seconds",
|
||||
"minimum": 1,
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"SessionCreateResponseDto": {
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"current": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"deviceOS": {
|
||||
"type": "string"
|
||||
},
|
||||
"deviceType": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"token": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"createdAt",
|
||||
"current",
|
||||
"deviceOS",
|
||||
"deviceType",
|
||||
"id",
|
||||
"token",
|
||||
"updatedAt"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SessionResponseDto": {
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
|
||||
@@ -1078,6 +1078,21 @@ export type SessionResponseDto = {
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
export type SessionCreateDto = {
|
||||
deviceOS?: string;
|
||||
deviceType?: string;
|
||||
/** session duration, in seconds */
|
||||
duration?: number;
|
||||
};
|
||||
export type SessionCreateResponseDto = {
|
||||
createdAt: string;
|
||||
current: boolean;
|
||||
deviceOS: string;
|
||||
deviceType: string;
|
||||
id: string;
|
||||
token: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
export type SharedLinkResponseDto = {
|
||||
album?: AlbumResponseDto;
|
||||
allowDownload: boolean;
|
||||
@@ -2917,6 +2932,18 @@ export function getSessions(opts?: Oazapfts.RequestOpts) {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function createSession({ sessionCreateDto }: {
|
||||
sessionCreateDto: SessionCreateDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 201;
|
||||
data: SessionCreateResponseDto;
|
||||
}>("/sessions", oazapfts.json({
|
||||
...opts,
|
||||
method: "POST",
|
||||
body: sessionCreateDto
|
||||
})));
|
||||
}
|
||||
export function deleteSession({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
@@ -3678,6 +3705,7 @@ export enum Permission {
|
||||
PersonStatistics = "person.statistics",
|
||||
PersonMerge = "person.merge",
|
||||
PersonReassign = "person.reassign",
|
||||
SessionCreate = "session.create",
|
||||
SessionRead = "session.read",
|
||||
SessionUpdate = "session.update",
|
||||
SessionDelete = "session.delete",
|
||||
|
||||
Reference in New Issue
Block a user