Skip to content

Commit f9ce7bb

Browse files
feat: adiciona o parâmetro opcional baseUrl no construtor da classe Bling (#35)
Co-authored-by: Alexandre Batistella Bellas <[email protected]>
1 parent 53a8759 commit f9ce7bb

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/bling.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ export default class Bling {
6565
*
6666
* @param accessToken O token de acesso à API do Bling.
6767
*/
68-
constructor(accessToken: string) {
69-
this.#repository = getRepository(accessToken)
68+
constructor(
69+
accessToken: string,
70+
baseUrl = 'https://api.bling.com.br/Api/v3'
71+
) {
72+
this.#repository = getRepository(accessToken, baseUrl)
7073
this.#modules = {}
7174
}
7275

src/providers/ioc.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ import { IBlingRepository } from '../repositories/bling.repository.interface'
66
*
77
* @returns {IBlingRepository}
88
*/
9-
export function getRepository(accessToken: string): IBlingRepository {
9+
export function getRepository(
10+
accessToken: string,
11+
baseUrl: string
12+
): IBlingRepository {
1013
return new BlingRepository({
11-
baseUrl: 'https://api.bling.com.br/Api/v3',
14+
baseUrl,
1215
accessToken
1316
})
1417
}

0 commit comments

Comments
 (0)