Skip to content

Commit

Permalink
Use main branch for github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
warunalakshitha committed Nov 18, 2024
1 parent 57e8fc0 commit bc631dc
Show file tree
Hide file tree
Showing 154 changed files with 6,758 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
call_workflow:
name: Run Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/build-timestamp-master-template.yml@java21
uses: ballerina-platform/ballerina-library/.github/workflows/build-timestamp-master-template.yml@main
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/build-with-bal-test-graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
call_stdlib_workflow:
name: Run StdLib Workflow
if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }}
uses: ballerina-platform/ballerina-library/.github/workflows/build-with-bal-test-graalvm-template.yml@java21
uses: ballerina-platform/ballerina-library/.github/workflows/build-with-bal-test-graalvm-template.yml@main
with:
lang_tag: ${{ inputs.lang_tag }}
lang_version: ${{ inputs.lang_version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/central-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
call_workflow:
name: Run Central Publish Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/central-publish-template.yml@java21
uses: ballerina-platform/ballerina-library/.github/workflows/central-publish-template.yml@main
secrets: inherit
with:
environment: ${{ github.event.inputs.environment }}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
call_workflow:
name: Run Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/build-timestamp-master-template.yml@java21
uses: ballerina-platform/ballerina-library/.github/workflows/build-timestamp-master-template.yml@main
with:
additional-build-flags: '-x check -x test'
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/process-load-test-result.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
call_stdlib_process_load_test_results_workflow:
name: Run StdLib Process Load Test Results Workflow
uses: ballerina-platform/ballerina-library/.github/workflows/process-load-test-results-template.yml@java21
uses: ballerina-platform/ballerina-library/.github/workflows/process-load-test-results-template.yml@main
with:
results: ${{ toJson(github.event.client_payload.results) }}
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
call_workflow:
name: Run Release Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/release-package-template.yml@java21
uses: ballerina-platform/ballerina-library/.github/workflows/release-package-template.yml@main
secrets: inherit
with:
package-name: http
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ jobs:
call_workflow:
name: Run PR Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/pull-request-build-template.yml@java21
uses: ballerina-platform/ballerina-library/.github/workflows/pull-request-build-template.yml@main
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/trigger-load-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
call_stdlib_trigger_load_test_workflow:
name: Run StdLib Load Test Workflow
if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }}
uses: ballerina-platform/ballerina-library/.github/workflows/trigger-load-tests-template.yml@java21
uses: ballerina-platform/ballerina-library/.github/workflows/trigger-load-tests-template.yml@main
with:
repo_name: 'module-ballerina-http'
runtime_artifacts_url: 'https://api.github.com/repos/ballerina-platform/module-ballerina-http/actions/artifacts'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jobs:
call_workflow:
name: Run Trivy Scan Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/trivy-scan-template.yml@java21
uses: ballerina-platform/ballerina-library/.github/workflows/trivy-scan-template.yml@main
secrets: inherit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
org = "http_test"
name = "codeaction_sample_1"
version = "0.1.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
//
// WSO2 Inc. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import ballerina/http;

service / on new http:Listener(9999) {

resource function get . (@http:Header json length) {

}

resource function get path1(http:Caller caller) returns string {
return "";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
org = "http_test"
name = "codeaction_sample_2"
version = "0.1.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
//
// WSO2 Inc. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import ballerina/http;

service /greeting on new http:Listener(0) {
resource function get hi() returns string {
return "hi";
}

resource function post hi(@http:Payload string payload) returns string {
return "hi";
}

resource function post hello() returns string {
return "hello";
}

resource function post hey(@http:Header string header) returns string {
return "hey";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
org = "http_test"
name = "codeaction_sample_3"
version = "0.1.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
//
// WSO2 Inc. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

// This is added to test some auto generated code segments.
// Please ignore the indentation.

import ballerina/http;

service class RequestInterceptor {
*http:RequestInterceptor;
}

service class RequestErrorInterceptor {
*http:RequestErrorInterceptor;
}

service class ResponseInterceptor {
*http:ResponseInterceptor;
}

service class ResponseErrorInterceptor {
*http:ResponseErrorInterceptor;
}

service /greeting on new http:Listener(9090) {
resource function get hi() returns string {
return "hi";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
org = "http_test"
name = "codeaction_sample_4"
version = "0.1.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
// Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org).
//
// WSO2 LLC. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

// This is added to test some auto generated code segments.
// Please ignore the indentation.

import ballerina/http;

import ballerina/http;
import ballerina/log;

# The service type that handles the social media API
@http:ServiceConfig {
mediaTypeSubtypePrefix: "vnd.socialMedia",
basePath: "/socialMedia"
}
public type Service service object {
*http:ServiceContract;
*http:InterceptableService;

public function createInterceptors() returns ErrorInterceptor;

# Get all users
#
# + return - List of users(`User[]`) or an error
@http:ResourceConfig {
name: "users"
}
resource function get users() returns @http:Cache {maxAge: 10} User[]|error;

# Get a user by ID
#
# + id - User ID
# + return - `User` or NotFound response(`UserNotFound`) when the user is not found or an error
@http:ResourceConfig {
name: "user",
linkedTo: [
{name: "user", method: http:DELETE, relation: "delete-user"},
{name: "posts", method: http:POST, relation: "create-posts"},
{name: "posts", method: http:GET, relation: "get-posts"}
]
}
resource function get users/[int id]() returns User|UserNotFound|error;

# Create a new user
#
# + newUser - New user details(`NewUser`) as payload
# + return - Created(`http:Created`) response or an error
@http:ResourceConfig {
name: "users",
linkedTo: [
{name: "user", method: http:GET, relation: "get-user"},
{name: "user", method: http:DELETE, relation: "delete-user"},
{name: "posts", method: http:POST, relation: "create-posts"},
{name: "posts", method: http:GET, relation: "get-posts"}
],
consumes: ["application/vnd.socialMedia+json"]
}
resource function post users(NewUser newUser) returns http:Created|error;

# Delete a user by ID
#
# + id - User ID
# + return - NoContent response(`http:NoContent`) or an error
@http:ResourceConfig {
name: "user"
}
resource function delete users/[int id]() returns http:NoContent|error;

# Get all posts of a user
#
# + id - User ID
# + return - List of posts with metadata(`PostWithMeta[]`) or NotFound response(`UserNotFound`) when the user is not found or an error
@http:ResourceConfig {
name: "posts"
}
resource function get users/[int id]/posts() returns @http:Cache {maxAge: 25} PostWithMeta[]|UserNotFound|error;

# Create a new post for a user
#
# + id - User ID
# + newPost - New post details(`NewPost`) as payload
# + return - Created(`http:Created`) response or an error
@http:ResourceConfig {
name: "posts",
linkedTo: [
{name: "posts", method: http:POST, relation: "create-posts"}
],
consumes: ["application/vnd.socialMedia+json"]
}
resource function post users/[int id]/posts(@http:Payload NewPost newPost) returns http:Created|UserNotFound|PostForbidden|error;
};

public isolated service class ErrorInterceptor {
*http:ResponseErrorInterceptor;

isolated remote function interceptResponseError(error err, http:Response res, http:RequestContext ctx) returns DefaultResponse {
log:printError("error occurred", err);
return {
body: err.message(),
status: new (res.statusCode)
};
}
}

# Represents a user in the system
#
# + id - user ID
# + name - user name
# + email - user email
public type User record {
int id;
string name;
string email;
};

# Represents a new user
#
# + name - user name
# + email - user email
public type NewUser record {
string name;
string email;
};

# Represents a user not found error
#
# + body - error message
public type UserNotFound record {|
*http:NotFound;
ErrorMessage body;
|};

# Represents a new post
#
# + content - post content
public type NewPost record {
string content;
};

# Represents a post with metadata
#
# + id - post ID
# + content - post content
# + createdAt - post creation time
public type PostWithMeta record {
int id;
string content;
string createdAt;
};

# Represents a post forbidden error
#
# + body - error message
public type PostForbidden record {|
*http:Forbidden;
ErrorMessage body;
|};

# Represents a default response
#
# + body - response body
public type DefaultResponse record {|
*http:DefaultStatusCodeResponse;
ErrorMessage body;
|};

# Represents a error message
public type ErrorMessage string;

service Service on new http:Listener(9090) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
org = "http_test"
name = "sample_completion_package_1"
version = "0.1.0"

Loading

0 comments on commit bc631dc

Please sign in to comment.