Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging #15

Merged
merged 9 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
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
42 changes: 42 additions & 0 deletions .github/workflows/staging-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Dart run tests when activity on staging

on:
push:
branches: [ "staging" ]
pull_request:
branches: [ "staging" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Note: This workflow uses the latest stable version of the Dart SDK.
# You can specify other versions if desired, see documentation here:
# https://github.com/dart-lang/setup-dart/blob/main/README.md
# - uses: dart-lang/setup-dart@v1
- uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603

- name: Install dependencies
run: dart pub get

# Uncomment this step to verify the use of 'dart format' on each commit.
# - name: Verify formatting
# run: dart format --output=none --set-exit-if-changed .

# Consider passing '--fatal-infos' for slightly stricter analysis.
- name: Analyze project source
run: dart analyze

# Your project will need to have tests in test/ and a dependency on
# package:test for this step to succeed. Note that Flutter projects will
# want to change this to 'flutter test'.
- name: Run tests
run: dart test
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.4.0

- Implemented endpoints for Goals, Guests and Task Checklists

## 0.3.2

- Refactoring and minor fixes.

## 0.3.0

- Implemented endpoints for Tasks.
Expand Down
73 changes: 23 additions & 50 deletions lib/src/clickup_dart_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,56 +59,29 @@ class ClickUp {
void initialize({required String authToken}) async {
httpClient = Client();

auth = ClickUpAuth(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
attachments = ClickUpAttachments(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
comments = ClickUpComments(
endPoint: apiEndpoint,
authToken: auth.authToken,
httpClient: httpClient);
customFields = ClickUpCustomFields(
endPoint: apiEndpoint,
authToken: auth.authToken,
httpClient: httpClient);
folders = ClickUpFolders(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
goals = ClickUpGoals(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
guests = ClickUpGuests(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
lists = ClickUpLists(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
members = ClickUpMembers(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
roles = ClickUpRoles(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
sharedHierarchy = ClickUpSharedHierarchy(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
spaces = ClickUpSpaces(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
tags = ClickUpTags(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
tasks = ClickUpTasks(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
taskChecklists = ClickUpTaskChecklists(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
taskRelationships = ClickUpTaskRelationships(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
taskTemplates = ClickUpTaskTemplates(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
teams = ClickUpTeams(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
timeTrackingLegacy = ClickUpTimeTrackingLegacy(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
timeTrackingV2 = ClickUpTimeTrackingV2(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
users = ClickUpUsers(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
views = ClickUpViews(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
webhooks = ClickUpWebhooks(
endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
auth = ClickUpAuth(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
attachments = ClickUpAttachments(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
comments = ClickUpComments(endPoint: apiEndpoint, authToken: auth.authToken, httpClient: httpClient);
customFields = ClickUpCustomFields(endPoint: apiEndpoint, authToken: auth.authToken, httpClient: httpClient);
folders = ClickUpFolders(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
goals = ClickUpGoals(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
guests = ClickUpGuests(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
lists = ClickUpLists(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
members = ClickUpMembers(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
roles = ClickUpRoles(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
sharedHierarchy = ClickUpSharedHierarchy(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
spaces = ClickUpSpaces(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
tags = ClickUpTags(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
tasks = ClickUpTasks(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
taskChecklists = ClickUpTaskChecklists(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
taskRelationships = ClickUpTaskRelationships(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
taskTemplates = ClickUpTaskTemplates(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
teams = ClickUpTeams(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
timeTrackingLegacy = ClickUpTimeTrackingLegacy(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
timeTrackingV2 = ClickUpTimeTrackingV2(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
users = ClickUpUsers(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
views = ClickUpViews(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
webhooks = ClickUpWebhooks(endPoint: apiEndpoint, authToken: authToken, httpClient: httpClient);
print("ClickUp Initialized..");
}
}
25 changes: 9 additions & 16 deletions lib/src/core/endpoints/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ class ClickUpAuth {
late String authToken;
late Client httpClient;

ClickUpAuth(
{required this.endPoint,
required this.authToken,
required this.httpClient});
ClickUpAuth({required this.endPoint, required this.authToken, required this.httpClient});

/// Get access token based on your credentials.
// Future<String> getAccessToken(
Expand All @@ -31,32 +28,28 @@ class ClickUpAuth {
/// Get the user bound to the token.
Future<Map<String, dynamic>> getAuthorizedUser() async {
try {
final response = await httpClient.get(Uri.parse("$endPoint/user"),
headers: {"Authorization": authToken});
final response = await httpClient.get(Uri.parse("$endPoint/user"), headers: {
"Authorization": authToken
});
final user = jsonDecode(response.body);
return user;
} catch (e) {
print(e.toString());
throw ClickUpException(
exceptionType: ClickUpExceptionType.requestError,
exceptionMessage:
"An error occured while making the request. Error is ${e.toString()}");
throw ClickUpException(exceptionType: ClickUpExceptionType.requestError, exceptionMessage: "An error occured while making the request. Error is ${e.toString()}");
}
}

/// Get the teams bound to authorized user.
Future<Map<String, dynamic>> getAuthorizedTeams() async {
try {
final response = await httpClient.get(Uri.parse("$endPoint/team"),
headers: {"Authorization": authToken});
final response = await httpClient.get(Uri.parse("$endPoint/team"), headers: {
"Authorization": authToken
});
final teams = jsonDecode(response.body);
return teams;
} catch (e) {
print(e.toString());
throw ClickUpException(
exceptionType: ClickUpExceptionType.requestError,
exceptionMessage:
"An error occured while making the request. Error is ${e.toString()}");
throw ClickUpException(exceptionType: ClickUpExceptionType.requestError, exceptionMessage: "An error occured while making the request. Error is ${e.toString()}");
}
}
}
Loading