-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(lib-api): httpclient폴더 이동, 서버별 인스턴스 생성 * fix(lib-api): httpclient 수정 반영 * feat: cSpell 예외 추가 * fix(lib-api): httpclient -> http-client 파일명 변경
- Loading branch information
Showing
27 changed files
with
350 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"cSpell.words": ["httpclient"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,37 @@ | ||
import { AxiosInstance } from "axios"; | ||
import { AxiosRequestConfig, AxiosResponse } from "axios"; | ||
|
||
import { AuthApi, Configuration } from "@til-log.lab/tilog-api"; | ||
import { | ||
AuthApi, | ||
GetAccessTokenUsingRefreshTokenResponse, | ||
} from "@til-log.lab/tilog-api"; | ||
|
||
export default class AuthRepository extends AuthApi { | ||
constructor( | ||
axios?: AxiosInstance, | ||
basePath?: string, | ||
configuration?: Configuration | ||
) { | ||
super(configuration, basePath, axios); | ||
import ExceptionInterface from "@Library/api/exception/interface"; | ||
import RepositoryConfig from "@Library/api/interface/RepositoryConfig"; | ||
|
||
export default class AuthRepository { | ||
protected authApi: AuthApi; | ||
constructor(repositoryConfig: RepositoryConfig) { | ||
this.authApi = new AuthApi( | ||
repositoryConfig.configuration, | ||
repositoryConfig.basePath, | ||
repositoryConfig.axios | ||
); | ||
} | ||
deleteRefreshToken( | ||
options?: AxiosRequestConfig | ||
): Promise<AxiosResponse<void, ExceptionInterface>> { | ||
return this.authApi.usersAuthControllerDeleteRefreshToken(options); | ||
} | ||
|
||
getAccessTokenUsingRefreshToken( | ||
userAgent?: string, | ||
options?: AxiosRequestConfig | ||
): Promise< | ||
AxiosResponse<GetAccessTokenUsingRefreshTokenResponse, ExceptionInterface> | ||
> { | ||
return this.authApi.usersAuthControllerGetAccessTokenUsingRefreshToken( | ||
userAgent, | ||
options | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import { TILOG_API } from "@Library/constants/environment"; | ||
import AuthRepository from "@Library/api/auth/authRepository"; | ||
import AuthService from "@Library/api/auth/authService"; | ||
import httpClient from "@Library/api/httpClient"; | ||
import { tilogApi } from "@Library/api/http-client"; | ||
|
||
const authRepository = new AuthRepository(httpClient.http, TILOG_API); | ||
const authService = new AuthService(authRepository, httpClient.http); | ||
const authRepository = new AuthRepository({ axios: tilogApi.http }); | ||
const authService = new AuthService(authRepository, tilogApi.http); | ||
|
||
export default authService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,40 @@ | ||
import { AxiosInstance } from "axios"; | ||
import { AxiosRequestConfig, AxiosResponse } from "axios"; | ||
|
||
import { CategoryApi, Configuration } from "@til-log.lab/tilog-api"; | ||
import { | ||
CategoryApi, | ||
GetCategoriesResponseDto, | ||
GetUserCategoriesResponseDto, | ||
} from "@til-log.lab/tilog-api"; | ||
|
||
export default class CategoryRepository extends CategoryApi { | ||
constructor( | ||
axios?: AxiosInstance, | ||
basePath?: string, | ||
configuration?: Configuration | ||
) { | ||
super(configuration, basePath, axios); | ||
import ExceptionInterface from "@Library/api/exception/interface"; | ||
import RepositoryConfig from "@Library/api/interface/RepositoryConfig"; | ||
|
||
export default class CategoryRepository { | ||
protected categoryApi: CategoryApi; | ||
constructor(repositoryConfig: RepositoryConfig) { | ||
this.categoryApi = new CategoryApi( | ||
repositoryConfig.configuration, | ||
repositoryConfig.basePath, | ||
repositoryConfig.axios | ||
); | ||
} | ||
getCategories( | ||
categoryName?: string, | ||
options?: AxiosRequestConfig | ||
): Promise<AxiosResponse<GetCategoriesResponseDto, ExceptionInterface>> { | ||
return this.categoryApi.categoriesControllerGetCategories( | ||
categoryName, | ||
options | ||
); | ||
} | ||
|
||
getUsersCategories( | ||
userId: number, | ||
options?: AxiosRequestConfig | ||
): Promise<AxiosResponse<GetUserCategoriesResponseDto, ExceptionInterface>> { | ||
return this.categoryApi.categoriesControllerGetUsersCategories( | ||
userId, | ||
options | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
import { TILOG_API } from "@Library/constants/environment"; | ||
import CategoryRepository from "@Library/api/category/categoryRepository"; | ||
import CategoryService from "@Library/api/category/categoryService"; | ||
import httpClient from "@Library/api/httpClient"; | ||
import { tilogApi } from "@Library/api/http-client"; | ||
|
||
const categoryRepository = new CategoryRepository(httpClient.http, TILOG_API); | ||
const categoryService = new CategoryService( | ||
categoryRepository, | ||
httpClient.http | ||
); | ||
const categoryRepository = new CategoryRepository({ axios: tilogApi.http }); | ||
const categoryService = new CategoryService(categoryRepository); | ||
|
||
export default categoryService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import HttpClient from "@Library/api/http-client/HttpClient"; | ||
|
||
const tilogApi = new HttpClient({ | ||
baseURL: process.env.TILOG_API, | ||
}); | ||
|
||
const githubApi = new HttpClient({}); | ||
|
||
export { tilogApi, githubApi }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { AxiosInstance } from "axios"; | ||
|
||
import { Configuration } from "@til-log.lab/tilog-api"; | ||
|
||
export default interface RepositoryConfig { | ||
configuration?: Configuration; | ||
basePath?: string; | ||
axios?: AxiosInstance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,63 @@ | ||
import { AxiosInstance } from "axios"; | ||
import { AxiosRequestConfig, AxiosResponse } from "axios"; | ||
|
||
import { CommentApi, Configuration } from "@til-log.lab/tilog-api"; | ||
import { | ||
CommentApi, | ||
CreateCommentsRequestBodyDto, | ||
DeleteCommentRequestDto, | ||
GetCommentsResponseDto, | ||
UpdateCommentRequestDto, | ||
} from "@til-log.lab/tilog-api"; | ||
|
||
export default class CommentRepository extends CommentApi { | ||
constructor( | ||
axios?: AxiosInstance, | ||
basePath?: string, | ||
configuration?: Configuration | ||
) { | ||
super(configuration, basePath, axios); | ||
import RepositoryConfig from "@Library/api/interface/RepositoryConfig"; | ||
|
||
export default class CommentRepository { | ||
protected commentApi: CommentApi; | ||
constructor(repositoryConfig: RepositoryConfig) { | ||
this.commentApi = new CommentApi( | ||
repositoryConfig.configuration, | ||
repositoryConfig.basePath, | ||
repositoryConfig.axios | ||
); | ||
} | ||
createComment( | ||
createCommentsRequestBodyDto: CreateCommentsRequestBodyDto, | ||
options?: AxiosRequestConfig | ||
): Promise<AxiosResponse<void, any>> { | ||
return this.commentApi.commentsControllerCreateComment( | ||
createCommentsRequestBodyDto, | ||
options | ||
); | ||
} | ||
|
||
deleteComment( | ||
deleteCommentRequestDto: DeleteCommentRequestDto, | ||
options?: AxiosRequestConfig | ||
): Promise<AxiosResponse<void, any>> { | ||
return this.commentApi.commentsControllerDeleteComment( | ||
deleteCommentRequestDto, | ||
options | ||
); | ||
} | ||
|
||
getComments( | ||
postId: string, | ||
replyTo?: string, | ||
options?: AxiosRequestConfig | ||
): Promise<AxiosResponse<GetCommentsResponseDto, any>> { | ||
return this.commentApi.commentsControllerGetComments( | ||
postId, | ||
replyTo, | ||
options | ||
); | ||
} | ||
|
||
updateComment( | ||
updateCommentRequestDto: UpdateCommentRequestDto, | ||
options?: AxiosRequestConfig | ||
): Promise<AxiosResponse<void, any>> { | ||
return this.commentApi.commentsControllerUpdateComment( | ||
updateCommentRequestDto, | ||
options | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.