Menu Option Sets

Create option set

import { MenuOptionSetsApi, MenuItemOptionSetBase } from '@flipdish/api-client-typescript'

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


let menuOptionSetsApi = new MenuOptionSetsApi();    

let menuItemOptionSetBase = new MenuItemOptionSetBase();
menuItemOptionSetBase.Name = "Sample item";

menuOptionSetsApi.createMenuItemOptionSet(menuId, menuSectionId, menuSectionItemId, menuItemOptionSetBase)
.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

import { MenuOptionSetsApi, MenuItemOptionSetBase } 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 menuOptionSetsApi = new MenuOptionSetsApi();    

let menuItemOptionSetBase = new MenuItemOptionSetBase();
menuItemOptionSetBase.Name = "Sample item";

menuOptionSetsApi.updateMenuItemOptionSet(menuId, menuSectionId, menuSectionItemId, menuOptionSetId, menuItemOptionSetBase)
.then(response => {
  if (response.response.statusCode == 200) {
    console.log("Menu option set updated");
  }
}).catch(error => {
  console.log(error);
})

Delete option set

import { MenuOptionSetsApi } 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 menuOptionSetsApi = new MenuOptionSetsApi();

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