// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.
// source: scheduling.proto
package scheduling
import context "context"
import fmt "fmt"
import http "net/http"
import io "io"
import json "encoding/json"
import strconv "strconv"
import strings "strings"
import protojson "google.golang.org/protobuf/encoding/protojson"
import proto "google.golang.org/protobuf/proto"
import twirp "github.com/twitchtv/twirp"
import ctxsetters "github.com/twitchtv/twirp/ctxsetters"
import bytes "bytes"
import errors "errors"
import path "path"
import url "net/url"
// Version compatibility assertion.
// If the constant is not defined in the package, that likely means
// the package needs to be updated to work with this generated code.
// See https://twitchtv.github.io/twirp/docs/version_matrix.html
const _ = twirp.TwirpPackageMinVersion_8_1_0
// ====================
// Scheduling Interface
// ====================
type Scheduling interface {
ParseEmail(context.Context, *ParseReq) (*ParseResp, error)
}
// ==========================
// Scheduling Protobuf Client
// ==========================
type schedulingProtobufClient struct {
client HTTPClient
urls [1]string
interceptor twirp.Interceptor
opts twirp.ClientOptions
}
// NewSchedulingProtobufClient creates a Protobuf client that implements the Scheduling interface.
// It communicates using Protobuf and can be configured with a custom HTTPClient.
func NewSchedulingProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Scheduling {
if c, ok := client.(*http.Client); ok {
client = withoutRedirects(c)
}
clientOpts := twirp.ClientOptions{}
for _, o := range opts {
o(&clientOpts)
}
// Using ReadOpt allows backwards and forwards compatibility with new options in the future
literalURLs := false
_ = clientOpts.ReadOpt("literalURLs", &literalURLs)
var pathPrefix string
if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok {
pathPrefix = "/twirp" // default prefix
}
// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>
serviceURL := sanitizeBaseURL(baseURL)
serviceURL += baseServicePath(pathPrefix, "within.website.x.mimi.scheduling", "Scheduling")
urls := [1]string{
serviceURL + "ParseEmail",
}
return &schedulingProtobufClient{
client: client,
urls: urls,
interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),
opts: clientOpts,
}
}
func (c *schedulingProtobufClient) ParseEmail(ctx context.Context, in *ParseReq) (*ParseResp, error) {
ctx = ctxsetters.WithPackageName(ctx, "within.website.x.mimi.scheduling")
ctx = ctxsetters.WithServiceName(ctx, "Scheduling")
ctx = ctxsetters.WithMethodName(ctx, "ParseEmail")
caller := c.callParseEmail
if c.interceptor != nil {
caller = func(ctx context.Context, req *ParseReq) (*ParseResp, error) {
resp, err := c.interceptor(
func(ctx context.Context, req interface{}) (interface{}, error) {
typedReq, ok := req.(*ParseReq)
if !ok {
return nil, twirp.InternalError("failed type assertion req.(*ParseReq) when calling interceptor")
}
return c.callParseEmail(ctx, typedReq)
},
)(ctx, req)
if resp != nil {
typedResp, ok := resp.(*ParseResp)
if !ok {
return nil, twirp.InternalError("failed type assertion resp.(*ParseResp) when calling interceptor")
}
return typedResp, err