-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
6,948 additions
and
6,125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["env"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,8 @@ lib | |
bin | ||
include | ||
.Python | ||
__pycache__ | ||
__pycache__ | ||
yarn-error.log | ||
node_modules | ||
.cache | ||
dist |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "clockify-alfred", | ||
"version": "1.0.0", | ||
"main": "src/index.js", | ||
"repository": "git@github.com:endrjuskr/alfred-clockify.git", | ||
"author": "endrjuskr", | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "parcel src/index.js", | ||
"build": "parcel build src/index.js --target node" | ||
}, | ||
"dependencies": { | ||
"alfy": "^0.9.0", | ||
"axios": "^0.19.0", | ||
"fs": "^0.0.1-security", | ||
"lodash": "^4.17.15" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.5.5", | ||
"babel-preset-env": "^1.7.0", | ||
"parcel-bundler": "^1.12.3" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import _ from "lodash"; | ||
import axios from "axios"; | ||
|
||
const API_URL = "https://api.clockify.me/api/v1"; | ||
|
||
export const get_workspaces = async (token) => { | ||
const response = await axios.get(`${API_URL}/workspaces`, { | ||
headers: { | ||
'content-type': 'application/json', | ||
'X-Api-Key': token | ||
} | ||
}); | ||
|
||
const workspaces = _.map(response.data, d => _.pick(d, ["id", "name"])); | ||
|
||
// console.log(workspaces); | ||
return workspaces; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import * as fs from "fs"; | ||
|
||
export const get_config = () => { | ||
const rawdata = fs.readFileSync('.env'); | ||
return JSON.parse(rawdata); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { get_workspaces } from './api'; | ||
import { get_config } from "./env"; | ||
import * as alfy from "alfy"; | ||
import _ from "lodash"; | ||
|
||
const main = async () => { | ||
const token = get_config().token; | ||
const data = await get_workspaces(token); | ||
|
||
// console.log(data); | ||
|
||
const items = _.map(data, d => { | ||
return { | ||
title: d.name, | ||
subtitle: d.id, | ||
arg: d.id | ||
}; | ||
}); | ||
|
||
// console.log(items); | ||
|
||
alfy.output(items); | ||
}; | ||
|
||
main(); |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.