shopbuilder_api v0.1.27 ExSbapi View Source
Elixir Wrapper Around Shopbuilder API
Link to this section Summary
Functions
Creates a product collection to the given website_url
using the provided arguments
Creates a product option to the given website_url
with the provided arguments
Creates a product to the given website_url
with the provided arguments
Creates a product to the given website_url
with a provided product_object
Returns {:ok,_ }
or {:error, %{reason: "unauthorized"}}
Builds a new ExSbapi.Collection
struct using the provided arguments
Builds a new ExSbapi.Product
struct using the provided arguments
Builds a new ExSbapi.ProductVariation
struct using the provided arguments
Creates a image to the given website_url
Deletes the option with the given option_id
from the given website_url
Fetchs all product collections from the given website_url
Gets the option with the given option_id
from the given website_url
Fetchs all product options from the given website_url
Fetchs all products from the given website_url
Gets the sublevel menu link with the given menu_id
from the given website_url
Fetchs all sublevel menu links from the given website_url
This function is expecting list_of_uuid
,date
, access_token
and client
Initiates a product bulk operation that can create, update or delete a set of products (up to 20 products)
in a single request to the given website_url
Set app settings
Initiates a sublevel menu link bulk operation that can update a set of sublevel menu links
in a single request to the given website_url
Updates a image to the given website_url
Updates a product option with the given option_id
to the given website_url
with the provided arguments
Updates a sublevel menu link with the given menu_id
to the given website_url
Link to this section Functions
Creates a product collection to the given website_url
using the provided arguments.
Arguments
title
- a unique string for the product variation.description
- description for the variarionimage
- anImage
structref
- a reference string
Makes a POST
request to the given website_url
using the OAuth2.AccessToken
.
Creates a product option to the given website_url
with the provided arguments.
Arguments
name
- name of the option.bundle_type
- “shop_builder” or “digital_goods”, bundle type to which this option is available.is_attribute
- boolean, to indicate if this option is an attribute.is_searchable
- boolean, to indicate if this option should be added as a filter in the shop page.is_default_visible
- boolean, to indicate if this option should show when adding products.show_as_button
- boolean, to indicate if this option should show as a button in the product page.facet_widget_type
- string, provide the facet filter widget type.
Makes a POST
request to the given website_url
using the OAuth2.AccessToken
.
Creates a product to the given website_url
with the provided arguments.
Arguments
title
- title of the product.variations
- a list ofExSbapi.ProductVariation
structscollections
- a list ofExSbapi.ProductType
structsdescription
- description of the product.status
- “0” or “1”images
- a list of imagesref
- a reference stringlanguage
- language code ex. “en”new
- boolean, to indicate if product is newon_sale
- boolean, to indicate if product is on salesame_price
- boolean, to indicate if all product variations has the same priceprice
- aExSbapi.Price
struct (will apply to all variations)same_weight_dimensions
- boolean, to indicate if all product variations has the same dimensions and weightweight
- aExSbapi.ProductWeight
struct (will apply to all variations)dimensions
- aExSbapi.ProductDimensions
struct (will apply to all variations)suggested_products
- a list of suggested productsseo
- a tupple containing seo fieldstype
- ex. “shop_builder_display”
Makes a POST
request to the given website_url
using the OAuth2.AccessToken
.
Creates a product to the given website_url
with a provided product_object
.
Makes a POST
request to the given website_url
using the OAuth2.AccessToken
.
Returns {:ok,_ }
or {:error, %{reason: "unauthorized"}}
Endpoint:
This function is being called from /lib/RtCheckoutWeb/templates/install/channel.js.eex
by
this.channel.join()
Params:
checkout:checkout_id
, message
, socket
Functionality:
It checks website_id
and order_od
that has been sent from client side
with website_id
and
order_id
that has been verified in user_socket
.
Builds a new ExSbapi.Collection
struct using the provided arguments.
Arguments
title
- a unique string for the product variation.description
- description for the variarionimage
- anImage
structref
- a reference string
Builds a new ExSbapi.Product
struct using the provided arguments.
Arguments
title
- title of the product.variations
- a list ofExSbapi.ProductVariation
structscollections
- a list ofExSbapi.ProductType
structsdescription
- description of the product.status
- “0” or “1”images
- a list of imagesref
- a reference stringlanguage
- language code ex. “en”new
- boolean, to indicate if product is newon_sale
- boolean, to indicate if product is on salesame_price
- boolean, to indicate if all product variations has the same priceprice
- aExSbapi.Price
struct (will apply to all variations)same_weight_dimensions
- boolean, to indicate if all product variations has the same dimensions and weightweight
- aExSbapi.ProductWeight
struct (will apply to all variations)dimensions
- aExSbapi.ProductDimensions
struct (will apply to all variations)suggested_products
- a list of suggested productsseo
- a tupple containing seo fieldstype
- ex. “shop_builder_display”
Builds a new ExSbapi.ProductVariation
struct using the provided arguments.
Arguments
sku
- a unique string for the product variation.stock
- an integer, quantity of the variationprice
- aExSbapi.Price
structdimensions
- aExSbapi.ProductDimensions
structweight
- aExSbapi.ProductWeight
structstatus
- “0” or “1”images
- a list of imagesoptions
- optionsold_price
- aExSbapi.Price
struct
Creates a image to the given website_url
.
Arguments
imagename
- name of the image.imagedata
- image in base64.status
- “0” (unpublished) or “1” (published).
Makes a POST
request to the given website_url
using the OAuth2.AccessToken
.
Deletes the option with the given option_id
from the given website_url
.
Makes a DELETE
request to the given website_url
using the OAuth2.AccessToken
Fetchs all product collections from the given website_url
.
Makes a GET
request to the given website_url
using the OAuth2.AccessToken
Gets the option with the given option_id
from the given website_url
.
Makes a GET
request to the given website_url
using the OAuth2.AccessToken
Fetchs all product options from the given website_url
.
Makes a GET
request to the given website_url
using the OAuth2.AccessToken
Fetchs all products from the given website_url
.
Makes a GET
request to the given website_url
using the OAuth2.AccessToken
This function is expecting list_of_uuid
,date
, access_token
and client
The format of date should be:
date: %{
start: %{
year: "2018",
month: "4",
day: "12"
},
end: %{
year: "2018",
month: "4",
day: "20"
}
}
Initiates a product bulk operation that can create, update or delete a set of products (up to 20 products)
in a single request to the given website_url
.
Makes a POST
request to the given website_url
using the OAuth2.AccessToken
.
Set app settings
Endpoint:
This function is being called from /lib/zaq_web/controllers/auth_controller.ex
by
callback/2
Parameters:
website_url::String
, access_token::String
, body::Map %{scripts: "", html: "", hash_key: ""}
Examples:
iex> set_app_settings(
"http:\merhi.dev.shopbuilder.me",
"01a1f82c447c1ffc19f54a8174ae1b8e648cc864",
%{hash_key: "5tQ4jHbQAqdfjI3cNEqoLAIChw6ZK2BI9tJR9omkzNCAFZS7odwcx+yC5xxTgt47wUg0iaoKuoRyClhU/3+okQ=="}
)
{:ok, %{"success": ["App settings has been updated."]}}
Updates a image to the given website_url
.
Arguments
fid
- image id.filedata
- image in base64.status
- “0” (unpublished) or “1” (published).
Makes a PUT
request to the given website_url
using the OAuth2.AccessToken
.
Updates a product option with the given option_id
to the given website_url
with the provided arguments.
Arguments
option_id
- id of the option.name
- name of the option.bundle_type
- bundle type to which this option is available.is_attribute
- boolean, to indicate if this option is an attribute.is_searchable
- boolean, to indicate if this option should be added as a filter in the shop page.is_default_visible
- boolean, to indicate if this option should show when adding products.show_as_button
- boolean, to indicate if this option should show as a button in the product page.facet_widget_type
- string, provide the facet filter widget type.
Makes a PUT
request to the given website_url
using the OAuth2.AccessToken
.