Any Updates please ?
Hi,
Thanks for your reply.
I'm getting the build errors with the code you shared, I have sent you mail regarding the same, please check.
Could you please some tips, tricks, shortcuts or utilities , automationwhile working with abp framework which can help in speed up development or testing speed.
Hi @ismcagdas,
Thanks for your help.
I tried the exact step mentioned by you, But still, I'm getting the >Duplicate function implementation error. Do I need to make any other changes also?
Below is the generated service-proxies.ts file.
export class AppServiceProxy {
{
private http: Http;
private baseUrl: string;
protected jsonParseReviver: (key: string, value: any) => any = undefined;
constructor(@Inject(Http) http: Http, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {
this.http = http;
this.baseUrl = baseUrl ? baseUrl : "";
}
/**
* @return Success
*/
test(id: number): Observable<void> {
let url_ = this.baseUrl + "/api/services/app/Test?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined and cannot be null.");
else
url_ += "Id=" + encodeURIComponent("" + id) + "&";
url_ = url_.replace(/[?&]$/, "");
const content_ = "";
let options_ = {
body: content_,
method: "get",
headers: new Headers({
"Content-Type": "application/json; charset=UTF-8",
"Accept": "application/json; charset=UTF-8"
})
};
return this.http.request(url_, options_).flatMap((response_) => {
return this.processTest(response_);
}).catch((response_: any) => {
if (response_ instanceof Response) {
try {
return this.processTest(response_);
} catch (e) {
return <Observable<void>><any>Observable.throw(e);
}
} else
return <Observable<void>><any>Observable.throw(response_);
});
}
protected processTest(response: Response): Observable<void> {
const status = response.status;
if (status === 200) {
const responseText = response.text();
return Observable.of<void>(<any>null);
} else if (status === 401) {
const responseText = response.text();
return throwException("A server error occurred.", status, responseText);
} else if (status !== 200 && status !== 204) {
const responseText = response.text();
return throwException("An unexpected server error occurred.", status, responseText);
}
return Observable.of<void>(<any>null);
}
/**
* @return Success
*/
test(input: NoticeDetailsDto): Observable<void> {
let url_ = this.baseUrl + "/api/services/app/Test";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(input ? input.toJSON() : null);
let options_ = {
body: content_,
method: "put",
headers: new Headers({
"Content-Type": "application/json; charset=UTF-8",
"Accept": "application/json; charset=UTF-8"
})
};
return this.http.request(url_, options_).flatMap((response_) => {
return this.processTest(response_);
}).catch((response_: any) => {
if (response_ instanceof Response) {
try {
return this.processTest(response_);
} catch (e) {
return <Observable<void>><any>Observable.throw(e);
}
} else
return <Observable<void>><any>Observable.throw(response_);
});
}
protected processTest(response: Response): Observable<void> {
const status = response.status;
if (status === 200) {
const responseText = response.text();
return Observable.of<void>(<any>null);
} else if (status === 401) {
const responseText = response.text();
return throwException("A server error occurred.", status, responseText);
} else if (status !== 200 && status !== 204) {
const responseText = response.text();
return throwException("An unexpected server error occurred.", status, responseText);
}
return Observable.of<void>(<any>null);
}
/**
* @return Success
*/
test(input: NoticeDetailsDto): Observable<void> {
let url_ = this.baseUrl + "/api/services/app/Test";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(input ? input.toJSON() : null);
let options_ = {
body: content_,
method: "post",
headers: new Headers({
"Content-Type": "application/json; charset=UTF-8",
"Accept": "application/json; charset=UTF-8"
})
};
return this.http.request(url_, options_).flatMap((response_) => {
return this.processTest(response_);
}).catch((response_: any) => {
if (response_ instanceof Response) {
try {
return this.processTest(response_);
} catch (e) {
return <Observable<void>><any>Observable.throw(e);
}
} else
return <Observable<void>><any>Observable.throw(response_);
});
}
protected processTest(response: Response): Observable<void> {
const status = response.status;
if (status === 200) {
const responseText = response.text();
return Observable.of<void>(<any>null);
} else if (status === 401) {
const responseText = response.text();
return throwException("A server error occurred.", status, responseText);
} else if (status !== 200 && status !== 204) {
const responseText = response.text();
return throwException("An unexpected server error occurred.", status, responseText);
}
return Observable.of<void>(<any>null);
}
/**
* @return Success
*/
test(id: number): Observable<void> {
let url_ = this.baseUrl + "/api/services/app/Test?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined and cannot be null.");
else
url_ += "Id=" + encodeURIComponent("" + id) + "&";
url_ = url_.replace(/[?&]$/, "");
const content_ = "";
let options_ = {
body: content_,
method: "delete",
headers: new Headers({
"Content-Type": "application/json; charset=UTF-8",
"Accept": "application/json; charset=UTF-8"
})
};
return this.http.request(url_, options_).flatMap((response_) => {
return this.processTest(response_);
}).catch((response_: any) => {
if (response_ instanceof Response) {
try {
return this.processTest(response_);
} catch (e) {
return <Observable<void>><any>Observable.throw(e);
}
} else
return <Observable<void>><any>Observable.throw(response_);
});
}
protected processTest(response: Response): Observable<void> {
const status = response.status;
if (status === 200) {
const responseText = response.text();
return Observable.of<void>(<any>null);
} else if (status === 401) {
const responseText = response.text();
return throwException("A server error occurred.", status, responseText);
} else if (status !== 200 && status !== 204) {
const responseText = response.text();
return throwException("An unexpected server error occurred.", status, responseText);
}
return Observable.of<void>(<any>null);
}
}
Any updates please?
Any updates please?
Hi
Tried, but its also not working.
[Route("api/services/app/Test")]
[HttpPost]
public async Task CreateTest(TestDetailsDto input)
[Route("api/services/app/Test")]
[HttpDelete]
public async Task DeleteTest(EntityDto input)
[Route("api/services/app/Test")]
[HttpGet]
public async Task GetTest(EntityDto input)
[Route("api/services/app/Test")]
[HttpPut]
public async Task UpdateTest(TestDetailsDto input)
Do I need to make any other change also ?
Giving the following error on npm start.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6197,5): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6230,15): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6252,5): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6267,16): The type argument for type parameter 'R' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'void' is not a valid type argument because it is not a supertype of candidate 'TestDetailsDto'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6281,15): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6300,5): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6315,16): The type argument for type parameter 'R' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'TestDetailsDto'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6329,15): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6351,5): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6370,16): The type argument for type parameter 'R' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'void' is not a valid type argument because it is not a supertype of candidate 'TestDetailsDto'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6384,15): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/app/merchandising/Tests/Test-list.component.ts (210,45): Property 'deleteTest' does not exist on type 'TestServiceProxy'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/app/merchandising/Tests/Test-main.component.ts (102,41): Property 'getTestDetailsforEdit' does not exist on type 'TestServiceProxy'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/app/merchandising/Tests/Test-main.component.ts (163,37): Property 'createTest' does not exist on type 'TestServiceProxy'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/app/merchandising/Tests/Test-main.component.ts (206,37): Property 'createTest' does not exist on type 'TestServiceProxy'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/app/merchandising/Tests/Test-main.component.ts (218,37): Property 'updateTest' does not exist on type 'TestServiceProxy'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6197,5): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6230,15): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6252,5): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6267,16): The type argument for type parameter 'R' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'void' is not a valid type argument because it is not a supertype of candidate 'TestDetailsDto'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6281,15): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6300,5): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6315,16): The type argument for type parameter 'R' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'TestDetailsDto'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6329,15): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6351,5): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6370,16): The type argument for type parameter 'R' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'void' is not a valid type argument because it is not a supertype of candidate 'TestDetailsDto'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/shared/service-proxies/service-proxies.ts (6384,15): Duplicate function implementation.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/app/merchandising/Tests/Test-list.component.ts (210,45): Property 'deleteTest' does not exist on type 'TestServiceProxy'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/app/merchandising/Tests/Test-main.component.ts (102,41): Property 'getTestDetailsforEdit' does not exist on type 'TestServiceProxy'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/app/merchandising/Tests/Test-main.component.ts (163,37): Property 'createTest' does not exist on type 'TestServiceProxy'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/app/merchandising/Tests/Test-main.component.ts (206,37): Property 'createTest' does not exist on type 'TestServiceProxy'.
ERROR in C:/Users/MyName/source/repos/MyProject/angular/src/app/merchandising/Tests/Test-main.component.ts (218,37): Property 'updateTest' does not exist on type 'TestServiceProxy'.
I have posted my answer here, please check it might help somebody.
[https://stackoverflow.com/a/48268866/6527049])
@Aaron any updates?
MultipleClientsFromOperationId not working, giving more than 100 error on npm start. Could you please try the same scenario on your local machine and come up with a proper solution with some test entity, because support for restful service has to be there in abp framework.