1// Copyright 2020-2021 InfluxData, Inc. All rights reserved.
2// Use of this source code is governed by MIT
3// license that can be found in the LICENSE file.
4
5// Package examples contains fake client with the same interface as real client to overcome import-cycle problem
6// to allow real E2E examples for apis in this package
7package examples
8
9import (
10	"context"
11	"github.com/influxdata/influxdb-client-go/v2/api"
12	"github.com/influxdata/influxdb-client-go/v2/domain"
13)
14
15// Options is fake options to satisfy Client interface
16type Options struct {
17}
18
19// SetBatchSize to emulate fake options
20func (o *Options) SetBatchSize(_ uint) *Options {
21	return o
22}
23
24// FakeClient emulates Client for allowing using client in api examples
25type FakeClient struct {
26}
27
28// NewClient returns new FakeClient
29func NewClient(_ string, _ string) *FakeClient {
30	client := &FakeClient{}
31	return client
32}
33
34// Options returns nil
35func (c *FakeClient) Options() *Options {
36	return nil
37}
38
39// ServerURL returns empty server URL
40func (c *FakeClient) ServerURL() string {
41	return ""
42}
43
44// Ready does nothing
45func (c *FakeClient) Ready(_ context.Context) (bool, error) {
46	return true, nil
47}
48
49// Setup does nothing
50func (c *FakeClient) Setup(_ context.Context, _, _, _, _ string, _ int) (*domain.OnboardingResponse, error) {
51	return nil, nil
52}
53
54// Health does nothing
55func (c *FakeClient) Health(_ context.Context) (*domain.HealthCheck, error) {
56	return nil, nil
57}
58
59// WriteAPI does nothing
60func (c *FakeClient) WriteAPI(_, _ string) api.WriteAPI {
61	return nil
62}
63
64// WriteAPIBlocking does nothing
65func (c *FakeClient) WriteAPIBlocking(_, _ string) api.WriteAPIBlocking {
66	return nil
67}
68
69// Close does nothing
70func (c *FakeClient) Close() {
71}
72
73// QueryAPI returns nil
74func (c *FakeClient) QueryAPI(_ string) api.QueryAPI {
75	return nil
76}
77
78// AuthorizationsAPI returns nil
79func (c *FakeClient) AuthorizationsAPI() api.AuthorizationsAPI {
80	return nil
81}
82
83// OrganizationsAPI returns nil
84func (c *FakeClient) OrganizationsAPI() api.OrganizationsAPI {
85	return nil
86}
87
88// UsersAPI returns nil
89func (c *FakeClient) UsersAPI() api.UsersAPI {
90	return nil
91}
92
93// DeleteAPI returns nil
94func (c *FakeClient) DeleteAPI() api.DeleteAPI {
95	return nil
96}
97
98// BucketsAPI returns nil
99func (c *FakeClient) BucketsAPI() api.BucketsAPI {
100	return nil
101}
102
103// LabelsAPI returns nil
104func (c *FakeClient) LabelsAPI() api.LabelsAPI {
105	return nil
106}
107
108// TasksAPI returns nil
109func (c *FakeClient) TasksAPI() api.TasksAPI {
110	return nil
111}
112