{{:: 'controllers.documentation.chooseFramework' | translate }}
PM > Install-Package NikSms.Library.Net
PM > Install-Package NikSms.Library.NetCore
using NikSms.Library.Net.ViewModels; using NikSms.Library.Net.WebApi; using System; using System.Threading.Tasks; namespace AwesomeApplication { public class NikSmsApiV1Client { private readonly PublicApiV1 service; public NikSmsApiV1Client(string username, string password, string culture = "fa") { service = new PublicApiV1(username, password, culture); } public async Task<bool> ResetReceiveSmsVisitedStatus(DateTime? startDate, DateTime? endDate) { var result = await service.ResetReceiveSmsVisitedStatus(startDate, endDate); switch (result.Status) { case LibOperationResultStatus.Success: return result.Data; case LibOperationResultStatus.InvalidModel: throw new Exception("Some required inputs are misssing..."); case LibOperationResultStatus.UnAuthorized: throw new Exception("Some thing is wrong with your account (call support!)"); case LibOperationResultStatus.Failed: throw new Exception("Ooops its our fault!"); default: throw new Exception("You sould not be here... :D"); } } } }
PM > Install-Package NikSms.Library.Net
PM > Install-Package NikSms.Library.NetCore
Imports NikSms.Library.Net.ViewModels Imports NikSms.Library.Net.WebApi Imports System Imports System.Threading.Tasks Namespace AwesomeApplication Public Class NikSmsApiV1Client Private ReadOnly service As PublicApiV1 Public Sub New(ByVal username As String, ByVal password As String, ByVal Optional culture As String = "fa") service = New PublicApiV1(username, password, culture) End Sub Public Async Function ResetReceiveSmsVisitedStatus(ByVal startDate As DateTime?, ByVal endDate As DateTime?) As Task(Of Boolean) Dim result = Await service.ResetReceiveSmsVisitedStatus(startDate, endDate) Select Case result.Status Case LibOperationResultStatus.Success Return result.Data Case LibOperationResultStatus.InvalidModel Throw New Exception("Some required inputs are misssing...") Case LibOperationResultStatus.UnAuthorized Throw New Exception("Some thing is wrong with your account (call support!)") Case LibOperationResultStatus.Failed Throw New Exception("Ooops its our fault!") Case Else Throw New Exception("You sould not be here... :D") End Select End Function End Class End Namespace
npm install --save niksms.library.javascript
import { ApiV1, LibOperationResultStatus, StringDictionary } from 'niksms'; export default class NikSmsApiV1Client{ private service: ApiV1 constructor(username: string, password: string, culture: string = "fa"){ this.service = new ApiV1(username, password, culture); } public async ResetReceiveSmsVisitedStatus( startDate?: Date | null, endDate?: Date | null ): Promise<boolean> { const result = await this.service.ResetReceiveSmsVisitedStatus(startDate, endDate); 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"); } } }
// URL: https://niksms.com/fa/publicapi/ResetReceiveSmsVisitedStatus?username=[username]&password=[password]&startDate=null // METHODS: GET, POST // EXAMPLE: https://niksms.com/fa/publicapi/ResetReceiveSmsVisitedStatus?username=989122399413&password=********** // RESULT: Boolean