{{:: '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.Collections.Generic; using System.Threading.Tasks; namespace AwesomeApplication { public class NikSmsApiV2Client { private readonly PublicApiV2 service; public NikSmsApiV2Client(string username, string password) { service = new PublicApiV2(username, password); } public async Task<ApiV2ContactGroup> ContactGroupCreate() { var result = await service.ContactGroupCreate("group name goes here...."); 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.Collections.Generic Imports System.Threading.Tasks Namespace AwesomeApplication Public Class NikSmsApiV2Client Private ReadOnly service As PublicApiV2 Public Sub New(ByVal username As String, ByVal password As String) service = New PublicApiV2(username, password) End Sub Public Async Function ContactGroupCreate() As Task(Of ApiV2ContactGroup) Dim result = Await service.ContactGroupCreate("group name goes here....") 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 { 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 ContactGroupCreate(): Promise<ApiV2ContactGroup> { const result = await this.service.ContactGroupCreate("group name goes here...."); 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/api/v2/contact/group/create // PAY LOAD: { "Username": "989122399413", "Password": "*******", "name": "group name goes here..." } // METHODS: GET, POST // RESULT: { "Data": { "Contacts": 0, "Date": "2018-09-17T15:24:06.3980749+04:30", "Id": 60083, "Name": "group name goes here..." }, "Status": 4, "Exception": null }
{{:: 'controllers.documentation.titleTable' | translate }} {{:: 'controllers.documentation.mustDo' | translate }} {{:: 'controllers.documentation.typeTable' | translate }} {{:: 'controllers.documentation.defualtValue' | translate }} {{:: 'controllers.documentation.description' | translate }}
1 name بله متن
{{:: 'controllers.documentation.titleTable' | translate }} {{:: 'controllers.documentation.typeTable' | translate }} {{:: 'controllers.documentation.description' | translate }}
1
LibOperationResult<ApiV2ContactGroup>
Object public class ApiV2ContactGroup { public int Contacts { get; set; } public DateTime Date { get; set; } public int Id { get; set; } public string Name { get; set; } }