Skip to content

Commit 17184a4

Browse files
add oas
1 parent 6777ca1 commit 17184a4

File tree

8 files changed

+494
-2
lines changed

8 files changed

+494
-2
lines changed

apps/backend/src/api/openapi/vendor/seller.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,54 @@
169169
* type: boolean
170170
* description: Whether the invite has been accepted.
171171
*/
172+
173+
/**
174+
* @schema SellerApiKey
175+
* title: "Api key"
176+
* description: "A seller api key details"
177+
* properties:
178+
* id:
179+
* type: string
180+
* description: The unique identifier of the api key.
181+
* title:
182+
* type: string
183+
* description: The api key title.
184+
* redacted:
185+
* type: string
186+
* description: The redacted api key value.
187+
* created_by:
188+
* type: string
189+
* description: The identity that created the api key.
190+
* revoked_by:
191+
* type: string
192+
* description: The identity that revoked the api key.
193+
* revoked_at:
194+
* type: string
195+
* format: date-time
196+
* description: The date with timezone at which the invite expires.
197+
*/
198+
199+
/**
200+
* @schema SellerApiKeyExplicit
201+
* title: "Api key explicit"
202+
* description: "A seller api key with explicit token value"
203+
* properties:
204+
* id:
205+
* type: string
206+
* description: The unique identifier of the api key.
207+
* title:
208+
* type: string
209+
* description: The api key title.
210+
* redacted:
211+
* type: string
212+
* description: The redacted api key value.
213+
* seller_id:
214+
* type: string
215+
* description: The seller id associated with the api key.
216+
* token:
217+
* type: string
218+
* description: Explicit api key value.
219+
* created_by:
220+
* type: string
221+
* description: The identity that created the api key.
222+
*/

apps/backend/src/api/vendor/sellers/me/api-keys/[id]/route.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@ import { ContainerRegistrationKeys } from '@medusajs/framework/utils'
77

88
import { revokeSellerApiKeyWorkflow } from '../../../../../../workflows/seller/workflows'
99

10+
/**
11+
* @oas [get] /vendor/sellers/me/api-keys/{id}
12+
* operationId: "VendorGetSellerApiKeyById"
13+
* summary: "Get an api key by id"
14+
* description: "Retrieves an api key by id for the authenticated vendor."
15+
* x-authenticated: true
16+
* parameters:
17+
* - in: path
18+
* name: id
19+
* required: true
20+
* description: The ID of the API key.
21+
* schema:
22+
* type: string
23+
* responses:
24+
* "200":
25+
* description: OK
26+
* content:
27+
* application/json:
28+
* schema:
29+
* type: object
30+
* properties:
31+
* api_key:
32+
* $ref: "#/components/schemas/SellerApiKey"
33+
* tags:
34+
* - Seller
35+
* security:
36+
* - api_token: []
37+
* - cookie_auth: []
38+
*/
1039
export const GET = async (
1140
req: AuthenticatedMedusaRequest,
1241
res: MedusaResponse
@@ -31,6 +60,35 @@ export const GET = async (
3160
res.json({ api_key })
3261
}
3362

63+
/**
64+
* @oas [delete] /vendor/sellers/me/api-keys/{id}
65+
* operationId: "VendorRevokeSellerApiKeyById"
66+
* summary: "Revoke an api key by id"
67+
* description: "Revokes an api key by id for the authenticated vendor."
68+
* x-authenticated: true
69+
* parameters:
70+
* - in: path
71+
* name: id
72+
* required: true
73+
* description: The ID of the API key.
74+
* schema:
75+
* type: string
76+
* responses:
77+
* "200":
78+
* description: OK
79+
* content:
80+
* application/json:
81+
* schema:
82+
* type: object
83+
* properties:
84+
* api_key:
85+
* $ref: "#/components/schemas/SellerApiKey"
86+
* tags:
87+
* - Seller
88+
* security:
89+
* - api_token: []
90+
* - cookie_auth: []
91+
*/
3492
export const DELETE = async (
3593
req: AuthenticatedMedusaRequest,
3694
res: MedusaResponse

apps/backend/src/api/vendor/sellers/me/api-keys/route.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,39 @@ import { fetchSellerByAuthContext } from '../../../../../shared/infra/http/utils
99
import { createSellerApiKeyWorkflow } from '../../../../../workflows/seller/workflows'
1010
import { VendorCreateSellerApiKeyType } from '../../validators'
1111

12+
/**
13+
* @oas [get] /vendor/sellers/me/api-keys
14+
* operationId: "VendorGetSellerMyApiKeys"
15+
* summary: "Get api keys of the current seller"
16+
* description: "Retrieves the api keys associated with the seller."
17+
* x-authenticated: true
18+
* responses:
19+
* "200":
20+
* description: OK
21+
* content:
22+
* application/json:
23+
* schema:
24+
* type: object
25+
* properties:
26+
* api_keys:
27+
* type: array
28+
* items:
29+
* $ref: "#/components/schemas/SellerApiKey"
30+
* count:
31+
* type: integer
32+
* description: The total number of items available
33+
* offset:
34+
* type: integer
35+
* description: The number of items skipped before these items
36+
* limit:
37+
* type: integer
38+
* description: The number of items per page
39+
* tags:
40+
* - Seller
41+
* security:
42+
* - api_token: []
43+
* - cookie_auth: []
44+
*/
1245
export const GET = async (
1346
req: AuthenticatedMedusaRequest,
1447
res: MedusaResponse
@@ -36,6 +69,33 @@ export const GET = async (
3669
})
3770
}
3871

72+
/**
73+
* @oas [post] /vendor/sellers/me/api-keys
74+
* operationId: "VendorCreateApiKey"
75+
* summary: "Create seller api key"
76+
* description: "Creates a seller api key"
77+
* x-authenticated: true
78+
* requestBody:
79+
* content:
80+
* application/json:
81+
* schema:
82+
* $ref: "#/components/schemas/VendorCreateSellerApiKey"
83+
* responses:
84+
* "201":
85+
* description: Created
86+
* content:
87+
* application/json:
88+
* schema:
89+
* type: object
90+
* properties:
91+
* api_key:
92+
* $ref: "#/components/schemas/SellerApiKeyExplicit"
93+
* tags:
94+
* - Seller
95+
* security:
96+
* - api_token: []
97+
* - cookie_auth: []
98+
*/
3999
export const POST = async (
40100
req: AuthenticatedMedusaRequest<VendorCreateSellerApiKeyType>,
41101
res: MedusaResponse

packages/http-client/dist/index.d.ts

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23393,6 +23393,45 @@ export interface ReviewRemoveRequest {
2339323393
reason?: string;
2339423394
};
2339523395
}
23396+
/**
23397+
* Api key
23398+
* A seller api key details
23399+
*/
23400+
export interface SellerApiKey {
23401+
/** The unique identifier of the api key. */
23402+
id?: string;
23403+
/** The api key title. */
23404+
title?: string;
23405+
/** The redacted api key value. */
23406+
redacted?: string;
23407+
/** The identity that created the api key. */
23408+
created_by?: string;
23409+
/** The identity that revoked the api key. */
23410+
revoked_by?: string;
23411+
/**
23412+
* The date with timezone at which the invite expires.
23413+
* @format date-time
23414+
*/
23415+
revoked_at?: string;
23416+
}
23417+
/**
23418+
* Api key explicit
23419+
* A seller api key with explicit token value
23420+
*/
23421+
export interface SellerApiKeyExplicit {
23422+
/** The unique identifier of the api key. */
23423+
id?: string;
23424+
/** The api key title. */
23425+
title?: string;
23426+
/** The redacted api key value. */
23427+
redacted?: string;
23428+
/** The seller id associated with the api key. */
23429+
seller_id?: string;
23430+
/** Explicit api key value. */
23431+
token?: string;
23432+
/** The identity that created the api key. */
23433+
created_by?: string;
23434+
}
2339623435
/**
2339723436
* Create Order Return Request
2339823437
* A schema for the creation of order return request.
@@ -23942,6 +23981,14 @@ export interface VendorCreateSeller {
2394223981
photo?: string | null;
2394323982
};
2394423983
}
23984+
/**
23985+
* Create api key
23986+
* A schema for the api key creation.
23987+
*/
23988+
export interface VendorCreateSellerApiKey {
23989+
/** The title of the key */
23990+
title?: string;
23991+
}
2394523992
export interface VendorCreateServiceZone {
2394623993
/** The name of the service zone. */
2394723994
name: string;
@@ -51533,6 +51580,63 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5153351580
/** A seller object with its properties */
5153451581
seller?: VendorSeller;
5153551582
}, any>>;
51583+
/**
51584+
* @description Retrieves the api keys associated with the seller.
51585+
*
51586+
* @tags Seller
51587+
* @name VendorGetSellerMyApiKeys
51588+
* @summary Get api keys of the current seller
51589+
* @request GET:/vendor/sellers/me/api-keys
51590+
* @secure
51591+
*/
51592+
vendorGetSellerMyApiKeys: (params?: RequestParams) => Promise<HttpResponse<{
51593+
api_keys?: SellerApiKey[];
51594+
/** The total number of items available */
51595+
count?: number;
51596+
/** The number of items skipped before these items */
51597+
offset?: number;
51598+
/** The number of items per page */
51599+
limit?: number;
51600+
}, any>>;
51601+
/**
51602+
* @description Creates a seller api key
51603+
*
51604+
* @tags Seller
51605+
* @name VendorCreateApiKey
51606+
* @summary Create seller api key
51607+
* @request POST:/vendor/sellers/me/api-keys
51608+
* @secure
51609+
*/
51610+
vendorCreateApiKey: (data: VendorCreateSellerApiKey, params?: RequestParams) => Promise<HttpResponse<{
51611+
/** A seller api key with explicit token value */
51612+
api_key?: SellerApiKeyExplicit;
51613+
}, any>>;
51614+
/**
51615+
* @description Retrieves an api key by id for the authenticated vendor.
51616+
*
51617+
* @tags Seller
51618+
* @name VendorGetSellerApiKeyById
51619+
* @summary Get an api key by id
51620+
* @request GET:/vendor/sellers/me/api-keys/{id}
51621+
* @secure
51622+
*/
51623+
vendorGetSellerApiKeyById: (id: string, params?: RequestParams) => Promise<HttpResponse<{
51624+
/** A seller api key details */
51625+
api_key?: SellerApiKey;
51626+
}, any>>;
51627+
/**
51628+
* @description Revokes an api key by id for the authenticated vendor.
51629+
*
51630+
* @tags Seller
51631+
* @name VendorRevokeSellerApiKeyById
51632+
* @summary Revoke an api key by id
51633+
* @request DELETE:/vendor/sellers/me/api-keys/{id}
51634+
* @secure
51635+
*/
51636+
vendorRevokeSellerApiKeyById: (id: string, params?: RequestParams) => Promise<HttpResponse<{
51637+
/** A seller api key details */
51638+
api_key?: SellerApiKey;
51639+
}, any>>;
5153651640
/**
5153751641
* @description Retrieves the onboarding details of the current authenticated seller.
5153851642
*

packages/http-client/dist/index.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/http-client/dist/index.js

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/http-client/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)