Skip to content

Commit 30fba7a

Browse files
committed
doc and remove dead code
1 parent 78ead4f commit 30fba7a

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

algolia-typescript-template/models.mustache

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,6 @@ export interface Authentication {
185185
applyToRequest(requestOptions: RequestOptions): Promise<void> | void;
186186
}
187187
188-
/*
189-
export class HttpBasicAuth implements Authentication {
190-
public username: string = '';
191-
public password: string = '';
192-
193-
applyToRequest(requestOptions: RequestOptions): void {
194-
requestOptions.auth = {
195-
username: this.username, password: this.password
196-
}
197-
}
198-
}*/
199-
200188
export class HttpBearerAuth implements Authentication {
201189
public accessToken: string | (() => string) = '';
202190

doc/AddLanguage.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# How to add a new language
2+
3+
In order to generate a client for a new language, here is a short guide:
4+
5+
## Extract the template
6+
7+
First you need to find your language in the list of generators:
8+
[list](https://openapi-generator.tech/docs/generators)
9+
10+
Once you find your template you can extract it with the following command:
11+
```bash
12+
openapi-generator author template -g <your language generator> -o templates/<your language>
13+
```
14+
15+
## Customize the template
16+
17+
There are a few components to add before generating the client, mostly:
18+
- Init method
19+
- Retry strategy
20+
- maybe more
21+
22+
### Init method
23+
24+
By default, OpenAPI will put the `AppId` and `ApiKey` in every method, but we want an init method that takes those parameters and put them in the header of every requests, and create the right hosts.
25+
To do this, change the constructor of the client in the `mustache` file to accept and store them.
26+
27+
### Retry strategy
28+
29+
The retry strategy cannot be included in the OpenAPI spec, you need to add a `<your language>` folder inside the `complement` folder and add your retry strategy code in that folder.
30+
31+
TODO finish this when we have more knowledge about the other languages.

0 commit comments

Comments
 (0)