import {
ApiV2,
LibOperationResultStatus,
ApiV2ContactGroup
} from 'niksms';
export default class NikSmsApiV2Client{
private service: ApiV2
constructor(username: string, password: string){
this.service = new ApiV2(username, password);
}
public async SendGroup(): Promise<ApiV2SendGroupResult> {
var input = {
SenderNumber: "YourSenderNumber",
Recipients: ArrayOfRecipients,
Message: "Here goes your message ...",
SendDate: SendDate,
LocalIds: number[]
}
const result = await this.service.SendGroup(input);
switch (result.Status)
{
case LibOperationResultStatus.Success:
return result.Data;
case LibOperationResultStatus.InvalidModel:
throw new Error("Some required inputs are misssing...");
case LibOperationResultStatus.UnAuthorized:
throw new Error("Some thing is wrong with your account (call support!)");
case LibOperationResultStatus.Failed:
throw new Error("Ooops its our fault!");
default:
throw new Error("You sould not be here... :D");
}
}
}