-
Notifications
You must be signed in to change notification settings - Fork 117
/
IApi.ts
60 lines (57 loc) · 2.05 KB
/
IApi.ts
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
import { ApiEndpoint } from './ApiEndpoint';
import { IApiEndpoint } from './IApiEndpoint';
/**
* Represents an api that is being provided.
*/
export interface IApi {
/**
* Provides the visibility method of the URL, see the ApiVisibility descriptions for more information
*/
visibility: ApiVisibility;
/**
* Provides the visibility method of the URL, see the ApiSecurity descriptions for more information
*/
security: ApiSecurity;
/**
* Provide enpoints for this api registry
*/
endpoints: Array<ApiEndpoint | IApiEndpoint>;
}
export enum ApiVisibility {
/**
* A public Api has a fixed format for a url. Using it enables an
* easy to remember structure, however, it also means the url is
* intelligently guessed. As a result, we recommend having some
* sort of security setup if you must have a public api.Whether
* you use the provided security, ApiSecurity, or implement your own.
* Url format:
* `https://{your-server-address}/api/apps/public/{your-app-id}/{path}`
*/
PUBLIC,
/**
* Private Api's contain a random value in the url format,
* making them harder go guess by default. The random value
* will be generated whenever the App is installed on a server.
* This means that the URL will not be the same on any server,
* but will remain the same throughout the lifecycle of an App
* including updates. As a result, if a user uninstalls the App
* and reinstalls the App, then the random value will change.
* Url format:
* `https://{your-server-address}/api/apps/private/{random-hash}/{your-app-id}/{path}`
*/
PRIVATE,
}
export enum ApiSecurity {
/**
* No security check will be executed agains the calls made to this URL
*/
UNSECURE,
/**
* Only calls containing a valid token will be able to execute the api
* Mutiple tokens can be generated to access the api, by default one
* will be generated automatically.
* @param `X-Auth-Token`
*/
// AUTH_TOKEN,
// CHECKSUM_SECRET,
}