This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
780ab41
commit c7a2a91
Showing
4 changed files
with
82 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import CRUDExtend from '../extends/crud' | ||
|
||
class SubscriptionProductsEndpoint extends CRUDExtend { | ||
constructor(endpoint) { | ||
super(endpoint) | ||
|
||
this.endpoint = 'subscriptions/products' | ||
} | ||
|
||
Create(body) { | ||
return this.request.send(this.endpoint, 'POST', { | ||
...body | ||
}) | ||
} | ||
|
||
Update(id, body, token = null) { | ||
return this.request.send( | ||
`${this.endpoint}/${id}`, | ||
'PUT', | ||
{ | ||
...body | ||
}, | ||
token | ||
) | ||
} | ||
|
||
} | ||
|
||
export default SubscriptionProductsEndpoint |
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,48 @@ | ||
/** | ||
* Subscription Products | ||
* Description: Subscription Products. | ||
* DOCS: TODO: add docs when ready | ||
*/ | ||
import { | ||
Identifiable, | ||
CrudQueryableResource | ||
} from './core' | ||
|
||
/** | ||
* Core Subscription Product Base Interface | ||
* For custom flows, extend this interface | ||
* DOCS: TODO: add docs when ready | ||
*/ | ||
export interface SubscriptionProductBase { | ||
type: string | ||
attributes: { | ||
created_at: string | ||
description: string | ||
main_image: string | ||
name: string | ||
sku: string | ||
updated_at: string | ||
}, | ||
} | ||
|
||
export interface SubscriptionProduct extends Identifiable, SubscriptionProductBase { | ||
|
||
} | ||
export type SubscriptionProductCreate = Omit<SubscriptionProductBase, 'attributes'> & {attributes: Partial<SubscriptionProductBase['attributes']>} | ||
export type SubscriptionProductUpdate = Omit<SubscriptionProduct, 'attributes'> & {attributes: Partial<SubscriptionProductBase['attributes']>} | ||
|
||
/** | ||
* Subscription Product Endpoints | ||
* DOCS: TODO: add docs when ready | ||
*/ | ||
export interface SubscriptionProductsEndpoint | ||
extends CrudQueryableResource< | ||
SubscriptionProduct, | ||
SubscriptionProductCreate, | ||
SubscriptionProductUpdate, | ||
never, | ||
never, | ||
never | ||
> { | ||
endpoint: 'products' | ||
} |