1.1.1 • Published 10 months ago

sell-app-fixed v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Sell.app API Wrapper

A simple Node.js API Wrapper made for Sell.app. CONTRIBUTING

This is a fork from fsalinas26's Sellix API Wrapper made to access the Sell.app's API

TO-DO List

  • Hi uh ik there has been lack of updates since i was too busy w uni and stuffs, i'll try to get back to update when i can (also published new changes to npm btw, forgot to update it when i merged a few pull requests from an awesome contributor).
  • Add full support for Product API V2
  • Make a wiki to replace this long listed examples.

Requirements

Installation

npm install sell-app

Usage

const Sellapp = require("sell-app");
const API = new Sellapp.API("YOUR_API_KEY");

API.getAllProducts().then((res) => {
	console.log(res); // returns a list of all products
});

API.createBlacklist("email", "hi@example.com", "evil user").then((res) => {
	console.log(res); // blacklisting the said user with the string "evil user" as description
});

Multi-Store Support

Say you are part of multiple stores and want to access bob.sell.app, you would pass the slug bob as your store.

Supported Endpoints

Click on an endpoint to see its example.

Blacklists Endpoint

  • getAllBlacklists(): Returns a list of all the blacklists created.
  • getBlacklist(id): Retrieves a blacklist by the entered ID.
  • createBlacklist(type, data, description): Creates a blacklist and returns the created blacklist.
  • updateBlacklist(id, type, data, description): Updates a blacklist by the entered ID.
  • deleteBlacklist(id): Deletes a blacklist by the entered ID.

Coupons Endpoint

  • getAllCoupons(): Returns a list of all the coupons created.
  • getCoupon(id): Retrieves a coupon by the entered ID.
  • createCoupon(fields): Creates a coupon and returns the created coupon.
  • updateCoupon(id, fields): Updates a coupon by the entered ID.
  • deleteCoupon(id): Deletes a coupon by the entered ID.

Listings/Products Endpoint

  • getAllProducts(): Returns a list of all the listings created.
  • getProduct(id): Retrieves a listing by the entered ID.
  • createProduct(fields): Creates a listing and returns the created listing.
  • updateProduct(id, fields): Updates a listing by the entered ID.
  • deleteProduct(id): Deletes a listing by the entered ID.

Listings/Products v2 Endpoint

  • getAllProductsv2(): Returns a list of all products created.
  • createListing(fields): Create Listing.
  • getListing(id): Gets listing by the entered ID.
  • updateListing(id, fields): Updates a listing by the entered ID.
  • deleteListing(id): Deletes a listing by the entered ID.
  • searchVariants(id): Search for product variants by the entered ID.
  • getAllVariants(id): Returns a list of all product variants created by the entered ID.

Sections Endpoint

  • getAllSections(): Returns a list of all the listings created.
  • getSection(id): Retrieves a section by the entered ID.
  • createSection(fields): Creates a section and returns the created section.
  • updateSection(id, fields): Updates a section by the entered ID.
  • deleteSections(id): Deletes a section by the entered ID.

Feedback Endpoint

  • getAllFeedback(): Returns a list of all the feedback received.
  • getFeedback(id): Retrieves a feedback by the entered ID.
  • replyFeedback(id, replyMessage): Responds to a given feedback by the entered ID.

Invoices Endpoint

  • getAllOrders(): Returns a list of all the orders that have been placed.
  • getOrder(id): Retrieve a specific order by the entered ID.
  • getOrderDeliverables(id): Retrieve deliverables from a specific order by the entered ID.
  • createInvoice(fields): Generates an invoice, and returns the invoice that is generated.
  • issueReplacement(id, fields): Issue a replacement for an order by the entered ID.
  • createPayment(id): Generates a payment session for the given order.

Tickets Endpoint

  • getAllTickets(): Retrieves a list of all the tickets received.
  • getTicket(id): Retrieves a ticket by the entered ID.

Ticket Messages Endpoint

  • getAllTicketMessages(id): Retrieves a list of all the messages within a ticket by its entered ID.
  • getTicketMessage(id, messageId): Retrieves a specific message within a ticket by their respective entered IDs.
  • respondTicket(id, fields): Creates a message to a ticket by its entered ID and returns the created message.

Endpoints' examples of usage

Blacklist Endpoint

API.updateBlacklist(
	"164",
	"country",
	"MX",
	"sorry my fellow Mexican friends :sob:"
).then((res) => {
	console.log(res);
});
ParametersTypeRequiredDescription
idstring✔️ID of the blacklist rule you want to update
typestring✔️Your blacklist rule's type, can be one of the following - "email", "ip", "country"
datastring✔️Depending on the type you chose, you can enter an IP address, email address, or country code here.
descriptionstring✔️A description that will help you remember why this blacklist rule was created.

Coupon Endpoint

ParametersTypeRequiredDescription
fieldsobject✔️Coupon's field
Fields' ValuesTypeRequiredDescription
codestring✔️The coupon code the customer enters during checkout.
typestring✔️This can be either "PERCENTAGE" or "AMOUNT".
discountstring✔️The discount value in percentage or cents.
limitint/nullThe maximum amount of times a coupon code can be used, across all customers.
store_wideboolean✔️Whether the coupon applies to all products within your store or not.
expires_atstring/nullThe coupon's expiry date. (format: YY-MM-DD HH-MM-SS)
ParametersTypeRequiredDescription
idstring✔️ID of the coupon you want to update
fieldsobject✔️Coupon's field
Fields' ValuesTypeRequiredDescription
codestring✔️The coupon code the customer enters during checkout.
typestring✔️This can be either "PERCENTAGE" or "AMOUNT".
discountstring✔️The discount value in percentage or cents.
limitint/nullThe maximum amount of times a coupon code can be used, across all customers.
store_wideboolean✔️Whether the coupon applies to all products within your store or not.
expires_atstring/nullThe coupon's expiry date. (format: YY-MM-DD HH-MM-SS)

Product Endpoint

ParametersTypeRequiredDescription
fieldsobject✔️Product's field
Fields' ValuesTypeRequiredDescription
titlestring✔️The product's title.
descriptionstring✔️The product's description.
imageobject/nullAn image binary which will be visible when someone views your product.
orderint/nullThe product's order in which it is sorted on your storefront.
visibilitystring✔️Either "PUBLIC", "HIDDEN", or "PRIVATE" - depending on whether you want this product to be visible.
deliverableobject✔️The product's deliverable which will be sent to the customer. Consists of three pieces of nested data, being "delivery_text", "type", and "data"
priceobject✔️The product's price in nested format. Consists of two variables "PRICE" (in cents) and "CURRENCY".
humblebooleanWhether you want to allow the customer to pay more than the product's price. ( ͡° ͜ʖ ͡°)
payment_methodsarray of string✔️Items Enum: "COINBASE" "PAYDASH" "PAYPAL" "STRIPE". The product's payment methods in array format.
additional_informationarrayAdditional info that can be requested from the customer during the checkout process.
bulk_discountarrayAn array of discounts when a customer purchases more than a specified quantity.
minimum_purchase_quantityint✔️The minimum amount a customer is able to purchase.
maximum_purchase_quantityint/nullThe maximum amount a customer is able to purchase.
webhookstring/nullA webhook URL that will receive updates when orders are placed.
warrantyobject/nullThe warranty time in which a customer is able to request a refund.
lockedbooleanWhether this product is locked by the admins or moderators.
sectionint/nullThe ID of a section to associate with this product. Use null to disassociate a section.
ParametersTypeRequiredDescription
idstring✔️ID of the coupon you want to update
fieldsobject✔️Coupon's field
Fields' ValuesTypeRequiredDescription
titlestring✔️The product's title.
descriptionstring✔️The product's description.
imageobject/nullAn image binary which will be visible when someone views your product.
orderint/nullThe product's order in which it is sorted on your storefront.
visibilitystring✔️Either "PUBLIC", "HIDDEN", or "PRIVATE" - depending on whether you want this product to be visible.
deliverableobject✔️The product's deliverable which will be sent to the customer. Consists of three pieces of nested data, being "delivery_text", "type", and "data"
priceobject✔️The product's price in nested format. Consists of two variables "PRICE" (in cents) and "CURRENCY".
humblebooleanWhether you want to allow the customer to pay more than the product's price. ( ͡° ͜ʖ ͡°)
payment_methodsarray of string✔️Items Enum: "COINBASE" "PAYDASH" "PAYPAL" "STRIPE". The product's payment methods in array format.
additional_informationarrayAdditional info that can be requested from the customer during the checkout process.
bulk_discountarrayAn array of discounts when a customer purchases more than a specified quantity.
minimum_purchase_quantityint✔️The minimum amount a customer is able to purchase.
maximum_purchase_quantityint/nullThe maximum amount a customer is able to purchase.
webhookstring/nullA webhook URL that will receive updates when orders are placed.
warrantyobject/nullThe warranty time in which a customer is able to request a refund.
lockedbooleanWhether this product is locked by the admins or moderators.
sectionint/nullThe ID of a section to associate with this product. Use null to disassociate a section.

Section Endpoint

ParametersTypeRequiredDescription
fieldsobject✔️Section's field
Fields' ValuesTypeRequiredDescription
titlestring✔️The section's title.
hiddenboolean✔️Whether this section is hidden from public view (can only be accessed by direct URL)
orderintThe order of the section in which it is displayed on your storefront.
ParametersTypeRequiredDescription
idstring✔️ID of the coupon you want to update
fieldsobject✔️Coupon's field
Fields' ValuesTypeRequiredDescription
titlestring✔️The section's title.
hiddenboolean✔️Whether this section is hidden from public view (can only be accessed by direct URL)
orderintThe order of the section in which it is displayed on your storefront.

Feedback Endpoint

ParametersTypeRequiredDescription
idstring✔️ID of the coupon you want to update
replyMessagestring✔️A reply message that was left by the store owner who received this rating

Invoice Endpoint

ParametersTypeRequiredDescription
fieldsobject✔️Invoice's field
Fields' ValuesTypeRequiredDescription
customer_emailstringThe email of the customer who placed this order.
totalstringThe total amount to pay for this order. Can be excluded to create free-of-charge orders.
payment_methodstringEnum: "COINBASE" "PAYDASH" "PAYPAL" "STRIPE". The payment gateway to process this order with.The selected payment gateway must be configured for the issuing store and should only be included in the request if the total of the order is greater than zero.
couponstringThe coupon code to apply to this order.
productsobjectAssociation of products with quantity and additional information to include in the order. The object keys must be the ids of the listings to include
ParametersTypeRequiredDescription
idstring✔️ID of the order you want to issue a replacement
fieldsarrayThe listings that should be replaced. If no listings are provided, all listings will be replaced.

Ticket Endpoint

Ticket Message Endpoint

ParametersTypeRequiredDescription
idstring✔️ID of the ticket you want to respond
fieldsobject✔️Response's field
ParametersTypeRequiredDescription
authorstringEither "STORE" or "CUSTOMER" depending on who sent this specific message.
contentstring✔️The message that was left.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

1.1.1

10 months ago