Menu Option Set Items

Create option set item

import { MenuOptionSetItemsApi, MenuItemOptionSetItemBase } from '@flipdish/api-client-typescript'

let menuId: number = <menu id>;
let menuSectionId: number = <section id>;
let menuSectionItemId: number = <section item id>;
let menuOptionSetId: number = <option set id>;

let menuOptionSetItemsApi = new MenuOptionSetItemsApi();    

let menuItemOptionSetItem = new MenuItemOptionSetItemBase();
menuItemOptionSetItem.Name = "Sample item";
menuItemOptionSetItem.Price = 0.20;    

menuOptionSetItemsApi.addMenuItemOptionSetItem(menuId, menuSectionId, menuSectionItemId, menuOptionSetId, menuItemOptionSetItem)
.then(response => {
  if (response.response.statusCode == 201) {
    console.log("Menu option set created at: " + response.response.headers.location);
  }
}).catch(error => {
  console.log(error);
})

Update option set item

import { MenuOptionSetItemsApi, MenuItemOptionSetItemBase } from '@flipdish/api-client-typescript'

let menuId: number = <menu id>;
let menuSectionId: number = <section id>;
let menuSectionItemId: number = <section item id>;
let menuOptionSetId: number = <option set id>;
let menuOptionSetItemId: number = <option set item id;

let menuOptionSetItemsApi = new MenuOptionSetItemsApi();    

let menuItemOptionSetItem = new MenuItemOptionSetItemBase();
menuItemOptionSetItem.Name = "Sample item";
menuItemOptionSetItem.Price = 0.20;    

menuOptionSetItemsApi.updateMenuItemOptionSetItem(menuId, menuSectionId, menuSectionItemId, menuOptionSetId, menuOptionSetItemId, menuItemOptionSetItem)
.then(response => {
  if (response.response.statusCode == 200) {
    console.log("Menu option set updated");
  }
}).catch(error => {
  console.log(error);
})

Delete option set item

import { MenuOptionSetItemsApi, MenuItemOptionSetItemBase } from '@flipdish/api-client-typescript'

let menuId: number = <menu id>;
let menuSectionId: number = <section id>;
let menuSectionItemId: number = <section item id>;
let menuOptionSetId: number = <option set id>;
let menuOptionSetItemId: number = <option set item id;

let menuOptionSetItemsApi = new MenuOptionSetItemsApi();

menuOptionSetItemsApi.removeMenuItemOptionSetItem(menuId, menuSectionId, menuSectionItemId, menuOptionSetId, menuOptionSetItemId)
.then(response => {
  if (response.response.statusCode == 200) {
    console.log("Menu option set deleted");
  }
}).catch(error => {
  console.log(error);
})