github.com/aavshr/aws-sdk-go@v1.41.3/service/mobileanalytics/mobileanalyticsiface/interface.go (about) 1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3 // Package mobileanalyticsiface provides an interface to enable mocking the Amazon Mobile Analytics service client 4 // for testing your code. 5 // 6 // It is important to note that this interface will have breaking changes 7 // when the service model is updated and adds new API operations, paginators, 8 // and waiters. 9 package mobileanalyticsiface 10 11 import ( 12 "github.com/aavshr/aws-sdk-go/aws" 13 "github.com/aavshr/aws-sdk-go/aws/request" 14 "github.com/aavshr/aws-sdk-go/service/mobileanalytics" 15 ) 16 17 // MobileAnalyticsAPI provides an interface to enable mocking the 18 // mobileanalytics.MobileAnalytics service client's API operation, 19 // paginators, and waiters. This make unit testing your code that calls out 20 // to the SDK's service client's calls easier. 21 // 22 // The best way to use this interface is so the SDK's service client's calls 23 // can be stubbed out for unit testing your code with the SDK without needing 24 // to inject custom request handlers into the SDK's request pipeline. 25 // 26 // // myFunc uses an SDK service client to make a request to 27 // // Amazon Mobile Analytics. 28 // func myFunc(svc mobileanalyticsiface.MobileAnalyticsAPI) bool { 29 // // Make svc.PutEvents request 30 // } 31 // 32 // func main() { 33 // sess := session.New() 34 // svc := mobileanalytics.New(sess) 35 // 36 // myFunc(svc) 37 // } 38 // 39 // In your _test.go file: 40 // 41 // // Define a mock struct to be used in your unit tests of myFunc. 42 // type mockMobileAnalyticsClient struct { 43 // mobileanalyticsiface.MobileAnalyticsAPI 44 // } 45 // func (m *mockMobileAnalyticsClient) PutEvents(input *mobileanalytics.PutEventsInput) (*mobileanalytics.PutEventsOutput, error) { 46 // // mock response/functionality 47 // } 48 // 49 // func TestMyFunc(t *testing.T) { 50 // // Setup Test 51 // mockSvc := &mockMobileAnalyticsClient{} 52 // 53 // myfunc(mockSvc) 54 // 55 // // Verify myFunc's functionality 56 // } 57 // 58 // It is important to note that this interface will have breaking changes 59 // when the service model is updated and adds new API operations, paginators, 60 // and waiters. Its suggested to use the pattern above for testing, or using 61 // tooling to generate mocks to satisfy the interfaces. 62 type MobileAnalyticsAPI interface { 63 PutEvents(*mobileanalytics.PutEventsInput) (*mobileanalytics.PutEventsOutput, error) 64 PutEventsWithContext(aws.Context, *mobileanalytics.PutEventsInput, ...request.Option) (*mobileanalytics.PutEventsOutput, error) 65 PutEventsRequest(*mobileanalytics.PutEventsInput) (*request.Request, *mobileanalytics.PutEventsOutput) 66 } 67 68 var _ MobileAnalyticsAPI = (*mobileanalytics.MobileAnalytics)(nil)