diff --git a/Ballerina.toml b/Ballerina.toml index 45e3732..266a8c1 100644 --- a/Ballerina.toml +++ b/Ballerina.toml @@ -1,7 +1,7 @@ [package] org= "ballerinax" name= "googleapis.people" -version= "0.1.2" +version= "0.1.3" license= ["Apache-2.0"] authors = ["Ballerina"] keywords = ["google", "people", "contact"] diff --git a/endpoint.bal b/endpoint.bal index 8662efd..cac16d9 100644 --- a/endpoint.bal +++ b/endpoint.bal @@ -47,8 +47,9 @@ public client class Client { # + return - Stream of `PersonResponse` will have information specified by `Read Masks` on success else an `error` @display {label: "List OtherContacts"} isolated remote function listOtherContacts(@display {label: "Read Masks"} OtherContactFieldMask[] readMasks, - @display {label: "List Options"} ContactListOptions? options = ()) returns - @tainted @display {label: "Stream of PersonResponse"} stream|error { + @display {label: "List Options"} ContactListOptions? options = ()) + returns @tainted @display {label: "Stream of PersonResponse"} + stream|error { string path = LIST_OTHERCONTACT_PATH; http:Request request = new; string pathWithReadMasks = prepareUrlWithReadMasks(path, readMasks); @@ -81,9 +82,9 @@ public client class Client { # + personFields - Restrict which fields on the person are returned # + return - `PersonResponse` will have information specified by `Person Fields` on success else an `error` @display {label: "Get Contact"} - isolated remote function getContact(@display {label: "Contact Resource Name"} string resourceName, - @display {label: "Person Fields"} FieldMask[] personFields) returns - @tainted @display {label: "PersonResponse"} PersonResponse|error { + isolated remote function getContact(@display {label: "Resource Name"} string resourceName, + @display {label: "Person Fields"} FieldMask[] personFields) returns + @tainted @display {label: "PersonResponse"} PersonResponse|error { string path = SLASH + resourceName + QUESTION_MARK; string pathWithPersonFields = prepareUrlWithPersonFields(path, personFields); http:Response httpResponse = check self.googleContactClient->get(pathWithPersonFields); @@ -124,7 +125,7 @@ public client class Client { # + imagePath - Path to image from root directory # + return - Nil on success, else an 'error' @display {label: "Update Contact Photo"} - isolated remote function updateContactPhoto(@display {label: "Contact Resource Name"} string resourceName, + isolated remote function updateContactPhoto(@display {label: "Resource Name"} string resourceName, @display {label: "Image Path"} string imagePath) returns @tainted error? { string path = SLASH + resourceName + COLON + UPDATE_PHOTO_PATH; @@ -141,7 +142,7 @@ public client class Client { # + resourceName - Contact resource name # + return - Nil on success, else an 'error' @display {label: "Delete Contact Photo"} - isolated remote function deleteContactPhoto(@display {label: "Contact Resource Name"} string resourceName) returns + isolated remote function deleteContactPhoto(@display {label: "Resource Name"} string resourceName) returns @tainted error? { string path = SLASH + resourceName + COLON + DELETE_PHOTO_PATH; http:Response deleteResponse = check self.googleContactClient->delete(path); @@ -154,7 +155,7 @@ public client class Client { # + personFields - Restrict which fields on the person are returned # + return - `PersonResponse[]` will have information specified by `Person Fields` on success, else an `error` @display {label: "Get Batch Contacts"} - isolated remote function getBatchContacts(@display {label: "Contact Resource Names"} string[] resourceNames, + isolated remote function getBatchContacts(@display {label: "Resource Names"} string[] resourceNames, @display {label: "Person Fields"} FieldMask[] personFields) returns @tainted @display {label: "PersonResponse Array"} PersonResponse[]|error { string path = SLASH + BATCH_CONTACT_PATH; @@ -183,11 +184,11 @@ public client class Client { # + personFields - Restrict which fields on the person are returned # + return - `PersonResponse` will have information specified by `Person Fields` on success else an `error` @display {label: "Update Contact"} - isolated remote function updateContact(@display {label: "Contact Resource Name"} string resourceName, + isolated remote function updateContact(@display {label: "Resource Name"} string resourceName, @display {label: "Contact Details"} Person person, @display {label: "Person Fields To Update"} FieldMask[] updatePersonFields, - @display {label: "Person Fields To Return"} FieldMask[]? personFields = ()) returns - @tainted @display {label: "PersonResponse"} PersonResponse|error { + @display {label: "Person Fields To Return"} FieldMask[]? personFields = ()) + returns @tainted @display {label: "PersonResponse"} PersonResponse|error { string getPath = SLASH + resourceName + QUESTION_MARK; string getPathWithPersonFields = prepareUrlWithPersonFields(getPath, personFields); http:Response httpResponse = check self.googleContactClient->get(getPathWithPersonFields); @@ -215,7 +216,7 @@ public client class Client { # + resourceName - Contact resource name # + return - Nil on success, else an `error` @display {label: "Delete Contact"} - isolated remote function deleteContact(@display {label: "Person Resource Name"} string resourceName) returns + isolated remote function deleteContact(@display {label: "Resource Name"} string resourceName) returns @tainted error? { string path = SLASH + resourceName + COLON + DELETE_CONTACT_PATH; http:Response deleteResponse = check self.googleContactClient->delete(path); @@ -230,8 +231,9 @@ public client class Client { # + return - `stream` will have information specified by `Person Fields` on success or else an `error` @display {label: "List Contacts"} isolated remote function listContacts(@display {label: "Person Fields"} FieldMask[] personFields, - @display {label: "List options"} ContactListOptions? options = ()) returns - @tainted @display {label: "Stream of PersonResponses"} stream|error { + @display {label: "List options"} ContactListOptions? options = ()) + returns @tainted @display {label: "Stream of PersonResponses"} + stream|error { string path = SLASH + LIST_PEOPLE_PATH; string pathWithPersonFields = prepareUrlWithPersonFields(path, personFields); PersonResponse[] persons = []; @@ -243,7 +245,7 @@ public client class Client { # + contactGroupName - Name of the `ContactGroup` to be created # + return - `ContactGroup` on success else an `error` @display {label: "Create a Contact Group"} - isolated remote function createContactGroup(@display {label: "Contact Group Resource Name"} string contactGroupName) returns + isolated remote function createContactGroup(@display {label: "Resource Name"} string contactGroupName) returns @tainted @display {label: "Contact Group"} ContactGroup|error { string path = SLASH + CONTACT_GROUP_PATH; http:Request request = new; @@ -259,7 +261,7 @@ public client class Client { # Get Batch contact groups. # - # + resourceNames - Name of the `ContactGroup` to be fetched + # + resourceNames - An array of strings with names of `Contact Groups` # + return - `ContactGroup[]` on success else an `error` @display {label: "Get Batch Contact Groups"} isolated remote function getBatchContactGroup(@display {label: "Resource Names"} string[] resourceNames) returns @@ -301,9 +303,9 @@ public client class Client { # + maxMembers - maximum number of members returned in contact group # + return - `ContactGroup` on success else an `error` @display {label: "Get Contact Group"} - isolated remote function getContactGroup(@display {label: "Contact Group Resource Name"} string resourceName, - @display {label: "Maximum Members"} int maxMembers) returns - @tainted @display {label: "Contact Group"} ContactGroup|error { + isolated remote function getContactGroup(@display {label: "Resource Name"} string resourceName, + @display {label: "Maximum Members"} int maxMembers) returns + @tainted @display {label: "Contact Group"} ContactGroup|error { string path = SLASH + resourceName; string pathWithParameter = prepareUrlWithStringParameter(path, maxMembers.toString()); http:Response httpResponse = check self.googleContactClient->get(path); @@ -317,7 +319,7 @@ public client class Client { # + updateName - Name to be updated # + return - `ContactGroup` on success else an `error` @display {label: "Update Contact Group"} - isolated remote function updateContactGroup(@display {label: "Contact Group Resource Name"} string resourceName, + isolated remote function updateContactGroup(@display {label: "Resource Name"} string resourceName, @display {label: "New Name"} string updateName) returns @tainted @display {label: "Contact Group"} ContactGroup|error { string path = SLASH + resourceName; @@ -344,8 +346,8 @@ public client class Client { # + resourceName - Contact Group resource name # + return - Nil on success, else an `error` @display {label: "Delete Contact Group"} - isolated remote function deleteContactGroup(@display {label: "Contact Group Resource Name"} string resourceName) returns - @tainted error? { + isolated remote function deleteContactGroup(@display {label: "Resource Name"} string resourceName) returns + @tainted error? { string path = SLASH + resourceName; http:Response deleteResponse = check self.googleContactClient->delete(path); return handleDeleteResponse(deleteResponse); @@ -358,10 +360,10 @@ public client class Client { # + resourceNameToRemove - Contact resource name to remove # + return - Nil on success, else an `error` @display {label: "Modify Contacts In Contact Group"} - isolated remote function modifyContactGroup(@display {label: "Contact Group Resource Name"} string contactGroupResourceName, + isolated remote function modifyContactGroup(@display {label: "Resource Name"} string contactGroupResourceName, @display {label: "Add (Resource Names)"} string[]? resourceNameToAdd = (), - @display {label: "Remove (Resource Names)"} string[]? resourceNameToRemove = ()) returns - @tainted error? { + @display {label: "Remove (Resource Names)"} string[]? resourceNameToRemove = ()) + returns @tainted error? { string path = SLASH + contactGroupResourceName + "/members:modify"; http:Request request = new; json payload = { diff --git a/resources/Client_functions.json b/resources/Client_functions.json new file mode 100644 index 0000000..a1b8dd2 --- /dev/null +++ b/resources/Client_functions.json @@ -0,0 +1 @@ +{"ballerinax/googleapis.people:0.1.3" : [{"function":{"name":"getBatchContacts","requiredParams":[{"resourceNames":["string[]"]},{"personFields":["ballerinax/googleapis.people:0.1.2:FieldMask[]"]}],"returnType":["ballerinax/googleapis.people:0.1.2:PersonResponse[]"]}},{"function":{"name":"createContactGroup","requiredParams":[{"contactGroupName":["string"]}],"returnType":["ballerinax/googleapis.people:0.1.2:ContactGroup"]}},{"function":{"name":"searchContacts","requiredParams":[{"query":["string"]},{"readMasks":["ballerinax/googleapis.people:0.1.2:FieldMask[]"]}],"returnType":["ballerinax/googleapis.people:0.1.2:PersonResponse[]"]}},{"function":{"name":"getContact","requiredParams":[{"personFields":["ballerinax/googleapis.people:0.1.2:FieldMask[]"]},{"resourceName":["string"]}],"returnType":["ballerinax/googleapis.people:0.1.2:PersonResponse"]}},{"function":{"name":"updateContactPhoto","requiredParams":[{"imagePath":["string"]},{"resourceName":["string"]}],"returnType":["()"]}},{"function":{"name":"listContactGroup","requiredParams":[],"returnType":["ballerinax/googleapis.people:0.1.2:ContactGroup[]"]}},{"function":{"name":"getBatchContactGroup","requiredParams":[{"resourceNames":["string[]"]}],"returnType":["ballerinax/googleapis.people:0.1.2:ContactGroup[]"]}},{"function":{"name":"modifyContactGroup","requiredParams":[{"resourceNameToAdd":["string[]"]},{"resourceNameToRemove":["string[]"]},{"contactGroupResourceName":["string"]}],"returnType":["()"]}},{"function":{"name":"deleteContactPhoto","requiredParams":[{"resourceName":["string"]}],"returnType":["()"]}},{"function":{"name":"deleteContact","requiredParams":[{"resourceName":["string"]}],"returnType":["()"]}},{"function":{"name":"listContacts","requiredParams":[{"personFields":["ballerinax/googleapis.people:0.1.2:FieldMask[]"]},{"options":["ballerinax/googleapis.people:0.1.2:ContactListOptions"]}],"returnType":["stream"]}},{"function":{"name":"updateContactGroup","requiredParams":[{"resourceName":["string"]},{"updateName":["string"]}],"returnType":["ballerinax/googleapis.people:0.1.2:ContactGroup"]}},{"function":{"name":"listOtherContacts","requiredParams":[{"options":["ballerinax/googleapis.people:0.1.2:ContactListOptions"]},{"readMasks":["ballerinax/googleapis.people:0.1.2:OtherContactFieldMask[]"]}],"returnType":["stream"]}},{"function":{"name":"createContact","requiredParams":[{"personFields":["ballerinax/googleapis.people:0.1.2:FieldMask[]"]},{"person":["ballerinax/googleapis.people:0.1.2:Person"]}],"returnType":["ballerinax/googleapis.people:0.1.2:PersonResponse"]}},{"function":{"name":"deleteContactGroup","requiredParams":[{"resourceName":["string"]}],"returnType":["()"]}},{"function":{"name":"updateContact","requiredParams":[{"updatePersonFields":["ballerinax/googleapis.people:0.1.2:FieldMask[]"]},{"personFields":["ballerinax/googleapis.people:0.1.2:FieldMask[]"]},{"person":["ballerinax/googleapis.people:0.1.2:Person"]},{"resourceName":["string"]}],"returnType":["ballerinax/googleapis.people:0.1.2:PersonResponse"]}},{"function":{"name":"getContactGroup","requiredParams":[{"maxMembers":["int"]},{"resourceName":["string"]}],"returnType":["ballerinax/googleapis.people:0.1.2:ContactGroup"]}}]} \ No newline at end of file