Giter Club home page Giter Club logo

boatsswift's Introduction

DEPRECATED

The website this module is for has shutdown.

BoatsSwift

This is the official API library for Discord Boats in the programming language: Swift.

How do I add this library to my workspace?

In your Package.swift file, just add .package(url: "https://github.com/DiscordBoats/BoatsSwift", .branch("master")) to your dependencies, and add BoatsSwift in your target dependencies.

How do I use the library?

The package is very simple, you just import the library, initalise the library with the API key, and call the methods to get relevant information.

Examples

Getting the library ready to connect to the website's API (THIS IS VERY IMPORTANT, METHODS WILL FAIL IF YOU DO NOT DO THIS)

import BoatsSwift 
let boats = BoatsSwift("apiKey")

Posting a server count to the website's API.

boats.postStats(botID: (exampleBotID)!, serverCount: 0) // exampleBotID must be passed as UInt64

This should post the server count to the website's API, and it will return an JSON response saying if it was successful. In the occasion that it was not successful, it will return an JSON response with an error message and you should be able to figure what went wrong.

Requesting user information from the website's API.

boats.getUser(userID: (exampleUserID)!) // This must be passed as UInt64

This should return an JSON response with all the user details. In the occasion that it was not successful, a error message will be returned and you should be able to figure what went wrong.

Requesting bot information from the website's API.

boats.getBotInfo(botID: (exampleBotID)!) // This must be passed as UInt64

This should return an JSON response with all the bot details. In the occasion that it was not successful, a error message will be returned and you should be able to figure what went wrong.

Checking if a user voted for the bot

boats.getUserVoted(botID: (exampleBotID)!, userID: (exampleUserID)!) // This must be passed as UInt64

This should return an JSON response confirming if the user has voted or not. In the occasion that it was not successful, a error message will be returned and you should be able to figure what went wrong.

IMPORTANT NOTE

All parameters that are either bot IDs or user IDs must be passed as UInt64, in order for the library to function as intended. More information about UInt64 can be found here

This library was re-written to add full API coverage on 15th June 2020.

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.