GithubHelp home page GithubHelp logo

fromdarkhell / dominosharp Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 3.0 30 KB

A C# Wrapper for the Dominos Pizza API made by a person with nothing else better to do.

License: MIT License

C# 100.00%

dominosharp's Introduction

DominoSharp

Description

This is a C# wrapper for the Dominos Pizza API.

It's a port of:
- The PizzaAPI nodeJS Module written by RIAEvangelist
- The PizzaAPI Python wrapper written by Magicjarvis

Quick Start

First create a Customer object and set the customer's address:

Address address = new Address("1600 Pennsylvania Ave NW, Washington, DC 20500 U.S.");
Customer thePresident = new Customer("The", "President", address, "[email protected]", "2024561111");

Then, find a Store object that will deliver to the customer's address.

Store nearestStore = thePresident.getNearestStore();

For you to be able to order any items you'll need the item's product codes.
To find the codes, get the menu from the store, and search for the items to add. Kindly ask the Store object for its Menu.

Menu menu = nearestStore.getMenu();

Then to search the menu for an item do:

// Get all items in the menu containing "Pizza".
List<Menu.MenuItem> menuItems = menu.searchInMenu("Pizza");

Once you've gathered all the MenuItem's you want. Time to start ordering them bucko!

The URLs.Country enum is to change the URL we gather data from based on the country (USA or Canada currently).

Order order = new Order(nearestStore, thePresident, URLs.Country.USA); // Create a new Order.
order.addItem("B8PCPT", 1); // Add 1 Parmesan Bread Twist onto our order.
order.addItem("MARBRWNE", 5); // We want 5 brownies because we're very fat

You can even remove items! Just perfect for when you mess up and realize you're too fat for those 5 brownies from earlier...

order.removeItem("MARBRWNE"); // Remove our brownies, sadly...

Next up is actually paying for your one parmesan bread twist or whatever.
You need to create a new CreditCard object to pay with.

Payment.CreditCard card = new Payment.CreditCard("4100123422343234", "0115", "777", "90210");

Then you get to place an order and **hopefully** if my code is to be believed, pay for it:

order.placeOrder(card);

dominosharp's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

kylemc1413

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.