Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
681 changes: 667 additions & 14 deletions scripts/data/swagger-spec.json

Large diffs are not rendered by default.

79 changes: 61 additions & 18 deletions src/api/query/articles/articles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ import type {
ArticlesControllerFindAllParams,
ArticlesControllerFindDraftsParams,
CreateArticleDto,
ErrorServerEntity,
UpdateArticleDto,
} from '../../types'

type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1]

/**
* Creates a new article with the provided details.
* @summary Create Article
*/
export const articlesControllerCreate = (
createArticleDto: BodyType<CreateArticleDto>,
options?: SecondParameter<typeof customInstance>
Expand All @@ -44,7 +49,7 @@ export const articlesControllerCreate = (
}

export const getArticlesControllerCreateMutationOptions = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand Down Expand Up @@ -78,10 +83,13 @@ export type ArticlesControllerCreateMutationResult = NonNullable<
Awaited<ReturnType<typeof articlesControllerCreate>>
>
export type ArticlesControllerCreateMutationBody = BodyType<CreateArticleDto>
export type ArticlesControllerCreateMutationError = ErrorType<unknown>
export type ArticlesControllerCreateMutationError = ErrorType<ErrorServerEntity>

/**
* @summary Create Article
*/
export const useArticlesControllerCreate = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand All @@ -96,6 +104,10 @@ export const useArticlesControllerCreate = <

return useMutation(mutationOptions)
}
/**
* Retrieves a list of all articles with pagination support.
* @summary Find All Articles
*/
export const articlesControllerFindAll = (
params: ArticlesControllerFindAllParams,
options?: SecondParameter<typeof customInstance>,
Expand All @@ -113,7 +125,7 @@ export const getArticlesControllerFindAllQueryKey = (params: ArticlesControllerF

export const getArticlesControllerFindAllQueryOptions = <
TData = Awaited<ReturnType<typeof articlesControllerFindAll>>,
TError = ErrorType<unknown>
TError = ErrorType<ErrorServerEntity>
>(
params: ArticlesControllerFindAllParams,
options?: {
Expand All @@ -139,11 +151,14 @@ export const getArticlesControllerFindAllQueryOptions = <
export type ArticlesControllerFindAllQueryResult = NonNullable<
Awaited<ReturnType<typeof articlesControllerFindAll>>
>
export type ArticlesControllerFindAllQueryError = ErrorType<unknown>
export type ArticlesControllerFindAllQueryError = ErrorType<ErrorServerEntity>

/**
* @summary Find All Articles
*/
export const useArticlesControllerFindAll = <
TData = Awaited<ReturnType<typeof articlesControllerFindAll>>,
TError = ErrorType<unknown>
TError = ErrorType<ErrorServerEntity>
>(
params: ArticlesControllerFindAllParams,
options?: {
Expand All @@ -160,6 +175,10 @@ export const useArticlesControllerFindAll = <
return query
}

/**
* Retrieves a list of draft articles with pagination support.
* @summary Find Draft Articles
*/
export const articlesControllerFindDrafts = (
params: ArticlesControllerFindDraftsParams,
options?: SecondParameter<typeof customInstance>,
Expand All @@ -179,7 +198,7 @@ export const getArticlesControllerFindDraftsQueryKey = (

export const getArticlesControllerFindDraftsQueryOptions = <
TData = Awaited<ReturnType<typeof articlesControllerFindDrafts>>,
TError = ErrorType<unknown>
TError = ErrorType<ErrorServerEntity>
>(
params: ArticlesControllerFindDraftsParams,
options?: {
Expand All @@ -205,11 +224,14 @@ export const getArticlesControllerFindDraftsQueryOptions = <
export type ArticlesControllerFindDraftsQueryResult = NonNullable<
Awaited<ReturnType<typeof articlesControllerFindDrafts>>
>
export type ArticlesControllerFindDraftsQueryError = ErrorType<unknown>
export type ArticlesControllerFindDraftsQueryError = ErrorType<ErrorServerEntity>

/**
* @summary Find Draft Articles
*/
export const useArticlesControllerFindDrafts = <
TData = Awaited<ReturnType<typeof articlesControllerFindDrafts>>,
TError = ErrorType<unknown>
TError = ErrorType<ErrorServerEntity>
>(
params: ArticlesControllerFindDraftsParams,
options?: {
Expand All @@ -226,6 +248,10 @@ export const useArticlesControllerFindDrafts = <
return query
}

/**
* Retrieves an article by its unique identifier.
* @summary Find Article by ID
*/
export const articlesControllerFindOne = (
id: number,
options?: SecondParameter<typeof customInstance>,
Expand All @@ -243,7 +269,7 @@ export const getArticlesControllerFindOneQueryKey = (id: number) => {

export const getArticlesControllerFindOneQueryOptions = <
TData = Awaited<ReturnType<typeof articlesControllerFindOne>>,
TError = ErrorType<unknown>
TError = ErrorType<ErrorServerEntity>
>(
id: number,
options?: {
Expand All @@ -269,11 +295,14 @@ export const getArticlesControllerFindOneQueryOptions = <
export type ArticlesControllerFindOneQueryResult = NonNullable<
Awaited<ReturnType<typeof articlesControllerFindOne>>
>
export type ArticlesControllerFindOneQueryError = ErrorType<unknown>
export type ArticlesControllerFindOneQueryError = ErrorType<ErrorServerEntity>

/**
* @summary Find Article by ID
*/
export const useArticlesControllerFindOne = <
TData = Awaited<ReturnType<typeof articlesControllerFindOne>>,
TError = ErrorType<unknown>
TError = ErrorType<ErrorServerEntity>
>(
id: number,
options?: {
Expand All @@ -290,6 +319,10 @@ export const useArticlesControllerFindOne = <
return query
}

/**
* Updates an article with the provided details.
* @summary Update Article
*/
export const articlesControllerUpdate = (
id: number,
updateArticleDto: BodyType<UpdateArticleDto>,
Expand All @@ -307,7 +340,7 @@ export const articlesControllerUpdate = (
}

export const getArticlesControllerUpdateMutationOptions = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand Down Expand Up @@ -341,10 +374,13 @@ export type ArticlesControllerUpdateMutationResult = NonNullable<
Awaited<ReturnType<typeof articlesControllerUpdate>>
>
export type ArticlesControllerUpdateMutationBody = BodyType<UpdateArticleDto>
export type ArticlesControllerUpdateMutationError = ErrorType<unknown>
export type ArticlesControllerUpdateMutationError = ErrorType<ErrorServerEntity>

/**
* @summary Update Article
*/
export const useArticlesControllerUpdate = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand All @@ -359,6 +395,10 @@ export const useArticlesControllerUpdate = <

return useMutation(mutationOptions)
}
/**
* Deletes an article by its unique identifier.
* @summary Remove Article
*/
export const articlesControllerRemove = (
id: number,
options?: SecondParameter<typeof customInstance>
Expand All @@ -367,7 +407,7 @@ export const articlesControllerRemove = (
}

export const getArticlesControllerRemoveMutationOptions = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand Down Expand Up @@ -401,10 +441,13 @@ export type ArticlesControllerRemoveMutationResult = NonNullable<
Awaited<ReturnType<typeof articlesControllerRemove>>
>

export type ArticlesControllerRemoveMutationError = ErrorType<unknown>
export type ArticlesControllerRemoveMutationError = ErrorType<ErrorServerEntity>

/**
* @summary Remove Article
*/
export const useArticlesControllerRemove = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand Down
6 changes: 3 additions & 3 deletions src/api/query/auth-social/auth-social.msw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const getAuthGoogleControllerLoginResponseMock = (
): AuthEntity => ({
accessToken: faker.word.sample(),
refreshToken: faker.word.sample(),
tokenExpires: faker.word.sample(),
tokenExpires: faker.number.int({ min: undefined, max: undefined }),
user: {
consent: faker.helpers.arrayElement([
{
Expand Down Expand Up @@ -56,7 +56,7 @@ export const getAuthFacebookControllerLoginResponseMock = (
): AuthEntity => ({
accessToken: faker.word.sample(),
refreshToken: faker.word.sample(),
tokenExpires: faker.word.sample(),
tokenExpires: faker.number.int({ min: undefined, max: undefined }),
user: {
consent: faker.helpers.arrayElement([
{
Expand Down Expand Up @@ -96,7 +96,7 @@ export const getAuthAppleControllerLoginResponseMock = (
): AuthEntity => ({
accessToken: faker.word.sample(),
refreshToken: faker.word.sample(),
tokenExpires: faker.word.sample(),
tokenExpires: faker.number.int({ min: undefined, max: undefined }),
user: {
consent: faker.helpers.arrayElement([
{
Expand Down
41 changes: 32 additions & 9 deletions src/api/query/auth-social/auth-social.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ import type {
AuthEntity,
AuthFacebookLoginDto,
AuthGoogleLoginDto,
ErrorEntity,
ErrorServerEntity,
} from '../../types'

type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1]

/**
* Logs the user into the system using Google authentication
* @summary Login with Google
*/
export const authGoogleControllerLogin = (
authGoogleLoginDto: BodyType<AuthGoogleLoginDto>,
options?: SecondParameter<typeof customInstance>
Expand All @@ -36,7 +42,7 @@ export const authGoogleControllerLogin = (
}

export const getAuthGoogleControllerLoginMutationOptions = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorEntity | ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand Down Expand Up @@ -70,10 +76,13 @@ export type AuthGoogleControllerLoginMutationResult = NonNullable<
Awaited<ReturnType<typeof authGoogleControllerLogin>>
>
export type AuthGoogleControllerLoginMutationBody = BodyType<AuthGoogleLoginDto>
export type AuthGoogleControllerLoginMutationError = ErrorType<unknown>
export type AuthGoogleControllerLoginMutationError = ErrorType<ErrorEntity | ErrorServerEntity>

/**
* @summary Login with Google
*/
export const useAuthGoogleControllerLogin = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorEntity | ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand All @@ -88,6 +97,10 @@ export const useAuthGoogleControllerLogin = <

return useMutation(mutationOptions)
}
/**
* Logs the user into the system using Facebook authentication
* @summary Login with Facebook
*/
export const authFacebookControllerLogin = (
authFacebookLoginDto: BodyType<AuthFacebookLoginDto>,
options?: SecondParameter<typeof customInstance>
Expand All @@ -104,7 +117,7 @@ export const authFacebookControllerLogin = (
}

export const getAuthFacebookControllerLoginMutationOptions = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorEntity | ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand Down Expand Up @@ -138,10 +151,13 @@ export type AuthFacebookControllerLoginMutationResult = NonNullable<
Awaited<ReturnType<typeof authFacebookControllerLogin>>
>
export type AuthFacebookControllerLoginMutationBody = BodyType<AuthFacebookLoginDto>
export type AuthFacebookControllerLoginMutationError = ErrorType<unknown>
export type AuthFacebookControllerLoginMutationError = ErrorType<ErrorEntity | ErrorServerEntity>

/**
* @summary Login with Facebook
*/
export const useAuthFacebookControllerLogin = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorEntity | ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand All @@ -156,6 +172,10 @@ export const useAuthFacebookControllerLogin = <

return useMutation(mutationOptions)
}
/**
* Logs the user into the system using Apple authentication
* @summary Login with Apple
*/
export const authAppleControllerLogin = (
authAppleLoginDto: BodyType<AuthAppleLoginDto>,
options?: SecondParameter<typeof customInstance>
Expand All @@ -172,7 +192,7 @@ export const authAppleControllerLogin = (
}

export const getAuthAppleControllerLoginMutationOptions = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorEntity | ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand Down Expand Up @@ -206,10 +226,13 @@ export type AuthAppleControllerLoginMutationResult = NonNullable<
Awaited<ReturnType<typeof authAppleControllerLogin>>
>
export type AuthAppleControllerLoginMutationBody = BodyType<AuthAppleLoginDto>
export type AuthAppleControllerLoginMutationError = ErrorType<unknown>
export type AuthAppleControllerLoginMutationError = ErrorType<ErrorEntity | ErrorServerEntity>

/**
* @summary Login with Apple
*/
export const useAuthAppleControllerLogin = <
TError = ErrorType<unknown>,
TError = ErrorType<ErrorEntity | ErrorServerEntity>,
TContext = unknown
>(options?: {
mutation?: UseMutationOptions<
Expand Down
Loading