gopadjs 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.codacy.yml +8 -0
  2. package/.editorconfig +24 -0
  3. package/.github/RELEASE +1 -0
  4. package/.github/issue_template.md +9 -0
  5. package/.github/pull_request_template.md +8 -0
  6. package/.github/renovate.json +6 -0
  7. package/.github/semantic.yml +23 -0
  8. package/.github/settings.yml +43 -0
  9. package/.github/workflows/automerge.yml +49 -0
  10. package/.github/workflows/flake.yml +56 -0
  11. package/.github/workflows/general.yml +45 -0
  12. package/.github/workflows/release.yml +49 -0
  13. package/.openapi-generator/FILES +25 -0
  14. package/.openapi-generator/VERSION +1 -0
  15. package/.openapi-generator-ignore +3 -0
  16. package/.releaserc +140 -0
  17. package/CHANGELOG.md +16 -0
  18. package/CONTRIBUTING.md +121 -0
  19. package/DCO +34 -0
  20. package/LICENSE +202 -0
  21. package/README.md +88 -0
  22. package/api/auth-api.ts +399 -0
  23. package/api/team-api.ts +1641 -0
  24. package/api/user-api.ts +1641 -0
  25. package/api.ts +17 -0
  26. package/base.ts +91 -0
  27. package/common.ts +203 -0
  28. package/configuration.ts +132 -0
  29. package/flake.lock +472 -0
  30. package/flake.nix +57 -0
  31. package/hack/generate-client.sh +65 -0
  32. package/hack/openapi/templates/README.mustache +93 -0
  33. package/hack/openapi/templates/gitignore +6 -0
  34. package/hack/semantic-version.sh +17 -0
  35. package/index.ts +17 -0
  36. package/model/index.ts +12 -0
  37. package/model/notification.ts +43 -0
  38. package/model/team-user-params.ts +42 -0
  39. package/model/team-users.ts +46 -0
  40. package/model/team.ts +61 -0
  41. package/model/teams.ts +37 -0
  42. package/model/user-auth.ts +45 -0
  43. package/model/user-team-params.ts +42 -0
  44. package/model/user-team.ts +79 -0
  45. package/model/user-teams.ts +46 -0
  46. package/model/user.ts +100 -0
  47. package/model/users.ts +37 -0
  48. package/model/validation.ts +33 -0
  49. package/openapi.yml +12 -0
  50. package/openapitools.json +7 -0
  51. package/package.json +41 -0
  52. package/tsconfig.esm.json +7 -0
  53. package/tsconfig.json +18 -0
package/api.ts ADDED
@@ -0,0 +1,17 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Gopad OpenAPI
5
+ * API definition for Gopad, Etherpad for markdown with go
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0-alpha1
8
+ * Contact: gopad@webhippie.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ export * from "./api/auth-api";
16
+ export * from "./api/team-api";
17
+ export * from "./api/user-api";
package/base.ts ADDED
@@ -0,0 +1,91 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Gopad OpenAPI
5
+ * API definition for Gopad, Etherpad for markdown with go
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0-alpha1
8
+ * Contact: gopad@webhippie.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import type { Configuration } from "./configuration";
16
+ // Some imports not used depending on template conditions
17
+ // @ts-ignore
18
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from "axios";
19
+ import globalAxios from "axios";
20
+
21
+ export const BASE_PATH = "https://try.gopad.eu/api/v1".replace(/\/+$/, "");
22
+
23
+ /**
24
+ *
25
+ * @export
26
+ */
27
+ export const COLLECTION_FORMATS = {
28
+ csv: ",",
29
+ ssv: " ",
30
+ tsv: "\t",
31
+ pipes: "|",
32
+ };
33
+
34
+ /**
35
+ *
36
+ * @export
37
+ * @interface RequestArgs
38
+ */
39
+ export interface RequestArgs {
40
+ url: string;
41
+ options: RawAxiosRequestConfig;
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @export
47
+ * @class BaseAPI
48
+ */
49
+ export class BaseAPI {
50
+ protected configuration: Configuration | undefined;
51
+
52
+ constructor(
53
+ configuration?: Configuration,
54
+ protected basePath: string = BASE_PATH,
55
+ protected axios: AxiosInstance = globalAxios,
56
+ ) {
57
+ if (configuration) {
58
+ this.configuration = configuration;
59
+ this.basePath = configuration.basePath ?? basePath;
60
+ }
61
+ }
62
+ }
63
+
64
+ /**
65
+ *
66
+ * @export
67
+ * @class RequiredError
68
+ * @extends {Error}
69
+ */
70
+ export class RequiredError extends Error {
71
+ constructor(
72
+ public field: string,
73
+ msg?: string,
74
+ ) {
75
+ super(msg);
76
+ this.name = "RequiredError";
77
+ }
78
+ }
79
+
80
+ interface ServerMap {
81
+ [key: string]: {
82
+ url: string;
83
+ description: string;
84
+ }[];
85
+ }
86
+
87
+ /**
88
+ *
89
+ * @export
90
+ */
91
+ export const operationServerMap: ServerMap = {};
package/common.ts ADDED
@@ -0,0 +1,203 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Gopad OpenAPI
5
+ * API definition for Gopad, Etherpad for markdown with go
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0-alpha1
8
+ * Contact: gopad@webhippie.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import type { Configuration } from "./configuration";
16
+ import type { RequestArgs } from "./base";
17
+ import type { AxiosInstance, AxiosResponse } from "axios";
18
+ import { RequiredError } from "./base";
19
+ import { URL, URLSearchParams } from "url";
20
+
21
+ /**
22
+ *
23
+ * @export
24
+ */
25
+ export const DUMMY_BASE_URL = "https://example.com";
26
+
27
+ /**
28
+ *
29
+ * @throws {RequiredError}
30
+ * @export
31
+ */
32
+ export const assertParamExists = function (
33
+ functionName: string,
34
+ paramName: string,
35
+ paramValue: unknown,
36
+ ) {
37
+ if (paramValue === null || paramValue === undefined) {
38
+ throw new RequiredError(
39
+ paramName,
40
+ `Required parameter ${paramName} was null or undefined when calling ${functionName}.`,
41
+ );
42
+ }
43
+ };
44
+
45
+ /**
46
+ *
47
+ * @export
48
+ */
49
+ export const setApiKeyToObject = async function (
50
+ object: any,
51
+ keyParamName: string,
52
+ configuration?: Configuration,
53
+ ) {
54
+ if (configuration && configuration.apiKey) {
55
+ const localVarApiKeyValue =
56
+ typeof configuration.apiKey === "function"
57
+ ? await configuration.apiKey(keyParamName)
58
+ : await configuration.apiKey;
59
+ object[keyParamName] = localVarApiKeyValue;
60
+ }
61
+ };
62
+
63
+ /**
64
+ *
65
+ * @export
66
+ */
67
+ export const setBasicAuthToObject = function (
68
+ object: any,
69
+ configuration?: Configuration,
70
+ ) {
71
+ if (configuration && (configuration.username || configuration.password)) {
72
+ object["auth"] = {
73
+ username: configuration.username,
74
+ password: configuration.password,
75
+ };
76
+ }
77
+ };
78
+
79
+ /**
80
+ *
81
+ * @export
82
+ */
83
+ export const setBearerAuthToObject = async function (
84
+ object: any,
85
+ configuration?: Configuration,
86
+ ) {
87
+ if (configuration && configuration.accessToken) {
88
+ const accessToken =
89
+ typeof configuration.accessToken === "function"
90
+ ? await configuration.accessToken()
91
+ : await configuration.accessToken;
92
+ object["Authorization"] = "Bearer " + accessToken;
93
+ }
94
+ };
95
+
96
+ /**
97
+ *
98
+ * @export
99
+ */
100
+ export const setOAuthToObject = async function (
101
+ object: any,
102
+ name: string,
103
+ scopes: string[],
104
+ configuration?: Configuration,
105
+ ) {
106
+ if (configuration && configuration.accessToken) {
107
+ const localVarAccessTokenValue =
108
+ typeof configuration.accessToken === "function"
109
+ ? await configuration.accessToken(name, scopes)
110
+ : await configuration.accessToken;
111
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
112
+ }
113
+ };
114
+
115
+ function setFlattenedQueryParams(
116
+ urlSearchParams: URLSearchParams,
117
+ parameter: any,
118
+ key: string = "",
119
+ ): void {
120
+ if (parameter == null) return;
121
+ if (typeof parameter === "object") {
122
+ if (Array.isArray(parameter)) {
123
+ (parameter as any[]).forEach((item) =>
124
+ setFlattenedQueryParams(urlSearchParams, item, key),
125
+ );
126
+ } else {
127
+ Object.keys(parameter).forEach((currentKey) =>
128
+ setFlattenedQueryParams(
129
+ urlSearchParams,
130
+ parameter[currentKey],
131
+ `${key}${key !== "" ? "." : ""}${currentKey}`,
132
+ ),
133
+ );
134
+ }
135
+ } else {
136
+ if (urlSearchParams.has(key)) {
137
+ urlSearchParams.append(key, parameter);
138
+ } else {
139
+ urlSearchParams.set(key, parameter);
140
+ }
141
+ }
142
+ }
143
+
144
+ /**
145
+ *
146
+ * @export
147
+ */
148
+ export const setSearchParams = function (url: URL, ...objects: any[]) {
149
+ const searchParams = new URLSearchParams(url.search);
150
+ setFlattenedQueryParams(searchParams, objects);
151
+ url.search = searchParams.toString();
152
+ };
153
+
154
+ /**
155
+ *
156
+ * @export
157
+ */
158
+ export const serializeDataIfNeeded = function (
159
+ value: any,
160
+ requestOptions: any,
161
+ configuration?: Configuration,
162
+ ) {
163
+ const nonString = typeof value !== "string";
164
+ const needsSerialization =
165
+ nonString && configuration && configuration.isJsonMime
166
+ ? configuration.isJsonMime(requestOptions.headers["Content-Type"])
167
+ : nonString;
168
+ return needsSerialization
169
+ ? JSON.stringify(value !== undefined ? value : {})
170
+ : value || "";
171
+ };
172
+
173
+ /**
174
+ *
175
+ * @export
176
+ */
177
+ export const toPathString = function (url: URL) {
178
+ return url.pathname + url.search + url.hash;
179
+ };
180
+
181
+ /**
182
+ *
183
+ * @export
184
+ */
185
+ export const createRequestFunction = function (
186
+ axiosArgs: RequestArgs,
187
+ globalAxios: AxiosInstance,
188
+ BASE_PATH: string,
189
+ configuration?: Configuration,
190
+ ) {
191
+ return <T = unknown, R = AxiosResponse<T>>(
192
+ axios: AxiosInstance = globalAxios,
193
+ basePath: string = BASE_PATH,
194
+ ) => {
195
+ const axiosRequestArgs = {
196
+ ...axiosArgs.options,
197
+ url:
198
+ (axios.defaults.baseURL ? "" : configuration?.basePath ?? basePath) +
199
+ axiosArgs.url,
200
+ };
201
+ return axios.request<T, R>(axiosRequestArgs);
202
+ };
203
+ };
@@ -0,0 +1,132 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Gopad OpenAPI
5
+ * API definition for Gopad, Etherpad for markdown with go
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0-alpha1
8
+ * Contact: gopad@webhippie.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ export interface ConfigurationParameters {
16
+ apiKey?:
17
+ | string
18
+ | Promise<string>
19
+ | ((name: string) => string)
20
+ | ((name: string) => Promise<string>);
21
+ username?: string;
22
+ password?: string;
23
+ accessToken?:
24
+ | string
25
+ | Promise<string>
26
+ | ((name?: string, scopes?: string[]) => string)
27
+ | ((name?: string, scopes?: string[]) => Promise<string>);
28
+ basePath?: string;
29
+ serverIndex?: number;
30
+ baseOptions?: any;
31
+ formDataCtor?: new () => any;
32
+ }
33
+
34
+ export class Configuration {
35
+ /**
36
+ * parameter for apiKey security
37
+ * @param name security name
38
+ * @memberof Configuration
39
+ */
40
+ apiKey?:
41
+ | string
42
+ | Promise<string>
43
+ | ((name: string) => string)
44
+ | ((name: string) => Promise<string>);
45
+ /**
46
+ * parameter for basic security
47
+ *
48
+ * @type {string}
49
+ * @memberof Configuration
50
+ */
51
+ username?: string;
52
+ /**
53
+ * parameter for basic security
54
+ *
55
+ * @type {string}
56
+ * @memberof Configuration
57
+ */
58
+ password?: string;
59
+ /**
60
+ * parameter for oauth2 security
61
+ * @param name security name
62
+ * @param scopes oauth2 scope
63
+ * @memberof Configuration
64
+ */
65
+ accessToken?:
66
+ | string
67
+ | Promise<string>
68
+ | ((name?: string, scopes?: string[]) => string)
69
+ | ((name?: string, scopes?: string[]) => Promise<string>);
70
+ /**
71
+ * override base path
72
+ *
73
+ * @type {string}
74
+ * @memberof Configuration
75
+ */
76
+ basePath?: string;
77
+ /**
78
+ * override server index
79
+ *
80
+ * @type {number}
81
+ * @memberof Configuration
82
+ */
83
+ serverIndex?: number;
84
+ /**
85
+ * base options for axios calls
86
+ *
87
+ * @type {any}
88
+ * @memberof Configuration
89
+ */
90
+ baseOptions?: any;
91
+ /**
92
+ * The FormData constructor that will be used to create multipart form data
93
+ * requests. You can inject this here so that execution environments that
94
+ * do not support the FormData class can still run the generated client.
95
+ *
96
+ * @type {new () => FormData}
97
+ */
98
+ formDataCtor?: new () => any;
99
+
100
+ constructor(param: ConfigurationParameters = {}) {
101
+ this.apiKey = param.apiKey;
102
+ this.username = param.username;
103
+ this.password = param.password;
104
+ this.accessToken = param.accessToken;
105
+ this.basePath = param.basePath;
106
+ this.serverIndex = param.serverIndex;
107
+ this.baseOptions = param.baseOptions;
108
+ this.formDataCtor = param.formDataCtor;
109
+ }
110
+
111
+ /**
112
+ * Check if the given MIME is a JSON MIME.
113
+ * JSON MIME examples:
114
+ * application/json
115
+ * application/json; charset=UTF8
116
+ * APPLICATION/JSON
117
+ * application/vnd.company+json
118
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
119
+ * @return True if the given MIME is JSON, false otherwise.
120
+ */
121
+ public isJsonMime(mime: string): boolean {
122
+ const jsonMime: RegExp = new RegExp(
123
+ "^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$",
124
+ "i",
125
+ );
126
+ return (
127
+ mime !== null &&
128
+ (jsonMime.test(mime) ||
129
+ mime.toLowerCase() === "application/json-patch+json")
130
+ );
131
+ }
132
+ }