Skip to content
Merged
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
24 changes: 18 additions & 6 deletions ballerina/client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerina/data.jsondata;
import ballerina/http;

# This feature allows an app to create and configure custom events that can show up in the timelines of certain CRM objects like contacts, companies, tickets, or deals. You'll find multiple use cases for this API in the sections below.
Expand Down Expand Up @@ -70,7 +71,7 @@
}
map<string|string[]> httpHeaders = http:getHeaderMap(headerValues);
http:Request request = new;
json jsonBody = payload.toJson();
json jsonBody = jsondata:toJson(payload);
request.setPayload(jsonBody, "application/json");
return self.clientEp->post(resourcePath, request, httpHeaders);
}
Expand All @@ -91,7 +92,7 @@
}
resourcePath = resourcePath + check getPathForQueryParam(queryParam);
http:Request request = new;
json jsonBody = payload.toJson();
json jsonBody = jsondata:toJson(payload);
request.setPayload(jsonBody, "application/json");
return self.clientEp->put(resourcePath, request, headers);
}
Expand Down Expand Up @@ -144,7 +145,7 @@
}
map<string|string[]> httpHeaders = http:getHeaderMap(headerValues);
http:Request request = new;
json jsonBody = payload.toJson();
json jsonBody = jsondata:toJson(payload);

Check warning on line 148 in ballerina/client.bal

View check run for this annotation

Codecov / codecov/patch

ballerina/client.bal#L148

Added line #L148 was not covered by tests
request.setPayload(jsonBody, "application/json");
return self.clientEp->post(resourcePath, request, httpHeaders);
}
Expand All @@ -168,6 +169,11 @@
return self.clientEp->get(resourcePath, httpHeaders);
}

# List all event templates for your app
#
# + appId - The ID of the target app
# + headers - Headers to be sent with the request
# + return - successful operation
resource isolated function get [int:Signed32 appId]/event\-templates(map<string|string[]> headers = {}) returns CollectionResponseTimelineEventTemplateNoPaging|error {
string resourcePath = string `/${getEncodedUri(appId)}/event-templates`;
map<anydata> queryParam = {};
Expand All @@ -178,6 +184,12 @@
return self.clientEp->get(resourcePath, headers);
}

# Create an event template for the app
#
# + appId - The ID of the target app
# + headers - Headers to be sent with the request
# + payload - The new event template definition
# + return - successful operation
resource isolated function post [int:Signed32 appId]/event\-templates(TimelineEventTemplateCreateRequest payload, map<string|string[]> headers = {}) returns TimelineEventTemplate|error {
string resourcePath = string `/${getEncodedUri(appId)}/event-templates`;
map<anydata> queryParam = {};
Expand All @@ -186,7 +198,7 @@
}
resourcePath = resourcePath + check getPathForQueryParam(queryParam);
http:Request request = new;
json jsonBody = payload.toJson();
json jsonBody = jsondata:toJson(payload);
request.setPayload(jsonBody, "application/json");
return self.clientEp->post(resourcePath, request, headers);
}
Expand Down Expand Up @@ -222,7 +234,7 @@
}
resourcePath = resourcePath + check getPathForQueryParam(queryParam);
http:Request request = new;
json jsonBody = payload.toJson();
json jsonBody = jsondata:toJson(payload);
request.setPayload(jsonBody, "application/json");
return self.clientEp->put(resourcePath, request, headers);
}
Expand Down Expand Up @@ -258,7 +270,7 @@
}
resourcePath = resourcePath + check getPathForQueryParam(queryParam);
http:Request request = new;
json jsonBody = payload.toJson();
json jsonBody = jsondata:toJson(payload);
request.setPayload(jsonBody, "application/json");
return self.clientEp->post(resourcePath, request, headers);
}
Expand Down
Loading