Skip to content

Commit 03b5619

Browse files
committed
refactor: Use new generator
1 parent b2b4ac0 commit 03b5619

File tree

63 files changed

+8967
-1335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+8967
-1335
lines changed

.gitignore

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
# If you prefer the allow list template instead of the deny list, see community template:
2-
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3-
#
4-
# Binaries for programs and plugins
5-
*.exe
6-
*.exe~
7-
*.dll
1+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2+
*.o
3+
*.a
84
*.so
9-
*.dylib
105

11-
# Test binary, built with `go test -c`
12-
*.test
6+
# Folders
7+
_obj
8+
_test
9+
10+
# Architecture specific extensions/prefixes
11+
*.[568vq]
12+
[568vq].out
1313

14-
# Output of the go coverage tool, specifically when used with LiteIDE
15-
*.out
14+
*.cgo1.go
15+
*.cgo2.c
16+
_cgo_defun.c
17+
_cgo_gotypes.go
18+
_cgo_export.*
1619

17-
# Dependency directories (remove the comment below to include it)
18-
# vendor/
20+
_testmain.go
1921

20-
# Go workspace file
21-
go.work
22+
*.exe
23+
*.test
24+
*.prof

.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

.openapi-generator/FILES

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.gitignore
2+
.openapi-generator-ignore
3+
.travis.yml
4+
README.md
5+
api/openapi.yaml
6+
api_contacts.go
7+
api_custom_fields.go
8+
api_events.go
9+
api_transactional_emails.go
10+
client.go
11+
configuration.go
12+
docs/Contact.md
13+
docs/ContactDeleteRequest.md
14+
docs/ContactDeleteResponse.md
15+
docs/ContactFailureResponse.md
16+
docs/ContactRequest.md
17+
docs/ContactSuccessResponse.md
18+
docs/ContactsAPI.md
19+
docs/ContactsDeletePost500Response.md
20+
docs/CustomField.md
21+
docs/CustomFieldsAPI.md
22+
docs/EventFailureResponse.md
23+
docs/EventRequest.md
24+
docs/EventSuccessResponse.md
25+
docs/EventsAPI.md
26+
docs/TransactionalEmailsAPI.md
27+
docs/TransactionalFailure2Response.md
28+
docs/TransactionalFailure2ResponseError.md
29+
docs/TransactionalFailure3Response.md
30+
docs/TransactionalFailureResponse.md
31+
docs/TransactionalPost400Response.md
32+
docs/TransactionalRequest.md
33+
docs/TransactionalSuccessResponse.md
34+
git_push.sh
35+
go.mod
36+
go.sum
37+
model__contacts_delete_post_500_response.go
38+
model__transactional_post_400_response.go
39+
model_contact.go
40+
model_contact_delete_request.go
41+
model_contact_delete_response.go
42+
model_contact_failure_response.go
43+
model_contact_request.go
44+
model_contact_success_response.go
45+
model_custom_field.go
46+
model_event_failure_response.go
47+
model_event_request.go
48+
model_event_success_response.go
49+
model_transactional_failure2_response.go
50+
model_transactional_failure2_response_error.go
51+
model_transactional_failure3_response.go
52+
model_transactional_failure_response.go
53+
model_transactional_request.go
54+
model_transactional_success_response.go
55+
response.go
56+
test/api_contacts_test.go
57+
test/api_custom_fields_test.go
58+
test/api_events_test.go
59+
test/api_transactional_emails_test.go
60+
utils.go

.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.2.0

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: go
2+
3+
install:
4+
- go get -d -v .
5+
6+
script:
7+
- go build -v ./
8+

README.md

Lines changed: 145 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,146 @@
1-
# loops-api-go
2-
API Client for loops.so generated from OpenAPI Spec
1+
# Go API client for openapi
2+
3+
This is the OpenAPI Spec for the [Loops API](https://loops.so/docs/api).
4+
5+
## Overview
6+
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
7+
8+
- API version: 1.0.1
9+
- Package version: 1.0.0
10+
- Build package: org.openapitools.codegen.languages.GoClientCodegen
11+
12+
## Installation
13+
14+
Install the following dependencies:
15+
16+
```sh
17+
go get github.com/stretchr/testify/assert
18+
go get golang.org/x/net/context
19+
```
20+
21+
Put the package under your project folder and add the following in import:
22+
23+
```go
24+
import openapi "github.com/GIT_USER_ID/GIT_REPO_ID"
25+
```
26+
27+
To use a proxy, set the environment variable `HTTP_PROXY`:
28+
29+
```go
30+
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
31+
```
32+
33+
## Configuration of Server URL
34+
35+
Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.
36+
37+
### Select Server Configuration
38+
39+
For using other server than the one defined on index 0 set context value `openapi.ContextServerIndex` of type `int`.
40+
41+
```go
42+
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
43+
```
44+
45+
### Templated Server URL
46+
47+
Templated server URL is formatted using default variables from configuration or from context value `openapi.ContextServerVariables` of type `map[string]string`.
48+
49+
```go
50+
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
51+
"basePath": "v2",
52+
})
53+
```
54+
55+
Note, enum values are always validated and all unused variables are silently ignored.
56+
57+
### URLs Configuration per Operation
58+
59+
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
60+
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
61+
Similar rules for overriding default operation server index and variables applies by using `openapi.ContextOperationServerIndices` and `openapi.ContextOperationServerVariables` context maps.
62+
63+
```go
64+
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
65+
"{classname}Service.{nickname}": 2,
66+
})
67+
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
68+
"{classname}Service.{nickname}": {
69+
"port": "8443",
70+
},
71+
})
72+
```
73+
74+
## Documentation for API Endpoints
75+
76+
All URIs are relative to *https://app.loops.so/api/v1*
77+
78+
Class | Method | HTTP request | Description
79+
------------ | ------------- | ------------- | -------------
80+
*ContactsAPI* | [**ContactsCreatePost**](docs/ContactsAPI.md#contactscreatepost) | **Post** /contacts/create | Create a contact
81+
*ContactsAPI* | [**ContactsDeletePost**](docs/ContactsAPI.md#contactsdeletepost) | **Post** /contacts/delete | Delete a contact
82+
*ContactsAPI* | [**ContactsFindGet**](docs/ContactsAPI.md#contactsfindget) | **Get** /contacts/find | Find a contact
83+
*ContactsAPI* | [**ContactsUpdatePut**](docs/ContactsAPI.md#contactsupdateput) | **Put** /contacts/update | Update a contact
84+
*CustomFieldsAPI* | [**ContactsCustomFieldsGet**](docs/CustomFieldsAPI.md#contactscustomfieldsget) | **Get** /contacts/customFields | Get a list of custom contact properties
85+
*EventsAPI* | [**EventsSendPost**](docs/EventsAPI.md#eventssendpost) | **Post** /events/send | Send an event
86+
*TransactionalEmailsAPI* | [**TransactionalPost**](docs/TransactionalEmailsAPI.md#transactionalpost) | **Post** /transactional | Send a transactional email
87+
88+
89+
## Documentation For Models
90+
91+
- [Contact](docs/Contact.md)
92+
- [ContactDeleteRequest](docs/ContactDeleteRequest.md)
93+
- [ContactDeleteResponse](docs/ContactDeleteResponse.md)
94+
- [ContactFailureResponse](docs/ContactFailureResponse.md)
95+
- [ContactRequest](docs/ContactRequest.md)
96+
- [ContactSuccessResponse](docs/ContactSuccessResponse.md)
97+
- [ContactsDeletePost500Response](docs/ContactsDeletePost500Response.md)
98+
- [CustomField](docs/CustomField.md)
99+
- [EventFailureResponse](docs/EventFailureResponse.md)
100+
- [EventRequest](docs/EventRequest.md)
101+
- [EventSuccessResponse](docs/EventSuccessResponse.md)
102+
- [TransactionalFailure2Response](docs/TransactionalFailure2Response.md)
103+
- [TransactionalFailure2ResponseError](docs/TransactionalFailure2ResponseError.md)
104+
- [TransactionalFailure3Response](docs/TransactionalFailure3Response.md)
105+
- [TransactionalFailureResponse](docs/TransactionalFailureResponse.md)
106+
- [TransactionalPost400Response](docs/TransactionalPost400Response.md)
107+
- [TransactionalRequest](docs/TransactionalRequest.md)
108+
- [TransactionalSuccessResponse](docs/TransactionalSuccessResponse.md)
109+
110+
111+
## Documentation For Authorization
112+
113+
114+
Authentication schemes defined for the API:
115+
### apiKey
116+
117+
- **Type**: HTTP Bearer token authentication
118+
119+
Example
120+
121+
```go
122+
auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "BEARER_TOKEN_STRING")
123+
r, err := client.Service.Operation(auth, args)
124+
```
125+
126+
127+
## Documentation for Utility Methods
128+
129+
Due to the fact that model structure members are all pointers, this package contains
130+
a number of utility functions to easily obtain pointers to values of basic types.
131+
Each of these functions takes a value of the given basic type and returns a pointer to it:
132+
133+
* `PtrBool`
134+
* `PtrInt`
135+
* `PtrInt32`
136+
* `PtrInt64`
137+
* `PtrFloat`
138+
* `PtrFloat32`
139+
* `PtrFloat64`
140+
* `PtrString`
141+
* `PtrTime`
142+
143+
## Author
144+
145+
3146

4-
[![Go Reference](https://pkg.go.dev/badge/github.com/behnh/loops-api-go.svg)](https://pkg.go.dev/github.com/behnh/loops-api-go)

0 commit comments

Comments
 (0)