我们希望将Google Tasks API集成到我们的Grails Web应用程序中,但是我对于同步任务和防止数据冲突有很多顾虑.
在授权Google帐户中创建任务时,同步任务的最佳做法是什么.我们是否应该定期创建一个轮询这些服务的服务,或者我们是否可以通过编程方式在用户的Google帐户中启用某种Push更新,以便通知我们的Web应用程序更改?
在Google帐户中操作同一任务时,我们如何防止用户在我们的系统中编辑任务时产生的冲突?有没有可用的版本/锁定?
我正在使用OAuth 2.0与一些Google API结合使用.虽然授权过程非常简单,但我在初始授权完成后面临自动授权问题.
所以:
Run Code Online (Sandbox Code Playgroud)1. Authorization is done for the first time. (user grants access, I get the token etc etc) 2. User exits the application 3. User starts the application again 4. How to logon automatically here?
在第4点,我确实有一个refresh_token所以我应该使用request_token请求一个新的令牌.但是我的电话仍然有401个未经授权的结果.
所以我尝试做的是我的应用程序可以静默登录,以便用户不必每次都授予访问权限.
我的特定任务的 Cloud Task Queue 仪表板如下所示:
它似乎只显示待处理的任务和出错并需要重试的任务。我怎样才能查看已完成的任务?我想要在此页面上完成任务的原因是这样我可以单击他们的日志。
我编写了以下代码,以便在每当将新项目添加到 Firestore 中的集合时创建一个任务。
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
const { CloudTasksClient } = require('@google-cloud/tasks')
exports.moveActivityFromPlanToRecord = () =>
functions
.region('europe-west1')
.firestore.document('Users/{userId}/Activities/{activityId}')
.onCreate(async snapshot => {
const moveTime = snapshot.data()! as MoveTime
if (!moveTime || !moveTime.dueTime) {
console.log("DueTime is empty or null: \n" + moveTime)
return
}
// Get the project ID from the FIREBASE_CONFIG env var
const project = JSON.parse(process.env.FIREBASE_CONFIG!).projectId
const location = 'europe-west1'
const queue = 'activityDateEventChecker'
//queuePath is going to be …Run Code Online (Sandbox Code Playgroud) G Suite 用户最近可以访问集成的 Gmail 界面。在此界面中,Google Chat 的聊天室现在拥有自己的任务集成
有没有人找到通过 API 访问和处理这些聊天室任务的资源。我对使用 Apps 脚本特别感兴趣。
我刚刚在我的任务列表上运行了列表 API 调用,并且我只能看到直接在 Google 任务中创建的列表。没有迹象表明与我的 Google 聊天室关联的列表。
gmail google-apps-script google-tasks-api google-chat google-workspace
从 9 月 13 日开始,Google Tasks BatchRequest 更新工作流程将在多年来保持稳定的应用程序中触发 400 错误返回“批量请求中的重复请求 ID”。我在请求中找不到任何指示重复请求 ID 的内容。有人知道怎么回事吗?谷歌改变了什么吗?
这是我在发送简单的批处理任务插入请求时收到的响应副本......
[{
"error": {
"code": 400,
"message": "Duplicate Request ID in Batch Request: ",
"errors": [
{
"message": "Duplicate Request ID in Batch Request: ",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}]
Run Code Online (Sandbox Code Playgroud)
在调查此问题时,我发现 Google 进行了更改,现在要求Content-ID每个批量请求项上都有标头。当前使用 .Net 类时未设置此标头 Google.Apis.Requests.BatchRequest。
为了解决这个问题,我能够创建一个新的 Google.Apis.Requests.BatchRequest 本地实现,并注入一个“Content-ID”标头,然后创建每个请求条目。
private static long _id = 0;
[VisibleForTestOnly]
internal static async Task<HttpContent> CreateIndividualRequest(IClientServiceRequest request)
{
HttpRequestMessage requestMessage = request.CreateRequest(false);
string …Run Code Online (Sandbox Code Playgroud) 如何在应用程序脚本中使用 Google 任务服务设置任务的截止日期?
尝试将此值设置为给定日期,但这似乎只更新本地值而不是服务器值,如 tehhowch 所建议的那样
task.due = new Date();
Run Code Online (Sandbox Code Playgroud)
你如何更新服务器?这是我尝试过的
var x = {
due: new Date()
};
Tasks.Tasks.update(x, "MDE2NzI3NTAzNjc5NTQ1ODY5MTY6MDow", task);
Run Code Online (Sandbox Code Playgroud)
但它会抛出错误
Invalid value for: Invalid format: "Tue Apr 10 20:45:26 GMT-04:00 2018"
Run Code Online (Sandbox Code Playgroud)
我使用此代码创建了此项目,以使 Google Tasks 保持最新状态:
无法使用 Google Tasks API 创建重复任务
Google Calendar APIhttps://developers.google.com/calendar/v3/reference/events#resource有recurrence密钥。
"recurrence": [
string
],
Run Code Online (Sandbox Code Playgroud)
recurrence但我在 Google Tasks API 中找不到。
如何使用 Google Tasks API 创建重复任务?
我收到了针对Google App Engine(标准版)上的任务队列的302响应,仅在生产中.我的本地环境处理得很好.(dev_appserver.py)我正在运行Laravel 4.2.
我已经创建了一个queue.yaml文件并进行了部署
queue:
- name: default
rate: 1/s
retry_parameters:
task_retry_limit: 3
Run Code Online (Sandbox Code Playgroud)
我的任务路线看起来像
Route::post('tasks', array('as' => 'tasks', function(){
return Queue::marshal();
}));
Run Code Online (Sandbox Code Playgroud)
日志
2018-08-31 12:30:09.256 EDT
POST
302
1,003 B
407 ms
AppEngine-Google; (+http://code.google.com/appengine)
/tasks
Run Code Online (Sandbox Code Playgroud) 我正在尝试理解以下代码:
flow = new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
{
DataStore = new FileDataStore("Tasks.ASP.NET.Sample.Store"),
ClientSecretsStream = stream,
Scopes = new[] { TasksService.Scope.TasksReadonly }
});
Run Code Online (Sandbox Code Playgroud)
根据我的理解,第一个和最后一个{...}之间的代码是匿名函数的主体.新的FileDataStore创建FileDataStore的新实例.我不明白的是它最后的逗号是什么意思.它后面的两行也有逗号.在C#中称为什么样的构造?我不熟悉它.
首次使用适用于Android的Google Tasks API并遇到此问题:使用Tasks.whenAllComplete或.whenAllSuccess()和OnCompleteListener或OnSuccessListener我收到错误任务即使在我检查task.isComplete()时仍未完成它返回true.知道这里出了什么问题吗?
db.collection("calendar").get()
.continueWith(new Continuation<Task<QuerySnapshot>, Task<?>>() {
@Override
public Task<?> then(@NonNull Task<Task<QuerySnapshot>> task) throws Exception {
List<Task<QuerySnapshot>> tasks = new ArrayList<Task<QuerySnapshot>>();
for (DocumentSnapshot ds : task.getResult().getResult())
tasks.add(ds.getReference().collection("thingstodo").get());
return Tasks.whenAllSuccess(tasks);
}
})
.addOnCompleteListener(new OnCompleteListener<Task<?>>() {
@Override
public void onComplete(@NonNull Task<Task<?>> task) {
List<QuerySnapshot> lists = (ArrayList<QuerySnapshot>)task.getResult().getResult(); //error in this line
for (QuerySnapshot qs : lists)
for (DocumentSnapshot ds: qs) {
ScheduledItem item = ds.toObject(ScheduledItem.class);
//add to list including day
itemsList.add(item);
}
//list ready to be used!
}
});
Run Code Online (Sandbox Code Playgroud)
这是错误:
E/AndroidRuntime: …Run Code Online (Sandbox Code Playgroud) 我想为我的云功能添加安全性,因此我删除了allUsers调用它的访问权限 - 所以我只能从我的 GCP 内的服务帐户调用它。
所以我完全按照 GCP 文档中的教程进行操作:
云功能
async function createTask(taskName, functionToFire, payload, fireAt){
const tasksClient = new CloudTasksClient()
const projectId = JSON.parse(process.env.FIREBASE_CONFIG).projectId
console.log(`${taskName} will fire ${functionToFire} at ${fireAt}...`)
const location = 'us-central1'
const queuePath = tasksClient.queuePath(projectId, location, taskName)
const url = `https://us-central1-${PROJECT_ID}.cloudfunctions.net/task/${functionToFire}`
const serviceAccountEmail = 'cloud-tasks@${PROJECT_ID}.iam.gserviceaccount.com';
// const sendAt = Date.now() / 1000 + 10 // plus 10 seconds of current epoch
const task = {
httpRequest: {
httpMethod: 'POST',
url,
oidcToken: {
serviceAccountEmail
}, …Run Code Online (Sandbox Code Playgroud) google-tasks-api google-cloud-platform google-cloud-functions google-iam
google-tasks-api ×12
google-tasks ×5
c# ×2
firebase ×2
.net ×1
android ×1
date ×1
gmail ×1
google-api ×1
google-chat ×1
google-iam ×1
grails ×1
json ×1
laravel ×1
laravel-4 ×1
oauth-2.0 ×1
php ×1
sync ×1