File tree Expand file tree Collapse file tree 1 file changed +38
-4
lines changed
Expand file tree Collapse file tree 1 file changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,24 @@ export interface ListAppResponse {
1313
1414export type GetAppRequest = string
1515
16+ const getAppQuery = `query($name: String!) {
17+ app(name: $name) {
18+ name
19+ status
20+ organization {
21+ name
22+ slug
23+ }
24+ ipAddresses {
25+ nodes {
26+ type
27+ region
28+ address
29+ }
30+ }
31+ }
32+ }`
33+
1634export enum AppStatus {
1735 deployed = 'deployed' ,
1836 pending = 'pending' ,
@@ -26,10 +44,12 @@ export interface AppResponse {
2644 name : string
2745 slug : string
2846 }
29- ipAddresses : {
30- type : string
31- address : string
32- } [ ]
47+ ipAddresses : IPAddress [ ]
48+ }
49+
50+ export interface IPAddress {
51+ type : string
52+ address : string
3353}
3454
3555export interface CreateAppRequest {
@@ -57,6 +77,20 @@ export class App {
5777 return await this . client . restOrThrow ( path )
5878 }
5979
80+ async getAppDetailed ( app_name : GetAppRequest ) : Promise < AppResponse > {
81+ const { app } = await this . client . gqlPostOrThrow ( {
82+ query : getAppQuery ,
83+ variables : { name : app_name } ,
84+ } ) as { app : AppResponse }
85+
86+ const ipAddresses = app . ipAddresses as unknown as { nodes : IPAddress [ ] }
87+
88+ return {
89+ ...app ,
90+ ipAddresses : ipAddresses . nodes ,
91+ }
92+ }
93+
6094 async createApp ( payload : CreateAppRequest ) : Promise < void > {
6195 const path = 'apps'
6296 return await this . client . restOrThrow ( path , 'POST' , payload )
You can’t perform that action at this time.
0 commit comments