lostluck commented on code in PR #30815: URL: https://github.com/apache/beam/pull/30815#discussion_r1575206085
########## sdks/go/pkg/beam/io/webapi/doc.go: ########## @@ -0,0 +1,57 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package webapi supports reading from or writing to Web APIs. + +Its design goals are to reduce the boilerplate of building Beam I/O connectors. +The implementation is not yet complete (See tracking issue: https://github.com/apache/beam/issues/30423). Review Comment: Don't say it's incomplete. Simply tell the user to refer to the issue for the current status. This avoids the very common case of the two sources of information (this doc comment, and the issue, mismatching). ########## sdks/go/pkg/beam/io/webapi/webapi.go: ########## @@ -0,0 +1,207 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package webapi + +import ( + "bytes" + "context" + "fmt" + "github.com/apache/beam/sdks/v2/go/pkg/beam" + "reflect" +) + +func init() { + beam.RegisterType(reflect.TypeOf((*wrappedCallerOnlyUserType)(nil)).Elem()) + beam.RegisterType(reflect.TypeOf((*Request)(nil)).Elem()) + beam.RegisterType(reflect.TypeOf((*Response)(nil)).Elem()) + beam.RegisterDoFn(reflect.TypeOf((*callerFn)(nil)).Elem()) Review Comment: Ideally use the generic registration package `register` instead. As a rule, don't use beam.RegisterDoFn anymore. It was a half measure before we had the generic solution. ########## sdks/go/pkg/beam/io/webapi/doc.go: ########## @@ -0,0 +1,57 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package webapi supports reading from or writing to Web APIs. + +Its design goals are to reduce the boilerplate of building Beam I/O connectors. +The implementation is not yet complete (See tracking issue: https://github.com/apache/beam/issues/30423). +Meanwhile, visit the Beam website (https://beam.apache.org/documentation/io/built-in/webapis/) +for details and examples on how this transform behaves in other SDKs for a preview of how this might look in the Go +SDK. + +# Basic usage + +Basic usage minimally requires providing a Caller to the Call func. Review Comment: I think we can simplify this to `Usage requires` instead of adding the extra modifiers. Remember, a "minimum requirement" is just the default any. There's need to clarify it's a minimum if it's necessary for any use at all. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
