Skip to content

Commit a119f90

Browse files
committed
update sdk
1 parent aeb6abd commit a119f90

20 files changed

+83
-148
lines changed

package-lock.json

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"tslib": "^2.3.0",
2222
"zone.js": "~0.13.0",
2323
"@ng-bootstrap/ng-bootstrap": "^15.0.0",
24-
"fusio-sdk": "^3.0.4",
24+
"fusio-sdk": "^3.0.5",
2525
"ngx-captcha": "^13.0.0",
2626
"ngx-gravatar": "^13.0.0",
2727
"ng-packagr": "^16.1.0"

projects/fusio-sdk/src/lib/abstract/manipulation.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {Component, Input, OnInit} from "@angular/core";
22
import {Message} from "fusio-sdk/dist/src/generated/backend/Message";
33
import {Mode} from "./list";
4-
import {AxiosResponse} from "axios";
54
import {ClientAbstract} from "sdkgen-client";
65
import {FusioService} from "../service/fusio.service";
76
import {ErrorService} from "../service/error.service";
@@ -64,12 +63,12 @@ export abstract class Manipulation<C extends ClientAbstract, T extends ModelId>
6463
}
6564
}
6665

67-
protected onResponse(response: AxiosResponse<Message>, entity: T): void {
66+
protected onResponse(response: Message, entity: T): void {
6867
}
6968

70-
protected abstract create(entity: T): Promise<AxiosResponse<Message>|void>;
71-
protected abstract update(entity: T): Promise<AxiosResponse<Message>|void>;
72-
protected abstract delete(entity: T): Promise<AxiosResponse<Message>|void>;
69+
protected abstract create(entity: T): Promise<Message|void>;
70+
protected abstract update(entity: T): Promise<Message|void>;
71+
protected abstract delete(entity: T): Promise<Message|void>;
7372
protected abstract newEntity(): T;
7473

7574
}

projects/fusio-sdk/src/lib/abstract/modal.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {Component} from "@angular/core";
22
import {Message} from "fusio-sdk/dist/src/generated/backend/Message";
33
import {NgbActiveModal, NgbModal} from "@ng-bootstrap/ng-bootstrap";
4-
import {AxiosResponse} from "axios";
54
import {ClientAbstract} from "sdkgen-client";
65
import {FusioService} from "../service/fusio.service";
76
import {ErrorService} from "../service/error.service";
@@ -26,10 +25,10 @@ export abstract class Modal<C extends ClientAbstract, T extends ModelId> extends
2625
this.modal = modal;
2726
}
2827

29-
protected onResponse(response: AxiosResponse<Message>, entity: T) {
28+
protected override onResponse(response: Message, entity: T) {
3029
this.modal.close({
3130
entity: entity,
32-
response: response.data,
31+
response: response,
3332
});
3433
}
3534

projects/fusio-sdk/src/lib/abstract/query.ts

+10-16
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import {Component, OnInit} from '@angular/core';
2-
import {CollectionCategoryQuery} from "fusio-sdk/dist/src/generated/backend/CollectionCategoryQuery";
32
import {ActivatedRoute, Router} from "@angular/router";
4-
import {AxiosResponse} from "axios";
53
import {ClientAbstract} from "sdkgen-client";
64
import {Collection} from "fusio-sdk/dist/src/generated/backend/Collection";
75
import {Message} from "fusio-sdk/dist/src/generated/backend/Message";
8-
import {CollectionQuery} from "fusio-sdk/dist/src/generated/backend/CollectionQuery";
96
import {FusioService} from "../service/fusio.service";
107
import {ErrorService} from "../service/error.service";
118
import {EventService} from "../service/event.service";
@@ -76,8 +73,8 @@ export abstract class Query<C extends ClientAbstract, T extends ModelId> impleme
7673
try {
7774
const response = await this.getAll(this.getCollectionQuery());
7875

79-
this.totalResults = response.data.totalResults || 0;
80-
this.entries = response.data.entry || [];
76+
this.totalResults = response.totalResults || 0;
77+
this.entries = response.entry || [];
8178

8279
this.onList();
8380
} catch (error) {
@@ -93,22 +90,19 @@ export abstract class Query<C extends ClientAbstract, T extends ModelId> impleme
9390
this.finishLoading();
9491
}
9592

96-
protected getCollectionQuery(): CollectionQuery {
97-
let query: CollectionQuery = {};
98-
query.startIndex = (this.page - 1) * this.pageSize;
99-
query.count = this.pageSize;
93+
protected getCollectionQuery(): Array<any> {
94+
let query: Array<any> = [];
95+
query.push((this.page - 1) * this.pageSize);
96+
query.push(this.pageSize);
10097
if (this.search) {
101-
query.search = this.search;
98+
query.push(this.search);
10299
}
103100
return query;
104101
}
105102

106103
async doGet(id: string) {
107104
try {
108-
const response = await this.get(id);
109-
110-
this.selected = response.data;
111-
105+
this.selected = await this.get(id);
112106
this.onGet();
113107
} catch (error) {
114108
this.response = this.error.convert(error);
@@ -170,8 +164,8 @@ export abstract class Query<C extends ClientAbstract, T extends ModelId> impleme
170164
}, 100);
171165
}
172166

173-
protected abstract getAll(query: CollectionCategoryQuery): Promise<AxiosResponse<Collection<T>>>;
174-
protected abstract get(id: string): Promise<AxiosResponse<T>>;
167+
protected abstract getAll(parameters: Array<any>): Promise<Collection<T>>;
168+
protected abstract get(id: string): Promise<T>;
175169
protected abstract getRoute(): string;
176170

177171
protected onList(): void

projects/fusio-sdk/src/lib/component/account/account.component.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ export class AccountComponent implements OnInit {
1919

2020
async ngOnInit(): Promise<void> {
2121
try {
22-
const account = await this.consumer.getClient().getConsumerAccount();
23-
const response = await account.consumerActionUserGet();
24-
25-
this.user = response.data;
22+
this.user = await this.consumer.getClient().account().get();
2623
this.email = this.user.email || '';
2724
this.response = undefined;
2825
} catch (error) {
@@ -36,10 +33,7 @@ export class AccountComponent implements OnInit {
3633
return;
3734
}
3835

39-
const account = await this.consumer.getClient().getConsumerAccount();
40-
const response = await account.consumerActionUserUpdate(this.user);
41-
42-
this.response = response.data;
36+
this.response = await this.consumer.getClient().account().update(this.user);
4337
} catch (error) {
4438
this.response = this.error.convert(error);
4539
}

projects/fusio-sdk/src/lib/component/app/list/list.component.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import {Component} from '@angular/core';
22
import {App} from "fusio-sdk/dist/src/generated/consumer/App";
3-
import Client from "fusio-sdk/dist/src/generated/consumer/Client";
4-
import {CollectionQuery} from "fusio-sdk/dist/src/generated/consumer/CollectionQuery";
3+
import {Client} from "fusio-sdk/dist/src/generated/consumer/Client";
54
import {Collection} from "fusio-sdk/dist/src/generated/consumer/Collection";
65
import {List} from "../../../abstract/list";
7-
import {AxiosResponse} from "axios";
86
import {ModalComponent} from "../modal/modal.component";
97
import {ActivatedRoute, Router} from "@angular/router";
108
import {NgbModal} from "@ng-bootstrap/ng-bootstrap";
@@ -23,14 +21,12 @@ export class ListComponent extends List<Client, App> {
2321
super(fusio, route, router, event, error, modalService);
2422
}
2523

26-
protected async getAll(query: CollectionQuery): Promise<AxiosResponse<Collection<App>>> {
27-
const app = await this.fusio.getClient().getConsumerApp();
28-
return await app.consumerActionAppGetAll(query);
24+
protected async getAll(parameters: Array<any>): Promise<Collection<App>> {
25+
return this.fusio.getClient().app().getAll(...parameters);
2926
}
3027

31-
protected async get(id: string): Promise<AxiosResponse<App>> {
32-
const app = await this.fusio.getClient().getConsumerAppByAppId(id);
33-
return await app.consumerActionAppGet();
28+
protected async get(id: string): Promise<App> {
29+
return this.fusio.getClient().app().get(id);
3430
}
3531

3632
protected getDetailComponent(): any {

projects/fusio-sdk/src/lib/component/app/modal/modal.component.ts

+9-15
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import {Component} from '@angular/core';
22
import {Modal} from "../../../abstract/modal";
3-
import Client from "fusio-sdk/dist/src/generated/consumer/Client";
3+
import {Client} from "fusio-sdk/dist/src/generated/consumer/Client";
44
import {App} from "fusio-sdk/dist/src/generated/consumer/App";
5-
import {AxiosResponse} from "axios";
65
import {Message} from "fusio-sdk/dist/src/generated/consumer/Message";
76
import {AppCreate} from "fusio-sdk/dist/src/generated/consumer/AppCreate";
87
import {AppUpdate} from "fusio-sdk/dist/src/generated/consumer/AppUpdate";
98
import {Scope} from "fusio-sdk/dist/src/generated/consumer/Scope";
10-
import {FusioService} from "../../../service/fusio.service";
119
import {NgbActiveModal, NgbModal} from "@ng-bootstrap/ng-bootstrap";
1210
import {ConsumerService} from "../../../service/consumer.service";
1311
import {ErrorService} from "../../../service/error.service";
@@ -26,24 +24,20 @@ export class ModalComponent extends Modal<Client, App> {
2624
}
2725

2826
override async ngOnInit(): Promise<void> {
29-
const scope = await this.fusio.getClient().getConsumerScope();
30-
const response = await scope.consumerActionScopeGetAll({count: 1024});
31-
this.scopes = response.data.entry;
27+
const response = await this.fusio.getClient().scope().getAll(0, 1024);
28+
this.scopes = response.entry;
3229
}
3330

34-
protected async create(entity: App): Promise<AxiosResponse<Message>> {
35-
const app = await this.fusio.getClient().getConsumerApp();
36-
return await app.consumerActionAppCreate(<AppCreate> entity);
31+
protected async create(entity: App): Promise<Message> {
32+
return this.fusio.getClient().app().create(<AppCreate> entity);
3733
}
3834

39-
protected async update(entity: App): Promise<AxiosResponse<Message>> {
40-
const app = await this.fusio.getClient().getConsumerAppByAppId('' + entity.id);
41-
return await app.consumerActionAppUpdate(<AppUpdate> entity);
35+
protected async update(entity: App): Promise<Message> {
36+
return this.fusio.getClient().app().update('' + entity.id, <AppUpdate> entity);
4237
}
4338

44-
protected async delete(entity: App): Promise<AxiosResponse<Message>> {
45-
const app = await this.fusio.getClient().getConsumerAppByAppId('' + entity.id);
46-
return await app.consumerActionAppDelete();
39+
protected async delete(entity: App): Promise<Message> {
40+
return this.fusio.getClient().app().delete('' + entity.id);
4741
}
4842

4943
protected newEntity(): App {

projects/fusio-sdk/src/lib/component/event/list/list.component.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import {Component} from '@angular/core';
22
import {EventSubscription} from "fusio-sdk/dist/src/generated/consumer/EventSubscription";
3-
import Client from "fusio-sdk/dist/src/generated/consumer/Client";
3+
import {Client} from "fusio-sdk/dist/src/generated/consumer/Client";
44
import {List} from "../../../abstract/list";
5-
import {CollectionQuery} from "fusio-sdk/dist/src/generated/consumer/CollectionQuery";
6-
import {AxiosResponse} from "axios";
75
import {Collection} from "fusio-sdk/dist/src/generated/consumer/Collection";
86
import {ModalComponent} from "../modal/modal.component";
97
import {ConsumerService} from "../../../service/consumer.service";
@@ -23,14 +21,12 @@ export class ListComponent extends List<Client, EventSubscription> {
2321
super(fusio, route, router, event, error, modalService);
2422
}
2523

26-
protected async getAll(query: CollectionQuery): Promise<AxiosResponse<Collection<EventSubscription>>> {
27-
const subscription = await this.fusio.getClient().getConsumerSubscription();
28-
return await subscription.consumerActionEventSubscriptionGetAll(query);
24+
protected async getAll(parameters: Array<any>): Promise<Collection<EventSubscription>> {
25+
return this.fusio.getClient().subscription().getAll(...parameters);
2926
}
3027

31-
protected async get(id: string): Promise<AxiosResponse<EventSubscription>> {
32-
const subscription = await this.fusio.getClient().getConsumerSubscriptionBySubscriptionId(id);
33-
return await subscription.consumerActionEventSubscriptionGet();
28+
protected async get(id: string): Promise<EventSubscription> {
29+
return this.fusio.getClient().subscription().get('' + id);
3430
}
3531

3632
protected getDetailComponent(): any {

projects/fusio-sdk/src/lib/component/event/modal/modal.component.ts

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import {Component} from '@angular/core';
22
import {EventSubscription} from "fusio-sdk/dist/src/generated/consumer/EventSubscription";
3-
import Client from "fusio-sdk/dist/src/generated/consumer/Client";
3+
import {Client} from "fusio-sdk/dist/src/generated/consumer/Client";
44
import {Modal} from "../../../abstract/modal";
5-
import {AxiosResponse} from "axios";
65
import {Message} from "fusio-sdk/dist/src/generated/consumer/Message";
76
import {Event} from "fusio-sdk/dist/src/generated/consumer/Event";
87
import {EventSubscriptionCreate} from "fusio-sdk/dist/src/generated/consumer/EventSubscriptionCreate";
@@ -25,24 +24,20 @@ export class ModalComponent extends Modal<Client, EventSubscription> {
2524
}
2625

2726
override async ngOnInit(): Promise<void> {
28-
const event = await this.fusio.getClient().getConsumerEvent();
29-
const response = await event.consumerActionEventGetAll({count: 1024});
30-
this.events = response.data.entry;
27+
const response = await this.fusio.getClient().event().getAll(0, 1024);
28+
this.events = response.entry;
3129
}
3230

33-
protected async create(entity: EventSubscription): Promise<AxiosResponse<Message>> {
34-
const subscription = await this.fusio.getClient().getConsumerSubscription();
35-
return await subscription.consumerActionEventSubscriptionCreate(<EventSubscriptionCreate> entity);
31+
protected async create(entity: EventSubscription): Promise<Message> {
32+
return this.fusio.getClient().subscription().create(<EventSubscriptionCreate> entity);
3633
}
3734

38-
protected async update(entity: EventSubscription): Promise<AxiosResponse<Message>> {
39-
const subscription = await this.fusio.getClient().getConsumerSubscriptionBySubscriptionId('' + entity.id);
40-
return await subscription.consumerActionEventSubscriptionUpdate(<EventSubscriptionUpdate> entity);
35+
protected async update(entity: EventSubscription): Promise<Message> {
36+
return this.fusio.getClient().subscription().update('' + entity.id, <EventSubscriptionUpdate> entity);
4137
}
4238

43-
protected async delete(entity: EventSubscription): Promise<AxiosResponse<Message>> {
44-
const subscription = await this.fusio.getClient().getConsumerSubscriptionBySubscriptionId('' + entity.id);
45-
return await subscription.consumerActionEventSubscriptionDelete();
39+
protected async delete(entity: EventSubscription): Promise<Message> {
40+
return this.fusio.getClient().subscription().delete('' + entity.id);
4641
}
4742

4843
protected newEntity(): EventSubscription {

projects/fusio-sdk/src/lib/component/login/login.component.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ export class LoginComponent implements OnInit {
3636
this.loading = true;
3737

3838
try {
39-
const client = this.consumer.getClientWithCredentials(this.credentials.username, this.credentials.password);
40-
const resource = await client.getConsumerAccount();
41-
const response = await resource.consumerActionUserGet();
39+
const response = await this.consumer.getClientWithCredentials(this.credentials.username, this.credentials.password).account().get();
4240

43-
this.user.login(response.data);
41+
this.user.login(response);
4442

4543
this.router.navigate([this.config.getHomePath()]).then(() => {
4644
location.reload();

projects/fusio-sdk/src/lib/component/login/provider/provider.component.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,22 @@ export class ProviderComponent implements OnInit {
3939
try {
4040
const verification = this.provider.verifyRequest(providerName, state);
4141

42-
const resource = await this.consumer.getClientAnonymous().getConsumerProviderByProvider(providerName);
43-
const response = await resource.consumerActionUserProvider({
42+
const response = await this.consumer.getClientAnonymous().account().provider(providerName, {
4443
code: code,
4544
clientId: verification.clientId,
4645
redirectUri: verification.redirectUri,
4746
});
4847

49-
if (!response.data.token) {
48+
if (!response.token) {
5049
throw new Error('Could not obtain access token');
5150
}
5251

5352
const token: AccessToken = {
5453
token_type: 'bearer',
55-
access_token: response.data.token,
56-
expires_in: response.data.expires_in || 0,
57-
refresh_token: response.data.refresh_token || '',
58-
scope: response.data.scope || '',
54+
access_token: response.token,
55+
expires_in: response.expires_in || 0,
56+
refresh_token: response.refresh_token || '',
57+
scope: response.scope || '',
5958
};
6059

6160
const store = new SessionTokenStore();
@@ -68,10 +67,9 @@ export class ProviderComponent implements OnInit {
6867
}
6968

7069
private async obtainUserInfo() {
71-
const resource = await this.consumer.getClient().getConsumerAccount();
72-
const response = await resource.consumerActionUserGet();
70+
const response = await this.consumer.getClient().account().get();
7371

74-
this.user.login(response.data);
72+
this.user.login(response);
7573

7674
this.router.navigate([this.config.getHomePath()]).then(() => {
7775
location.reload();

projects/fusio-sdk/src/lib/component/password/confirm/confirm.component.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ export class ConfirmComponent implements OnInit {
4242
throw new Error('The provided password does not match with the confirmation password');
4343
}
4444

45-
const client = this.consumer.getClientAnonymous();
46-
const resource = await client.getConsumerPasswordReset();
47-
const response = await resource.consumerActionUserResetPasswordExecute(this.reset);
48-
49-
this.response = response.data;
45+
this.response = await this.consumer.getClientAnonymous().account().executePasswordReset(this.reset);
5046
this.loading = false;
5147
} catch (error) {
5248
this.loading = false;

0 commit comments

Comments
 (0)