File size: 1,693 Bytes
048b1e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import "@typespec/http";
import "@typespec/rest";
import "@typespec/openapi";
import "@typespec/openapi3";
import "../common/error.tsp";
import "../common/pagination.tsp";
import "../common/parameters.tsp";
import "../shared/index.tsp";
import "./app.tsp";
import "./external_invoicing.tsp";
import "./stripe.tsp";

using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Apps;

interface AppsOperations {
  /**
   * List installed apps.
   */
  @get
  @operationId("list-apps")
  @summary("List apps")
  list(...Common.PagePaginationQuery):
    | Shared.PagePaginatedResponse<App>
    | Common.ErrorResponses;

  /**
   * Get an installed app.
   */
  @get
  @operationId("get-app")
  @summary("Get app")
  get(@path appId: Shared.ULID):
    | Shared.GetResponse<App>
    | Common.NotFound
    | Common.ErrorResponses;
}

interface AppCatalogOperations {
  /**
   * List available apps.
   */
  @get
  @operationId("list-app-catalog")
  @summary("List app catalog")
  list(...Common.PagePaginationQuery):
    | Shared.PagePaginatedResponse<AppCatalogItem>
    | Common.ErrorResponses;

  /**
   * Get an app catalog item by type.
   */
  @get
  @route("/{appType}")
  @operationId("get-app-catalog-item")
  @summary("Get app catalog item by type")
  get(@path appType: AppType):
    | Shared.GetResponse<AppCatalogItem>
    | Common.NotFound
    | Common.ErrorResponses;

  /**
   * Install an app from the catalog.
   *
   * @returns App installed successfully.
   */
  @post
  @route("/install")
  @operationId("install-app")
  @summary("Install app from the catalog")
  install(@body body: InstallAppRequest):
    | Shared.CreateResponse<InstallAppResponse>
    | Common.ErrorResponses;
}