Skip to content

Commit

Permalink
Merge pull request #807 from sachinira/testvote
Browse files Browse the repository at this point in the history
Update types of zendesk support connector
  • Loading branch information
LakshanSS authored Aug 18, 2023
2 parents a2c7135 + c1b4e25 commit b85ed0a
Show file tree
Hide file tree
Showing 5 changed files with 509 additions and 183 deletions.
2 changes: 1 addition & 1 deletion openapi/zendesk.support/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name = "zendesk.support"
icon = "icon.png"
distribution = "2201.4.1"
repository = "https://github.com/ballerina-platform/openapi-connectors/tree/main/openapi/zendesk.support"
version = "1.5.1"
version = "1.6.0"
authors = ["Ballerina"]
[build-options]
observabilityIncluded = true
2 changes: 1 addition & 1 deletion openapi/zendesk.support/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ zensupport:Client baseClient = check new Client(clientConfig, serviceUrl = "<htt
role: "agent"
}
};
zensupport:User userResult = check baseClient->createUser(user);
zensupport:UserResponse userResult = check baseClient->createUser(user);
log:printInfo(userResult.toString());
}
```
Expand Down
43 changes: 21 additions & 22 deletions openapi/zendesk.support/client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import ballerina/http;

# This is a generated connector for [Zendesk Support API v2](https://developer.zendesk.com/api-reference/) OpenAPI specification.
Expand Down Expand Up @@ -67,12 +66,12 @@ public isolated client class Client {
#
# + payload - The information for create user request
# + return - Returns detail of user created
remote isolated function createUser(CreateUserInfo payload) returns User|error {
remote isolated function createUser(CreateUserInfo payload) returns UserResponse|error {
string resourcePath = string `/api/v2/users.json`;
http:Request request = new;
json jsonBody = check payload.cloneWithType(json);
json jsonBody = payload.toJson();
request.setPayload(jsonBody, "application/json");
User response = check self.clientEp->post(resourcePath, request);
UserResponse response = check self.clientEp->post(resourcePath, request);
return response;
}
# Search Users.
Expand All @@ -88,20 +87,20 @@ public isolated client class Client {
}
# Get User By Id.
#
# + userId - User Id
# + user_id - User Id
# + return - Returns user belong to the user id
remote isolated function getUserById(string userId) returns User|error {
string resourcePath = string `/api/v2/users/${getEncodedUri(userId)}.json`;
User response = check self.clientEp->get(resourcePath);
remote isolated function getUserById(string user_id) returns UserResponse|error {
string resourcePath = string `/api/v2/users/${getEncodedUri(user_id)}.json`;
UserResponse response = check self.clientEp->get(resourcePath);
return response;
}
# Delete User By Id.
#
# + userId - User Id
# + user_id - User Id
# + return - Returns detail of user deleted
remote isolated function deleteUserById(string userId) returns User|error {
string resourcePath = string `/api/v2/users/${getEncodedUri(userId)}.json`;
User response = check self.clientEp-> delete(resourcePath);
remote isolated function deleteUserById(string user_id) returns UserResponse|error {
string resourcePath = string `/api/v2/users/${getEncodedUri(user_id)}.json`;
UserResponse response = check self.clientEp-> delete(resourcePath);
return response;
}
# List Tickets.
Expand All @@ -116,23 +115,23 @@ public isolated client class Client {
#
# + payload - The information for create ticket request
# + return - Returns detail of created ticket
remote isolated function createTicket(CreateTicketInfo payload) returns Ticket|error {
remote isolated function createTicket(CreateTicketInfo payload) returns TicketResponse|error {
string resourcePath = string `/api/v2/tickets.json`;
http:Request request = new;
json jsonBody = check payload.cloneWithType(json);
json jsonBody = payload.toJson();
request.setPayload(jsonBody, "application/json");
Ticket response = check self.clientEp->post(resourcePath, request);
TicketResponse response = check self.clientEp->post(resourcePath, request);
return response;
}
# Update Ticket.
#
# + ticketId - Ticket Id
# + ticket_id - Ticket Id
# + payload - The information for update ticket request
# + return - Returns deatil of updated ticket by ticket id
remote isolated function updateTicket(string ticketId, UpdateTicketInfo payload) returns json|error {
string resourcePath = string `/api/v2/tickets/${getEncodedUri(ticketId)}`;
remote isolated function updateTicket(string ticket_id, UpdateTicketInfo payload) returns json|error {
string resourcePath = string `/api/v2/tickets/${getEncodedUri(ticket_id)}`;
http:Request request = new;
json jsonBody = check payload.cloneWithType(json);
json jsonBody = payload.toJson();
request.setPayload(jsonBody, "application/json");
json response = check self.clientEp->put(resourcePath, request);
return response;
Expand All @@ -141,12 +140,12 @@ public isolated client class Client {
#
# + payload - The information for create organization request
# + return - Organization created
remote isolated function createOrganization(CreateOrganizationInfo payload) returns Organization|error {
remote isolated function createOrganization(CreateOrganizationInfo payload) returns OrganizationResponse|error {
string resourcePath = string `/api/v2/organizations.json`;
http:Request request = new;
json jsonBody = check payload.cloneWithType(json);
json jsonBody = payload.toJson();
request.setPayload(jsonBody, "application/json");
Organization response = check self.clientEp->post(resourcePath, request);
OrganizationResponse response = check self.clientEp->post(resourcePath, request);
return response;
}
}
Loading

0 comments on commit b85ed0a

Please sign in to comment.