Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(javascript): expose models #252

Merged
merged 2 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
# The patterns follow closely to .gitignore or .dockerignore.

git_push.sh
model/models.ts
.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
# The patterns follow closely to .gitignore or .dockerignore.

git_push.sh
model/models.ts
.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
# The patterns follow closely to .gitignore or .dockerignore.

git_push.sh
model/models.ts
.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
# The patterns follow closely to .gitignore or .dockerignore.

git_push.sh
model/models.ts
.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
# The patterns follow closely to .gitignore or .dockerignore.

git_push.sh
model/models.ts
.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
# The patterns follow closely to .gitignore or .dockerignore.

git_push.sh
model/models.ts
.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
# The patterns follow closely to .gitignore or .dockerignore.

git_push.sh
model/models.ts
.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
# The patterns follow closely to .gitignore or .dockerignore.

git_push.sh
model/models.ts
.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
# The patterns follow closely to .gitignore or .dockerignore.

git_push.sh
model/models.ts
.gitignore
4 changes: 3 additions & 1 deletion playground/javascript/node/algoliasearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { algoliasearch } from '@experimental-api-clients-automation/algoliasearc
import { ApiError } from '@experimental-api-clients-automation/client-common';
import dotenv from 'dotenv';

import type { SearchResponse } from '@experimental-api-clients-automation/client-search';

dotenv.config({ path: '../../.env' });

const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****';
Expand Down Expand Up @@ -29,7 +31,7 @@ client.addUserAgent('algoliasearch node playground', '0.0.1');

async function testAlgoliasearch() {
try {
const res = await client.search({
const res: SearchResponse = await client.search({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need to type here ? It can only return SearchResponse

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was mostly to test if it worked, and since we don't have a way to ensure it's still exposed, I've left it here

indexName: searchIndex,
searchParams: { query: searchQuery },
});
Expand Down
1 change: 1 addition & 0 deletions templates/javascript/api-single.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type {
import { {{classname}} } from '{{filename}}';
{{/imports}}

export * from '../model/models';
export const apiClientVersion = '{{packageVersion}}';

{{#operations}}
Expand Down
5 changes: 5 additions & 0 deletions templates/javascript/models.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{#models}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised this works ahah

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too, sometimes the generator have really easy features

{{#model}}
export * from '{{{ classFilename }}}';
{{/model}}
{{/models}}