Skip to content

Commit

Permalink
Merge pull request #14 from ayazemre/dev
Browse files Browse the repository at this point in the history
dev to staging
  • Loading branch information
ayazemre committed Jul 3, 2023
2 parents c975a0a + ca6a41b commit 0fbf895
Show file tree
Hide file tree
Showing 77 changed files with 3,169 additions and 287 deletions.
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
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
## 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.

## 0.2.0

- Tests added.
- Implemented endpoints for Attachments, Authentication, Comments, Custom Fields and Folders
- Classes for all api endpoints.

## 0.1.0

- Initial version.
- Added basic functionality
- Wraps all api endpoints.
- Classes for all api endpoints.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ and the Flutter guide for
-->


![readmeheaderblack](https://user-images.githubusercontent.com/68122318/216693931-64f1b1a5-d69a-4af4-9f67-ab281bd68c3d.png#gh-light-mode-only)
![readmeheaderwhite](https://user-images.githubusercontent.com/68122318/216693937-2cbf9f31-d643-4457-941e-ba33ba3b638d.png#gh-dark-mode-only)


This is an API wrapper for ClickUp
This is a SDK for ClickUp written in Dart


## Features
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:clickup_dart/clickup_dart_sdk.dart';
import 'package:clickup_dart_sdk/clickup_dart_sdk.dart';

void main() async {
final token = "pk_testrandomtoken123";
Expand All @@ -11,6 +11,7 @@ void main() async {
taskID: "8669e046h",
useCustomTaskID: false,
filePath: "./test/beksinski_sample.jpg");

print(attachment);
final listComments = await clickUp.comments.getListComments(listID: 1);
print(listComments);
}
51 changes: 0 additions & 51 deletions lib/src/auth/auth.dart

This file was deleted.

5 changes: 0 additions & 5 deletions lib/src/checklists/checklists.dart

This file was deleted.

111 changes: 53 additions & 58 deletions lib/src/clickup_dart_base.dart
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
import 'package:clickup_dart/src/attachments/attachments.dart';
import 'package:clickup_dart/src/auth/auth.dart';
import 'package:clickup_dart/src/checklists/checklists.dart';
import 'package:clickup_dart/src/comments/comments.dart';
import 'package:clickup_dart/src/custom_fields/custom_fields.dart';
import 'package:clickup_dart/src/dependencies/dependencies.dart';
import 'package:clickup_dart/src/folders/folders.dart';
import 'package:clickup_dart/src/goals/goals.dart';
import 'package:clickup_dart/src/guests/guests.dart';
import 'package:clickup_dart/src/lists/lists.dart';
import 'package:clickup_dart/src/members/members.dart';
import 'package:clickup_dart/src/roles/roles.dart';
import 'package:clickup_dart/src/shared_hierarchy/shared_hierarchy.dart';
import 'package:clickup_dart/src/spaces/spaces.dart';
import 'package:clickup_dart/src/tags/tags.dart';
import 'package:clickup_dart/src/tasks/task_templates.dart';
import 'package:clickup_dart/src/tasks/tasks.dart';
import 'package:clickup_dart/src/teams/teams.dart';
import 'package:clickup_dart/src/time_tracking/time_tracking_legacy.dart';
import 'package:clickup_dart/src/time_tracking/time_tracking_v2.dart';
import 'package:clickup_dart/src/users/users.dart';
import 'package:clickup_dart/src/views/views.dart';
import 'package:clickup_dart/src/webhooks/webhooks.dart';
import 'package:http/http.dart';

import 'core/endpoints/attachments.dart';
import 'core/endpoints/auth.dart';
import 'core/endpoints/task_checklists.dart';
import 'core/endpoints/comments.dart';
import 'core/endpoints/custom_fields.dart';
import 'core/endpoints/task_relationships.dart';
import 'core/endpoints/folders.dart';
import 'core/endpoints/goals.dart';
import 'core/endpoints/guests.dart';
import 'core/endpoints/lists.dart';
import 'core/endpoints/members.dart';
import 'core/endpoints/roles.dart';
import 'core/endpoints/shared_hierarchy.dart';
import 'core/endpoints/spaces.dart';
import 'core/endpoints/tags.dart';
import 'core/endpoints/task_templates.dart';
import 'core/endpoints/tasks.dart';
import 'core/endpoints/teams.dart';
import 'core/endpoints/time_tracking_legacy.dart';
import 'core/endpoints/time_tracking_v2.dart';
import 'core/endpoints/users.dart';
import 'core/endpoints/views.dart';
import 'core/endpoints/webhooks.dart';

class ClickUp {
late final String apiEndpoint;
late final Client httpClient;

late final ClickUpAuth auth;
late final ClickUpAttachments attachments;
late final ClickUpChecklists checklists;
late final ClickUpComments comments;
late final ClickUpCustomFields customFields;
late final ClickUpDependencies dependencies;
late final ClickUpFolders folders;
late final ClickUpGoals goals;
late final ClickUpGuests guests;
Expand All @@ -41,6 +42,8 @@ class ClickUp {
late final ClickUpSpaces spaces;
late final ClickUpTags tags;
late final ClickUpTasks tasks;
late final ClickUpTaskRelationships taskRelationships;
late final ClickUpTaskChecklists taskChecklists;
late final ClickUpTaskTemplates taskTemplates;
late final ClickUpTeams teams;
late final ClickUpTimeTrackingLegacy timeTrackingLegacy;
Expand All @@ -54,39 +57,31 @@ class ClickUp {
});

void initialize({required String authToken}) async {
auth = ClickUpAuth(endPoint: apiEndpoint, authToken: authToken);
attachments =
ClickUpAttachments(endPoint: apiEndpoint, authToken: auth.authToken);
checklists =
ClickUpChecklists(endPoint: apiEndpoint, authToken: auth.authToken);
comments =
ClickUpComments(endPoint: apiEndpoint, authToken: auth.authToken);
customFields =
ClickUpCustomFields(endPoint: apiEndpoint, authToken: auth.authToken);
dependencies =
ClickUpDependencies(endPoint: apiEndpoint, authToken: auth.authToken);
folders = ClickUpFolders(endPoint: apiEndpoint, authToken: auth.authToken);
goals = ClickUpGoals(endPoint: apiEndpoint, authToken: auth.authToken);
guests = ClickUpGuests(endPoint: apiEndpoint, authToken: auth.authToken);
lists = ClickUpLists(endPoint: apiEndpoint, authToken: auth.authToken);
members = ClickUpMembers(endPoint: apiEndpoint, authToken: auth.authToken);
roles = ClickUpRoles(endPoint: apiEndpoint, authToken: auth.authToken);
sharedHierarchy = ClickUpSharedHierarchy(
endPoint: apiEndpoint, authToken: auth.authToken);
spaces = ClickUpSpaces(endPoint: apiEndpoint, authToken: auth.authToken);
tags = ClickUpTags(endPoint: apiEndpoint, authToken: auth.authToken);
tasks = ClickUpTasks(endPoint: apiEndpoint, authToken: auth.authToken);
taskTemplates =
ClickUpTaskTemplates(endPoint: apiEndpoint, authToken: auth.authToken);
teams = ClickUpTeams(endPoint: apiEndpoint, authToken: auth.authToken);
timeTrackingLegacy = ClickUpTimeTrackingLegacy(
endPoint: apiEndpoint, authToken: auth.authToken);
timeTrackingV2 =
ClickUpTimeTrackingV2(endPoint: apiEndpoint, authToken: auth.authToken);
users = ClickUpUsers(endPoint: apiEndpoint, authToken: auth.authToken);
views = ClickUpViews(endPoint: apiEndpoint, authToken: auth.authToken);
webhooks =
ClickUpWebhooks(endPoint: apiEndpoint, authToken: auth.authToken);
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);
print("ClickUp Initialized..");
}
}
27 changes: 0 additions & 27 deletions lib/src/comments/comments.dart

This file was deleted.

9 changes: 9 additions & 0 deletions lib/src/core/clickup_exception.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
enum ClickUpExceptionType { invalidModel, requestError, unauthorized }

class ClickUpException implements Exception {
ClickUpException(
{required this.exceptionType, required this.exceptionMessage});

final ClickUpExceptionType exceptionType;
final String exceptionMessage;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import 'dart:convert';

import 'package:http/http.dart';

import '../clickup_exception.dart';

class ClickUpAttachments {
ClickUpAttachments({required this.endPoint, required this.authToken});
ClickUpAttachments(
{required this.endPoint,
required this.authToken,
required this.httpClient});
final String endPoint;
final String authToken;
late Client httpClient;

Future<Map<String, dynamic>> createTaskAttachment({
required String taskID,
Expand All @@ -26,7 +31,10 @@ class ClickUpAttachments {
return jsonDecode(result);
} catch (e) {
print(e);
return {"error": e.toString()};
throw ClickUpException(
exceptionType: ClickUpExceptionType.requestError,
exceptionMessage:
"An error occured while making the request. Error is ${e.toString()}");
}
}
}
Loading

0 comments on commit 0fbf895

Please sign in to comment.