Download wp-calypso/client/dashboard/data/site-plans.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 602 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/dashboard/data/site-plans.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/dashboard/data/site-plans.ts
-
curl -L -o site-plans.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/dashboard/data/site-plans.ts
602 Bytes
| import wpcom from 'calypso/lib/wp'; | |
| export interface Plan { | |
| id?: string | null; | |
| current_plan?: boolean; | |
| expiry?: string; | |
| has_domain_credit?: boolean; | |
| product_slug?: string; | |
| subscribed_date?: string; | |
| user_facing_expiry?: string; | |
| } | |
| export async function fetchCurrentSitePlan( siteId: number ): Promise< Plan > { | |
| const plans: Record< string, Plan > = await wpcom.req.get( { | |
| path: `/sites/${ siteId }/plans`, | |
| apiVersion: '1.3', | |
| } ); | |
| const plan = Object.values( plans ).find( ( plan ) => plan.current_plan ); | |
| if ( ! plan ) { | |
| throw new Error( 'No current plan found' ); | |
| } | |
| return plan; | |
| } | |