Skip to content

Commit 0ecd638

Browse files
chore: update api instance
1 parent d699f61 commit 0ecd638

6 files changed

Lines changed: 176 additions & 1 deletion

File tree

scripts/data/swagger-spec.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,20 @@
12111211
},
12121212
"tags": ["health"]
12131213
}
1214+
},
1215+
"/api/v1/system/app-updates/check": {
1216+
"post": {
1217+
"operationId": "SystemController_checkForAppUpdate",
1218+
"parameters": [],
1219+
"requestBody": {
1220+
"required": true,
1221+
"content": {
1222+
"application/json": { "schema": { "$ref": "#/components/schemas/CheckUpdateDto" } }
1223+
}
1224+
},
1225+
"responses": { "201": { "description": "" } },
1226+
"tags": ["system"]
1227+
}
12141228
}
12151229
},
12161230
"info": {
@@ -1829,7 +1843,7 @@
18291843
"properties": {
18301844
"accessToken": {
18311845
"type": "string",
1832-
"example": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjFlOGI2ZTFlYTI1Y2I2M2Q0ZTI5YWI1Y2M2ZDZmODBlZjRmNDY2NjciLCJ0eXAiOiJKV1QifQ.eyJhenAiOiIxMjM0NTY3ODkwMTIzNDU2Nzg5MC5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSIsImF1ZCI6IjEyMzQ1Njc4OTAxMjM0NTY3ODkwLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiZXhwIjoxNjUxNTc2MDAwLCJpYXQiOjE2NTE1NzI0MDAsImlzcyI6ImFjY291bnRzLmdvb2dsZS5jb20iLCJzdWIiOiIxMjM0NTY3ODkwMTIzNDU2Nzg5MCIsImVtYWlsIjoianVzdHVzZXJAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsIm5hbWUiOiJKdXN0IFVzZXIiLCJwaWN0dXJlIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9qdXN0dXNlci9waG90by5qcGciLCJnaXZlbl9uYW1lIjoiSnVzdCIsImZhbWlseV9uYW1lIjoiVXNlciJ9.QWxsYWtoemF0aGtqZGxza2FqaGRsa2FqZGxza2FqZGhza2FqaGRrc2FqaGtqZHNhbGtqZHNhbGtqZGhsYWtqZHNhbGtqaGRsYWtqaGRza2FqaGRrc2FqaGRrc2FqaGRrc2Fq",
1846+
"example": "EAAJ3MZA...ZDZD",
18331847
"description": "Google Access token obtained after user authentication using Google OAuth. Use this token to authenticate the request to the application."
18341848
}
18351849
},
@@ -1915,6 +1929,23 @@
19151929
}
19161930
},
19171931
"required": ["status", "info", "error", "details"]
1932+
},
1933+
"CheckUpdateDto": {
1934+
"type": "object",
1935+
"properties": {
1936+
"os": {
1937+
"type": "string",
1938+
"example": "ios",
1939+
"description": "The operating system for which to check the update. Can be either \"android\" or \"ios\".",
1940+
"enum": ["android", "ios"]
1941+
},
1942+
"currentVersion": {
1943+
"type": "string",
1944+
"example": "1.2.0",
1945+
"description": "The current version of the app installed on the device."
1946+
}
1947+
},
1948+
"required": ["os", "currentVersion"]
19181949
}
19191950
}
19201951
},

src/api/query/system/system.msw.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
/**
3+
* Generated by orval 🍺
4+
* Do not edit manually.
5+
* API
6+
* API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources.
7+
* OpenAPI spec version: 1.0
8+
*/
9+
import { HttpResponse, delay, http } from 'msw'
10+
11+
export const getSystemControllerCheckForAppUpdateMockHandler = () => {
12+
return http.post('*/api/v1/system/app-updates/check', async () => {
13+
await delay(1000)
14+
return new HttpResponse(null, {
15+
status: 200,
16+
headers: {
17+
'Content-Type': 'application/json',
18+
},
19+
})
20+
})
21+
}
22+
export const getSystemMock = () => [getSystemControllerCheckForAppUpdateMockHandler()]

src/api/query/system/system.ts

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
/**
3+
* Generated by orval 🍺
4+
* Do not edit manually.
5+
* API
6+
* API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources.
7+
* OpenAPI spec version: 1.0
8+
*/
9+
import { useMutation } from '@tanstack/react-query'
10+
import type { MutationFunction, UseMutationOptions } from '@tanstack/react-query'
11+
12+
import { customInstance } from '../../axios/custom-instance'
13+
import type { ErrorType, BodyType } from '../../axios/custom-instance'
14+
import type { CheckUpdateDto } from '../../types'
15+
16+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1]
17+
18+
export const systemControllerCheckForAppUpdate = (
19+
checkUpdateDto: BodyType<CheckUpdateDto>,
20+
options?: SecondParameter<typeof customInstance>
21+
) => {
22+
return customInstance<void>(
23+
{
24+
url: `/api/v1/system/app-updates/check`,
25+
method: 'POST',
26+
headers: { 'Content-Type': 'application/json' },
27+
data: checkUpdateDto,
28+
},
29+
options
30+
)
31+
}
32+
33+
export const getSystemControllerCheckForAppUpdateMutationOptions = <
34+
TError = ErrorType<unknown>,
35+
TContext = unknown
36+
>(options?: {
37+
mutation?: UseMutationOptions<
38+
Awaited<ReturnType<typeof systemControllerCheckForAppUpdate>>,
39+
TError,
40+
{ data: BodyType<CheckUpdateDto> },
41+
TContext
42+
>
43+
request?: SecondParameter<typeof customInstance>
44+
}): UseMutationOptions<
45+
Awaited<ReturnType<typeof systemControllerCheckForAppUpdate>>,
46+
TError,
47+
{ data: BodyType<CheckUpdateDto> },
48+
TContext
49+
> => {
50+
const { mutation: mutationOptions, request: requestOptions } = options ?? {}
51+
52+
const mutationFn: MutationFunction<
53+
Awaited<ReturnType<typeof systemControllerCheckForAppUpdate>>,
54+
{ data: BodyType<CheckUpdateDto> }
55+
> = (props) => {
56+
const { data } = props ?? {}
57+
58+
return systemControllerCheckForAppUpdate(data, requestOptions)
59+
}
60+
61+
return { mutationFn, ...mutationOptions }
62+
}
63+
64+
export type SystemControllerCheckForAppUpdateMutationResult = NonNullable<
65+
Awaited<ReturnType<typeof systemControllerCheckForAppUpdate>>
66+
>
67+
export type SystemControllerCheckForAppUpdateMutationBody = BodyType<CheckUpdateDto>
68+
export type SystemControllerCheckForAppUpdateMutationError = ErrorType<unknown>
69+
70+
export const useSystemControllerCheckForAppUpdate = <
71+
TError = ErrorType<unknown>,
72+
TContext = unknown
73+
>(options?: {
74+
mutation?: UseMutationOptions<
75+
Awaited<ReturnType<typeof systemControllerCheckForAppUpdate>>,
76+
TError,
77+
{ data: BodyType<CheckUpdateDto> },
78+
TContext
79+
>
80+
request?: SecondParameter<typeof customInstance>
81+
}) => {
82+
const mutationOptions = getSystemControllerCheckForAppUpdateMutationOptions(options)
83+
84+
return useMutation(mutationOptions)
85+
}

src/api/types/checkUpdateDto.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
/**
3+
* Generated by orval 🍺
4+
* Do not edit manually.
5+
* API
6+
* API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources.
7+
* OpenAPI spec version: 1.0
8+
*/
9+
import type { CheckUpdateDtoOs } from './checkUpdateDtoOs'
10+
11+
export interface CheckUpdateDto {
12+
/** The current version of the app installed on the device. */
13+
currentVersion: string
14+
/** The operating system for which to check the update. Can be either "android" or "ios". */
15+
os: CheckUpdateDtoOs
16+
}

src/api/types/checkUpdateDtoOs.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
/**
3+
* Generated by orval 🍺
4+
* Do not edit manually.
5+
* API
6+
* API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources.
7+
* OpenAPI spec version: 1.0
8+
*/
9+
10+
/**
11+
* The operating system for which to check the update. Can be either "android" or "ios".
12+
*/
13+
export type CheckUpdateDtoOs = (typeof CheckUpdateDtoOs)[keyof typeof CheckUpdateDtoOs]
14+
15+
// eslint-disable-next-line @typescript-eslint/no-redeclare
16+
export const CheckUpdateDtoOs = {
17+
android: 'android',
18+
ios: 'ios',
19+
} as const

src/api/types/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export * from './authResendVerificationEmailDto'
2424
export * from './authResetPasswordDto'
2525
export * from './authUpdateDto'
2626
export * from './authorPublicDto'
27+
export * from './checkUpdateDto'
28+
export * from './checkUpdateDtoOs'
2729
export * from './createArticleDto'
2830
export * from './createUserDto'
2931
export * from './errorEntity'

0 commit comments

Comments
 (0)