Skip to content

Commit 28519b8

Browse files
committed
Finish first draft
1 parent 0befe1b commit 28519b8

File tree

7 files changed

+9
-7
lines changed

7 files changed

+9
-7
lines changed

templates/dart/lib/src/client_io.dart.twig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:io';
22
import 'dart:math';
33
import 'package:http/http.dart' as http;
4+
import 'package:package_info_plus/package_info_plus.dart';
45
import 'package:http/io_client.dart';
56
import 'client_mixin.dart';
67
import 'client_base.dart';
@@ -42,6 +43,8 @@ class ClientIO extends ClientBase with ClientMixin {
4243
'x-sdk-version': '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}',
4344
{% for key,header in spec.global.defaultHeaders %}
4445
'{{key}}' : '{{header}}',
46+
'user-agent' : '${packageInfo.packageName}/${packageInfo.version}'
47+
4548
{% endfor %}
4649
};
4750

templates/dotnet/src/Appwrite/Client.cs.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace {{ spec.title | caseUcfirst }}
3131
{
3232
{ "content-type", "application/json" },
3333
{ "x-sdk-version", "{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{sdk.version}}" },
34-
{ "User-Agent" , "{{spec.title | caseUcfirst}}DOTNET/{{ sdk.version }} (${os.type()} ${os.version()}; ${os.arch()})"},
34+
{ "user-agent" , "{{spec.title | caseUcfirst}}{{ language.name | caseUcfirst }}SDK/{{ sdk.version }} (${Environment.OSVersion.Platform}; ${Environment.OSVersion.VersionString})"},
3535

3636
{% for key,header in spec.global.defaultHeaders %}
3737
{ "{{key}}", "{{header}}" }{% if not loop.last %},{% endif %}

templates/go/client.go.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"encoding/json"
77
"errors"
88
"fmt"
9+
"runtime"
910
"io"
1011
"io/ioutil"
1112
"mime/multipart"
@@ -66,7 +67,7 @@ func NewClient() Client {
6667
{% for key,header in spec.global.defaultHeaders %}
6768
"{{key}}" : "{{header}}",
6869
"x-sdk-version": "{{ sdk.gitUserName|url_encode }}:go:{{sdk.version}}",
69-
"User-Agent" : "{{spec.title | caseUcfirst}}Go/{{ sdk.version }} (${os.type()} ${os.version()}; ${os.arch()})",
70+
"User-Agent" : "{{spec.title | caseUcfirst}}{{ language.name | caseUcfirst }}SDK/ (${runtime.GOOS}; ${runtime.GOARCH})",
7071

7172
{% endfor %}
7273
}

templates/kotlin/src/main/kotlin/io/appwrite/Client.kt.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Client @JvmOverloads constructor(
6262
init {
6363
headers = mutableMapOf(
6464
"content-type" to "application/json",
65-
"User-Agent" to "{{spec.title | caseUcfirst}}Kotlin/{{ sdk.version }} ",
65+
"user-agent" to "{{spec.title | caseUcfirst}}{{ language.name | caseUcfirst }}SDK/{{ sdk.version }} ${System.getProperty("http.agent")}",
6666
"x-sdk-version" to "{{spec.title | caseDash}}:{{ language.name | caseLower }}:${BuildConfig.SDK_VERSION}"{% if spec.global.defaultHeaders | length > 0 %},{% endif %}
6767

6868

templates/node/lib/client.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Client {
1111
this.headers = {
1212
'content-type': '',
1313
'x-sdk-version': '{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}',
14-
'User-Agent' : '{{spec.title | caseUcfirst}}Node/{{ sdk.version }} (${os.type()} ${os.version()}; ${os.arch()})',
14+
'user-agent' : '{{spec.title | caseUcfirst}}Node/{{ sdk.version }} (${os.type()} ${os.version()}; ${os.arch()})',
1515
{% for key,header in spec.global.defaultHeaders %}
1616
'{{key}}' : '{{header}}',
1717
{% endfor %}

templates/ruby/lib/container/client.rb.twig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module {{ spec.title | caseUcfirst }}
1313
@headers = {
1414
'user-agent' => RUBY_PLATFORM + ':{{ language.name | caseLower }}-' + RUBY_VERSION,
1515
'x-sdk-version' => '{{ spec.title | caseDash }}:{{ language.name | caseLower }}:{{ sdk.version }}',
16-
'User-Agent' => '{{spec.title | caseUcfirst}}Ruby/{{ sdk.version }} (${os.type()} ${os.version()}; ${os.arch()})',
1716

1817
{% for key,header in spec.global.defaultHeaders %}
1918
'{{key}}' => '{{header}}'{% if not loop.last %},{% endif %}

templates/swift/Sources/Client.swift.twig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ open class Client {
2020

2121
open var headers: [String: String] = [
2222
"content-type": "",
23-
"x-sdk-version": "{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}",
24-
"User-Agent" : "{{spec.title | caseUcfirst}}Swift/{{ sdk.version }} (${os.type()} ${os.version()}; ${os.arch()})",
23+
"x-sdk-version": "{{spec.title | caseDash}}:{{ language.name | caseLower }}:{{ sdk.version }}"
2524

2625
{% for key,header in spec.global.defaultHeaders %}
2726
"{{key}}": "{{header}}"{% if not loop.last %},{% endif %}

0 commit comments

Comments
 (0)