Giter Site home page Giter Site logo

clicksendclient's Introduction

The official swift library for ClickSend v3 REST API

This is the official ClickSend SDK. Documentation can be found here.

Requirements

Installation

Manual

You can integrate ClicksendSwift into your project manually.

  1. Open up Terminal, cd into your top-level project directory, and run the following command "if" your project is not initialized as a git repository: Open Terminal git init
  2. Add ClickSend-swift as a git submodule by running the following command: git submodule add https://github.com/ClickSend/clicksend-swift.git
  3. Next, go inside the submodule directory "clicksend-swift" and Drag "ClickSendClient" folder inside your project
  4. Lastly, Install Alamofire using Cocoapods
    1. CocoapodsCocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your Podfile:
      1. Open up Terminal, cd into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:
      2. Open Terminal
      3. pod init
      4. Podfile will be generated and inside that Podfile add
      5. pod 'Alamofire', '~> 4.9.1' and save
      6. Go back to Terminal and run pod install
    2. After installing Alamofire sing cocoapods, make sure to Open the Project using "project_name.xcworkspace"
  5. Congrats, You are good to go!

Cocoapods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your Podfile: pod 'ClickSendSwift'

Documentation

Documentation for our SDK and REST API can be found here.

Getting Started (sms/send example)

Please follow the installation procedure and then run the following code:

import Alamofire

if let authHeader = Request.authorizationHeader(user: "USERNAME", password: "PASSWORD") {
    ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
}

let message1 = SmsMessage(
        body: "Chocolate bar icing icing oat cake carrot cake jelly cotton MWEvciEPIr.", 
        to: "+0451111111", 
        source: "swift"
)

let message2 = SmsMessage(
        body: "Chocolate bar icing icing oat cake carrot cake jelly cotton MWEvciEPIr.", 
        source: "swift", 
        listId: 1234
)

let smsCollection = SmsMessageCollection(messages: [message1, message2])
SMSAPI.smsSendPost(smsMessages: smsCollection) { (dataString, error) in

    guard let dataString = dataString else {
        print(error!)
        return
    }

    if let data = dataString.data(using: String.Encoding.utf8) {
        do {
            if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                print(dictonary)
            } else {
                print("bad json")
            }
        } catch let error as NSError {
            print(error)
        }
    }
}

clicksendclient's People

Contributors

cyberkallen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.