Skip to content

Commit

Permalink
Merge pull request #7 from kasthuriraajan/main
Browse files Browse the repository at this point in the history
Migrate to SwanLake Alpha5
  • Loading branch information
abeykoon authored May 4, 2021
2 parents 3d6fdb3 + 70bc52a commit 58ee23e
Show file tree
Hide file tree
Showing 20 changed files with 68 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .ballerina/ballerina-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ballerina-slalpha4
ballerina-slalpha5
8 changes: 6 additions & 2 deletions Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[package]
org= "ballerinax"
name= "googleapis_people"
version= "0.1.0"
name= "googleapis.people"
version= "0.1.1"
license= ["Apache-2.0"]
authors = ["Ballerina"]
keywords = ["google", "people", "contact"]
repository = "https://github.com/ballerina-platform/module-ballerinax-googleapis.people"

[build-options]
observabilityIncluded = true
25 changes: 13 additions & 12 deletions Dependencies.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
[[dependency]]
org = "ballerina"
name = "io"
version = "0.6.0-alpha7"
name = "log"
version = "1.1.0-alpha8"

[[dependency]]
org = "ballerina"
name = "test"
version = "0.0.0"
name = "os"
version = "0.8.0-alpha8"

[[dependency]]
org = "ballerina"
name = "http"
version = "1.1.0-alpha7"
name = "url"
version = "1.1.0-alpha8"

[[dependency]]
org = "ballerina"
name = "url"
version = "1.1.0-alpha7"
name = "test"
version = "0.0.0"

[[dependency]]
org = "ballerina"
name = "log"
version = "1.1.0-alpha7"
name = "http"
version = "1.1.0-alpha8"

[[dependency]]
org = "ballerina"
name = "os"
version = "1.1.0-alpha7"
name = "io"
version = "0.6.0-alpha8"


20 changes: 10 additions & 10 deletions Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ The Google People Ballerina Connector allows you to access the Google People API
* Java 11 Installed
Java Development Kit (JDK) with version 11 is required.

* Download the Ballerina [distribution](https://ballerinalang.org/downloads/) SLAlpha4
Ballerina Swan Lake Alpha Version 4 is required.
* Download the Ballerina [distribution](https://ballerinalang.org/downloads/) SLAlpha5
Ballerina Swan Lake Alpha Version 5 is required.

* Instantiate the connector by giving authentication details in the HTTP client config. The HTTP client config has built-in support for BasicAuth and OAuth 2.0. Google People uses OAuth 2.0 to authenticate and authorize requests.
* The Google People connector can be minimally instantiated in the HTTP client config using client ID, client secret, and refresh token.
Expand All @@ -36,7 +36,7 @@ The Google People Ballerina Connector allows you to access the Google People API

| | Versions |
|:---------------------------:|:-------------------------------:|
| Ballerina Language | Swan Lake Alpha 4 |
| Ballerina Language | Swan Lake Alpha 5 |
| Google People API | V1 |


Expand All @@ -60,7 +60,7 @@ This file should have following configurations. Add the tokens obtained in the p

#### For client operations
```
[ballerinax.googleapis_people]
[ballerinax.googleapis.people]
clientId = "<client_id">
clientSecret = "<client_secret>"
refreshToken = "<refresh_token>"
Expand All @@ -72,7 +72,7 @@ refreshUrl = "<refresh_URL>"
### Create a Contact
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -112,7 +112,7 @@ public function main() {
```
### Fetch a Contact
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -163,7 +163,7 @@ public function main() {
```
### Search a Contact using a string value
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -195,7 +195,7 @@ public function main() {

### Delete a Contact
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -247,7 +247,7 @@ public function main() {

### Create a Contact Group
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -278,7 +278,7 @@ public function main() {
```
### Fetch a Contact Group
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ The Google People Ballerina Connector allows you to access the Google People API
* Java 11 Installed
Java Development Kit (JDK) with version 11 is required.

* Download the Ballerina [distribution](https://ballerinalang.org/downloads/) SLAlpha4
Ballerina Swan Lake Alpha Version 4 is required.
* Download the Ballerina [distribution](https://ballerinalang.org/downloads/) SLAlpha5
Ballerina Swan Lake Alpha Version 5 is required.

* Instantiate the connector by giving authentication details in the HTTP client config. The HTTP client config has built-in support for BasicAuth and OAuth 2.0. Google People uses OAuth 2.0 to authenticate and authorize requests.
* The Google People connector can be minimally instantiated in the HTTP client config using client ID, client secret, and refresh token.
Expand All @@ -38,7 +38,7 @@ The Google People Ballerina Connector allows you to access the Google People API

| | Versions |
|:---------------------------:|:-------------------------------:|
| Ballerina Language | Swan Lake Alpha 4 |
| Ballerina Language | Swan Lake Alpha 5 |
| Google People API | V1 |


Expand All @@ -62,7 +62,7 @@ This file should have following configurations. Add the tokens obtained in the p

#### For client operations
```
[ballerinax.googleapis_people]
[ballerinax.googleapis.people]
clientId = "<client_id">
clientSecret = "<client_secret>"
refreshToken = "<refresh_token>"
Expand All @@ -73,7 +73,7 @@ refreshUrl = "<refresh_URL>"

### Create a Contact
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -113,7 +113,7 @@ public function main() {
```
### Fetch a Contact
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -164,7 +164,7 @@ public function main() {
```
### Search a Contact using a string value
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -196,7 +196,7 @@ public function main() {

### Delete a Contact
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -248,7 +248,7 @@ public function main() {

### Create a Contact Group
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -279,7 +279,7 @@ public function main() {
```
### Fetch a Contact Group
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down
9 changes: 6 additions & 3 deletions endpoint.bal
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public client class Client {
# Fetch all from "Other Contacts".
#
# + readMasks - Restrict which fields on the person are returned
# + options - Record that contains options
# + return - Stream of `PersonResponse` on success else an `error`
@display {label: "List OtherContacts"}
isolated remote function listOtherContacts(@display {label: "Read Masks"} OtherContactFieldMask[] readMasks,
Expand Down Expand Up @@ -93,6 +94,7 @@ public client class Client {
# Search a contacts.
#
# + query - String to be searched
# + readMasks - Restrict which fields on the person are returned
# + return - `PersonResponse[]` on success else an `error`
@display {label: "Search a Contact"}
isolated remote function searchContacts(@display {label: "Searchable substring"} string query,
Expand Down Expand Up @@ -129,7 +131,7 @@ public client class Client {
http:Request request = new;
string encodedString = check convertImageToBase64String(imagePath);
json updatePayload = {"photoBytes": encodedString};
request.setJsonPayload(updatePayload);
request.setJsonPayload(<@untainted>updatePayload);
http:Response uploadResponse = <http:Response>check self.googleContactClient->patch(path, request);
return handleUploadPhotoResponse(uploadResponse);
}
Expand Down Expand Up @@ -176,6 +178,7 @@ public client class Client {
# Update a contact.
#
# + resourceName - Contact resource name
# + person - Person
# + updatePersonFields - Restrict which fields on the person are returned
# + personFields - Restrict which fields on the person are returned
# + return - `Person` on success else an `error`
Expand All @@ -198,7 +201,7 @@ public client class Client {
string pathWithPersonFields = prepareUrlWithPersonFields(pathWithFields, personFields);
Person updatedContact = propareUpdate(person, getContact);
json payload = check getContact.cloneWithType(json);
request.setJsonPayload(payload);
request.setJsonPayload(<@untainted>payload);
http:Response updateResponse = <http:Response>check self.googleContactClient->patch(pathWithPersonFields, request);
var response = check handleResponse(updateResponse);
return check response.cloneWithType(PersonResponse);
Expand Down Expand Up @@ -326,7 +329,7 @@ public client class Client {
getContactGroup.name = updateName;
json payload = check getContactGroup.cloneWithType(json);
json newpayload = {"contactGroup": payload};
request.setJsonPayload(newpayload);
request.setJsonPayload(<@untainted>newpayload);
http:Response httpResponse = <http:Response>check self.googleContactClient->put(path, request);
var response = check handleResponse(httpResponse);
return check response.cloneWithType(ContactGroup);
Expand Down
2 changes: 1 addition & 1 deletion samples/createContact.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
2 changes: 1 addition & 1 deletion samples/createContactGroup.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
2 changes: 1 addition & 1 deletion samples/deleteContact.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
2 changes: 1 addition & 1 deletion samples/deleteContactGroup.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
2 changes: 1 addition & 1 deletion samples/deleteContactPhoto.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
2 changes: 1 addition & 1 deletion samples/getContactGroup.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
2 changes: 1 addition & 1 deletion samples/getContacts.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
2 changes: 1 addition & 1 deletion samples/listContactGroup.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
2 changes: 1 addition & 1 deletion samples/listContacts.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
2 changes: 1 addition & 1 deletion samples/searchContacts.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
2 changes: 1 addition & 1 deletion samples/updateContactGroup.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
2 changes: 1 addition & 1 deletion samples/uploadContactPhoto.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;

configurable string refreshToken = ?;
Expand Down
Loading

0 comments on commit 58ee23e

Please sign in to comment.