Skip to content

Commit bc1386a

Browse files
authored
Merge pull request #8 from freestylejs/refactor/add-gen-type-description
[refactor] add gen type description
2 parents 930d96c + 5ed029f commit bc1386a

File tree

19 files changed

+70227
-10
lines changed

19 files changed

+70227
-10
lines changed

packages/create_freestyle_fetch/src/__tests__/__mocks__/.gen/e_commerse/api.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,32 @@ export const createClient = (config: { baseUrl?: string, auth?: AuthConfig } = {
1111
baseUrl: config.baseUrl || 'https://{environment}.example.com/v{version}',
1212
middleware
1313
}, {
14+
/**
15+
* Product catalog operations
16+
*
17+
* Endpoints for managing products in the store.
18+
*/
1419
'products': {
20+
/**
21+
* List products
22+
*
23+
* Retrieve a paginated list of products with filtering options.
24+
*/
1525
'GET': f.builder().def_json().def_searchparams(z.object({ category: z.enum(['electronics', 'clothing', 'books']).optional(), priceRange: z.array(z.number()).optional(), page: z.number().int().min(1).optional(), limit: z.number().int().min(1).max(100).optional(), sort: z.record(z.string(), z.enum(['asc', 'desc'])).optional() }).parse).def_response(async ({ json }) => z.array(Model.Product).parse(await json())),
26+
/**
27+
* Create a new product
28+
*
29+
* Add a new product to the catalog. Supports different product types via polymorphism.
30+
*/
1631
'POST': f.builder().def_json().def_body(Model.Product.parse).def_response(async ({ json }) => Model.Product.parse(await json()))
1732
},
1833
'orders': {
1934
'$orderId': {
35+
/**
36+
* Get order details
37+
*
38+
* Retrieve details of a specific order.
39+
*/
2040
'GET': f.builder().def_json().def_response(async ({ json }) => Model.Order.parse(await json()))
2141
}
2242
}

packages/create_freestyle_fetch/src/__tests__/__mocks__/.gen/e_commerse_2/api.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,35 @@ export const createClient = (config: { baseUrl?: string, auth?: AuthConfig } = {
1111
baseUrl: config.baseUrl || 'https://{environment}.example-commerce.com/api/v2',
1212
middleware
1313
}, {
14+
/**
15+
* Product Collection
16+
*
17+
* Endpoint for searching and creating products.
18+
*/
1419
'products': {
20+
/**
21+
* Search and filter products
22+
*/
1523
'GET': f.builder().def_json().def_searchparams(z.object({ searchQuery: z.string().optional(), tags: z.array(z.string()).optional(), page: z.number().int().min(1).optional() }).parse).def_response(async ({ json }) => Model.PaginatedProductResponse.parse(await json())),
24+
/**
25+
* Add a new product with an image
26+
*/
1627
'POST': f.builder().def_json().def_body(z.instanceof(FormData).parse).def_response(async ({ json }) => Model.Product.parse(await json())),
1728
'$productId': {
29+
/**
30+
* Get a single product by its ID
31+
*/
1832
'GET': f.builder().def_json().def_response(async ({ json }) => Model.Product.parse(await json()))
1933
}
2034
},
2135
'orders': {
2236
'$orderId': {
2337
'process': {
38+
/**
39+
* Process an order asynchronously
40+
*
41+
* Begins processing an order. A callback URL is invoked upon completion.
42+
*/
2443
'POST': f.builder().def_json()
2544
}
2645
}

packages/create_freestyle_fetch/src/__tests__/__mocks__/.gen/simple/api.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,18 @@ export const createClient = (config: { baseUrl?: string, auth?: AuthConfig } = {
1212
middleware
1313
}, {
1414
'books': {
15+
/**
16+
* Get a list of books
17+
*/
1518
'GET': f.builder().def_json().def_response(async ({ json }) => z.array(Model.Book).parse(await json())),
19+
/**
20+
* Create a new book
21+
*/
1622
'POST': f.builder().def_json().def_body(Model.BookRequest.parse).def_response(async ({ json }) => Model.Book.parse(await json())),
1723
'$id': {
24+
/**
25+
* Get a book by ID
26+
*/
1827
'GET': f.builder().def_json().def_response(async ({ json }) => Model.Book.parse(await json()))
1928
}
2029
}

0 commit comments

Comments
 (0)