This repository has been archived by the owner on Dec 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from JumpLink/master
Added themes api
- Loading branch information
Showing
7 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ShopifyObject } from "./base"; | ||
|
||
export interface Theme extends ShopifyObject { | ||
/** | ||
* The name of the theme. | ||
*/ | ||
name?: string; | ||
/** | ||
* The date and time (ISO 8601 format) when the theme was created. | ||
*/ | ||
created_at?: string; | ||
/** | ||
* The date and time ( ISO 8601 format) when the theme was last updated. | ||
*/ | ||
updated_at?: string; | ||
/** | ||
* Specifies how the theme is being used within the shop. Valid values: | ||
* * main: The theme is published. Customers see it when they visit the online store. | ||
* * unpublished: The theme is unpublished. Customers can't see it. | ||
* * demo: The theme is installed on the store as a demo. The theme can't be published until the merchant buys the full version. | ||
*/ | ||
role?: 'main' | 'unpublished' | 'demo'; | ||
/** | ||
* A unique identifier applied to Shopify-made themes that are installed from the Shopify Theme Store Theme Store. Not all themes available in the Theme Store are developed by Shopify. Returns null if the store's theme isn't made by Shopify, or if it wasn't installed from the Theme Store. | ||
*/ | ||
theme_store_id?: number | null; | ||
/** | ||
* Whether the theme can currently be previewed. | ||
*/ | ||
previewable?: boolean; | ||
/** | ||
* Whether files are still being copied into place for this theme. | ||
*/ | ||
processing?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import * as Options from '../options'; | ||
import { BaseService } from '../infrastructure'; | ||
import { Theme } from '../models'; | ||
|
||
/** | ||
* A service for manipulating a Shopify shop's theme. | ||
*/ | ||
export class Themes extends BaseService { | ||
constructor(shopDomain: string, accessToken: string) { | ||
super(shopDomain, accessToken, "themes"); | ||
} | ||
|
||
/** | ||
* Creates a theme by providing the public URL of a ZIP file that contains the theme. | ||
* @param themes The theme being created. | ||
*/ | ||
public create(themes: Theme) { | ||
return this.createRequest<Theme>("POST", `.json`, "", { themes }); | ||
} | ||
|
||
/** | ||
* Gets a tsingle hemes with the given id. | ||
* @param id Id of the theme to retrieve. | ||
* @param options Options for filtering the result. | ||
*/ | ||
public get(id: number, options?: Options.FieldOptions) { | ||
return this.createRequest<Theme>("GET", `${id}.json`, "", options); | ||
} | ||
|
||
/** | ||
* Updates an existing theme. | ||
* @param id Id of the themes being updated. | ||
* @param themes The updated theme. | ||
*/ | ||
public update(id: number, themes: Theme) { | ||
return this.createRequest<Theme>("PUT", `${id}.json`, "themes", { themes }); | ||
} | ||
|
||
/** | ||
* Gets a list of all themes on the shop. | ||
* @param options Options for filtering the results. | ||
*/ | ||
public list(options?: Options.FieldOptions) { | ||
return this.createRequest<Theme[]>("GET", `.json`, "themes", options); | ||
} | ||
|
||
/** | ||
* Deletes the themes with the given id. | ||
* @param id Id of the theme being deleted. | ||
*/ | ||
public delete(id: number) { | ||
return this.createRequest<void>("DELETE", `${id}.json`); | ||
} | ||
} | ||
|
||
export default Themes; |