Skip to content
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 @@ -133,6 +133,13 @@ If your endpoint has multiple server objects in the servers array, you can set t
void setServerIndex(const QString &operation, int serverIndex);
```
Parameter "operation" should be your operationid. "serverIndex" is the index you want to set as your default server. The function will check if there is a server with your index.

Alternatively, to set the server index globally for all operations:
```c++
void setServerIndex(int serverIndex);
```
This will apply the specified server index to all operations in the API.

Here is an example of multiple servers in the servers array. The first server will have index 0 and the second will have index 1.
```yaml
servers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ void {{classname}}::setServerIndex(const QString &operation, int serverIndex) {
}
}

void {{classname}}::setServerIndex(int serverIndex) {
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
setServerIndex(*keyIt, serverIndex);
}
}

Copy link
Member

Choose a reason for hiding this comment

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

thanks for the PR

what about adding a docstring similar to the comment block above (line 59 - 62) ?

Copy link
Member

Choose a reason for hiding this comment

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

i'll do it in another PR instead. thanks for the contribution.

void {{classname}}::setApiKey(const QString &apiKeyName, const QString &apiKey) {
_apiKeys.insert(apiKeyName, apiKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public:
void initializeServerConfigs();
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
void setServerIndex(const QString &operation, int serverIndex);
void setServerIndex(int serverIndex);
void setApiKey(const QString &apiKeyName, const QString &apiKey);
void setBearerToken(const QString &token);
void setUsername(const QString &username);
Expand Down
7 changes: 7 additions & 0 deletions samples/client/petstore/cpp-qt-addDownloadProgress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ If your endpoint has multiple server objects in the servers array, you can set t
void setServerIndex(const QString &operation, int serverIndex);
```
Parameter "operation" should be your operationid. "serverIndex" is the index you want to set as your default server. The function will check if there is a server with your index.

Alternatively, to set the server index globally for all operations:
```c++
void setServerIndex(int serverIndex);
```
This will apply the specified server index to all operations in the API.

Here is an example of multiple servers in the servers array. The first server will have index 0 and the second will have index 1.
```yaml
servers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ void PFXFakeApi::setServerIndex(const QString &operation, int serverIndex) {
}
}

void PFXFakeApi::setServerIndex(int serverIndex) {
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
setServerIndex(*keyIt, serverIndex);
}
}

void PFXFakeApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
_apiKeys.insert(apiKeyName, apiKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class PFXFakeApi : public QObject {
void initializeServerConfigs();
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
void setServerIndex(const QString &operation, int serverIndex);
void setServerIndex(int serverIndex);
void setApiKey(const QString &apiKeyName, const QString &apiKey);
void setBearerToken(const QString &token);
void setUsername(const QString &username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ void PFXPetApi::setServerIndex(const QString &operation, int serverIndex) {
}
}

void PFXPetApi::setServerIndex(int serverIndex) {
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
setServerIndex(*keyIt, serverIndex);
}
}

void PFXPetApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
_apiKeys.insert(apiKeyName, apiKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class PFXPetApi : public QObject {
void initializeServerConfigs();
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
void setServerIndex(const QString &operation, int serverIndex);
void setServerIndex(int serverIndex);
void setApiKey(const QString &apiKeyName, const QString &apiKey);
void setBearerToken(const QString &token);
void setUsername(const QString &username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ void PFXPrimitivesApi::setServerIndex(const QString &operation, int serverIndex)
}
}

void PFXPrimitivesApi::setServerIndex(int serverIndex) {
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
setServerIndex(*keyIt, serverIndex);
}
}

void PFXPrimitivesApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
_apiKeys.insert(apiKeyName, apiKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class PFXPrimitivesApi : public QObject {
void initializeServerConfigs();
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
void setServerIndex(const QString &operation, int serverIndex);
void setServerIndex(int serverIndex);
void setApiKey(const QString &apiKeyName, const QString &apiKey);
void setBearerToken(const QString &token);
void setUsername(const QString &username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ void PFXStoreApi::setServerIndex(const QString &operation, int serverIndex) {
}
}

void PFXStoreApi::setServerIndex(int serverIndex) {
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
setServerIndex(*keyIt, serverIndex);
}
}

void PFXStoreApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
_apiKeys.insert(apiKeyName, apiKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class PFXStoreApi : public QObject {
void initializeServerConfigs();
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
void setServerIndex(const QString &operation, int serverIndex);
void setServerIndex(int serverIndex);
void setApiKey(const QString &apiKeyName, const QString &apiKey);
void setBearerToken(const QString &token);
void setUsername(const QString &username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ void PFXUserApi::setServerIndex(const QString &operation, int serverIndex) {
}
}

void PFXUserApi::setServerIndex(int serverIndex) {
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
setServerIndex(*keyIt, serverIndex);
}
}

void PFXUserApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
_apiKeys.insert(apiKeyName, apiKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class PFXUserApi : public QObject {
void initializeServerConfigs();
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
void setServerIndex(const QString &operation, int serverIndex);
void setServerIndex(int serverIndex);
void setApiKey(const QString &apiKeyName, const QString &apiKey);
void setBearerToken(const QString &token);
void setUsername(const QString &username);
Expand Down
7 changes: 7 additions & 0 deletions samples/client/petstore/cpp-qt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ If your endpoint has multiple server objects in the servers array, you can set t
void setServerIndex(const QString &operation, int serverIndex);
```
Parameter "operation" should be your operationid. "serverIndex" is the index you want to set as your default server. The function will check if there is a server with your index.

Alternatively, to set the server index globally for all operations:
```c++
void setServerIndex(int serverIndex);
```
This will apply the specified server index to all operations in the API.

Here is an example of multiple servers in the servers array. The first server will have index 0 and the second will have index 1.
```yaml
servers:
Expand Down
6 changes: 6 additions & 0 deletions samples/client/petstore/cpp-qt/client/PFXFakeApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ void PFXFakeApi::setServerIndex(const QString &operation, int serverIndex) {
}
}

void PFXFakeApi::setServerIndex(int serverIndex) {
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
setServerIndex(*keyIt, serverIndex);
}
}

void PFXFakeApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
_apiKeys.insert(apiKeyName, apiKey);
}
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/cpp-qt/client/PFXFakeApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class PFXFakeApi : public QObject {
void initializeServerConfigs();
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
void setServerIndex(const QString &operation, int serverIndex);
void setServerIndex(int serverIndex);
void setApiKey(const QString &apiKeyName, const QString &apiKey);
void setBearerToken(const QString &token);
void setUsername(const QString &username);
Expand Down
6 changes: 6 additions & 0 deletions samples/client/petstore/cpp-qt/client/PFXPetApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ void PFXPetApi::setServerIndex(const QString &operation, int serverIndex) {
}
}

void PFXPetApi::setServerIndex(int serverIndex) {
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
setServerIndex(*keyIt, serverIndex);
}
}

void PFXPetApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
_apiKeys.insert(apiKeyName, apiKey);
}
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/cpp-qt/client/PFXPetApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class PFXPetApi : public QObject {
void initializeServerConfigs();
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
void setServerIndex(const QString &operation, int serverIndex);
void setServerIndex(int serverIndex);
void setApiKey(const QString &apiKeyName, const QString &apiKey);
void setBearerToken(const QString &token);
void setUsername(const QString &username);
Expand Down
6 changes: 6 additions & 0 deletions samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ void PFXPrimitivesApi::setServerIndex(const QString &operation, int serverIndex)
}
}

void PFXPrimitivesApi::setServerIndex(int serverIndex) {
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
setServerIndex(*keyIt, serverIndex);
}
}

void PFXPrimitivesApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
_apiKeys.insert(apiKeyName, apiKey);
}
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class PFXPrimitivesApi : public QObject {
void initializeServerConfigs();
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
void setServerIndex(const QString &operation, int serverIndex);
void setServerIndex(int serverIndex);
void setApiKey(const QString &apiKeyName, const QString &apiKey);
void setBearerToken(const QString &token);
void setUsername(const QString &username);
Expand Down
6 changes: 6 additions & 0 deletions samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ void PFXStoreApi::setServerIndex(const QString &operation, int serverIndex) {
}
}

void PFXStoreApi::setServerIndex(int serverIndex) {
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
setServerIndex(*keyIt, serverIndex);
}
}

void PFXStoreApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
_apiKeys.insert(apiKeyName, apiKey);
}
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/cpp-qt/client/PFXStoreApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class PFXStoreApi : public QObject {
void initializeServerConfigs();
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
void setServerIndex(const QString &operation, int serverIndex);
void setServerIndex(int serverIndex);
void setApiKey(const QString &apiKeyName, const QString &apiKey);
void setBearerToken(const QString &token);
void setUsername(const QString &username);
Expand Down
6 changes: 6 additions & 0 deletions samples/client/petstore/cpp-qt/client/PFXUserApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ void PFXUserApi::setServerIndex(const QString &operation, int serverIndex) {
}
}

void PFXUserApi::setServerIndex(int serverIndex) {
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
setServerIndex(*keyIt, serverIndex);
}
}

void PFXUserApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
_apiKeys.insert(apiKeyName, apiKey);
}
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/cpp-qt/client/PFXUserApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class PFXUserApi : public QObject {
void initializeServerConfigs();
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
void setServerIndex(const QString &operation, int serverIndex);
void setServerIndex(int serverIndex);
void setApiKey(const QString &apiKeyName, const QString &apiKey);
void setBearerToken(const QString &token);
void setUsername(const QString &username);
Expand Down
Loading