Skip to content

Commit

Permalink
Refactor conversationTemplatesHostname
Browse files Browse the repository at this point in the history
  • Loading branch information
asein-sinch committed Apr 5, 2024
1 parent 02003e8 commit a067d3d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class ConversationDomainApi implements Api {
switch (this.apiName) {
case 'TemplatesV1Api':
case 'TemplatesV2Api':
return this.sinchClientParameters.templatesHostname ?? `https://${region}.template.api.sinch.com`;
return this.sinchClientParameters.conversationTemplatesHostname ?? `https://${region}.template.api.sinch.com`;
default:
return this.sinchClientParameters.conversationHostname ?? `https://${region}.conversation.api.sinch.com`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ApiHostname, Region, UnifiedCredentials } from '@sinch/sdk-client';
describe('Conversation API', () => {
let conversationApi: ConversationDomainApi;
let templateApi: TemplatesV2Api;
let params: UnifiedCredentials & Pick<ApiHostname, 'conversationHostname' | 'templatesHostname'>;
let params: UnifiedCredentials & Pick<ApiHostname, 'conversationHostname' | 'conversationTemplatesHostname'>;
const CUSTOM_HOSTNAME = 'https://new.host.name';
const CUSTOM_HOSTNAME_TEMPLATES = 'https://templates.new.host.name';

Expand Down Expand Up @@ -54,7 +54,7 @@ describe('Conversation API', () => {
});

it('should use the hostname parameter for templates only', () => {
params.templatesHostname = CUSTOM_HOSTNAME_TEMPLATES;
params.conversationTemplatesHostname = CUSTOM_HOSTNAME_TEMPLATES;
conversationApi = new ConversationDomainApi(params, 'dummy');
conversationApi.getSinchClient();
templateApi = new TemplatesV2Api(params);
Expand All @@ -65,7 +65,7 @@ describe('Conversation API', () => {

it('should use the hostname parameter for the 2 different domains', () => {
params.conversationHostname = CUSTOM_HOSTNAME;
params.templatesHostname = CUSTOM_HOSTNAME_TEMPLATES;
params.conversationTemplatesHostname = CUSTOM_HOSTNAME_TEMPLATES;
conversationApi = new ConversationDomainApi(params, 'dummy');
conversationApi.getSinchClient();
templateApi = new TemplatesV2Api(params);
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-client/src/domain/domain-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface ApplicationCredentials {
export interface ApiHostname {
authHostname?: string;
conversationHostname?: string;
templatesHostname?: string;
conversationTemplatesHostname?: string;
faxHostname?: string;
numbersHostname?: string;
smsHostname?: string;
Expand Down

0 comments on commit a067d3d

Please sign in to comment.