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

dev to staging #14

Merged
merged 30 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
35a9ddb
Merge pull request #3 from ayazemre/staging
ayazemre Feb 3, 2023
4185533
initial setup
Mar 4, 2023
ddb0e7a
refactor tests and package
Apr 10, 2023
ae72b95
Merge pull request #5 from ayazemre/main
ayazemre Apr 10, 2023
e3691b9
Merge pull request #6 from ayazemre/dev
ayazemre Apr 10, 2023
5058487
Exception Handling, Unit Tests for Comments
Apr 18, 2023
f6fd325
Merge branch 'dev' of https://github.com/ayazemre/clickup-dart into dev
Apr 18, 2023
b0e7fd5
version update
Apr 18, 2023
6d4993b
Custom Fields Done with Tests
Apr 20, 2023
403888c
Space Endpoint
Apr 23, 2023
6c4067a
changelog update
May 15, 2023
1883b0b
changelog and pubspec update
May 15, 2023
df933f4
version update
May 15, 2023
7750877
tasks endpoints update
May 25, 2023
ff3d1e7
Merge pull request #7 from ayazemre/dev
ayazemre May 25, 2023
5a2f975
small linter fixes
May 25, 2023
325927a
Merge pull request #8 from ayazemre/dev
ayazemre May 25, 2023
1fde40f
refactor and small fix
May 25, 2023
ef8769e
Merge pull request #9 from ayazemre/dev
ayazemre May 25, 2023
cf45b07
pubspecfix
May 25, 2023
6f2987c
Merge branch 'main' of https://github.com/ayazemre/clickup-dart
May 25, 2023
719fa38
version fix
May 25, 2023
1334872
Merge pull request #10 from ayazemre/dev
ayazemre May 25, 2023
96ff5fc
Merge pull request #11 from ayazemre/main
ayazemre May 25, 2023
ec6a232
various implementations
Jul 3, 2023
1dddccb
Create staging-tests.yml
ayazemre Jul 3, 2023
11bd5dc
Merge pull request #12 from ayazemre/staging-tests
ayazemre Jul 3, 2023
9a2e093
version update
Jul 3, 2023
f9041ee
Merge branch 'dev' of https://github.com/ayazemre/clickup-dart into dev
Jul 3, 2023
ca6a41b
Merge branch 'staging' into dev
Jul 3, 2023
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
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